JOGL Update: New NEWT Mouse Features

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

JOGL Update: New NEWT Mouse Features

Sven Gothel
Administrator

http://jausoft.com/blog/2011/10/13/new-newt-mouse-features/

+++

After doing all the Android work, I thought I need a break and finally
added the NEWT mouse features some are desiring:

    Visibility
    set pointer visible or invisible
    Confined
    confine pointer to window, or not
    Warp
    set mouse position within the window

This is NEWT’s minimal API addition in this regard.

The InputEvent’s modifiers expose the above states confined and invisible
which can be easily queried and reacted upon in the event listener, as shown in GearsES2.

This allows you to have a game-like mouse navigation, where you control the direction w/o pressing the mouse button (which you may need for something else), not seeing the mouse pointer and last but not least,
not leaving the game window.

Tested w/ TestGearsES2NEWT, using GearsES2.

This is currently impl. for X11 and Windows and I am currently adding these to our OSX port.
Since the default operation for these features are NOP and touchscreen don’t require any of those, there is no work to do on Android in this regard.

+++

Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: New NEWT Mouse Features

gouessej
Administrator
Hi

It is an excellent piece of news, thank you so much. Now I will be able to fully implement the Jogl NEWT Ardor3D canvas and then I will be able to use it with TUER when the OSX port is fully functional :)
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: New NEWT Mouse Features

gouessej
Administrator
This post was updated on .
In reply to this post by Sven Gothel
Hi

warpPointer() does not work on my machine, I have just tested it with TUER, it does not throw any exception, it just does nothing :( I use Mageia Linux 1, KDE 4.6, the latest dev build of JOGL 2 (535), OpenJDK 1.6. I will have to investigate.

Edit.: There is something wrong here:
/*
* Class: Java_jogamp_newt_driver_x11_X11Window
* Method: warpPointer0
* Signature: (JJII)V
*/
JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_X11Window_warpPointer0
  (JNIEnv *env, jclass clazz, jlong display, jlong window, jint x, jint y)
{
    Display * dpy = (Display *) (intptr_t) display;
    Window w = (Window)window;

    DBG_PRINT( "X11: warpPointer0: %d/%d\n", x, y);

    XWarpPointer(dpy, None, w, 0, 0, 0, 0, x, y);
}

I would rather call XWarpPointer(dpy, w, None, 0, 0, 0, 0, x, y); because XWarpPointer needs the source window to get its width and its height (when src_width and src_height are set to zero). If you pass None, it cannot "know" them. Ok I'm falling asleep, good night.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: New NEWT Mouse Features

gouessej
Administrator
In reply to this post by Sven Gothel
If I have some time, I will try to rebuild JOGL with my suggestion to check whether it really fixes this bug.
Julien Gouesse | Personal blog | Website