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



Mukund Sivaraman wrote:
> On Fri, Jan 15, 2010 at 03:50:03PM -0800, Peter Sivak wrote:
>> Is there any function to tell the gtkmm window manager, that when I position
>> the mouse pointer over the window, the mouse pointer will "stick" to that
>> window and only for example after the ESCAPE click, the mouse pointer
>> "release" from the window and become again the normal pointer?
> 
> You can grab the pointer. See gdk_pointer_grab(), which is a GTK+
> function.  You should be able to find an equivalent in gtkmm.
> 

I'm not sure if grabbing would be enough. The user could still move the
mouse to the edge of the screen, and even though your program will
receive these mouse events, they will be useless --- as the user cannot
move the mouse any further. When you're doing mouse look, user must
always be able to move the mouse in any direction, because for mouse
look you're interested in "relative" mouse moves (that is, "new mouse
position" is not interesting to you per se, only "new mouse position -
old mouse position").

The normal approach to mouse look, AFAIK, is to continously reposition
the mouse to stay in the middle of the window. That's at least how I do
it, and it works mighty fine :)

Sure, grabbing may still be useful. Otherwise, when the user moves the
mouse very fast and/or system is highly loaded, user could leave the
window and (depending on when you reposition the mouse to the middle of
the window) you may not want it.

Michalis


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