Package com.ardor3d.input
Class MouseState
java.lang.Object
com.ardor3d.input.MouseState
Describes the mouse state at some point in time.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMouseState
(int x, int y, int dx, int dy, int dwheel, EnumMap<MouseButton, ButtonState> buttonStates, EnumMap<MouseButton, Integer> clicks) Constructs a new MouseState instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns a new EnumSet of all buttons that were clicked this frame.getButtonsPressedSince
(MouseState previous) getButtonsReleasedSince
(MouseState previous) getButtonState
(MouseButton button) Returns the current state for the supplied button, or UP if no state for that button is registered.Returns all the buttons' states.getButtonStates
(EnumMap<MouseButton, ButtonState> store) Returns all the buttons' states.int
getClickCount
(MouseButton button) Returns the click count of a mouse button as of this frame.Returns all the buttons' states.getClickCounts
(EnumMap<MouseButton, Integer> store) int
int
getDx()
int
getDy()
int
getX()
int
getY()
boolean
hasButtonState
(ButtonState state) boolean
hasButtonState
(MouseButton button) toString()
-
Field Details
-
NOTHING
-
CLICK_TIME_MS
public static long CLICK_TIME_MS
-
-
Constructor Details
-
MouseState
public MouseState(int x, int y, int dx, int dy, int dwheel, EnumMap<MouseButton, ButtonState> buttonStates, EnumMap<MouseButton, Integer> clicks) Constructs a new MouseState instance.- Parameters:
x
- the mouse's x positiony
- the mouse's y positiondx
- the delta in the mouse's x position since the last updatedy
- the delta in the mouse's y position since the last updatedwheel
- the delta in the mouse's wheel movement since the last updatebuttonStates
- the states of the various given buttons.clicks
- the number of times each button has been clicked
-
-
Method Details
-
getX
public int getX() -
getY
public int getY() -
getDx
public int getDx() -
getDy
public int getDy() -
getDwheel
public int getDwheel() -
hasButtonState
- Parameters:
state
- the button state to look for- Returns:
- true if at least one mouse button is in the given button state.
-
hasButtonState
- Parameters:
button
- the button to look for- Returns:
- true if the given mouse button is currently mapped to a state.
-
getButtonStates
Returns all the buttons' states. It could be easier for most classes to use thegetButtonState(MouseButton)
methods, and that also results in less object creation.- Returns:
- a defensive copy of the states of all the buttons at this point in time.
-
getButtonStates
Returns all the buttons' states. It could be easier for most classes to use thegetButtonState(MouseButton)
methods, and that also results in less object creation.- Parameters:
store
- a map to store the states in... any values in store are cleared first. If store is null, a new map is created.- Returns:
- a defensive copy of the states of all the buttons at this point in time.
-
getButtonState
Returns the current state for the supplied button, or UP if no state for that button is registered.- Parameters:
button
- the mouse button to check- Returns:
- the button's state, or
ButtonState.UP
if no button state registered.
-
getButtonsReleasedSince
-
getButtonsPressedSince
-
getClickCounts
Returns all the buttons' states. It could be easier for most classes to use thegetClickCount(MouseButton)
method, and that also results in less object creation.- Returns:
- a defensive copy of the click counts of all the buttons at this point in time.
-
getClickCounts
-
getClickCount
Returns the click count of a mouse button as of this frame. Click counts are non-zero only for frames when the mouse button is released. A double-click sequence, for instance, could show up like this:- Frame 1, mouse button pressed - click count == 0
- Frame 2, mouse button down - click count == 0
- Frame 3, mouse button released - click count == 1
- Frame 4, mouse button up - click count == 0
- Frame 5, mouse button pressed - click count == 0
- Frame 6, mouse button down - click count == 0
- Frame 7, mouse button released - click count == 2
CLICK_TIME_MS
.- Parameters:
button
- the button to check for clicks- Returns:
- the click count in this frame
-
getButtonsClicked
Returns a new EnumSet of all buttons that were clicked this frame.- Returns:
- every mouse button whose click count this frame is > 0
-
toString
-