X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSDL%2FEvent.pm;h=baa1801370924648309c45bd505fbd890a6442f1;hb=896b04ee008898e1c1edbdd432bedaa8643400dc;hp=ad37ae49803e8a1eccf58f36e79334bd25aaab4e;hpb=b3cdeb39a431b026168c4060bf74001fcee07493;p=sdlgit%2FSDL_perl.git diff --git a/lib/SDL/Event.pm b/lib/SDL/Event.pm index ad37ae4..baa1801 100644 --- a/lib/SDL/Event.pm +++ b/lib/SDL/Event.pm @@ -192,185 +192,3 @@ sub resize_h { } 1; - -__END__; - -=pod - -=head1 NAME - -SDL::Event - a SDL perl extension - -=head1 SYNOPSIS - - use SDL::Event; - my $event = new SDL::Event; # create a new event - $event->pump(); # pump all events from SDL Event Queue - $event->poll(); # Get the top one from the queue - while ($event->wait()) { - my $type = $event->type(); # get event type - # ... handle event - exit if $type == SDL_QUIT; - } - -=head1 DESCRIPTION - -C offers an object-oriented approach to SDL events. By creating -an instance of SDL::Event via new() you can wait for events, and then determine -the type of the event and take an appropriate action. - -=head1 EXAMPLE - -Here is an example of a simple event handler loop routine. -See also L. - - sub loop { - my ($self,$href) = @_; - my $event = new SDL::Event; - while ( $event->wait() ) { - # ... insert here your event handling like: - if ( ref($$href{$event->type()}) eq "CODE" ) { - &{$$href{$event->type()}}($event); - $self->sync(); - } - } - } - -=head1 METHODS - -=head2 new() - -Create a new event object.It returns a SDL::Event. - -=head2 type() - -Returns the type of the event, see list of exported symbols for which are -available. - -=head2 pump() - -SDL::Events::pump gathers all the pending input information from devices and places -it on the event queue. -Without calls to pump no events would ever be placed on the queue. -Often the need for calls to pump is hidden from the user -since C and C. -As this function implicitly calls C, you can only call this function in the thread that set the video mode. -it take a SDL::Event as first parameter. - -=head2 wait(event) - -Waits indefinitely for the next available event, returning undef if there was an error while waiting for events, -a L< SDL::Event> otherwise. -If event is not NULL, the next event is removed. -As this function implicitly calls L, you can only call this function in the thread that set the video mode. -WaitEvent take a SDL::Event as first parameter. - -=head2 set( type, state ) - -Set the state for all events of the given event's type - -=head2 set_unicode( toggle ) - -Toggle unicode on the event. - -=head2 set_key_repeat( delay, interval) - -Sets the delay and intervall of the key repeat rate (e.g. when a user -holds down a key on the keyboard). - -=head2 active_gain(event) - -active_gain return the active gain from the SDL::Event given as first parameter. - -=head2 active_state(event) - -active_state return the active state from the SDL::Event given as first parameter. - -=head2 key_state(event) - -key_state return the active key state from the SDL::Event given as first parameter. - - -=head2 key_sym(key) - -key_sym return the key pressed/released information from the SDL::Event given as first parameter. - -=head2 get_key_name(key) - -get_key_name get the name of an SDL virtual keysym. -it returns the key name. - -=head2 key_mod(event) - -key_mod return the mod keys pressed information from the SDL::Event given as first parameter. - -=head2 key_unicode(event) - -key_unicode return the unicode translated keys pressed/released information from the SDL::Event given as first parameter. - -=head2 key_scancode(event) * to move in SDL::Game::Keyboard - -key_scancode return the hardware specific keyboard scan code from the SDL::Event given as first parameter. - -=head2 motion_state(event) * to move in SDL::Game::Mouse - -motion_state return the state of the mouse button from the SDL::Event given as first parameter. - -=head2 motion_x(event) * to move in SDL::Game::Mouse - -Returns the motion of the mouse in X direction as an absolute value. -It take a SDL::Event as first parameter. - -=head2 motion_y(event) * to move in SDL::Game::Mouse - -Returns the motion of the mouse in Y direction as an absolute value. -It take a SDL::Event as first parameter. - -=head2 motion_xrel(event) * to move in SDL::Game::Mouse - -Returns the motion of the mouse in X direction as a relative value. -It take a SDL::Event as first parameter. - -=head2 motion_yrel(event) * to move in SDL::Game::Mouse - -Returns the motion of the mouse in Y direction as a relative value. -It take a SDL::Event as first parameter. - -=head2 button_state(event) * to move in SDL::Game::Mouse - -Returns the state of the mouse buttons. -It take a SDL::Event as first parameter. - -=head2 button_x(event) * to move in SDL::Game::Mouse - -Return the X position of the mouse at keypress.it take a SDL::Event as first parameter. - -=head2 button_y(event) * to move in SDL::Game::Mouse - -Return the Y position of the mouse at keypress.it take a SDL::Event as first parameter. - -=head2 button(event) * to move in SDL::Game::Mouse - -Return the mouse button index (SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT, SDL_BUTTON_WHEELUP, SDL_BUTTON_WHEELDOWN) - -=head1 AUTHOR - -David J. Goehrig -Documentation by Tels - -=head1 SEE ALSO - -L L - -=cut