KeyboardMapper (to map ui.Buttion with KeyEvent)

About Monkey 2 Forums Monkey 2 Code Library KeyboardMapper (to map ui.Buttion with KeyEvent)

Tagged: , , ,

This topic contains 1 reply, has 1 voice, and was last updated by  nerobot 1 year, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #12109

    nerobot
    Participant

    Originally, I wrote similar code as an answer for unity3d. Use it or lose it! 🙂

    Idea is: we have some ui.Buttons and want to click them by keyboard with breaking nothing.

    And we can do it using KeyboardMapper. Just write single line and voila!

    _mapper.Map( but,Key.S,Modifier.Control )

    but is mojox.Button here.

    You can add only one key combunation per button.

    You can specify what types of key events to grab; default types are KeyDown & KeyRepeat.

    You’ll find KeyboardMapper class in the example app below:

    #12110

    nerobot
    Participant

    Actually, we can to omit where condition, and then we can pass any instance with method Clicked() as a button – thanks to geteric type T.

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

You must be logged in to reply to this topic.