geMouse
From GriffinEngine
Contents
Usage
Examples
Inheritance
Base classes
- geObject
- geMouse
Reference
Mouse Button Codes
| Code | Constant | Button |
|---|---|---|
| 1 | GE_MB_LEFT | left mouse button |
| 2 | GE_MB_CENTER | middle mouse button |
| 3 | GE_MB_RIGHT | right mouse button |
| 4 | GE_MB_WHEELUP | mouse wheel (moving up) |
| 5 | GE_MB_WHEELDOWN | mouse wheel (moving down) |
Mouse Button States
Note: mouse button states behave just like key states. See geKeyboard for a more detailed reference.
| Code | Constant | State | Equivalent |
|---|---|---|---|
| 1 | GE_MS_PRESSED | Mouse button was pressed just now | |
| 2 | GE_MS_HELD | Mouse button is held down (down for two or more ticks) | |
| 3 | GE_MS_DOWN | Mouse button is down (either pressed or held) | GE_MS_PRESSED | GE_MS_HELD |
| 4 | GE_MS_RELEASED | Mouse button was released just now | |
| 8 | GE_MS_NORMAL | Mouse button is untouched (up for two or more ticks) | |
| 12 | GE_MS_UP | Mouse button is not pressed (released or normal) | GE_MS_RELEASED | GE_MS_NORMAL |
Accessors
Note: all mouse coordinates are in pixels, relative to the top-left corner of the window.
static int getX(); // get current mouse X coord (pixels)
static int getY(); // get current mouse Y coord (pixels)
static int getOldX(); // get mouse X coord from previous frame (pixels)
static int getOldY(); // get mouse Y coord from previous frame (pixels)
static int deltaX(); // the mouse pointer speed along the X axis last frame (X-oldX)
static int deltaY(); // the mouse pointer speed along the Y axis last frame (Y-oldY)
static double getDirection(); // get angle of the mouse, in radians
static double getDirectionD(); // get angle of the mouse, in degrees
static double getDistance(); // get distance traveled by the mouse (pixels)
- Note: to convert deltaX/deltaY/distance to actual pixels-per-second mouse speed, divide the values by .
geTimer::getFrameDuration()
- Note: to convert deltaX/deltaY/distance to actual pixels-per-second mouse speed, divide the values by
static int getButtonState( int button ); // get current state of the specified mouse button
static bool isButtonDown( int button ); // returns true if the specified mouse button is down (GE_MS_DOWN)
| Events |
|---|
| geEventManager · geKeyboard · geMouse · geTimer |
| geCollisionEvent · GeKeyEvent · GeMouseClickEvent · GeMouseDragEvent · GeMouseMotionEvent |
Categories:
- Events
- API