1SDL::Mouse(3) User Contributed Perl Documentation SDL::Mouse(3)
2
3
4
6 SDL::Mouse - SDL Bindings for the Mouse device
7
9 Core, Mouse
10
12 The constants for SDL::Mouse belong to SDL::Events/SDL::Event, under
13 the export tag of ':state'.
14
16 warp_mouse
17 SDL::Mouse::warp_mouse( $x, $y );
18
19 Set the position of the mouse cursor (generates a mouse motion event).
20 Even if the mouse is warped to where it currently is, a mouse motion
21 event is generated.
22
23 set_cursor
24 SDL::Mouse::set_cursor( $cursor_object );
25
26 Sets the currently active cursor to the specified one. See SDL::Cursor
27 for details on cursor objects. If the cursor is currently visible, the
28 change will be immediately represented on the display. "set_cursor()"
29 can be used to force cursor redraw, if this is desired for any reason.
30
31 get_cursor
32 my $cursor_object = SDL::Mouse::get_cursor;
33
34 Gets the currently active mouse cursor.
35
36 show_cursor
37 my $return = SDL::Mouse::show_cursor( $state );
38
39 Toggle whether or not the cursor is shown on the screen. Passing
40 "SDL_ENABLE" displays the cursor and passing "SDL_DISABLE" hides it.
41 The current state of the mouse cursor can be queried by passing
42 "SDL_QUERY", either "SDL_DISABLE" or "SDL_ENABLE" will be returned.
43
44 use SDL;
45 use SDL::Mouse;
46 use SDL::Video;
47 use SDL::Events ':state'; #For the constants
48
49 SDL::init(SDL_INIT_VIDEO);
50 SDL::Video::set_video_mode(640, 480, 16, SDL_SWSURFACE);
51
52 printf("Cursor is %s\n", SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
53
54 sleep(3);
55
56 SDL::Mouse::show_cursor(SDL_DISABLE);
57 printf("Cursor is %s\n", SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
58
59 sleep(3);
60
61 SDL::Mouse::show_cursor(SDL_ENABLE);
62 printf("Cursor is %s\n", SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
63
64 sleep(3);
65
67 SDL::Cursor
68
70 See "AUTHORS" in SDL.
71
72
73
74perl v5.30.0 2019-07-26 SDL::Mouse(3)