Skip to content

Commit

Permalink
Added more docs for interface
Browse files Browse the repository at this point in the history
  • Loading branch information
kthakore committed Sep 11, 2010
1 parent 3934503 commit 034c105
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions lib/pods/SDLx/Controller/Interface.pod
Expand Up @@ -49,22 +49,68 @@ Core, Extension


=head2 set_acceleration =head2 set_acceleration


Allows you to set the acceleration callback for defining the inferface's behaviour in terms of x,y and rotation.

$interface->set_acceleration (
sub {
my ($time, $current_state) = @_;

return ( $acc_x, $acc_y, $torque );
}
);

These accelerations are arbitary and can be set to any frame of reference. Your render callback will handle how to
interpert it.

The callback will recieve the time and the current state as a C<SDLx::Controller::State>.

=head2 attach =head2 attach


Attaches the interface to a controller with a render callback

$interface->attach( $controller, $render, @params );

Where $render is a callback that recieves the interpolated C<SDLx::Controller::State>.

my $render = sub {
my ($state) = shift; my @params = @_;
#draw the current $state.
};

The @params are any extra parameters you would like to pass to the $render callback.

=head2 current =head2 current


my $current_state = $interface->current();

Returns the current state of the interface as a C<SDLx::Controller::State>.

=head2 previous =head2 previous


my $previous_state = $interface->previous();

Returns the previous state of the interface as a C<SDLx::Controller::State>.

=head1 OTHER METHODS =head1 OTHER METHODS


Don't use these unless you really really want to.

=head2 acceleration =head2 acceleration


Call the acceleration callback once.

=head2 interpolate =head2 interpolate


Interpolate the current state

=head2 evaluate =head2 evaluate


Evaluate the new currrent and previous state.

=head2 update =head2 update


Update the states by integrating with time.

=head1 AUTHORS =head1 AUTHORS


See L<SDL/AUTHORS>. See L<SDL/AUTHORS>.
Expand Down

0 comments on commit 034c105

Please sign in to comment.