I program the game in "OpenGL" and use "Gtkmm" as a window manager. I want to use the keyboard to move the camera (thus, “UP-key” to move forward, “DOWN-key” to move back, etc.)
Some time ago, when I was programming in Java, I used this technique to “move”:
When the application received, for example, a “UP-key- click ” signal , it subsequently set the “shouldMoveForward” flag to “true” and when it later received an “UP-key- release , it will return the flag“ false. "
And the“ game loop "constantly checked this flag, and if it was true, it moves the camera forward, otherwise it did nothing.
So, I would like to use the same technique in "Gtkmm". So I just redefined these functions with my "Gtk :: DrawingArea":
bool Gtk::Widget::on_key_press_event(GdkEventKey* event)
bool Gtk::Widget::on_key_release_event(GdkEventKey* event)
But the problem is this: when I, for example, press the UP key and hold it for 5 seconds, this sequence of signals is emitted:
press ...<little time waiting>... release press release press release press release .......... press release press release
, " Linux" .
" Windows" , , , :
press ...<little time waiting>... press press press press press .......... press press release
, " " Gtkmm.
, ("" ) Gtkmm ?