org.jagatoo.input.impl.lwjgl
Class LWJGLMouse

java.lang.Object
  extended by org.jagatoo.input.devices.InputDevice
      extended by org.jagatoo.input.devices.Mouse
          extended by org.jagatoo.input.impl.lwjgl.LWJGLMouse
All Implemented Interfaces:
Enableable

public class LWJGLMouse
extends Mouse

LWJGL implementation of the Mouse class.


Constructor Summary
protected LWJGLMouse(MouseFactory factory, InputSourceWindow sourceWindow, EventQueue eventQueue)
           
 
Method Summary
 void centerMouse()
          Centers the mouse cursor on the source-window.
 void collectEvents(InputSystem is, EventQueue eventQueue, long nanoTime)
          Processes pending events from the system and places them into the EventQueue.
protected  void collectOrFireEvents(InputSystem is, EventQueue eventQueue, long nanoTime, boolean acceptEvents)
           
 void consumePendingEvents(InputSystem is, EventQueue eventQueue, long nanoTime)
          Processes pending events from the system and simply wastes them.
static MouseButton convertButton(int lwjglButton)
           
 void destroyImpl()
          Destroys the Mouse.
 void onDeviceRegistered(InputSystem inputSystem)
          This method is called by the InputSystem after the device has been completely and successfully registered.
protected  void setAbsoluteImpl(boolean absolute)
          Makes this Mouse an absolute mouse (only delta positions become valid) or relative.
 void setPosition(int x, int y)
          This method stores the positional values and may do some additional implementation dependent stuff.
 void updateMouse(InputSystem is, EventQueue eventQueue, long nanoTime)
          Processes pending events from the system and directly fires them (notifes the listeners).
 
Methods inherited from class org.jagatoo.input.devices.Mouse
addButtonsState, addButtonsState, addMouseListener, addMouseStopListener, destroy, fireMouseEvent, fireOnMouseButtonClicked, fireOnMouseButtonPressed, fireOnMouseButtonReleased, fireOnMouseMoved, fireOnMouseWheelMoved, getButton, getButtonsCount, getButtonsState, getButtonState, getCurrentX, getCurrentY, getSourceFactory, getState, getWheel, getXAxis, getYAxis, handleClickedEvents, hasListener, hasMouseListener, isAbsolute, isButtonPressed, notifyMouseStopManager, prepareMouseButtonPressedEvent, prepareMouseButtonReleasedEvent, prepareMouseMovedEvent, prepareMouseWheelMovedEvent, removeButtonsState, removeButtonsState, removeMouseListener, removeMouseStopListener, setAbsolute, setButtonsState, storePosition, toString, update
 
Methods inherited from class org.jagatoo.input.devices.InputDevice
addInputStateListener, equals, fireStateEventsAndDoActions, getEventQueue, getName, getSourceWindow, hasInputStateListener, isEnabled, onDeviceUnregistered, removeInputStateListener, setEnabled
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LWJGLMouse

protected LWJGLMouse(MouseFactory factory,
                     InputSourceWindow sourceWindow,
                     EventQueue eventQueue)
              throws InputSystemException
Throws:
InputSystemException
Method Detail

convertButton

public static final MouseButton convertButton(int lwjglButton)

setPosition

public void setPosition(int x,
                        int y)
                 throws InputSystemException
This method stores the positional values and may do some additional implementation dependent stuff.

Overrides:
setPosition in class Mouse
Throws:
InputSystemException

centerMouse

public void centerMouse()
                 throws InputSystemException
Centers the mouse cursor on the source-window.

Specified by:
centerMouse in class Mouse
Throws:
InputSystemException

collectOrFireEvents

protected final void collectOrFireEvents(InputSystem is,
                                         EventQueue eventQueue,
                                         long nanoTime,
                                         boolean acceptEvents)
                                  throws InputSystemException
Throws:
InputSystemException

consumePendingEvents

public void consumePendingEvents(InputSystem is,
                                 EventQueue eventQueue,
                                 long nanoTime)
                          throws InputSystemException
Processes pending events from the system and simply wastes them.
This method is invoked by the InputSystem when a new InputDevice is registered and instead of the InputDevice.update(InputSystem, EventQueue, long) method, if the device is disabled or its InputSourceWindow doesn't currently receive input events.

Specified by:
consumePendingEvents in class InputDevice
Throws:
InputSystemException

collectEvents

public void collectEvents(InputSystem is,
                          EventQueue eventQueue,
                          long nanoTime)
                   throws InputSystemException
Processes pending events from the system and places them into the EventQueue.
The events are not fired (listeners are not notified). They are fired when the InputDevice.update(InputSystem, EventQueue, long) method is invoked.

Specified by:
collectEvents in class InputDevice
Throws:
InputSystemException

updateMouse

public void updateMouse(InputSystem is,
                        EventQueue eventQueue,
                        long nanoTime)
                 throws InputSystemException
Processes pending events from the system and directly fires them (notifes the listeners).
This method also flushes the EventQueue, if the previously called InputDevice.collectEvents(InputSystem, EventQueue, long) method placed events into it.

Specified by:
updateMouse in class Mouse
Throws:
InputSystemException

setAbsoluteImpl

protected void setAbsoluteImpl(boolean absolute)
                        throws InputSystemException
Makes this Mouse an absolute mouse (only delta positions become valid) or relative. This method is implicitly called by Mouse.setAbsolute(boolean), but only if the value has changed.

Specified by:
setAbsoluteImpl in class Mouse
Throws:
InputSystemException

destroyImpl

public void destroyImpl()
                 throws InputSystemException
Destroys the Mouse.

Specified by:
destroyImpl in class Mouse
Throws:
InputSystemException

onDeviceRegistered

public void onDeviceRegistered(InputSystem inputSystem)
                        throws InputSystemException
This method is called by the InputSystem after the device has been completely and successfully registered.

Overrides:
onDeviceRegistered in class InputDevice
Throws:
InputSystemException