void256/nifty-gui — pull request #159 by 3xp0n3nt (2013-11-02 15:56:09+00:00)
Title: Update libGDX custom mouse cursor support.

I added support for custom mouse cursor images to the libGDX library
itself, which was missing, so the method of setting custom mouse cursor
images in GdxBatchRenderBackend class of nifty-renderer-libgdx module
was a nasty hack.

This nasty hack involved setting the system mouse cursor image to an
invisible texture of the smallest allowable size, and then rendering the
custom mouse cursor image as a separate batch after all other batches
were rendered. This means it added an extra openGL draw call as well.
Yuck.

We also had to update the texture's vertex buffer position data with the
current mouse coordinates every frame. It also was buggy on OS X, and
many times the system cursor would be displayed on top of the custom
cursor, or the system cursor would appear as a single-pixel dot of
various colors along with the custom cursor.

This hack also made the mouse cursor very laggy. Nasty. Nasty. Nasty!

So now that true custom mouse cursor image support has been added to the
libGDX library, this nasty hack disappears forever, and custom mouse
cursor support is much, much better! :D

Windows operating system is very picky about it's mouse cursor images,
and the libGDX mouse cursor image support requires that any custom
cursor image have a width and height that are powers-of-two greater than
zero.

We're going one step further and making the two custom mouse cursors
that ship with nifty (nifty-cursor.png & mouse-cursor-textfield.png)
into images of size 32x32, since not only are the width & height
powers-of-two, but this is the size of the system cursor in Windows,
which provides maximum compatibility.

The hotspots of these two custom mouse cursors are unaffected, as are
their "perceived" sizes; only the invisible background increases in size
to add the necessary padding to get them to be 32x32.

Integration testing shows no problems in OS X, but Windows and Linux
integration testing should be done by running the libGDX nifty examples
on those systems.