Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merged with experimental

  • Loading branch information...
commit bee3715f3cda362889669dad10aab37781ca180d 2 parents 67b709e + 9926ffa
Tobias Leich authored
View
5 CHANGELOG
@@ -1,5 +1,10 @@
Revision history for Perl extension SDL_perl.
+* 2.531_02 March 19 2011
+ - Fixes for several examples [jtpalmer]
+ - Fixes for INSTALL/README file [Pip]
+ - Fixes for draw_rect [FROGGS]
+
* 2.531_01 March 9 2011
New features:
- SDLx::Surface draw_polygon(), linking GFX to Surfaces when available [FROGGS]
View
3  INSTALL
@@ -18,14 +18,13 @@ following libraries (as pre-compiled DLLs for Microsoft Windows platforms):
* libSDL
* png
+ * tiff
* jpeg
* smpeg
* OpenGL (GL)
* GLUT (GLU)
* SDL_image
* SDL_mixer
- * SDL_net
- * SDL_tiff
* SDL_gfx
* SDL_ttf
View
51 README
@@ -1,53 +1,14 @@
NAME
- SDL_perl - Simple DirectMedia Layer for Perl
-
+ SDL Perl - Simple DirectMedia Layer for Perl
+
SYNOPSIS
use SDL;
-
+
DESCRIPTION
- SDL_perl is a package of Perl modules that provide both functional and
+ SDL Perl is a package of Perl modules that provide both functional and
object oriented interfaces to the Simple DirectMedia Layer for Perl 5.
This package takes some liberties with the SDL API, and attempts to adhere
to the spirit of both the SDL and Perl.
-
-The SDL Perl 2009 Development Team
- Documentation
- Nick: magnet
-
- Perl Development
- Nick: Garu
- Name: Breno G. de Oliveira
-
- Nick: Dngor
- Name: Rocco Caputo
-
- Nick: nferraz
- Name: Nelson Ferraz
-
- Nick: monsenhor
- Name: Ricardo Filipo
-
- Maintainance
- Nick: kthakore
- Name: Kartik Thakore
- Nick: FROGGS
- Name: Tobias Leich
-
-MacOSX Experimental Usage
- Please get libsdl packages from Fink
-
- perl Build.PL
- perl Build test
- perl Build Bundle
- perl Build install
-
- Running SDL Perl Scripts in MacOSX
- First set the PERL5LIB environment variable to the dependencies of your
- script
-
- %export PERL5LIB=$PERL5LIB:./lib
-
- Use the SDLPerl executable made in the bundle and call your scripts
-
- %SDLPerl.app/Contents/MacOS/SDLPerl yourScript.pl
+The SDL Perl Development Team
+ Please see: HTTPS://GitHub.Com/PerlGameDev/SDL/contributors
View
4 examples/SDLx/SDLx_sprite_animated.pl
@@ -17,12 +17,12 @@
);
my $sprite = SDLx::Sprite::Animated->new(
- image => 'test/data/hero.png',
+ image => 'test/data/hero.bmp',
rect => SDL::Rect->new( 48, 0, 48, 48 ),
ticks_per_frame => 6,
);
$sprite->set_sequences( left => [ [ 1, 0 ], [ 1, 1 ], [ 1, 2 ] ], );
-$sprite->alpha_key( SDL::Color->new( 0xfc, 0x00, 0xff ) );
+$sprite->alpha_key( SDL::Color->new( 0xff, 0x00, 0xff ) );
$sprite->sequence('left');
$sprite->start();
my $x = 0;
View
4 examples/SDLx/pong.pl
@@ -123,7 +123,7 @@ sub on_move {
}
sub on_event {
- my $event = shift;
+ my ( $event, $app ) = @_;
if ( $event->type == SDL_KEYDOWN ) {
my $key = $event->key_sym;
@@ -144,7 +144,7 @@ sub on_event {
$paddle->{y_vel} += $paddle->{vel} if $key == SDLK_UP;
$paddle->{y_vel} -= $paddle->{vel} if $key == SDLK_DOWN;
} elsif ( $event->type == SDL_QUIT ) {
- $app->stop();
+ exit;
}
}
View
5 examples/cookbook/pogl_sdl_texture.pl
@@ -115,7 +115,10 @@ sub LoadTexture {
my $nOfColors;
my $texture_format;
my $texture = 0;
- $surface = SDL::Image::load( $ARGV[0] );
+ my $img = $ARGV[0] || 'test/data/picture.bmp';
+
+ $surface = SDL::Image::load( $img );
+ die "Couldn't load image: ".SDL::get_error() unless $surface;
SDL::Video::lock_surface($surface);
#get the number of channels in the SDL surface
View
3  examples/pixel_operations/starry.pl
@@ -26,8 +26,7 @@
my $display_matrix = SDLx::Surface->new( surface => $app );
-#foreach(0..300)
-while (1) {
+while ( !$quit ) {
SDL::Events::pump_events();
while ( SDL::Events::poll_event($event) ) {
View
2  examples/pixel_operations/tie_matrix.pl
@@ -75,7 +75,7 @@ sub update {
foreach ( 0 ... rand( $surface->w ) ) {
- $matrix->[$_][ rand( $surface->h ) ] = 0xFFFFFFFF / ( $_ + 1 );
+ $matrix->[$_][ rand( $surface->h ) ] = int(0xFFFFFFFF / ( $_ + 1 ));
}
SDL::Video::unlock_surface($surface);
View
31 lib/SDLx/FPS.pm
@@ -8,24 +8,31 @@ our @ISA = qw(SDL::GFX::FPSManager);
sub new {
my ( $class, @args ) = @_;
+
+ my %options;
if ( ref $args[0] ) {
- my %options = %{ $args[0] };
+ %options = %{ $args[0] };
if ( @args > 1 ) {
Carp::cluck("Extra arguments are not taken when hash is specified");
}
- for (
- grep {
- my $key = $_;
- !grep $_ eq $key, qw/fps framecount rateticks lastticks rate/;
- } keys %options
- )
- {
- Carp::cluck("Unrecognized constructor hash key: $_");
- }
- @args = ( @options{qw/fps framecount rateticks lastticks rate/} );
- } elsif ( @args > 4 ) {
+ } else {
+ %options = @args;
+ }
+
+ if ( keys %options > 4 ) {
Carp::cluck("Too many arguments given");
}
+
+ for (
+ grep {
+ my $key = $_;
+ !grep $_ eq $key, qw/fps framecount rateticks lastticks rate/;
+ } keys %options
+ )
+ {
+ Carp::cluck("Unrecognized constructor hash key: $_");
+ }
+ @args = ( @options{qw/fps framecount rateticks lastticks rate/} );
my $fps = $class->SDL::GFX::FPSManager::new(
map defined() ? $_ : 0,
@args[ 1 .. 4 ]
View
14 src/SDLx/Surface.xs
@@ -182,26 +182,23 @@ surfacex_draw_rect ( surface, rt, color )
SV* rt
SV* color
CODE:
+ Uint32 m_color = __map_rgba( color, surface->format );
SDL_Rect r_rect;
- SV* foo;
if( SvOK(rt) )
{
int newly_created_rect = 0;
- foo = rect( rt, &newly_created_rect );
+ SV* foo = rect( rt, &newly_created_rect );
r_rect = *(SDL_Rect*)bag2obj(foo);
+ SDL_FillRect(surface, &r_rect, m_color);
+ SvREFCNT_dec(foo);
}
else
{
r_rect.x = 0; r_rect.y = 0; r_rect.w = surface->w; r_rect.h = surface->h;
+ SDL_FillRect(surface, &r_rect, m_color);
}
- Uint32 m_color = __map_rgba( color, surface->format );
- SDL_FillRect(surface, &r_rect, m_color);
-
- if( SvOK(rt) )
- SvREFCNT_dec(foo);
-
void
surfacex_draw_rect_blended ( surface, rt, color )
SDL_Surface *surface
@@ -235,6 +232,7 @@ surfacex_draw_rect_blended ( surface, rt, color )
if( SvOK(rt) )
SvREFCNT_dec(foo);
+
#ifdef HAVE_SDL_GFX_PRIMITIVES
int
Please sign in to comment.
Something went wrong with that request. Please try again.