Class: SDL2::Mouse::Cursor

Inherits:
Object
  • Object
show all
Defined in:
mouse.c,
mouse.c

Overview

This class represents mouse cursor shape, and have some class-methods for a mouse cursor.

Class Method Summary (collapse)

Class Method Details

+ (nil) hide

Hide the mouse cursor.

Returns:

  • (nil)


177
178
179
180
181
# File 'mouse.c', line 177

static VALUE Cursor_s_hide(VALUE self)
{
    HANDLE_ERROR(SDL_ShowCursor(SDL_DISABLE));
    return Qnil;
}

+ (nil) show

Show the mouse cursor.

Returns:

  • (nil)


167
168
169
170
171
# File 'mouse.c', line 167

static VALUE Cursor_s_show(VALUE self)
{
    HANDLE_ERROR(SDL_ShowCursor(SDL_ENABLE));
    return Qnil;
}

+ (Boolean) shown?

Return true if the mouse cursor is shown.

Returns:

  • (Boolean)


186
187
188
189
# File 'mouse.c', line 186

static VALUE Cursor_s_shown_p(VALUE self)
{
    return INT2BOOL(HANDLE_ERROR(SDL_ShowCursor(SDL_QUERY)));
}

+ (nil) warp(window, x, y)

Move the mouse cursor to the given position within the window.

Parameters:

  • window (SDL::Window)

    the window to move the mouse cursor into

  • x (Integer)

    the x coordinate within the window

  • y (Integer)

    the y coordinate within the window

Returns:

  • (nil)


200
201
202
203
204
# File 'mouse.c', line 200

static VALUE Cursor_s_warp(VALUE self, VALUE window, VALUE x, VALUE y)
{
    SDL_WarpMouseInWindow(Get_SDL_Window(window), NUM2INT(x), NUM2INT(y));
    return Qnil;
}

+ (nil) warp_globally(x, y)

Note:

This class module function is available since SDL 2.0.4.

Move the mouse cursor to the given position within the desktop.

Parameters:

  • x (Integer)

    the x coordinate within the desktop

  • y (Integer)

    the y coordinate within the desktop

Returns:

  • (nil)


216
217
218
219
220
# File 'mouse.c', line 216

static VALUE Cursor_s_warp_globally(VALUE self, VALUE x, VALUE y)
{
    SDL_WarpMouseGlobal(NUM2INT(x), NUM2INT(y));
    return Qnil;
}