X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDLx-App.html-inc;h=ca61336f28932d06fbbaa4afc879c4de4dbd07d3;hb=d5943b684b1240307fbf0a103abbf18dd93998f4;hp=23e5cd32140330615901b5dbcf7b274b07b98aef;hpb=ca0a3441dd72000cbbbb4be484b18d0d305fdb29;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDLx-App.html-inc b/pages/SDLx-App.html-inc index 23e5cd3..ca61336 100644 --- a/pages/SDLx-App.html-inc +++ b/pages/SDLx-App.html-inc @@ -8,20 +8,23 @@
  • DESCRIPTION
  • METHODS
  • -
  • AUTHOR
  • +
  • AUTHORS
  • SEE ALSO

  • @@ -45,14 +48,14 @@ 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 ); -

    This is the manual way of doing things

    +

    This is the manual way of doing things

        my $event = SDL::Event->new; # create a new event 
     
         SDL::Events::pump_events();
    @@ -64,7 +67,7 @@
         }
     
     
    -

    An alternative to the manual Event processing is the SDLx::App::loop .

    +

    An alternative to the manual Event processing is the SDLx::App::loop.

    DESCRIPTION

    Top

    @@ -83,30 +86,49 @@ manager oriented functions.

    SDLx::App::new initializes the SDL, creates a new screen, and initializes some of the window manager properties. SDLx::App::new takes a series of named parameters:

    - +
    +
    * title +the window title. Defaults to the file name. Shorter alias: 't'
    +
    * icon_title +the icon title. Defaults to file name. Shortcut: 'it'
    +
    * icon +the icon itself. Defaults to none. Shortcut: 'i'
    +
    * width +Window width, in pixels. Defaults to 800. Shortcut: 'w'
    +
    * height +Window height, in pixels. Defaults to 600. Shortcut: 'h'
    +
    * depth +Screen depth. Defaults to 16. Shortcut: 'd'.
    +
    * flags +Any flags you want to pass to SDL::Video upon initialization. Defaults to SDL_ANYFORMAT. Flags should be or'ed together if you're passing more than one (flags => FOO|BAR). Shortcut: 'f'.
    +
    * resizeable +Set this to a true value to make the window resizeable by the user. Default is off.
    +
    + + + -

    title

    +

    title()

    -

    SDLx::App::title 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.

    -

    delay

    -
    +

    title( $new_title )

    +
    + +
    +

    title( $window_title, $icon_title )

    +
    +

    SDLx::App::title 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.

    + +
    +

    delay( $ms )

    +

    SDLx::App::delay takes 1 argument, and will sleep the application for that many ms.

    @@ -121,10 +143,10 @@ that many ms.

    SDLx::App::error returns the last error message set by the SDL.

    -

    resize

    -
    -

    SDLx::App::resize takes a new height and width of the application -if the application was originally created with the -resizable option.

    +

    resize( $width, $height )

    +
    +

    SDLx::App::resize takes a new width and height of the application. Only +works if the application was originally created with the resizable option.

    fullscreen

    @@ -134,35 +156,32 @@ if the application was originally created with the -resizable option.

    iconify

    -

    SDLx::App::iconify iconifies the applicaiton window.

    +

    SDLx::App::iconify iconifies the application window.

    -

    grab_input

    -
    +

    grab_input( $CONSTANT )

    +

    SDLx::App::grab_input can be used to change the input focus behavior of -the application. It takes one argument, which should be one of the following:

    +the application. It takes one argument, which should be one of the following:

    -
    * -SDL_GRAB_QUERY
    -
    * -SDL_GRAB_ON
    -
    * -SDL_GRAB_OFF
    +
    * SDL_GRAB_QUERY
    +
    * SDL_GRAB_ON
    +
    * SDL_GRAB_OFF
    -

    loop

    -
    +

    loop( \%actions )

    +

    SDLx::App::loop 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.

    +of event handler subroutines. The keys of the hash must be SDL event types such +as SDL_QUIT(), SDL_KEYDOWN(), and the like. When called, the event method recieves +as its parameter the event object used in the loop.

    Example:

        my $app = SDLx::App->new(
    -        -title  => "test.app", 
    -        -width  => 800, 
    -        -height => 600, 
    -        -depth  => 32
    +        title  => "test.app", 
    +        width  => 800, 
    +        height => 600, 
    +        depth  => 32
         );
     
         my %actions = (
    @@ -178,21 +197,24 @@ the event object used in the loop.

    sync

    SDLx::App::sync encapsulates the various methods of syncronizing the screen with the -current video buffer. SDLx::App::sync will do a fullscreen update, using the double buffer -or OpenGL buffer if applicable. This is prefered to calling flip on the application window.

    +current video buffer. SDLx::App::sync will do a fullscreen update, using the double buffer +or OpenGL buffer if applicable. This is prefered to calling flip on the application window.

    + +
    +

    attribute( $attr )

    +
    -

    attribute ( attr, [value] )

    +

    attribute( $attr, $value )

    -

    SDLx::App::attribute allows one to set and get GL attributes. By passing a value -in addition to the attribute selector, the value will be set. SDL:::App::attribute +

    SDLx::App::attribute allows one to get and set GL attributes. By passing a value +in addition to the attribute selector, the value will be set. SDL:::App::attribute always returns the current value of the given attribute, or croaks on failure.

    -

    AUTHOR

    Top

    -
    -

    David J. Goehrig -Kartik Thakore

    +

    AUTHORS

    Top

    +
    +

    See AUTHORS in SDL.

    SEE ALSO

    Top