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 int
MOUSE_BUTTON_1
static int
MOUSE_BUTTON_2
static int
MOUSE_BUTTON_3
static int
MOUSE_BUTTON_4
static int
MOUSE_BUTTON_5
static int
MOUSE_BUTTON_6
static int
MOUSE_BUTTON_7
static int
MOUSE_BUTTON_8
static int
MOUSE_BUTTON_LAST
static int
MOUSE_BUTTON_LEFT
static int
MOUSE_BUTTON_MIDDLE
static int
MOUSE_BUTTON_RIGHT
-
Constructor Summary
Constructors Constructor Description Mouse()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
getDWheel()
static float
getDx()
static float
getDy()
static float
getPosx()
static float
getPosy()
static boolean
isButtonPressed(int buttonCode)
Check if the button is pressed at the moment.
Returns false, if button code is out of range!static boolean
isGrabbed()
static boolean
isVisible()
static void
setGrabbed(boolean grabbed)
static void
setVisible(boolean visible)
Setting mouse cursor visibility.
true = visible
false = invisiblestatic void
update()
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
-
-