Register Listener for KeyEvents

Hej,

I was wondering if there is a way to register for KeyEvents (or MouseEvents) without delegating it manually from the main App.

Thank you!

// Mouse Down
app::App::get()->getWindow()->getSignalMouseDown().connect ( [=] ( const app::MouseEvent& event )
{   
    std::cout << "!" << std::endl;
} );

// Key Down
app::App::get()->getWindow()->getSignalKeyDown().connect ( [=] ( const app::KeyEvent& event )
{
     std::cout << "?" << std::endl;
} );

Be aware that the connect function can take a priority argument, so if you have anything else connecting to the signals this way (such as CameraUi), you may have to adjust your connection’s priority accordingly.

A.

1 Like

Perfect! Thanks alot