1SDL::Event(3)         User Contributed Perl Documentation        SDL::Event(3)
2
3
4

NAME

6       SDL::Event - a SDL perl extension
7

SYNOPSIS

9        use SDL::Event;
10        my $event = new SDL::Event;             # create a new event
11        while ($event->wait()) {
12               my $type = $event->type();      # get event type
13               # ... handle event
14               exit if $type == SDL_QUIT;
15        }
16

DESCRIPTION

18       "SDL::Event" offers an object-oriented approach to SDL events. By cre‐
19       ating an instance of SDL::Event via new() you can wait for events, and
20       then determine the type of the event and take an appropriate action.
21

EXAMPLE

23       Here is an example of a simple event handler loop routine.  See also
24       SDL::App::loop.
25
26              sub loop {
27                      my ($self,$href) = @_;
28                      my $event = new SDL::Event;
29                      while ( $event->wait() ) {
30                              # ... insert here your event handling like:
31                              if ( ref($$href{$event->type()}) eq "CODE" ) {
32                                      &{$$href{$event->type()}}($event);
33                                      $self->sync();
34                              }
35                      }
36              }
37

METHODS

39       new()
40
41       Create a new event object.
42
43       type()
44
45       Returns the type of the event, see list of exported symbols for which
46       are available.
47
48       pump()
49
50       poll()
51
52       wait()
53
54       Waits for an event end returns then. Always returns true.
55
56       set( type, state )
57
58       Set the state for all events of the given event's type
59
60       set_unicode( toggle )
61
62       Toggle unicode on the event.
63
64       set_key_repeat( delay, interval)
65
66       Sets the delay and intervall of the key repeat rate (e.g. when a user
67       holds down a key on the keyboard).
68
69       active_gain()
70
71       active_state()
72
73       key_state()
74
75       key_sym()
76
77       key_name()
78
79       key_mod()
80
81       key_unicode()
82
83       key_scancode()
84
85       motion_state()
86
87       motion_x()
88
89       Returns the motion of the mouse in X direction as an absolute value.
90
91       motion_y()
92
93       Returns the motion of the mouse in Y direction as an absolute value.
94
95       motion_xrel()
96
97       Returns the motion of the mouse in X direction as a relative value.
98
99       motion_yrel()
100
101       Returns the motion of the mouse in Y direction as a relative value.
102
103       button_state()
104
105       Returns the state of the mouse buttons.
106
107       button_x()
108
109       button_y()
110
111       button()
112

AUTHOR

114       David J. Goehrig Documentation by Tels <http://bloodgate.com/>
115

SEE ALSO

117       perl SDL::App
118
119
120
121perl v5.8.8                       2006-08-28                     SDL::Event(3)
Impressum