Skip to main content
ASuom.1
Associate
November 10, 2021
Question

Is there a way to handle physical key pressed and released events separately in the simulator?

  • November 10, 2021
  • 1 reply
  • 713 views

In our GUI we need to trigger a visible change when a physical button is pressed and another change when it is released. When using real hardware I can supply separate key codes for key pressed and released events from the ButtonController class, but i cannot find any way to do this in the simulator.

This topic has been closed for replies.

1 reply

ASuom.1
ASuom.1Author
Associate
November 11, 2021

I figured it out myself. It can be done by modifying the the taskEntry() method and the sampleKey() method in the HALSDL2 class. The event.key.repeat variable must be checked in the SDL_KEYDOWN and SDL_KEYUP events because SDL generates repeated key events.

I ended up creating an own derived HAL class because I did not want to modify the original one.