Hi,
after a long time i have a new problem with thor, that i couldnt solve till now ....
I am trying to push an event manually in code:
void init()
{
thor::ActionMap<InputCmd::MyAction>::CallbackSystem system;
thor::ActionMap<InputCmd::MyAction> mMyActionmap;
mMyActionmap[InputCmd::KeyPressed] = Action(Event::KeyPressed);
mMyActionmap[InputCmd::Forward] = Action(toKeyboardKey("Key_W"), Action::Hold); //hold Action
system.connect(InputCmd::KeyPressed, ActionHandler(this));
system.connect(InputCmd::Forward, std::bind(&Controller::move, this, InputCmd::Forward));
}
void update()
{
mMyActionmap.update(*mView.mWindow);
// Forward actions to callbacks: Invokes onResize() in case of Event::Resized events
mMyActionmap.invokeCallbacks(system, mView.mWindow);
}
void manualEvent()
{
sf::Event eventTest;
eventTest.type = sf::Event::EventType::KeyPressed;
eventTest.key.code = sf::Keyboard::Key::W;
mMyActionmap.pushEvent(eventTest); //push event here
}
what works:
- pressing and holding the key "K" in the window triggers the "Forward" event
- calling manualEvent() and change Action::Hold to Action::PressOnce fires the "Forward" event
what doesn't work:- calling manualEvent() with Action::Hold doesn't trigger the "Forward" event, just the "Keypressed" event
Shouldn't the hold event fire, if the "keypressed" event is fired, without keyreleased?
do i miss somthing?