test includes
[sdlgit/SDL-Site.git] / pages / SDL-Events.html-inc
diff --git a/pages/SDL-Events.html-inc b/pages/SDL-Events.html-inc
new file mode 100644 (file)
index 0000000..b51f9fd
--- /dev/null
@@ -0,0 +1,161 @@
+<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="#pump_events">pump_events</a></li>
+<li><a href="#peep_events_event_num_events_action_">peep_events (event, num_events, action, mask) </a>
+<ul><li><a href="#RETURN">RETURN</a></li>
+</ul>
+</li>
+<li><a href="#poll_event_event">poll_event($event)</a>
+<ul><li><a href="#RETURN-2">RETURN</a></li>
+</ul>
+</li>
+<li><a href="#push_event_event">push_event($event)</a>
+<ul><li><a href="#RETURN-3">RETURN</a></li>
+</ul>
+</li>
+<li><a href="#wait_event_event">wait_event($event)</a>
+<ul><li><a href="#RETURN-4">RETURN</a></li>
+</ul>
+</li>
+</ul>
+</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::Events - Bindings to the Events Category in SDL API</p>
+
+</div>
+<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="SYNOPSIS_CONTENT">
+<p>Most likely you just want to know how to get events for you app.
+  use SDL;
+  use SDL::Event;
+  use SDL::Events;</p>
+<pre>  SDL::init(SDL_INIT_VIDEO); # Event can only be grabbed in the same thread as this 
+
+  ...
+
+  my $event = SDL::Event-&gt;new(); # notices 'Event' ne 'Events'
+
+  while( 1 )
+       {
+          SDL::Events::pump_events();   
+                while(  SDL::Events::poll_event($event) )
+        {
+               #check by event type
+               on_active() if $event-&gt;type == SDL_ACTIVEEVENT; 
+               ...
+        }
+       }
+
+</pre>
+
+</div>
+<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="DESCRIPTION_CONTENT">
+
+
+
+
+
+</div>
+<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="METHODS_CONTENT">
+
+</div>
+<h2 id="pump_events">pump_events</h2>
+<div id="pump_events_CONTENT">
+<p>Pumps the event loop, gathering events from the input devices.</p>
+<pre>  pump_events();
+
+</pre>
+<p>pump_events gathers all the pending input information from devices and places it on the event queue. Without calls to pump_events no events would ever be placed on the queue. 
+Often the need for calls to pump_events is hidden from the user since <cite>poll_event</cite> and <cite>wait_event</cite> implicitly call pump_events. 
+However, if you are not polling or waiting for events (e.g. you are filtering them), then you must call pump_events to force an event queue update.</p>
+
+
+
+
+
+</div>
+<h2 id="peep_events_event_num_events_action_">peep_events (event, num_events, action, mask) </h2>
+<div id="peep_events_event_num_events_action_-2">
+<p>Checks the event queue for messages and optionally returns them.  </p>
+<pre>  my $num_peep_events = SDL::Events::peep_events($event, 127, SDL_PEEKEVENT, SDL_ALLEVENTS);
+
+</pre>
+<p>If action is SDL_ADDEVENT, up to numevents events will be added to the back of the event queue.</p>
+<p>If action is SDL_PEEKEVENT, up to numevents events at the front of the event queue, matching mask, will be returned and will not be removed from the queue.</p>
+<p>If action is SDL_GETEVENT, up to numevents events at the front of the event queue, matching mask, will be returned and will be removed from the queue.</p>
+<p>The mask parameter is a bitwise OR of SDL::Events::SDL_EVENTMASK(event_type), for all event types you are interested in</p>
+<p>This function is thread-safe.</p>
+<p>You may have to call pump_events before calling this function. Otherwise, the events may not be ready to be filtered when you call peep_events.</p>
+<p>Examples of mask:</p>
+<dl>
+       <dt>SDL_EVENTMASK (SDL_KEYUP)</dt>
+       <dt>(SDL_EVENTMASK (SDL_MOUSEBUTTONDOWN) | SDL_EVENTMASK (SDL_MOUSEBUTTONUP))</dt>
+       <dt>SDL_ALLEVENTS</dt>
+       <dt>SDL_KEYUPMASK</dt>
+       <dt>SDL_ALLEVENTS ^ SDL_QUITMASK</dt>
+</dl>
+
+</div>
+<h3 id="RETURN">RETURN</h3>
+<div id="RETURN_CONTENT">
+<p>Number of Events actually stored or -1 if there was an error</p>
+
+</div>
+<h2 id="poll_event_event">poll_event($event)</h2>
+<div id="poll_event_event_CONTENT">
+<p>Polls for currently pending events. </p>
+<p>If $event is not NULL, the next event is removed from the queue and stored in the <cite>SDL::Event</cite> structure pointed to by $event.</p>
+<p>As this function implicitly calls pump_events, you can only call this function in the thread that set the video mode with <cite>SDL::Video::set_video_mode</cite>. </p>
+
+</div>
+<h3 id="RETURN-2">RETURN</h3>
+<div id="RETURN_CONTENT-2">
+<p>Returns 1 if there are any pending events, or 0 if there are none available. </p>
+
+</div>
+<h2 id="push_event_event">push_event($event)</h2>
+<div id="push_event_event_CONTENT">
+<p>Pushes an event onto the event queue </p>
+<p>The event queue can actually be used as a two way communication channel. Not only can events be read from the queue, but the user can also push their own events onto it. event is a pointer to the event structure you wish to push onto the queue. 
+The event is copied into the queue, and the caller may dispose of the memory pointed to after push_event returns.</p>
+<p>Note: Pushing device input events onto the queue doesn't modify the state of the device within SDL. </p>
+<p>This function is thread safe, and can be called from other threads safely.</p>
+
+</div>
+<h3 id="RETURN-3">RETURN</h3>
+<div id="RETURN_CONTENT-3">
+<p>Returns 0 on success or -1 if the event couldn't be pushed.</p>
+
+</div>
+<h2 id="wait_event_event">wait_event($event)</h2>
+<div id="wait_event_event_CONTENT">
+<p>Waits indefinitely for the next available $event, returning 0 if there was an error while waiting for events, 1 otherwise.</p>
+<p>If $event is not NULL, the next event is removed from the queue and stored in $event.</p>
+<p>As this function implicitly calls SDL_PumpEvents, you can only call this function in the thread that  <cite>SDL::Video::set_video_mode</cite>.  </p>
+
+</div>
+<h3 id="RETURN-4">RETURN</h3>
+<div id="RETURN_CONTENT-4">
+<p>0 if there was an error while waiting for events, 1 otherwise</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>SDL::Event</cite>, <cite>SDL::Video</cite></p>
+
+</div>
+</div>
\ No newline at end of file