Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added more docs for interface

  • Loading branch information...
commit 034c105d40627311dc4d8f22755fac3bf5f4ef97 1 parent 3934503
@kthakore kthakore authored
Showing with 46 additions and 0 deletions.
  1. +46 −0 lib/pods/SDLx/Controller/Interface.pod
46 lib/pods/SDLx/Controller/Interface.pod
@@ -49,22 +49,68 @@ Core, Extension
=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
+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
+ my $current_state = $interface->current();
+Returns the current state of the interface as a C<SDLx::Controller::State>.
=head2 previous
+ my $previous_state = $interface->previous();
+Returns the previous state of the interface as a C<SDLx::Controller::State>.
+Don't use these unless you really really want to.
=head2 acceleration
+Call the acceleration callback once.
=head2 interpolate
+Interpolate the current state
=head2 evaluate
+Evaluate the new currrent and previous state.
=head2 update
+Update the states by integrating with time.
=head1 AUTHORS
Please sign in to comment.
Something went wrong with that request. Please try again.