Proposal - Physics Custom Mask Editor Changes

This forum is currently in read-only mode.
From the Asset Store
Basic template for drawing game with masks and easy customization
  • Just to be clear, this isn't a feature request, rather it's a proposal to merge some changes I've made to the physics behavior's custom collision mask editor with the version on the SVN. These changes are all usability related, simplifying the mask creation process with some nifty new features.

    All of the changes take place in two files, Edittime.cpp and Main.h. Here's a download link to the altered files and a compiled version of the plugin:

    Physics Changes

    [CHANGE] - The first and last vertices are marked; the first vertex has a red minus symbol inside while the last vertex has a blue plus symbol inside. This is so users will know better where the next point will be placed.

    [ADDITION] - Vertex dragging. If a user left clicks and holds the mouse over a vertex, the vertex can be dragged around. All newly placed vertices are also placed in drag mode. Holding the control key will disable this, allowing the user to place vertices on top of one another and place many points quickly without worrying about dragging them.

    [ADDITION] - Rick clicking on any vertex will delete it, instead of having to delete all the vertices after it sequentially just to delete it.

    [ADDITION] - Holding down the shift key will display lines running from the first and last vertices to the mouse, showing where new collision lines will run if a point is placed.

    Variable and function additions in the code include:

    POINTF* dragPoint in the EditExt class in Main.h - This is a pointer to the vertex currently being dragged.

    bool setWindowFocus in the EditExt class in Main.h - This is set to true when first starting the mask editor. If the value equals true, the focus is set on the frame editor and the value is set to false.

    bool MouseOverPoint(bool deletePoint) function in EditTime.cpp - This is used to detect if the mouse is hovering over a vertex and for deleting any such vertices if specified as true through deletePoint. Also, if a vertex is being hovered over, dragPoint will be pointed to it.

    Most of the feature additions are contained in EditExt::OnMessage() and MouseOverPoint(). These are where point dragging and point deletion are handled. The shift key preview is contained in EditExt::Draw().

    So, there it is for your consideration. I've tested everything and it all seems to work properly, but since I don't entirely know how parts of the plugin work, some of it may not be properly handled -- mostly these concerns lie in the point deletion aspect of MouseOverPoint().

    Cheers.

  • This sounds awesome. You've got some good changes there, I hope they can make it into a build

  • indeed it does sound awesome.

    are the additions and changes clear enough

    that id be able to update future versions of the physics plugin with your code if the devs decide not to include this?

  • Lucid, go ahead, it'd save us some time!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the code changes, I added it into physics and made a few changes so the dragging doesn't happen at the centre of the point but accounts for the mouse offset etc. Oh and i made it that clicking a point makes it so any more points you add afterwards are from that point on etc. Oh and I made it whiten the layout editor a little so if your adding points around a dark object they dont get lost.

  • Sweet, thanks, David!

    The changes you made were all things I never got around to, so it's nice to see you put them in there.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)