.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "pods::SDL::Mouse 3pm" .TH pods::SDL::Mouse 3pm 2024-03-28 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME SDL::Mouse \- SDL Bindings for the Mouse device .SH CATEGORY .IX Header "CATEGORY" Core, Mouse .SH CONSTANTS .IX Header "CONSTANTS" The constants for SDL::Mouse belong to SDL::Events/SDL::Event, under the export tag of \f(CW\*(Aq:state\*(Aq\fR. .SH METHODS .IX Header "METHODS" .SS warp_mouse .IX Subsection "warp_mouse" .Vb 1 \& SDL::Mouse::warp_mouse( $x, $y ); .Ve .PP Set the position of the mouse cursor (generates a mouse motion event). Even if the mouse is warped to where it currently is, a mouse motion event is generated. .SS set_cursor .IX Subsection "set_cursor" .Vb 1 \& SDL::Mouse::set_cursor( $cursor_object ); .Ve .PP 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. \&\f(CWset_cursor()\fR can be used to force cursor redraw, if this is desired for any reason. .SS get_cursor .IX Subsection "get_cursor" .Vb 1 \& my $cursor_object = SDL::Mouse::get_cursor; .Ve .PP Gets the currently active mouse cursor. .SS show_cursor .IX Subsection "show_cursor" .Vb 1 \& my $return = SDL::Mouse::show_cursor( $state ); .Ve .PP Toggle whether or not the cursor is shown on the screen. Passing \f(CW\*(C`SDL_ENABLE\*(C'\fR displays the cursor and passing \f(CW\*(C`SDL_DISABLE\*(C'\fR hides it. The current state of the mouse cursor can be queried by passing \f(CW\*(C`SDL_QUERY\*(C'\fR, either \f(CW\*(C`SDL_DISABLE\*(C'\fR or \f(CW\*(C`SDL_ENABLE\*(C'\fR will be returned. .PP .Vb 4 \& use SDL; \& use SDL::Mouse; \& use SDL::Video; \& use SDL::Events \*(Aq:state\*(Aq; #For the constants \& \& SDL::init(SDL_INIT_VIDEO); \& SDL::Video::set_video_mode(640, 480, 16, SDL_SWSURFACE); \& \& printf("Cursor is %s\en", SDL::Mouse::show_cursor(SDL_QUERY) ? \*(Aqvisible\*(Aq : \*(Aqnot visible\*(Aq); \& \& sleep(3); \& \& SDL::Mouse::show_cursor(SDL_DISABLE); \& printf("Cursor is %s\en", SDL::Mouse::show_cursor(SDL_QUERY) ? \*(Aqvisible\*(Aq : \*(Aqnot visible\*(Aq); \& \& sleep(3); \& \& SDL::Mouse::show_cursor(SDL_ENABLE); \& printf("Cursor is %s\en", SDL::Mouse::show_cursor(SDL_QUERY) ? \*(Aqvisible\*(Aq : \*(Aqnot visible\*(Aq); \& \& sleep(3); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" SDL::Cursor .SH AUTHORS .IX Header "AUTHORS" See "AUTHORS" in SDL.