Package de.coreengine.framework
Class Mouse
- java.lang.Object
-
- de.coreengine.framework.Mouse
-
public class Mouse extends Object
Class to manage the cursor and get mouse inputs- Author:
- Darius Dinger
-
-
Field Summary
Fields Modifier and Type Field Description static intMOUSE_BUTTON_1static intMOUSE_BUTTON_2static intMOUSE_BUTTON_3static intMOUSE_BUTTON_4static intMOUSE_BUTTON_5static intMOUSE_BUTTON_6static intMOUSE_BUTTON_7static intMOUSE_BUTTON_8static intMOUSE_BUTTON_LASTstatic intMOUSE_BUTTON_LEFTstatic intMOUSE_BUTTON_MIDDLEstatic intMOUSE_BUTTON_RIGHT
-
Constructor Summary
Constructors Constructor Description Mouse()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doublegetDWheel()static floatgetDx()static floatgetDy()static floatgetPosx()static floatgetPosy()static booleanisButtonPressed(int buttonCode)Check if the button is pressed at the moment.
Returns false, if button code is out of range!static booleanisGrabbed()static booleanisVisible()static voidsetGrabbed(boolean grabbed)static voidsetVisible(boolean visible)Setting mouse cursor visibility.
true = visible
false = invisiblestatic voidupdate()Update the mouse and go to thenext frame.
-
-
-
Field Detail
-
MOUSE_BUTTON_1
public static final int MOUSE_BUTTON_1
- See Also:
- Constant Field Values
-
MOUSE_BUTTON_2
public static final int MOUSE_BUTTON_2
- See Also:
- Constant Field Values
-
MOUSE_BUTTON_3
public static final int MOUSE_BUTTON_3
- See Also:
- Constant Field Values
-
MOUSE_BUTTON_4
public static final int MOUSE_BUTTON_4
- See Also:
- Constant Field Values
-
MOUSE_BUTTON_5
public static final int MOUSE_BUTTON_5
- See Also:
- Constant Field Values
-
MOUSE_BUTTON_6
public static final int MOUSE_BUTTON_6
- See Also:
- Constant Field Values
-
MOUSE_BUTTON_7
public static final int MOUSE_BUTTON_7
- See Also:
- Constant Field Values
-
MOUSE_BUTTON_8
public static final int MOUSE_BUTTON_8
- See Also:
- Constant Field Values
-
MOUSE_BUTTON_LAST
public static final int MOUSE_BUTTON_LAST
- See Also:
- Constant Field Values
-
MOUSE_BUTTON_LEFT
public static final int MOUSE_BUTTON_LEFT
- See Also:
- Constant Field Values
-
MOUSE_BUTTON_RIGHT
public static final int MOUSE_BUTTON_RIGHT
- See Also:
- Constant Field Values
-
MOUSE_BUTTON_MIDDLE
public static final int MOUSE_BUTTON_MIDDLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
update
public static void update()
Update the mouse and go to thenext frame. Should be called once per frame
-
isVisible
public static boolean isVisible()
- Returns:
- Is mouse cursor visible at the moment
-
setVisible
public static void setVisible(boolean visible)
Setting mouse cursor visibility.
true = visible
false = invisible- Parameters:
visible- New visibility
-
setGrabbed
public static void setGrabbed(boolean grabbed)
- Parameters:
grabbed- Grab mouse at the center of the screen (true), or not(false)
-
isGrabbed
public static boolean isGrabbed()
- Returns:
- Is mouse currently grabbed at the center of the screen
-
isButtonPressed
public static boolean isButtonPressed(int buttonCode)
Check if the button is pressed at the moment.
Returns false, if button code is out of range!- Parameters:
buttonCode- Code of the button to check- Returns:
- True if the button is pressed, else false
-
getDWheel
public static double getDWheel()
- Returns:
- Vertical delta mouse wheel scroll offset since last frame
-
getDx
public static float getDx()
- Returns:
- Delta mouse position offset since last frame x
-
getDy
public static float getDy()
- Returns:
- Delta mouse position offset since last frame y
-
getPosx
public static float getPosx()
- Returns:
- Current mouse position x
-
getPosy
public static float getPosy()
- Returns:
- Current mouse position y
-
-