Dgame.System.Mouse

« Go back

Bottom


abstract class Mouse;
Represent the Mouse

Author:
Randy Schuett (rswhite4@googlemail.com)

enum Button: ubyte;
Supported mouse buttons

Left


Middle


Right


X1


X2


Other


enum SystemCursor: int;
Possible System cursors

Arrow


IBeam


Wait


CrossHair


WaitArrow


SizeNWSE


SizeNESW


SizeWE


SizeNS


SizeAll


None


Hand


alias Cursor = SDL_Cursor*;
The Cursor representation

static nothrow @nogc bool isPressed(Button btn);
Returns if the given button is pressed.

See:
Mouse.Button

static nothrow @nogc Vector2i getCursorPosition();
Returns the current cursor position

static nothrow @nogc Vector2i getRelativeCursorPosition();
Returns the relative cursor position. x and y are set to the mouse deltas since the last call

static nothrow @nogc void setCursorPosition(int x, int y);
Set the cursor position inside the window.

Note:
A call to this function generates a mouse motion event.

nothrow @nogc void setCursorPosition()(auto ref const Vector2i pos);
Set the cursor position inside the window.

Note:
A call to this function generates a mouse motion event.

static nothrow @nogc bool hasRelativeMouse();
Returns if the Relative mouse mode is enabled/supported.

static nothrow @nogc bool enableRelativeMouse(bool enable);
Tries to enable/disable the relative mouse mode. While the mouse is in relative mode, the cursor is hidden, and the driver will try to report continuous motion in the current Window. Only relative motion events will be delivered, the mouse position will not change.

static nothrow @nogc void showCursor(bool enable);
Enable or disable that the cursor is shown on the window.

static nothrow @nogc Cursor createCursor(ref Surface srfc, int hx, int hy);
Create a Surface cursor.

static nothrow @nogc Cursor createCursor(SystemCursor cursor);
Create a system cursor.

static nothrow @nogc void setCursor(Cursor cursor);
Set the active cursor.

static nothrow @nogc Cursor getCursor();
Returns the active cursor.

static nothrow @nogc Cursor getDefaultCursor();
Get the default cursor.


Page generated by Ddoc.

» Dgame.System.Mouse on Github

Top

« Go back