Component class with mouse events

About Monkey 2 Forums Monkey 2 Projects Component class with mouse events

This topic contains 2 replies, has 2 voices, and was last updated by  Ethernaut 7 months, 4 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #15607



    I was writing a little framework designed to go “on top” of mojo3d, but things were getting unwieldy and I decided to break it apart into as many separate, simple independent modules as possible.

    The first one is a barebones “GuiComponent” class that can handle mouse events like “OnMouseOver”, “OnMouseEnter”, “OnMouseClick( mousebutton )”, etc. The class is abstract, intended to alway be extended. Example:


    For it to work, there are a couple extensions for the Scene and Canvas classes that need to be called:


    There’s an example in the “_tests” folder:

    I hope to add some more useful methods in the future.



    Cool, I’ll hopefully get to try tonight or tomorrow.



    Updated it, and now in addition to GuiComponents it has an early, largely untested class called GameComponents. It provides collision events like OnCollisionEnter( body ) , OnCollisionStay( body ) and OnCollisionLeave( body ). You need to use the “GameBody” class instead of the regular “RigidBody” to achieve that.

    There’s even a… uhh… bananas demo! 🙂  It showcases a simple GameComponent:


    And here it is in action:

    The repo was renamed GameComponents to reflect the changes. Will probably post it in the Code Library section once I’ve tested it some more. Will also include an “Arcade Physics” style Character Controller (based on Mark’s QCollide demo) that uses the exact same Collision Events as the physics system. Take that, Unity3D!


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.