Xj3D VRML/X3D Code API

org.web3d.ogl.loaders
Class UserInputRuntime

java.lang.Object
  extended byorg.web3d.ogl.loaders.UserInputRuntime
All Implemented Interfaces:
InputEventBuffer

public class UserInputRuntime
extends java.lang.Object
implements InputEventBuffer

An Aviatrix3D runtime component that allows user code to feed mouse and keyboard events into a loaded X3D/VRML model, buffering them for later processing.

Version:
$Revision: 1.1 $
Author:
Justin Couch

Constructor Summary
UserInputRuntime()
          Create a new behavior with default settings.
 
Method Summary
 void addKeyEvent(java.awt.event.KeyEvent evt)
          Add an event to the key array
 void addMouseEvent(java.awt.event.MouseEvent evt)
          Add an event to the mouse array
 void executeModelBehavior()
          Execute the behaviour of the runtime component now.
 int getKeyEvents(java.awt.event.KeyEvent[] events)
          Get the list of keyboard keycodes that were hit in the last frame.
 int getMouseEvents(java.awt.event.MouseEvent[] events)
          Get the last mouse event that was received.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserInputRuntime

public UserInputRuntime()
Create a new behavior with default settings. The scehduling bounds is already set to be a sphere with infinite radius.

Method Detail

executeModelBehavior

public void executeModelBehavior()
Execute the behaviour of the runtime component now.


getKeyEvents

public int getKeyEvents(java.awt.event.KeyEvent[] events)
Get the list of keyboard keycodes that were hit in the last frame. This will be presented in the order that they were pressed. When providing an array, the end user should choose a value that is "big enough" to handle what could possibly be given. There's no hints from this code, but it is unlikely that very long periods of time will exist between calls so there's no need to pass in an array 64k ints long. The return value will include the number of valid items copied into the array. If the user's array is too short then it will be filled, and the return value will indicate the real number of events that were buffered.

Specified by:
getKeyEvents in interface InputEventBuffer
Parameters:
events - The array to copy the key codes into
Returns:
The number of events copied into the array

getMouseEvents

public int getMouseEvents(java.awt.event.MouseEvent[] events)
Get the last mouse event that was received.

Specified by:
getMouseEvents in interface InputEventBuffer
Parameters:
events - The array to copy the key codes into
Returns:
The last mouse event reference

addKeyEvent

public void addKeyEvent(java.awt.event.KeyEvent evt)
Add an event to the key array

Parameters:
evt - The event to call

addMouseEvent

public void addMouseEvent(java.awt.event.MouseEvent evt)
Add an event to the mouse array

Parameters:
evt - The event to call

Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium