Permalink
Browse files

Renamed SDLx::Controller::Object to Interface

  • Loading branch information...
1 parent c4cf5b1 commit 532225999b82c166e9d1157d63cb6f8ac9526fd8 @kthakore kthakore committed Sep 1, 2010
View
@@ -174,10 +174,10 @@ my %subsystems = (
},
libraries => [qw( SDL )],
},
- ObjectX => {
+ InterfaceX => {
file => {
- from => 'src/SDLx/Controller/Object.xs',
- to => 'lib/SDLx/Controller/Object.xs',
+ from => 'src/SDLx/Controller/Interface.xs',
+ to => 'lib/SDLx/Controller/Interface.xs',
},
libraries => [qw( SDL )],
},
@@ -1,4 +1,4 @@
-package SDLx::Controller::Object;
+package SDLx::Controller::Interface;
use strict;
use warnings;
@@ -19,11 +19,11 @@ sub new {
push @args, ( $foo{rot} || 0 );
push @args, ( $foo{ang_v} || 0 );
- return SDLx::Controller::Object->make(@args);
+ return SDLx::Controller::Interface->make(@args);
}
internal_load_dlls(__PACKAGE__);
-bootstrap SDLx::Controller::Object;
+bootstrap SDLx::Controller::Interface;
1;
@@ -1,4 +1,4 @@
-// Defines Controller Object structs
+// Defines Controller Interface structs
//
#include "EXTERN.h"
#include "perl.h"
@@ -33,7 +33,7 @@ typedef struct Derivative
} SDLx_Derivative;
-typedef struct SDLx_Object
+typedef struct SDLx_Interface
{
// states to hold
@@ -46,7 +46,7 @@ typedef struct SDLx_Object
SV* interpolate;
SV* integrate;
-} SDLx_Object;
+} SDLx_Interface;
void copy_state( SDLx_State * a, SDLx_State * b )
{
@@ -60,7 +60,7 @@ void copy_state( SDLx_State * a, SDLx_State * b )
}
-void interpolate( SDLx_Object* obj, SDLx_State* out, float alpha )
+void interpolate( SDLx_Interface* obj, SDLx_State* out, float alpha )
{
out->x = obj->current->x * alpha + obj->previous->x * (1 - alpha);
out->y = obj->current->y * alpha + obj->previous->y * (1 - alpha);
@@ -7,16 +7,16 @@
#define aTHX_
#endif
-#include "SDLx/Controller/Object.h"
+#include "SDLx/Controller/Interface.h"
-AV* acceleration_cb( SDLx_Object * obj, float t )
+AV* acceleration_cb( SDLx_Interface * obj, float t )
{
SV* tmpsv;
if( !(SvROK(obj->acceleration) && (tmpsv = obj->acceleration) ) )
{
- croak( "Object doesn't not contain an acceleration callback" );
+ croak( "Interface doesn't not contain an acceleration callback" );
}
@@ -58,7 +58,7 @@ AV* acceleration_cb( SDLx_Object * obj, float t )
return array;
}
-void evaluate(SDLx_Object* obj, SDLx_Derivative* out, SDLx_State* initial, float t)
+void evaluate(SDLx_Interface* obj, SDLx_Derivative* out, SDLx_State* initial, float t)
{
out->dx = initial->v_x;
out->dy = initial->v_y;
@@ -70,7 +70,7 @@ void evaluate(SDLx_Object* obj, SDLx_Derivative* out, SDLx_State* initial, float
}
-void evaluate_dt(SDLx_Object* obj, SDLx_Derivative* out, SDLx_State* initial, float t, float dt, SDLx_Derivative* d)
+void evaluate_dt(SDLx_Interface* obj, SDLx_Derivative* out, SDLx_State* initial, float t, float dt, SDLx_Derivative* d)
{
SDLx_State state;
state.x = initial->x + d->dx*dt;
@@ -91,7 +91,7 @@ void evaluate_dt(SDLx_Object* obj, SDLx_Derivative* out, SDLx_State* initial, fl
out->dang_v = sv_nv(av_pop(accel));
}
-void integrate( SDLx_Object* object, float t, float dt)
+void integrate( SDLx_Interface* object, float t, float dt)
{
SDLx_State* state = object->current;
SDLx_Derivative* a = (SDLx_Derivative *)safemalloc( sizeof(SDLx_Derivative) );
@@ -125,13 +125,13 @@ void integrate( SDLx_Object* object, float t, float dt)
}
-MODULE = SDLx::Controller::Object PACKAGE = SDLx::Controller::Object PREFIX = objx_
+MODULE = SDLx::Controller::Interface PACKAGE = SDLx::Controller::Interface PREFIX = objx_
-SDLx_Object *
+SDLx_Interface *
objx_make( CLASS, ... )
char * CLASS
CODE:
- RETVAL = (SDLx_Object * ) safemalloc( sizeof(SDLx_Object) );
+ RETVAL = (SDLx_Interface * ) safemalloc( sizeof(SDLx_Interface) );
RETVAL->previous = (SDLx_State * ) safemalloc( sizeof(SDLx_State) );
RETVAL->current = (SDLx_State * ) safemalloc( sizeof(SDLx_State) );
RETVAL->acceleration = newSViv(-1);
@@ -165,7 +165,7 @@ objx_make( CLASS, ... )
void
objx_set_acceleration(obj, callback)
- SDLx_Object* obj
+ SDLx_Interface* obj
SV* callback
CODE:
@@ -178,7 +178,7 @@ objx_set_acceleration(obj, callback)
AV*
objx_acceleration(obj, t)
- SDLx_Object* obj
+ SDLx_Interface* obj
float t
CODE:
RETVAL = acceleration_cb(obj, t);
@@ -189,7 +189,7 @@ objx_acceleration(obj, t)
SDLx_State *
objx_interpolate(obj, alpha)
- SDLx_Object* obj
+ SDLx_Interface* obj
float alpha
PREINIT:
char * CLASS = "SDLx::Controller::State";
@@ -203,7 +203,7 @@ objx_interpolate(obj, alpha)
SDLx_State *
objx_current ( obj, ... )
- SDLx_Object *obj
+ SDLx_Interface *obj
PREINIT:
char * CLASS = "SDLx::Controller::State";
CODE:
@@ -213,7 +213,7 @@ objx_current ( obj, ... )
SDLx_State *
objx_previous ( obj, ... )
- SDLx_Object *obj
+ SDLx_Interface *obj
PREINIT:
char * CLASS = "SDLx::Controller::State";
CODE:
@@ -223,7 +223,7 @@ objx_previous ( obj, ... )
void
objx_update(obj, t, dt)
- SDLx_Object* obj
+ SDLx_Interface* obj
float t
float dt
CODE:
@@ -233,7 +233,7 @@ objx_update(obj, t, dt)
void
objx_DESTROY( obj )
- SDLx_Object *obj
+ SDLx_Interface *obj
CODE:
SvREFCNT_dec(obj->acceleration);
safefree(obj->previous);
@@ -7,7 +7,7 @@
#define aTHX_
#endif
-#include "SDLx/Controller/Object.h"
+#include "SDLx/Controller/Interface.h"
MODULE = SDLx::Controller::State PACKAGE = SDLx::Controller::State PREFIX = state_
View
@@ -64,7 +64,7 @@ BEGIN {
SDLx::Surface::TiedMatrixRow
SDLx::Controller
- SDLx::Controller::Object
+ SDLx::Controller::Interface
SDLx::Controller::State
SDLx::Controller::Timer
@@ -3,25 +3,25 @@ use warnings;
use Test::More;
use SDL;
use SDLx::Controller::State;
-use SDLx::Controller::Object;
+use SDLx::Controller::Interface;
use lib 't/lib';
use SDL::TestTool;
use Data::Dumper;
can_ok(
- 'SDLx::Controller::Object',
+ 'SDLx::Controller::Interface',
qw( new ) #meh, put the rest in later
);
TODO: {
local $TODO = 'methods not implemented yet';
- can_ok( 'SDLx::Controller::Object', qw( foo ) );
+ can_ok( 'SDLx::Controller::Interface', qw( foo ) );
}
-my $obj = SDLx::Controller::Object->new( x => 1, y => 2, v_x => 3, v_y => 4, rot => 5, ang_v => 6 );
+my $obj = SDLx::Controller::Interface->new( x => 1, y => 2, v_x => 3, v_y => 4, rot => 5, ang_v => 6 );
-isa_ok( $obj, 'SDLx::Controller::Object' );
+isa_ok( $obj, 'SDLx::Controller::Interface' );
my $s = sub { pass 'ran accel'; return ( 0.0, 10, 19 ) };
$obj->set_acceleration($s);
@@ -55,7 +55,7 @@ is( $hv->x, 1.75 );
is( $hv->y, 3.625 );
is( $hv->rotation, 7.6875 );
-$obj = SDLx::Controller::Object->new( x => 1, y => 2, v_x => 3, v_y => 4, rot => 5, ang_v => 6 );
+$obj = SDLx::Controller::Interface->new( x => 1, y => 2, v_x => 3, v_y => 4, rot => 5, ang_v => 6 );
$obj->set_acceleration( sub { $_[1]->x(2); pass '[state] is mutable'; return ( 0.0, 10, 19 ) } );
View
@@ -57,7 +57,7 @@ SDLPango_Context * O_OBJECT
sdlx_timer * O_OBJECT
SDLx_LayerManager * O_OBJECT
SDLx_Layer * O_OBJECT
-SDLx_Object * O_OBJECT
+SDLx_Interface * O_OBJECT
SDLx_State * O_OBJECT
SDLPango_Alignment T_UV
int * T_PTR

0 comments on commit 5322259

Please sign in to comment.