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 3 weeks, 2 days ago.

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

    Ethernaut
    Participant

    https://github.com/DoctorWhoof/gui3d

    Hi,

    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.
    Cheers!

    #15608

    DruggedBunny
    Participant

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

    #15611

    Ethernaut
    Participant

    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.

    https://github.com/DoctorWhoof/GameComponents

    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!

    πŸ˜€
    Cheers.

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

You must be logged in to reply to this topic.