Re: [GtkGLExt] First person shooter games - mouse movement



Hello again,
thank you all for your answers, thanks to them I have decided to do the
following:
I will "grab" the mouse pointer and therefore I will not need to reposition
the pointer to the center of the "window", but I will just reposition the
pointer to the center of the "screen".

So it seems, that the "rotation" of a camera with mouse is solved for me,
but there is another problem with "moving" of the camera (forward, backward,
left, right, ...).

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


So my question is: Why are also the "release" signals emitted when I have
only "pressed" and still "hold" the UP key?
Or is there any other way to accomplish the "camera moving"?

Thanks.
-- 
View this message in context: http://old.nabble.com/First-person-shooter-games---mouse-movement-tp27185222p27531422.html
Sent from the Gnome - GtkGLExt mailing list archive at Nabble.com.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]