com.jme.input
Class Mouse

java.lang.Object
  extended bycom.jme.scene.Spatial
      extended bycom.jme.scene.Geometry
          extended bycom.jme.scene.TriMesh
              extended bycom.jme.scene.shape.Quad
                  extended bycom.jme.input.Mouse
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AbsoluteMouse, RelativeMouse

public abstract class Mouse
extends Quad

Mouse defines a node that handles the rendering and updating of a mouse input device. If a cursor is set, this cursor is desplayed in the position defined by the device.

Version:
$Id: Mouse.java,v 1.15 2004/10/14 01:23:07 mojomonkey Exp $
Author:
Mark Powell, Gregg Patton
See Also:
Serialized Form

Field Summary
protected  float _speed
           
protected  boolean hasCursor
          the cursor's texture.
protected  Vector3f hotSpotLocation
          This mouse's actual location after hotspot offset is taken into account.
protected  Vector3f hotSpotOffset
          This mouse's hotspot location.
protected  int imageHeight
          Height of this mouse's texture.
protected  int imageWidth
          Width of this mouse's texture.
protected  MouseInput mouse
          the input device.
 
Fields inherited from class com.jme.scene.TriMesh
indices, triangleQuantity
 
Fields inherited from class com.jme.scene.Geometry
bound, color, colorBuf, normal, normBuf, texBuf, texture, vertBuf, vertex, vertQuantity
 
Fields inherited from class com.jme.scene.Spatial
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder
 
Constructor Summary
Mouse(java.lang.String name)
          Constructor creates a new Mouse object.
 
Method Summary
 Vector3f getHotSpotOffset()
          Returns the currently set hotspot of the mouse.
 Vector3f getHotSpotPosition()
          Returns this mouse's location relative to the hotspot offset.
 int getImageHeight()
          getImageHeight retrieves the height of the cursor image.
 int getImageWidth()
          getImageWidth retrieves the width of the cursor image.
 MouseInput getMouseInput()
          getMouseInput retrieves the input device for the mouse.
 boolean hasCursor()
          hasCursor returns true if there is a texture associated with the mouse.
 void setHotSpotOffset(Vector3f offset)
          Sets the mouse's hotspot offset.
 void setMouseInput(MouseInput mouse)
          setMouseInput sets the input device for the mouse.
 RenderState setRenderState(RenderState rs)
          setRenderState sets a render state for this node.
 void setSpeed(float speed)
          Sets the speed multiplier for updating the cursor position
abstract  void update()
          update updates the mouse input object.
abstract  void update(boolean updateState)
          update updates the mouse input object.
 
Methods inherited from class com.jme.scene.shape.Quad
getCenter, initialize, resize
 
Methods inherited from class com.jme.scene.TriMesh
clearBuffers, draw, drawBounds, findCollisions, findTriangleCollision, findTrianglePick, findWorldRotMat, getIndexAsBuffer, getIndices, getMeshAsTriangles, getTriangle, getTriangle, getTriangleQuantity, hasCollision, hasTriangleCollision, putClone, reconstruct, setIndexBuffer, setIndices, updateCollisionTree, updateIndexBuffer
 
Methods inherited from class com.jme.scene.Geometry
applyRenderState, applyStates, copyTextureCoords, findPick, getAllTextures, getCloneID, getColorAsFloatBuffer, getColors, getModelBound, getNormalAsFloatBuffer, getNormals, getNumberOfUnits, getTextureAsFloatBuffer, getTextureAsFloatBuffer, getTextures, getTextures, getVBOColorID, getVBONormalID, getVBOTextureID, getVBOVertexID, getVerticeAsFloatBuffer, getVertices, getVertQuantity, isVBOColorEnabled, isVBONormalEnabled, isVBOTextureEnabled, isVBOVertexEnabled, randomVertice, reconstruct, setAllTextures, setColor, setColors, setFloatBuffer, setForceView, setModelBound, setNormal, setNormalBuffer, setNormals, setRandomColors, setSolidColor, setTexture, setTexture, setTextureBuffer, setTextureCoord, setTextures, setTextures, setVBOColorEnabled, setVBOColorID, setVBONormalEnabled, setVBONormalID, setVBOTextureEnabled, setVBOTextureID, setVBOVertexEnabled, setVBOVertexID, setVertex, setVertexBuffer, setVertices, updateColorBuffer, updateColorBuffer, updateModelBound, updateNormalBuffer, updateNormalBuffer, updateTextureBuffer, updateTextureBuffer, updateTextureBuffer, updateVertexBuffer, updateVertexBuffer, updateWorldBound
 
Methods inherited from class com.jme.scene.Spatial
addController, applyDefaultStates, calculateCollisions, calculatePick, clearCurrentState, clearCurrentStates, clearRenderState, getController, getControllers, getCurrentState, getLastFrustumIntersection, getLightCombineMode, getLocalRotation, getLocalScale, getLocalTranslation, getName, getParent, getRenderQueueMode, getRenderStateList, getTextureCombineMode, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, isForceCulled, isForceView, onDraw, onDrawBounds, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeFromParent, setForceCull, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setName, setParent, setRenderQueueMode, setTextureCombineMode, setWorldBound, setZOrder, toString, updateGeometricState, updateRenderState, updateRenderState, updateWorldData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mouse

protected MouseInput mouse
the input device.


hasCursor

protected boolean hasCursor
the cursor's texture.


imageWidth

protected int imageWidth
Width of this mouse's texture.


imageHeight

protected int imageHeight
Height of this mouse's texture.


_speed

protected float _speed

hotSpotLocation

protected Vector3f hotSpotLocation
This mouse's actual location after hotspot offset is taken into account.


hotSpotOffset

protected Vector3f hotSpotOffset
This mouse's hotspot location. The location on the texture where the mouse is actually clicking, relative to the bottom left.

Constructor Detail

Mouse

public Mouse(java.lang.String name)
Constructor creates a new Mouse object.

Parameters:
name - the name of the scene element. This is required for identification and comparision purposes.
Method Detail

setRenderState

public RenderState setRenderState(RenderState rs)
setRenderState sets a render state for this node. Note, there can only be one render state per type per node. That is, there can only be a single AlphaState a single TextureState, etc. If there is already a render state for a type set the old render state will be rendered. Otherwise, null is returned.

Overrides:
setRenderState in class Spatial
Parameters:
rs - the render state to add.
Returns:
the old render state.

getImageHeight

public int getImageHeight()
getImageHeight retrieves the height of the cursor image.

Returns:
the height of the cursor image.

getImageWidth

public int getImageWidth()
getImageWidth retrieves the width of the cursor image.

Returns:
the width of the cursor image.

hasCursor

public boolean hasCursor()
hasCursor returns true if there is a texture associated with the mouse.

Returns:
true if there is a texture for the mouse, false otherwise.

setMouseInput

public void setMouseInput(MouseInput mouse)
setMouseInput sets the input device for the mouse.

Parameters:
mouse - the input device for the mouse.

getMouseInput

public MouseInput getMouseInput()
getMouseInput retrieves the input device for the mouse.

Returns:
the input device for the mouse.

update

public abstract void update()
update updates the mouse input object. This is normally a call to update(true).

See Also:
update(boolean)

update

public abstract void update(boolean updateState)
update updates the mouse input object. This is where the mouse location and button press states are updated.

Parameters:
updateState - indicates if the mouse's state (buttons) should be updated

setSpeed

public void setSpeed(float speed)
Sets the speed multiplier for updating the cursor position

Parameters:
speed -

getHotSpotPosition

public Vector3f getHotSpotPosition()
Returns this mouse's location relative to the hotspot offset. Basicly, where the mouse is on the screen.

Returns:
The mouse's location.

getHotSpotOffset

public Vector3f getHotSpotOffset()
Returns the currently set hotspot of the mouse. This is the spot relative to the bottom left of the texture where the mouse is actually pointed.

Returns:
The mouse's hotspot offset.

setHotSpotOffset

public void setHotSpotOffset(Vector3f offset)
Sets the mouse's hotspot offset. The hotspot is the spot relative to the bottom left of the texture where the mouse is actually pointed. Note that this is a shallow copy, not a deep copy.

Parameters:
offset - The new hotspot for this mouse.