test includes
[sdlgit/SDL-Site.git] / pages / SDL-Event.html-inc
diff --git a/pages/SDL-Event.html-inc b/pages/SDL-Event.html-inc
new file mode 100644 (file)
index 0000000..9621614
--- /dev/null
@@ -0,0 +1,454 @@
+<div class="pod">
+<!-- INDEX START -->
+<h3 id="TOP">Index</h3>
+
+<ul><li><a href="#NAME">NAME</a></li>
+<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
+<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
+<li><a href="#METHODS">METHODS</a>
+<ul><li><a href="#new">new</a></li>
+<li><a href="#type">type</a></li>
+<li><a href="#active">active</a>
+<ul><li><a href="#active_type">active_type</a></li>
+<li><a href="#active_gain">active_gain</a></li>
+<li><a href="#active_state">active_state</a></li>
+</ul>
+</li>
+<li><a href="#key">key</a>
+<ul><li><a href="#key_type">key_type</a></li>
+<li><a href="#key_state">key_state</a></li>
+<li><a href="#key_keysym">key_keysym</a></li>
+<li><a href="#key_scancode">key_scancode</a></li>
+<li><a href="#key_sym">key_sym</a></li>
+<li><a href="#key_mod">key_mod</a></li>
+<li><a href="#key_unicode">key_unicode</a></li>
+</ul>
+</li>
+<li><a href="#motion">motion</a>
+<ul><li><a href="#motion_type">motion_type</a></li>
+<li><a href="#motion_state">motion_state</a></li>
+<li><a href="#motion_x_motion_y">motion_x, motion_y</a></li>
+<li><a href="#motion_xrel_motion_yrel">motion_xrel, motion_yrel</a></li>
+</ul>
+</li>
+<li><a href="#button">button</a>
+<ul><li><a href="#button_type">button_type</a></li>
+<li><a href="#button_which">button_which</a></li>
+<li><a href="#button_button">button_button</a></li>
+<li><a href="#button_state">button_state</a></li>
+<li><a href="#button_x_button_y">button_x, button_y</a></li>
+</ul>
+</li>
+<li><a href="#jaxis">jaxis</a>
+<ul><li><a href="#jaxis_type">jaxis_type</a></li>
+<li><a href="#jaxis_which">jaxis_which</a></li>
+<li><a href="#jaxis_axis">jaxis_axis</a></li>
+<li><a href="#jaxis_value">jaxis_value</a></li>
+</ul>
+</li>
+<li><a href="#jbutton">jbutton</a>
+<ul><li><a href="#jbutton_type">jbutton_type</a></li>
+<li><a href="#jbutton_which">jbutton_which</a></li>
+<li><a href="#jbutton_button">jbutton_button</a></li>
+<li><a href="#jbutton_state">jbutton_state</a></li>
+</ul>
+</li>
+<li><a href="#jhat">jhat</a>
+<ul><li><a href="#jhat_type">jhat_type</a></li>
+<li><a href="#jhat_which">jhat_which</a></li>
+<li><a href="#jhat_hat">jhat_hat</a></li>
+<li><a href="#jhat_value">jhat_value</a></li>
+</ul>
+</li>
+<li><a href="#jball">jball</a>
+<ul><li><a href="#jball_type">jball_type</a></li>
+<li><a href="#jball_which">jball_which</a></li>
+<li><a href="#jball_ball">jball_ball</a></li>
+<li><a href="#jball_xrel_jball_yrel">jball_xrel, jball_yrel</a></li>
+</ul>
+</li>
+<li><a href="#resize">resize</a>
+<ul><li><a href="#resize_type">resize_type</a></li>
+<li><a href="#resize_x_resize_y">resize_x, resize_y</a></li>
+</ul>
+</li>
+<li><a href="#expose">expose</a>
+<ul><li><a href="#expose_type">expose_type</a></li>
+</ul>
+</li>
+<li><a href="#syswm">syswm</a>
+<ul><li><a href="#syswm_type">syswm_type</a></li>
+<li><a href="#syswm_msg">syswm_msg</a></li>
+</ul>
+</li>
+<li><a href="#user">user</a>
+<ul><li><a href="#user_type">user_type</a></li>
+<li><a href="#user_code">user_code</a></li>
+<li><a href="#user_data1_user_data2">user_data1, user_data2</a></li>
+</ul>
+</li>
+<li><a href="#quit">quit</a>
+<ul><li><a href="#quit_type">quit_type</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li><a href="#AUTHOR">AUTHOR</a></li>
+<li><a href="#SEE_ALSO">SEE ALSO</a>
+</li>
+</ul><hr />
+<!-- INDEX END -->
+
+<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="NAME_CONTENT">
+<p>SDL::Event - General event 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
+
+ SDL::init(SDL_INIT_VIDEO);
+ my $event = SDL::Event-&gt;new();
+
+ while(1)
+ {
+     pump_events();
+
+     if(poll_event($event))
+     {
+        if($event-&gt;type == SDL_MOUSEBUTTONDOWN)
+        {
+            # now you can handle the details
+            $event-&gt;button_which;
+            $event-&gt;button_button;
+            $event-&gt;button_x;
+            $event-&gt;button_y;
+        }
+
+        last if $event-&gt;type == SDL_QUIT;
+     }
+
+     # your screen drawing code will be here
+ }
+
+</pre>
+
+</div>
+<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="DESCRIPTION_CONTENT">
+<p>Event handling allows your application to receive input from the user. 
+Event handling is initalised (along with video) with a call to:</p>
+<p><code>SDL::init(SDL_INIT_VIDEO);</code></p>
+<p>Internally, SDL stores all the events waiting to be handled in an event queue. 
+Using functions like <code>SDL::Events::poll_event()</code>, <code>SDL::Events::peep_events</code> 
+and <code>SDL::Events::wait_event()</code> you can observe and handle waiting input events.</p>
+<p>The key to event handling in SDL is the <code>SDL::Event</code> union. 
+The event queue itself is composed of a series of <code>SDL::Event</code> unions, one for each waiting event. 
+<code>SDL::Event</code> unions are read from the queue with the <code>SDL::Events::poll_event()</code> function 
+and it is then up to the application to process the information stored with them. </p>
+
+</div>
+<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="METHODS_CONTENT">
+
+</div>
+<h2 id="new">new</h2>
+<div id="new_CONTENT">
+<p><code>new</code> creates an empty event-object, which can be used store information. 
+Either by calling <code>poll_event($event)</code> that transferes one event from the queue into our object 
+or by setting all the needed data manually in order to push the event to the queue.</p>
+<pre> use SDL::Event;
+
+ my $event = SDL::Event-&gt;new();
+
+</pre>
+
+</div>
+<h2 id="type">type</h2>
+<div id="type_CONTENT">
+<p>SDL::Event is a union of all event structures used in SDL, using it is a simple matter of knowing 
+which union member relates to which event <code>type</code>.</p>
+<pre> print 'heureka' if $event-&gt;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>
+</ul>
+
+<p>TODO: SDL_EVENTMASK()</p>
+
+</div>
+<h2 id="active">active</h2>
+<div id="active_CONTENT">
+<p><code>active</code> is a member of the <code>SDL::Event</code> union and is used when an event of type <code>SDL_ACTIVEEVENT</code> is reported.</p>
+<p>When the mouse leaves or enters the window area a <code>SDL_APPMOUSEFOCUS</code> type activation event occurs, 
+if the mouse entered the window then <strong>gain</strong> will be 1, otherwise <strong>gain</strong> will be 0. </p>
+<p>A <code>SDL_APPINPUTFOCUS</code> type activation event occurs when the application loses or gains keyboard focus. 
+This usually occurs when another application is made active. </p>
+<p>Finally, a <code>SDL_APPACTIVE</code> type event occurs when the application is either minimised/iconified (<strong>gain</strong>=0) or restored. </p>
+<p>A single event can have multiple values set in <strong>state</strong>.</p>
+<p><strong>Note:</strong> This event does not occur when an application window is first created. </p>
+<p>A new ActiveEvent (to fake focus loss) will be created like this:</p>
+<pre> my $event = SDL::Event-&gt;new();
+    $event-&gt;type(SDL_ACTIVEEVENT);
+    $event-&gt;active_gain(0);
+    $event-&gt;active_state(SDL_APPMOUSEFOCUS);
+
+ # I think this is wrong, -&gt;active_type() should get SDL_APPMOUSEFOCUS, but what state gets?
+
+</pre>
+
+</div>
+<h3 id="active_type">active_type</h3>
+<div id="active_type_CONTENT">
+
+</div>
+<h3 id="active_gain">active_gain</h3>
+<div id="active_gain_CONTENT">
+
+</div>
+<h3 id="active_state">active_state</h3>
+<div id="active_state_CONTENT">
+
+</div>
+<h2 id="key">key</h2>
+<div id="key_CONTENT">
+
+</div>
+<h3 id="key_type">key_type</h3>
+<div id="key_type_CONTENT">
+
+</div>
+<h3 id="key_state">key_state</h3>
+<div id="key_state_CONTENT">
+
+</div>
+<h3 id="key_keysym">key_keysym</h3>
+<div id="key_keysym_CONTENT">
+
+</div>
+<h3 id="key_scancode">key_scancode</h3>
+<div id="key_scancode_CONTENT">
+
+</div>
+<h3 id="key_sym">key_sym</h3>
+<div id="key_sym_CONTENT">
+
+</div>
+<h3 id="key_mod">key_mod</h3>
+<div id="key_mod_CONTENT">
+
+</div>
+<h3 id="key_unicode">key_unicode</h3>
+<div id="key_unicode_CONTENT">
+
+</div>
+<h2 id="motion">motion</h2>
+<div id="motion_CONTENT">
+
+</div>
+<h3 id="motion_type">motion_type</h3>
+<div id="motion_type_CONTENT">
+
+</div>
+<h3 id="motion_state">motion_state</h3>
+<div id="motion_state_CONTENT">
+
+</div>
+<h3 id="motion_x_motion_y">motion_x, motion_y</h3>
+<div id="motion_x_motion_y_CONTENT">
+
+</div>
+<h3 id="motion_xrel_motion_yrel">motion_xrel, motion_yrel</h3>
+<div id="motion_xrel_motion_yrel_CONTENT">
+
+</div>
+<h2 id="button">button</h2>
+<div id="button_CONTENT">
+
+</div>
+<h3 id="button_type">button_type</h3>
+<div id="button_type_CONTENT">
+
+</div>
+<h3 id="button_which">button_which</h3>
+<div id="button_which_CONTENT">
+
+</div>
+<h3 id="button_button">button_button</h3>
+<div id="button_button_CONTENT">
+
+</div>
+<h3 id="button_state">button_state</h3>
+<div id="button_state_CONTENT">
+
+</div>
+<h3 id="button_x_button_y">button_x, button_y</h3>
+<div id="button_x_button_y_CONTENT">
+
+</div>
+<h2 id="jaxis">jaxis</h2>
+<div id="jaxis_CONTENT">
+
+</div>
+<h3 id="jaxis_type">jaxis_type</h3>
+<div id="jaxis_type_CONTENT">
+
+</div>
+<h3 id="jaxis_which">jaxis_which</h3>
+<div id="jaxis_which_CONTENT">
+
+</div>
+<h3 id="jaxis_axis">jaxis_axis</h3>
+<div id="jaxis_axis_CONTENT">
+
+</div>
+<h3 id="jaxis_value">jaxis_value</h3>
+<div id="jaxis_value_CONTENT">
+
+</div>
+<h2 id="jbutton">jbutton</h2>
+<div id="jbutton_CONTENT">
+
+</div>
+<h3 id="jbutton_type">jbutton_type</h3>
+<div id="jbutton_type_CONTENT">
+
+</div>
+<h3 id="jbutton_which">jbutton_which</h3>
+<div id="jbutton_which_CONTENT">
+
+</div>
+<h3 id="jbutton_button">jbutton_button</h3>
+<div id="jbutton_button_CONTENT">
+
+</div>
+<h3 id="jbutton_state">jbutton_state</h3>
+<div id="jbutton_state_CONTENT">
+
+</div>
+<h2 id="jhat">jhat</h2>
+<div id="jhat_CONTENT">
+
+</div>
+<h3 id="jhat_type">jhat_type</h3>
+<div id="jhat_type_CONTENT">
+
+</div>
+<h3 id="jhat_which">jhat_which</h3>
+<div id="jhat_which_CONTENT">
+
+</div>
+<h3 id="jhat_hat">jhat_hat</h3>
+<div id="jhat_hat_CONTENT">
+
+</div>
+<h3 id="jhat_value">jhat_value</h3>
+<div id="jhat_value_CONTENT">
+
+</div>
+<h2 id="jball">jball</h2>
+<div id="jball_CONTENT">
+
+</div>
+<h3 id="jball_type">jball_type</h3>
+<div id="jball_type_CONTENT">
+
+</div>
+<h3 id="jball_which">jball_which</h3>
+<div id="jball_which_CONTENT">
+
+</div>
+<h3 id="jball_ball">jball_ball</h3>
+<div id="jball_ball_CONTENT">
+
+</div>
+<h3 id="jball_xrel_jball_yrel">jball_xrel, jball_yrel</h3>
+<div id="jball_xrel_jball_yrel_CONTENT">
+
+</div>
+<h2 id="resize">resize</h2>
+<div id="resize_CONTENT">
+
+</div>
+<h3 id="resize_type">resize_type</h3>
+<div id="resize_type_CONTENT">
+
+</div>
+<h3 id="resize_x_resize_y">resize_x, resize_y</h3>
+<div id="resize_x_resize_y_CONTENT">
+
+</div>
+<h2 id="expose">expose</h2>
+<div id="expose_CONTENT">
+
+</div>
+<h3 id="expose_type">expose_type</h3>
+<div id="expose_type_CONTENT">
+
+</div>
+<h2 id="syswm">syswm</h2>
+<div id="syswm_CONTENT">
+
+</div>
+<h3 id="syswm_type">syswm_type</h3>
+<div id="syswm_type_CONTENT">
+
+</div>
+<h3 id="syswm_msg">syswm_msg</h3>
+<div id="syswm_msg_CONTENT">
+
+</div>
+<h2 id="user">user</h2>
+<div id="user_CONTENT">
+
+</div>
+<h3 id="user_type">user_type</h3>
+<div id="user_type_CONTENT">
+
+</div>
+<h3 id="user_code">user_code</h3>
+<div id="user_code_CONTENT">
+
+</div>
+<h3 id="user_data1_user_data2">user_data1, user_data2</h3>
+<div id="user_data1_user_data2_CONTENT">
+
+</div>
+<h2 id="quit">quit</h2>
+<div id="quit_CONTENT">
+
+</div>
+<h3 id="quit_type">quit_type</h3>
+<div id="quit_type_CONTENT">
+<p>Create a new SDL::Event object.</p>
+
+</div>
+<h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="AUTHOR_CONTENT">
+
+</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>
+
+</div>
+</div>
\ No newline at end of file