Permalink
Browse files

Added Joystick XS, Added surface tests. Need a joystick to test the r…

…est so leaving them as TODO
  • Loading branch information...
1 parent d70f48a commit f104313f0f70ebb307b7cb8c7c6f6d77391fd669 @kthakore kthakore committed Nov 17, 2009
Showing with 183 additions and 244 deletions.
  1. +7 −0 Build.PL
  2. +9 −0 lib/SDL/Joystick.pm
  3. +138 −0 src/Core/Joystick.xs
  4. +0 −227 src/SDL.xs
  5. +1 −0 t/00-load.t
  6. +27 −16 t/core_joystick.t
  7. +1 −1 typemap
View
@@ -161,6 +161,13 @@ my %subsystems =
},
libraries => [qw( SDL )],
},
+ Joystick => {
+ file => {
+ from => 'src/Core/Joystick.xs',
+ to => 'lib/SDL/Joystick.xs',
+ },
+ libraries => [qw( SDL )],
+ },
TTF_Font => {
file => {
View
@@ -0,0 +1,9 @@
+package SDL::Joystick;
+use strict;
+use warnings;
+require Exporter;
+require DynaLoader;
+our @ISA = qw(Exporter DynaLoader);
+bootstrap SDL::Joystick;
+
+1;
View
@@ -0,0 +1,138 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#ifndef aTHX_
+#define aTHX_
+#endif
+
+#include <SDL.h>
+
+MODULE = SDL::Joystick PACKAGE = SDL::Joystick PREFIX = joystick_
+
+SDL_Joystick *
+joystick_new (CLASS, index )
+ char* CLASS
+ int index
+ CODE:
+ RETVAL = SDL_JoystickOpen(index);
+ OUTPUT:
+ RETVAL
+
+
+int
+joystick_num_joysticks ()
+ CODE:
+ RETVAL = SDL_NumJoysticks();
+ OUTPUT:
+ RETVAL
+
+char *
+joystick_name ( index )
+ int index
+ CODE:
+ RETVAL = (char*)SDL_JoystickName(index);
+ OUTPUT:
+ RETVAL
+
+int
+joystick_opened ( index )
+ int index
+ CODE:
+ RETVAL = SDL_JoystickOpened(index);
+ OUTPUT:
+ RETVAL
+
+int
+joystick_index ( joystick )
+ SDL_Joystick *joystick
+ CODE:
+ RETVAL = SDL_JoystickIndex(joystick);
+ OUTPUT:
+ RETVAL
+
+int
+joystick_num_axes ( joystick )
+ SDL_Joystick *joystick
+ CODE:
+ RETVAL = SDL_JoystickNumAxes(joystick);
+ OUTPUT:
+ RETVAL
+
+int
+joystick_num_balls ( joystick )
+ SDL_Joystick *joystick
+ CODE:
+ RETVAL = SDL_JoystickNumBalls(joystick);
+ OUTPUT:
+ RETVAL
+
+int
+joystick_num_hats ( joystick )
+ SDL_Joystick *joystick
+ CODE:
+ RETVAL = SDL_JoystickNumHats(joystick);
+ OUTPUT:
+ RETVAL
+
+int
+joystick_num_buttons ( joystick )
+ SDL_Joystick *joystick
+ CODE:
+ RETVAL = SDL_JoystickNumButtons(joystick);
+ OUTPUT:
+ RETVAL
+
+void
+joystick_update ()
+ CODE:
+ SDL_JoystickUpdate();
+
+Sint16
+joystick_get_axis ( joystick, axis )
+ SDL_Joystick *joystick
+ int axis
+ CODE:
+ RETVAL = SDL_JoystickGetAxis(joystick,axis);
+ OUTPUT:
+ RETVAL
+
+Uint8
+joystick_get_hat ( joystick, hat )
+ SDL_Joystick *joystick
+ int hat
+ CODE:
+ RETVAL = SDL_JoystickGetHat(joystick,hat);
+ OUTPUT:
+ RETVAL
+
+Uint8
+joystick_get_button ( joystick, button)
+ SDL_Joystick *joystick
+ int button
+ CODE:
+ RETVAL = SDL_JoystickGetButton(joystick,button);
+ OUTPUT:
+ RETVAL
+
+AV *
+joystick_get_ball ( joystick, ball )
+ SDL_Joystick *joystick
+ int ball
+ CODE:
+ int success,dx,dy;
+ success = SDL_JoystickGetBall(joystick,ball,&dx,&dy);
+ RETVAL = newAV();
+ RETVAL = sv_2mortal((SV*)RETVAL);
+ av_push(RETVAL,newSViv(success));
+ av_push(RETVAL,newSViv(dx));
+ av_push(RETVAL,newSViv(dy));
+ OUTPUT:
+ RETVAL
+
+void
+joystick_DESTROY ( joystick )
+ SDL_Joystick *joystick
+ CODE:
+ SDL_JoystickClose(joystick);
+
View
@@ -1182,233 +1182,6 @@ BigEndian ()
OUTPUT:
RETVAL
-int
-NumJoysticks ()
- CODE:
- RETVAL = SDL_NumJoysticks();
- OUTPUT:
- RETVAL
-
-char *
-JoystickName ( index )
- int index
- CODE:
- RETVAL = (char*)SDL_JoystickName(index);
- OUTPUT:
- RETVAL
-
-SDL_Joystick *
-JoystickOpen ( index )
- int index
- CODE:
- RETVAL = SDL_JoystickOpen(index);
- OUTPUT:
- RETVAL
-
-int
-JoystickOpened ( index )
- int index
- CODE:
- RETVAL = SDL_JoystickOpened(index);
- OUTPUT:
- RETVAL
-
-int
-JoystickIndex ( joystick )
- SDL_Joystick *joystick
- CODE:
- RETVAL = SDL_JoystickIndex(joystick);
- OUTPUT:
- RETVAL
-
-int
-JoystickNumAxes ( joystick )
- SDL_Joystick *joystick
- CODE:
- RETVAL = SDL_JoystickNumAxes(joystick);
- OUTPUT:
- RETVAL
-
-int
-JoystickNumBalls ( joystick )
- SDL_Joystick *joystick
- CODE:
- RETVAL = SDL_JoystickNumBalls(joystick);
- OUTPUT:
- RETVAL
-
-int
-JoystickNumHats ( joystick )
- SDL_Joystick *joystick
- CODE:
- RETVAL = SDL_JoystickNumHats(joystick);
- OUTPUT:
- RETVAL
-
-int
-JoystickNumButtons ( joystick )
- SDL_Joystick *joystick
- CODE:
- RETVAL = SDL_JoystickNumButtons(joystick);
- OUTPUT:
- RETVAL
-
-void
-JoystickUpdate ()
- CODE:
- SDL_JoystickUpdate();
-
-Sint16
-JoystickGetAxis ( joystick, axis )
- SDL_Joystick *joystick
- int axis
- CODE:
- RETVAL = SDL_JoystickGetAxis(joystick,axis);
- OUTPUT:
- RETVAL
-
-Uint8
-JoystickGetHat ( joystick, hat )
- SDL_Joystick *joystick
- int hat
- CODE:
- RETVAL = SDL_JoystickGetHat(joystick,hat);
- OUTPUT:
- RETVAL
-
-Uint8
-JoystickGetButton ( joystick, button)
- SDL_Joystick *joystick
- int button
- CODE:
- RETVAL = SDL_JoystickGetButton(joystick,button);
- OUTPUT:
- RETVAL
-
-AV *
-JoystickGetBall ( joystick, ball )
- SDL_Joystick *joystick
- int ball
- CODE:
- int success,dx,dy;
- success = SDL_JoystickGetBall(joystick,ball,&dx,&dy);
- RETVAL = newAV();
- av_push(RETVAL,newSViv(success));
- av_push(RETVAL,newSViv(dx));
- av_push(RETVAL,newSViv(dy));
- OUTPUT:
- RETVAL
-
-void
-JoystickClose ( joystick )
- SDL_Joystick *joystick
- CODE:
- SDL_JoystickClose(joystick);
-
-Sint16
-JoyAxisEventWhich ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jaxis.which;
- OUTPUT:
- RETVAL
-
-Uint8
-JoyAxisEventAxis ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jaxis.axis;
- OUTPUT:
- RETVAL
-
-Sint16
-JoyAxisEventValue ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jaxis.value;
- OUTPUT:
- RETVAL
-
-Uint8
-JoyButtonEventWhich ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jbutton.which;
- OUTPUT:
- RETVAL
-
-Uint8
-JoyButtonEventButton ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jbutton.button;
- OUTPUT:
- RETVAL
-
-Uint8
-JoyButtonEventState ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jbutton.state;
- OUTPUT:
- RETVAL
-
-Uint8
-JoyHatEventWhich ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jhat.which;
- OUTPUT:
- RETVAL
-
-Uint8
-JoyHatEventHat ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jhat.hat;
- OUTPUT:
- RETVAL
-
-Uint8
-JoyHatEventValue ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jhat.value;
- OUTPUT:
- RETVAL
-
-Uint8
-JoyBallEventWhich ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jball.which;
- OUTPUT:
- RETVAL
-
-Uint8
-JoyBallEventBall ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jball.ball;
- OUTPUT:
- RETVAL
-
-Sint16
-JoyBallEventXrel ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jball.xrel;
- OUTPUT:
- RETVAL
-
-Sint16
-JoyBallEventYrel ( e )
- SDL_Event *e
- CODE:
- RETVAL = e->jball.yrel;
- OUTPUT:
- RETVAL
-
#ifdef HAVE_SDL_NET
int
Oops, something went wrong.

0 comments on commit f104313

Please sign in to comment.