<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
<li><a href="#METHODS">METHODS</a>
<ul><li><a href="#new">new</a></li>
-<li><a href="#title">title</a></li>
-<li><a href="#delay">delay</a></li>
+</ul>
+</li>
+<li><a href="#METHODS-2">METHODS</a>
+<ul><li><a href="#title">title()</a></li>
+<li><a href="#title_new_title">title( $new_title )</a></li>
+<li><a href="#title_window_title_icon_title">title( $window_title, $icon_title )</a></li>
+<li><a href="#delay_ms">delay( $ms )</a></li>
<li><a href="#ticks">ticks</a></li>
<li><a href="#error">error</a></li>
-<li><a href="#resize">resize</a></li>
+<li><a href="#resize_width_height">resize( $width, $height )</a></li>
<li><a href="#fullscreen">fullscreen</a></li>
<li><a href="#iconify">iconify</a></li>
-<li><a href="#grab_input">grab_input</a></li>
-<li><a href="#loop">loop</a></li>
+<li><a href="#grab_input_CONSTANT">grab_input( $CONSTANT )</a></li>
<li><a href="#sync">sync</a></li>
-<li><a href="#attribute_attr_value">attribute ( attr, [value] )</a></li>
+<li><a href="#attribute_attr">attribute( $attr )</a></li>
+<li><a href="#attribute_attr_value">attribute( $attr, $value )</a></li>
</ul>
</li>
-<li><a href="#AUTHOR">AUTHOR</a></li>
+<li><a href="#CALLBACKS">CALLBACKS</a></li>
+<li><a href="#AUTHORS">AUTHORS</a></li>
<li><a href="#SEE_ALSO">SEE ALSO</a>
</li>
</ul><hr />
use SDL::Events;
my $app = SDLx::App->new(
- -title => 'Application Title',
- -width => 640,
- -height => 480,
- -depth => 32
+ title => 'Application Title',
+ width => 640,
+ height => 480,
+ depth => 32
);
</pre>
-<p>This is the manual way of doing things </p>
+<p>This is the manual way of doing things</p>
<pre> my $event = SDL::Event->new; # create a new event
SDL::Events::pump_events();
}
</pre>
-<p>An alternative to the manual Event processing is the <a href="http://search.cpan.org/perldoc?SDLx::App::loop">SDLx::App::loop</a> .</p>
+<p>An alternative to the manual Event processing is through the <a href="http://search.cpan.org/perldoc?SDLx::Controller">SDLx::Controller</a> module. <a href="http://search.cpan.org/perldoc?SDLx::App">SDLx::App</a> is a Controller so see the CALLBACKS section below.</p>
</div>
<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
<p><code>SDLx::App::new</code> initializes the SDL, creates a new screen,
and initializes some of the window manager properties.
<code>SDLx::App::new</code> takes a series of named parameters:</p>
-<ul>
- <li>-title </li>
- <li>-icon_title </li>
- <li>-icon </li>
- <li>-width </li>
- <li>-height </li>
- <li>-depth </li>
- <li>-flags </li>
- <li>-resizeable</li>
-</ul>
+<dl>
+ <dt>* title
+the window title. Defaults to the file name. Shorter alias: 't'</dt>
+ <dt>* icon_title
+the icon title. Defaults to file name. Shortcut: 'it'</dt>
+ <dt>* icon
+the icon itself. Defaults to none. Shortcut: 'i'</dt>
+ <dt>* width
+Window width, in pixels. Defaults to 800. Shortcut: 'w'</dt>
+ <dt>* height
+Window height, in pixels. Defaults to 600. Shortcut: 'h'</dt>
+ <dt>* depth
+Screen depth. Defaults to 16. Shortcut: 'd'.</dt>
+ <dt>* flags
+Any flags you want to pass to <a href="SDL-Video.html">SDL::Video</a> upon initialization. Defaults to SDL_ANYFORMAT. Flags should be <i>or'ed</i> together if you're passing more than one (flags => FOO|BAR). Shortcut: 'f'.</dt>
+ <dt>* resizeable
+Set this to a true value to make the window resizeable by the user. Default is off.</dt>
+</dl>
+</div>
+<h1 id="METHODS-2">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="METHODS_CONTENT-2">
</div>
-<h2 id="title">title</h2>
+<h2 id="title">title()</h2>
<div id="title_CONTENT">
-<p><code>SDLx::App::title</code> takes 0, 1, or 2 arguments. It returns the current
-application window title. If one parameter is passed, both the window
-title and icon title will be set to its value. If two parameters are
-passed the window title will be set to the first, and the icon title
-to the second.</p>
</div>
-<h2 id="delay">delay</h2>
-<div id="delay_CONTENT">
+<h2 id="title_new_title">title( $new_title )</h2>
+<div id="title_new_title_CONTENT">
+
+</div>
+<h2 id="title_window_title_icon_title">title( $window_title, $icon_title )</h2>
+<div id="title_window_title_icon_title_CONTEN">
+<p><code>SDLx::App::title</code> takes 0, 1, or 2 arguments. If no parameter is given,
+it returns the current application window title. If one parameter is
+passed, both the window title and icon title will be set to its value.
+If two parameters are passed the window title will be set to the first,
+and the icon title to the second.</p>
+
+</div>
+<h2 id="delay_ms">delay( $ms )</h2>
+<div id="delay_ms_CONTENT">
<p><code>SDLx::App::delay</code> takes 1 argument, and will sleep the application for
that many ms.</p>
<p><code>SDLx::App::error</code> returns the last error message set by the SDL.</p>
</div>
-<h2 id="resize">resize</h2>
-<div id="resize_CONTENT">
-<p><code>SDLx::App::resize</code> takes a new height and width of the application
-if the application was originally created with the -resizable option.</p>
+<h2 id="resize_width_height">resize( $width, $height )</h2>
+<div id="resize_width_height_CONTENT">
+<p><code>SDLx::App::resize</code> takes a new width and height of the application. Only
+works if the application was originally created with the resizable option.</p>
</div>
<h2 id="fullscreen">fullscreen</h2>
</div>
<h2 id="iconify">iconify</h2>
<div id="iconify_CONTENT">
-<p><code>SDLx::App::iconify</code> iconifies the applicaiton window.</p>
+<p><code>SDLx::App::iconify</code> iconifies the application window.</p>
</div>
-<h2 id="grab_input">grab_input</h2>
-<div id="grab_input_CONTENT">
+<h2 id="grab_input_CONSTANT">grab_input( $CONSTANT )</h2>
+<div id="grab_input_CONSTANT_CONTENT">
<p><code>SDLx::App::grab_input</code> can be used to change the input focus behavior of
-the application. It takes one argument, which should be one of the following:</p>
+the application. It takes one argument, which should be one of the following:</p>
<dl>
- <dt>*
-SDL_GRAB_QUERY</dt>
- <dt>*
-SDL_GRAB_ON</dt>
- <dt>*
-SDL_GRAB_OFF</dt>
+ <dt>* SDL_GRAB_QUERY</dt>
+ <dt>* SDL_GRAB_ON</dt>
+ <dt>* SDL_GRAB_OFF</dt>
</dl>
</div>
-<h2 id="loop">loop</h2>
-<div id="loop_CONTENT">
-<p><code>SDLx::App::loop</code> is a simple event loop method which takes a reference to a hash
-of event handler subroutines. The keys of the hash must be SDL event types such
-as SDL_QUIT(), SDL_KEYDOWN(), and the like. The event method recieves as its parameter
-the event object used in the loop.</p>
-<p>Example:</p>
-<pre> my $app = SDLx::App->new(
- -title => "test.app",
- -width => 800,
- -height => 600,
- -depth => 32
- );
-
- my %actions = (
- SDL_QUIT() => sub { exit(0); },
- SDL_KEYDOWN() => sub { print "Key Pressed" },
- );
-
- $app->loop( \%actions );
-
-</pre>
-
-</div>
<h2 id="sync">sync</h2>
<div id="sync_CONTENT">
<p><code>SDLx::App::sync</code> encapsulates the various methods of syncronizing the screen with the
-current video buffer. <code>SDLx::App::sync</code> will do a fullscreen update, using the double buffer
-or OpenGL buffer if applicable. This is prefered to calling flip on the application window.</p>
+current video buffer. <code>SDLx::App::sync</code> will do a fullscreen update, using the double buffer
+or OpenGL buffer if applicable. This is prefered to calling flip on the application window.</p>
+
+</div>
+<h2 id="attribute_attr">attribute( $attr )</h2>
+<div id="attribute_attr_CONTENT">
</div>
-<h2 id="attribute_attr_value">attribute ( attr, [value] )</h2>
+<h2 id="attribute_attr_value">attribute( $attr, $value )</h2>
<div id="attribute_attr_value_CONTENT">
-<p><code>SDLx::App::attribute</code> allows one to set and get GL attributes. By passing a value
-in addition to the attribute selector, the value will be set. <code>SDL:::App::attribute</code>
-always returns the current value of the given attribute, or croaks on failure.</p>
+<p><code>SDLx::App::attribute</code> allows one to get and set GL attributes. By passing a value
+in addition to the attribute selector, the value will be set. <code>SDL:::App::attribute</code>
+always returns the current value of the given attribute, or Carp::confesss on failure.</p>
+
+</div>
+<h1 id="CALLBACKS">CALLBACKS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="CALLBACKS_CONTENT">
+<p><code>SDLx::App</code> is a <code>SDLx::Controller</code>. Use the event, show and handlers to run the app.</p>
+<pre> use SDL;
+ use SDLx::App;
+
+ use SDL::Event; #Where ever the event call back is processed
+
+ my $app = SDLx::App->new( width => 200, height => 200);
+
+ $app->add_event_handler( sub{ return 0 if $_[0]->type == SDL_QUIT; return 1});
+
+ $app->add_show_handler( sub{ $app->update() } );
+
+ $app->add_move_handler(
+ sub{
+ #calc your physics here
+ } );
+
+ $app->run();
+
+</pre>
+<p>see <a href="http://search.cpan.org/perldoc?SDLx::Controller">SDLx::Controller</a> for more details.</p>
</div>
-<h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p>
-<div id="AUTHOR_CONTENT">
-<p>David J. Goehrig
-Kartik Thakore</p>
+<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>