Over the past couple of years the SDL Perl bindings have gone through a complete rewrite, making them modular, stable, faster, multiplatform, 1:1 compatible with libsdl and fixing several memory leaks ...
Over the past couple of years the SDL Perl bindings have gone through a complete rewrite, making them modular, stable, faster, multiplatform, 1:1 compatible with libsdl and fixing several memory leaks while at it.
The community is more alive than ever and now the SDL Perl project is ready to move the Perl motto into gamedev:
"Simple games, easy. Complex games, possible."
In this talk I'll discuss some of the sugar layers being developed on top of SDL Perl, including game loops, widgets, physics engines and full-fledged frameworks for easy game development.
Game Development with SDL and PerlPresentation Transcript
GameDevelopmentWith Perl and SDL - press start -
PerlSDL
PerlSDL
PerlSDL
Simple DirectMedia Layer
low level access
Video
Audio
Input Devices
cross-platform
Multimedia App libSDLDirectX GDI framebuffer Xlib Quartz ...MS Windows Linux OS X
LGPL v2
Round 1 . . . F IGH T !
1:1 API
use strict;use warnings;use SDL;use SDL::Video;use SDL::Surface;use SDL::Rect;SDL::init(SDL_INIT_VIDEO);my ($screen_w, $screen_h) = (800, 600);my $screen = SDL::Video::set_video_mode( $screen_w, $screen_h, 32, SDL_ANYFORMAT);my $blue = SDL::Video::map_RGB($screen->format(), 0, 0, 255);SDL::Video::fill_rect( $screen, SDL::Rect->new(15, 15, 100, 100), $blue);SDL::Video::update_rect($screen, 0, 0, $screen_w, $screen_h);sleep 5; # so we have time to see!
Too low level
Not Perlish at all!
SDLx::* Sugar
use strict;use warnings;use SDLx::App;my $app = SDLx::App->new( width => 800, height => 600,);$app->draw_rect( [15, 15, 100, 100], # rect [0,0,255,255], # blue);$app->update;sleep 5; # so we have time to see!
The Game Loop
while ( $running ) { get_events(); update_game(); render_scene();}
my $menu = SDLx::Widget::Menu->new;$menu->items( New Game => sub { ... }, Load Game => sub { ... }, Options => sub { ... }, Quit => sub { ... },);show { $menu->render( app ) };
my $text = SDLx::Text->new( font => /path/to/my/font.ttf, color => white, h_align => center, shadow => 1, bold => 1,);$text->write_to( app, All your base are belong to us.);