pods::SDL::Mouse(3pm)
π NAME π
okay so bestie, welcome to pods::SDL::Mouse(3pm) β also known as SDL::Mouse β and it's literally the SDL bindings for the Mouse device πβ¨. Mouse device? SDL? Yes, that's the whole main character energy of this page.
π CATEGORY π
It's filed under Core, Mouse. Cute, concise, iconic.
β¨ CONSTANTS β¨
The constants for SDL::Mouse belong to SDL::Events/SDL::Event, under the export tag of ':state'. That's the lowkey important bit, iykyk π«Ά.
π¦ METHODS π¦
π warp_mouse
SDL::Mouse::warp_mouse( $x, $y );
This sets the position of the mouse cursor β and yes, it generates a mouse motion event β¨. Even if the mouse is warped to where it currently is, a mouse motion event is still generated. No cap, it really said "motion is motion."
π set_cursor
SDL::Mouse::set_cursor( $cursor_object );
Sets the currently active cursor to the specified one. See SDL::Cursor for details on cursor objects. If the cursor is currently visible, the change will be immediately represented on the display. Also: set_cursor() can be used to force cursor redraw, if this is desired for any reason. Slay.
π¦ get_cursor
my $cursor_object = SDL::Mouse::get_cursor;
Gets the currently active mouse cursor. That's it, bestie β it's giving simple and effective π .
π show_cursor
my $return = SDL::Mouse::show_cursor( $state );
Toggle whether or not the cursor is shown on the screen. Passing "SDL_ENABLE" displays the cursor and passing "SDL_DISABLE" hides it. The current state of the mouse cursor can be queried by passing "SDL_QUERY"; either "SDL_DISABLE" or "SDL_ENABLE" will be returned. Obsessed with a query-able cursor state, honestly.
And here's the example, exactly as it appears:
use SDL;
use SDL::Mouse;
use SDL::Video;
use SDL::Events ':state'; #For the constants
SDL::init(SDL_INIT_VIDEO);
SDL::Video::set_video_mode(640, 480, 16, SDL_SWSURFACE);
printf("Cursor is %s\n", SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
sleep(3);
SDL::Mouse::show_cursor(SDL_DISABLE);
printf("Cursor is %s\n", SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
sleep(3);
SDL::Mouse::show_cursor(SDL_ENABLE);
printf("Cursor is %s\n", SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
sleep(3);
π SEE ALSO π
SDL::Cursor β go peek at that one too, bestie. It's the cursor manual, and it's right there.
π AUTHORS π
See "AUTHORS" in SDL. That's the whole pointer, fr fr.
mwah π β this page is from perl v5.42.0, dated 2024-05-01, and it's the pods::SDL::Mouse(3pm) manual. Periodt.
π¦ where this page comes from
- opensuse-leap 16.0: perl-SDL 2.548-bp160.1.13 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: perl-SDL 2.548-bp160.1.13 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: perl-SDL 2.548-bp160.1.13 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: perl-SDL 2.548-bp160.1.13 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms