com.jme.input
Class Mouse

java.lang.Object
  extended by com.jme.scene.Spatial
      extended by com.jme.scene.Geometry
          extended by com.jme.scene.TriMesh
              extended by com.jme.scene.shape.Quad
                  extended by com.jme.input.Mouse
All Implemented Interfaces:
Savable, 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 displayed in the position defined by the device.

Version:
$Id: Mouse.java,v 1.26 2007/08/29 19:00:15 nca Exp $
Author:
Mark Powell, Gregg Patton
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme.scene.TriMesh
TriMesh.Mode
 
Nested classes/interfaces inherited from class com.jme.scene.Spatial
Spatial.CullHint, Spatial.LightCombineMode, Spatial.NormalsMode, Spatial.TextureCombineMode
 
Field Summary
 
Fields inherited from class com.jme.scene.Geometry
states
 
Fields inherited from class com.jme.scene.Spatial
LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, queueDistance
 
Constructor Summary
Mouse(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.
 boolean hasCursor()
          hasCursor returns true if there is a texture associated with the mouse.
abstract  void registerWithInputHandler(InputHandler inputHandler)
           
 void setHotSpotOffset(Vector3f offset)
          Sets the mouse's hotspot offset.
 RenderState setRenderState(RenderState rs)
          setRenderState sets a render state for this node.
abstract  void setSpeed(float speed)
          Sets the speed multiplier for updating the cursor position
 
Methods inherited from class com.jme.scene.shape.Quad
getCenter, getHeight, getWidth, initialize, resize
 
Methods inherited from class com.jme.scene.TriMesh
clearBuffers, draw, findCollisions, findTriangleCollision, findTrianglePick, getIndexBuffer, getMaxIndex, getMeshAsTriangles, getMeshAsTrianglesVertices, getMode, getTriangle, getTriangle, getTriangleCount, getTriangleIndices, hasCollision, hasTriangleCollision, randomPointOnTriangles, read, reconstruct, setIndexBuffer, setMode, setTriangleQuantity, write
 
Methods inherited from class com.jme.scene.Geometry
addTextureCoordinates, addTextureCoordinates, clearTextureBuffers, copyTextureCoordinates, findPick, getBinormalBuffer, getColorBuffer, getDefaultColor, getDisplayListID, getFogBuffer, getLightState, getModelBound, getNormalBuffer, getNumberOfUnits, getTangentBuffer, getTextureCoords, getTextureCoords, getVBOInfo, getVertexBuffer, getVertexCount, getWorldCoords, getWorldNormals, hasDirtyVertices, isCastsShadows, lockMeshes, postdraw, predraw, randomVertex, reconstruct, resizeTextureIds, rotateNormals, rotatePoints, scaleTextureCoordinates, scaleTextureCoordinates, setBinormalBuffer, setCastsShadows, setColorBuffer, setDefaultColor, setDisplayListID, setFogCoordBuffer, setHasDirtyVertices, setLightState, setModelBound, setNormalBuffer, setRandomColors, setSolidColor, setTangentBuffer, setTextureCoords, setTextureCoords, setTextureCoords, setVBOInfo, setVertexBuffer, setVertexCount, sortLights, translatePoints, translatePoints, unlockMeshes, updateModelBound, updateWorldBound
 
Methods inherited from class com.jme.scene.Spatial
addController, calculateCollisions, calculatePick, clearControllers, clearRenderState, getClassTag, getController, getControllerCount, getControllers, getCullHint, getLastFrustumIntersection, getLightCombineMode, getLocalCullHint, getLocalLightCombineMode, getLocalNormalsMode, getLocalRenderQueueMode, getLocalRotation, getLocalScale, getLocalTextureCombineMode, getLocalToWorldMatrix, getLocalTranslation, getLocks, getName, getNormalsMode, getParent, getRenderQueueMode, getRenderState, getTextureCombineMode, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, hasAncestor, isCollidable, localToWorld, lock, lock, lockBounds, lockBranch, lockMeshes, lockShadows, lockTransforms, lookAt, onDraw, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeController, removeFromParent, removeUserData, rotateUpTo, setCullHint, setIsCollidable, setLastFrustumIntersection, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setLocalTranslation, setLocks, setLocks, setName, setNormalsMode, setRenderQueueMode, setTextureCombineMode, setUserData, setZOrder, setZOrder, toString, unlock, unlock, unlockBounds, unlockBranch, unlockMeshes, unlockShadows, unlockTransforms, updateGeometricState, updateRenderState, updateWorldData, updateWorldVectors, updateWorldVectors, worldToLocal
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jme.util.export.Savable
getClassTag
 

Constructor Detail

Mouse

public Mouse(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 BlendState 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.

setSpeed

public abstract 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.
Please note that if a TextureState is set for this object, the hotspot offset is overwritten again.

Parameters:
offset - The new hotspot for this mouse.

registerWithInputHandler

public abstract void registerWithInputHandler(InputHandler inputHandler)