void256/nifty-gui — pull request #266 by 3xp0n3nt (2014-08-08 12:00:18+00:00)
Title: Add LibGDX input forwarding customization.

Make it possible to forward input events unhandled by Nifty to multiple
custom LibGDX InputProcessor's. Currently, the GdxInputSystem used by
Nifty consumes all input. On the other hand, if you try and capture
input via LibGDX directly, for example to get input directly for your
game that is being rendered underneath the Nifty UI, then Nifty will not
receive any input.

The problem with the current setup is that it's an either-or approach,
so either 1) Nifty (the UI) will consume all input, or 2) some custom
InputProcessor set by the LibGDX method Gdx.input.setInputProcessor
(myCustomGameInputProcessor) will consume all input (the game).

What is needed is for Nifty to share nicely with others. ;-) So modify
GdxInputSystem to use LibGDX's InputMultiplexer, which supports multiple
InputProcessors simultaneously. Modify the GdxInputSystem constructor to
allow the optional addition of multiple custom InputProcessors. Add
methods to GdxInputSystem to append, insert, remove, clear, and get
custom InputProcessors.

The new way GdxInputSystem will work by default is that Nifty will get
first dibs on any input. If Nifty does not process the input, then any
custom InputProcessor's that are set will receive the input, in the same
order they were added / inserted.

However, there is now the possibility of specifying that Nifty will
receive input AFTER all of your custom input processors. (This is not
the default behavior as most use cases will have Nifty as a UI
overlaying a game, so it makes sense to allow the UI a chance to handle
the input before the game.) Add an additional constructor to
GdxInputSystem that allows passing in the enum NiftyReceivesInput.FIRST
/ NiftyReceivesInput.LAST. FIRST is default, if LAST is specified then
any custom input processors will receive first dibs on any input, and
only if it is not handled, that is the input handling method in the
InputProcessor returns false, then Nifty will receive it.