added SDL_keysym struct
Tobias Leich [Sun, 8 Nov 2009 19:41:54 +0000 (20:41 +0100)]
Build.PL
lib/SDL/Constants.pm
lib/SDL/Events.pm
src/Core/objects/KeyboardEvent.xs
t/core_events.t
typemap

index 79d5ba7..7c1df59 100644 (file)
--- a/Build.PL
+++ b/Build.PL
@@ -105,6 +105,13 @@ my %subsystems =
                },
                libraries => [qw( SDL )],
        },
+       keysym => {
+               file      => {
+                       from  => 'src/Core/objects/keysym.xs',
+                       to    => 'lib/SDL/keysym.xs',
+               },
+               libraries => [qw( SDL )],
+       },
        MouseButtonEvent => {
                file      => {
                        from  => 'src/Core/objects/MouseButtonEvent.xs',
index f6146e0..7308565 100644 (file)
@@ -218,6 +218,7 @@ our @EXPORT=qw(
        SDL_BUTTON_RIGHT
        SDL_BUTTON_WHEELUP
        SDL_BUTTON_WHEELDOWN
+       SDL_DISABLE
        SDL_DOUBLEBUF
        SDL_ENABLE
        SDL_FULLSCREEN
@@ -537,7 +538,8 @@ use constant {
     SDL_BUTTON_WHEELUP   => 8,
     SDL_BUTTON_WHEELDOWN => 16,
     
-    SDL_DOUBLEBUF => 1073741824,
+       SDL_DISABLE             => 0,
+    SDL_DOUBLEBUF           => 1073741824,
        
     SDL_ENABLE => 1,
     SDL_EVENT_RESERVEDA     => 14,
index 7f25ef4..558f24e 100644 (file)
@@ -1,6 +1,7 @@
 package SDL::Events;
 use strict;
 use warnings;
+use SDL::keysym;
 require Exporter;
 require DynaLoader;
 our @ISA = qw(Exporter DynaLoader);
index 6d3e11d..53cebc4 100644 (file)
@@ -12,7 +12,7 @@ MODULE = SDL::KeyboardEvent   PACKAGE = SDL::KeyboardEvent    PREFIX = kbevent_
 
 =for documentation
 
-SDL_KeyboardEvent --Keyboard event structure
+SDL_KeyboardEvent -- Keyboard event structure
 
  typedef struct{
   Uint8 type;
index f182d11..dc15de6 100644 (file)
@@ -19,7 +19,7 @@ use SDL::UserEvent;
 use SDL::Video;
 use Test::More;
 
-plan ( tests => 108 );
+plan ( tests => 111 );
 
 my @done =qw/
 pump_events 
@@ -52,6 +52,7 @@ use_ok( 'SDL::JoyBallEvent' );
 use_ok( 'SDL::JoyButtonEvent' ); 
 use_ok( 'SDL::JoyHatEvent' ); 
 use_ok( 'SDL::KeyboardEvent' ); 
+use_ok( 'SDL::keysym' ); 
 use_ok( 'SDL::MouseButtonEvent' ); 
 use_ok( 'SDL::MouseMotionEvent' ); 
 use_ok( 'SDL::QuitEvent' ); 
@@ -67,6 +68,7 @@ can_ok( 'SDL::JoyBallEvent',     qw/type which ball xrel yrel/);
 can_ok( 'SDL::JoyButtonEvent',   qw/type which button state/);
 can_ok( 'SDL::JoyHatEvent',      qw/type which hat value/);
 can_ok( 'SDL::KeyboardEvent',    qw/type state keysym/);
+can_ok( 'SDL::keysym',           qw/scancode sym mod unicode/);
 can_ok( 'SDL::MouseButtonEvent', qw/type which button state x y/);
 can_ok( 'SDL::MouseMotionEvent', qw/type state x y xrel yrel/);
 can_ok( 'SDL::QuitEvent',        qw/type/);
@@ -88,6 +90,7 @@ my $jtevent = SDL::JoyBallEvent->new();
 my $jbevent = SDL::JoyButtonEvent->new(); 
 my $jhevent = SDL::JoyHatEvent->new(); 
 my $kbevent = SDL::KeyboardEvent->new(); 
+my $keysym  = SDL::keysym->new(); 
 my $mbevent = SDL::MouseButtonEvent->new(); 
 my $mmevent = SDL::MouseMotionEvent->new(); 
 my $qevent  = SDL::QuitEvent->new(); 
@@ -103,6 +106,7 @@ isa_ok( $jtevent, 'SDL::JoyBallEvent',     '[SDL::JoyBallEvent::new] is creating
 isa_ok( $jbevent, 'SDL::JoyButtonEvent',   '[SDL::JoyButtonEvent::new] is creating an JoyButtonEvent');
 isa_ok( $jhevent, 'SDL::JoyHatEvent',      '[SDL::JoyHatEvent::new] is creating an JoyHatEvent');
 isa_ok( $kbevent, 'SDL::KeyboardEvent',    '[SDL::KeyboardEvent::new] is creating an KeyboardEvent');
+isa_ok( $keysym,  'SDL::keysym',           '[SDL::keysym::new] is creating an keysym');
 isa_ok( $mbevent, 'SDL::MouseButtonEvent', '[SDL::MouseButtonEvent::new] is creating an MouseButtonEvent');
 isa_ok( $mmevent, 'SDL::MouseMotionEvent', '[SDL::MouseMotionEvent::new] is creating an MouseMotionEvent');
 isa_ok( $qevent,  'SDL::QuitEvent',        '[SDL::QuitEvent::new] is creating an QuitEvent');
diff --git a/typemap b/typemap
index bdd4c52..17b93e8 100644 (file)
--- a/typemap
+++ b/typemap
@@ -9,6 +9,9 @@ Uint16 *                T_PTR
 Uint32                 T_UV
 Uint32 *               T_PTR
 SDLKey                 T_UV
+SDLKey *               T_PTR
+SDLMod                 T_UV
+SDLMod *               T_PTR
 Sint16                 T_IV
 Sint16 *               T_PTR
 Sint32                 T_IV