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, 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 displayed in the position defined by the device.

Version:
$Id: Mouse.java 4131 2009-03-19 20:15:28Z blaine.dev $
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
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.
 
Fields inherited from class com.jme.scene.shape.Quad
height, width
 
Fields inherited from class com.jme.scene.TriMesh
indexBuffer, mode, triangleQuantity
 
Fields inherited from class com.jme.scene.Geometry
binormalBuf, bound, castsShadows, colorBuf, compVect, defaultColor, displayListID, enabled, fogBuf, hasDirtyVertices, normBuf, states, tangentBuf, texBuf, vboInfo, vertBuf, vertQuantity
 
Fields inherited from class com.jme.scene.Spatial
cullHint, frustrumIntersects, geometricalControllers, isCollidable, lightCombineMode, localRotation, localScale, localTranslation, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, normalsMode, 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.
 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, updateGeometry
 
Methods inherited from class com.jme.scene.TriMesh
clearBuffers, draw, findCollisions, findTriangleCollision, findTrianglePick, getIndexBuffer, getMaxIndex, getMeshAsTriangles, getMeshAsTrianglesVertices, getMode, getTriangle, getTriangle, getTriangleCount, getTriangleIndices, getVertIndex, hasCollision, hasTriangleCollision, randomPointOnTriangles, read, recalcTriangleQuantity, reconstruct, setIndexBuffer, setMode, setTriangleQuantity, write
 
Methods inherited from class com.jme.scene.Geometry
addTextureCoordinates, addTextureCoordinates, applyRenderState, checkTextureCoordinates, clearTextureBuffers, copyTextureCoordinates, 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, clearRenderState, getClassTag, getController, getControllerCount, getControllers, getCullHint, getLastFrustumIntersection, getLightCombineMode, getLocalCullHint, getLocalLightCombineMode, getLocalNormalsMode, getLocalRenderQueueMode, getLocalRotation, getLocalScale, getLocalTextureCombineMode, getLocalToWorldMatrix, getLocalTranslation, getLocks, getName, getNormalsMode, getParent, getRenderQueueMode, getRenderState, 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, setParent, setRenderQueueMode, setTextureCombineMode, setUserData, setZOrder, setZOrder, toString, unlock, unlock, unlockBounds, unlockBranch, unlockMeshes, unlockShadows, unlockTransforms, updateGeometricState, updateRenderState, updateRenderState, updateWorldData, updateWorldRotation, updateWorldScale, updateWorldTranslation, updateWorldVectors, updateWorldVectors, worldToLocal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jme.util.export.Savable
getClassTag
 

Field Detail

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.


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 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)