<!-- INDEX START -->
<h3 id="TOP">Index</h3>
-<ul><li><a href="#NAME">NAME</a></li>
+<ul><li><a href="#NAME">NAME</a>
+<ul><li><a href="#CATEGORY">CATEGORY</a></li>
+</ul>
+</li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
<li><a href="#METHODS">METHODS</a>
</ul>
</li>
<li><a href="#Window_resize_events">Window resize events</a>
-<ul><li><a href="#resize_x_resize_y">resize_x, resize_y</a></li>
+<ul><li><a href="#resize_w_resize_h">resize_w, resize_h</a></li>
</ul>
</li>
<li><a href="#Window_expose_events">Window expose events</a></li>
<li><a href="#Quit_event">Quit event</a></li>
</ul>
</li>
-<li><a href="#AUTHOR">AUTHOR</a></li>
+<li><a href="#AUTHORS">AUTHORS</a></li>
<li><a href="#SEE_ALSO">SEE ALSO</a>
</li>
</ul><hr />
<p>SDL::Event - General event structure</p>
</div>
+<h2 id="CATEGORY">CATEGORY</h2>
+<div id="CATEGORY_CONTENT">
+<p>Core, Events, Structure</p>
+
+</div>
<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="SYNOPSIS_CONTENT">
-<pre> use SDL::Event; # for the event object itself
- use SDL::Events qw(pump_events poll_event); # functions for event queue handling
+<pre> use SDL::Event; # for the event object itself
+ use SDL::Events; # functions for event queue handling
SDL::init(SDL_INIT_VIDEO);
my $event = SDL::Event->new();
while(1)
{
- pump_events();
+ SDL::Events::pump_events();
- if(poll_event($event))
+ if(SDL::Events::poll_event($event))
{
if($event->type == SDL_MOUSEBUTTONDOWN)
{
</pre>
<p>Available type constants:</p>
<ul>
- <li><a href="#active">SDL_ACTIVEEVENT</a> - Application visibility event structure </li>
- <li><a href="#active">SDL_KEYDOWN</a> - Keyboard event structure </li>
- <li><a href="#active">SDL_KEYUP</a> - Keyboard event structure </li>
- <li><a href="#active">SDL_MOUSEMOTION</a> - Mouse motion event structure </li>
- <li><a href="#active">SDL_MOUSEBUTTONDOWN</a> - Mouse button event structure </li>
- <li><a href="#button">SDL_MOUSEBUTTONUP</a> - Mouse button event structure </li>
- <li><a href="#active">SDL_JOYAXISMOTION</a> - Joystick axis motion event structure </li>
- <li><a href="#active">SDL_JOYBALLMOTION</a> - Joystick trackball motion event structure </li>
- <li><a href="#active">SDL_JOYHATMOTION</a> - Joystick hat position change event structure </li>
- <li><a href="#active">SDL_JOYBUTTONDOWN</a> - Joystick button event structure </li>
- <li><a href="#active">SDL_JOYBUTTONUP</a> - Joystick button event structure </li>
- <li><a href="#active">SDL_VIDEORESIZE</a> - Window resize event structure </li>
- <li><a href="#active">SDL_VIDEOEXPOSE</a> - Window expose event </li>
- <li><a href="#active">SDL_QUIT</a> - Quit requested event </li>
- <li><a href="#active">SDL_USEREVENT</a> - A user-defined event type </li>
- <li><a href="#active">SDL_SYSWMEVENT</a> - Platform-dependent window manager event. </li>
+ <li><a href="#Application_visibility_events">SDL_ACTIVEEVENT</a> - Application visibility event structure </li>
+ <li><a href="#Keyboard_events">SDL_KEYDOWN</a> - Keyboard event structure </li>
+ <li><a href="#Keyboard_events">SDL_KEYUP</a> - Keyboard event structure </li>
+ <li><a href="#Mouse_motion_events">SDL_MOUSEMOTION</a> - Mouse motion event structure </li>
+ <li><a href="#Mouse_button_events">SDL_MOUSEBUTTONDOWN</a> - Mouse button event structure </li>
+ <li><a href="#Mouse_button_events">SDL_MOUSEBUTTONUP</a> - Mouse button event structure </li>
+ <li><a href="#Joystick_axis_events">SDL_JOYAXISMOTION</a> - Joystick axis motion event structure </li>
+ <li><a href="#Joystrick_trackball_events">SDL_JOYBALLMOTION</a> - Joystick trackball motion event structure </li>
+ <li><a href="#Joystick_hat_events">SDL_JOYHATMOTION</a> - Joystick hat position change event structure </li>
+ <li><a href="#Joystick_button_events">SDL_JOYBUTTONDOWN</a> - Joystick button event structure </li>
+ <li><a href="#Joystick_button_events">SDL_JOYBUTTONUP</a> - Joystick button event structure </li>
+ <li><a href="#Window_resize_events">SDL_VIDEORESIZE</a> - Window resize event structure </li>
+ <li><a href="#Window_expose_events">SDL_VIDEOEXPOSE</a> - Window expose event </li>
+ <li><a href="#Quit_event">SDL_QUIT</a> - Quit requested event </li>
+ <li><a href="#User_defined_events">SDL_USEREVENT</a> - A user-defined event type </li>
+ <li><a href="#System_window_manager_events">SDL_SYSWMEVENT</a> - Platform-dependent window manager event. </li>
</ul>
<p>Event types are grouped by masks. <code>SDL_EVENTMASK($type)</code> will return the proper mask for the given <code>type</code>.</p>
then an <code>SDL_RELEASED</code> when released and pressed again. For these keys <code>KEYUP</code> and <code>KEYDOWN</code> events are therefore
analogous to the state of the caps lock and num lock LEDs rather than the keys themselves.
These special cases are required for compatibility with Sun workstations.</p>
-<p><strong>Note:</strong> Repeating <code>SDL_KEYDOWN</code> events will occur if key repeat is enabled (see <code>SDL_EnableKeyRepeat</code>). </p>
+<p><strong>Note:</strong> Repeating <code>SDL_KEYDOWN</code> events will occur if key repeat is enabled (see <b>enable_key_repeat</b> (<b>enable_key_repeat</b> in <cite>SDL::EVENTS</cite>)). </p>
</div>
<h3 id="key_state">key_state</h3>
</div>
<h3 id="key_unicode">key_unicode</h3>
<div id="key_unicode_CONTENT">
-<p>The <code>unicode</code> field is only used when UNICODE translation is enabled with SDL_EnableUNICODE.
+<p>The <code>unicode</code> field is only used when UNICODE translation is enabled with <b>enable_unicode</b> (<b>enable_unicode</b> in <cite>SDL::EVENTS</cite>).
If <code>unicode</code> is non-zero then this is the UNICODE character corresponding to the keypress.
If the high 9 bits of the character are 0, then this maps to the equivalent ASCII character:</p>
<pre> my $char;
</div>
<h3 id="motion_state">motion_state</h3>
<div id="motion_state_CONTENT">
-<p>The button state can be interpreted using the <code>SDL_BUTTON</code> macro (see SDL_GetMouseState). </p>
+<p>The button state can be interpreted using the <code>SDL_BUTTON</code> macro (see <b>get_mouse_state</b> (<b>get_mouse_state</b> in <cite>SDL::EVENTS</cite>)). </p>
</div>
<h3 id="motion_x_motion_y">motion_x, motion_y</h3>
</div>
<h2 id="Mouse_button_events">Mouse button events</h2>
<div id="Mouse_button_events_CONTENT">
-<p>When a mouse button press or release is detected the number of the button pressed (from 1 to 255,
-with 1 usually being the left button and 2 the right) is placed into <code>button_button</code>, the position of the mouse
-when this event occured is stored in the <code>button_x</code> and the <code>button_y</code> fields. Like SDL_KeyboardEvent,
+<p>When a mouse button press or release is detected, the number of the button pressed (from 1 to 255,
+with 1 usually being the left button and 2 the right) is placed into <code>button_button</code>. The position of the mouse
+when this event occured is stored in the <code>button_x</code> and the <code>button_y</code> fields. Like a keyboard event,
information on whether the event was a press or a release event is stored in both the <code>button_type</code>
and <code>button_state</code> fields, but this should be obvious.</p>
<p>Mouse wheel events are reported as buttons 4 (up) and 5 (down). Two events are generated i.e. you get
<div id="Window_resize_events_CONTENT">
</div>
-<h3 id="resize_x_resize_y">resize_x, resize_y</h3>
-<div id="resize_x_resize_y_CONTENT">
+<h3 id="resize_w_resize_h">resize_w, resize_h</h3>
+<div id="resize_w_resize_h_CONTENT">
+<p>When <code>SDL_RESIZABLE</code> is passed as a flag to <code>SDL_SetVideoMode</code> the user is allowed to resize the
+applications window. When the window is resized an <code>SDL_VIDEORESIZE</code> is reported, with the new
+window width and height values stored in the resize structure's <code>resize_w</code> and <code>resize_h</code>.
+When an <code>SDL_VIDEORESIZE</code> is received the window should be resized to the new dimensions using
+SDL_SetVideoMode. </p>
</div>
<h2 id="Window_expose_events">Window expose events</h2>
<div id="Window_expose_events_CONTENT">
+<p>A <code>VIDEOEXPOSE</code> event is triggered when the screen has been modified outside of the application,
+usually by the window manager and needs to be redrawn.</p>
</div>
<h2 id="System_window_manager_events">System window manager events</h2>
<div id="System_window_manager_events_CONTENT">
+<p>The system window manager event contains a system-specific information about unknown window manager
+events. If you enable this event using <code>SDL_EventState</code>, it will be generated whenever unhandled
+events are received from the window manager. This can be used, for example, to implement cut-and-paste
+in your application.</p>
+<p>If you want to obtain system-specific information about the window manager, you can fill in the
+version member of a SDL_SysWMinfo structure (details can be found in SDL_syswm.h, which must be included)
+using the SDL_VERSION() macro found in SDL_version.h, and pass it to the function:</p>
+<pre> int SDL_GetWMInfo(SDL_SysWMinfo *info);
+
+</pre>
+<p>See <a href="http://www.libsdl.org/cgi/docwiki.cgi/SDL_SysWMEvent">http://www.libsdl.org/cgi/docwiki.cgi/SDL_SysWMEvent</a></p>
</div>
<h3 id="syswm_msg">syswm_msg</h3>
</div>
<h2 id="User_defined_events">User defined events</h2>
<div id="User_defined_events_CONTENT">
+<p>This event is unique, it is never created by SDL but only by the user. The event can be pushed onto
+the event queue using <code>SDL::Events::push_event</code>. The contents of the structure members are completely up to the
+programmer, the only requirement is that type is a value from <code>SDL_USEREVENT</code> to <code>SDL_NUMEVENTS-1</code> (inclusive)</p>
+<pre> my $event = SDL::Event->new();
+ $event->type ( SDL_USEREVENT + 3 );
+ $event->user_code(10);
+ $event->user_data1('hello event');
+
+ SDL::Events::push_event($event);
+
+</pre>
</div>
<h3 id="user_code">user_code</h3>
<div id="user_code_CONTENT">
+<p>User defined event code (integer).</p>
</div>
<h3 id="user_data1_user_data2">user_data1, user_data2</h3>
<div id="user_data1_user_data2_CONTENT">
+<p>User defined data.</p>
</div>
<h2 id="Quit_event">Quit event</h2>
<div id="Quit_event_CONTENT">
-<p>Create a new SDL::Event object.</p>
+<p>As can be seen, the <code>SDL_QuitEvent</code> structure serves no useful purpose. The event itself, on the other hand,
+is very important. If you filter out or ignore a quit event then it is impossible for the user to close the
+window. On the other hand, if you do accept a quit event then the application window will be closed, and
+screen updates will still report success even though the application will no longer be visible.</p>
+<p><strong>Note</strong>: The macro SDL_QuitRequested will return non-zero if a quit event is pending </p>
</div>
-<h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p>
-<div id="AUTHOR_CONTENT">
+<h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="AUTHORS_CONTENT">
+<p>See <b>AUTHORS</b> in <cite>SDL</cite>.</p>
</div>
<h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="SEE_ALSO_CONTENT">
-<p><cite>perl</cite></p>
+<p><a href="http://search.cpan.org/perldoc?perl">perl</a>
+</p>
</div>
</div>
\ No newline at end of file