Hello,
I am programming a game in "OpenGL" and using "Gtkmm" as a window manager. I want to use the keyboard to camera moving (thus, "UP-key" to move forward, "DOWN-key" to move backward, etc...)
Some time ago, when I programmed in Java, I used this technique to "move":
When the application received for example the "UP-key-press" signal, it subsequently set the flag "shouldMoveForward" to "true" and when it later received the "UP-key-release" signal, it set the flag back to "false".
And the "game loop" continuously checked for that flag, and if it was true, it moves the camera forward, otherwise it did nothing.
So that I would like to use the same technique in "Gtkmm". So I just overrided these functions of 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 in this: when I for example press the "UP" key and hold it for 5 seconds, then this sequence of signals is emitted:
press ...<little time waiting>... release press release press release press release .......... press release press release
The previous situation appears when I am running my game "on Linux".
When I am "on Windows", it is as I want it to be, thus:
press ...<little time waiting>... press press press press press .......... press press release
So this seems to be a "non-portable" solution for camera moving in Gtkmm.
So is there any other ("PORTABLE") solution to achieve camera moving using Gtkmm as a window manager?