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.
15. 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!
19. 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!
36. my $menu = SDLx::Widget::Menu->new;
$menu->items(
'New Game' => sub { ... },
'Load Game' => sub { ... },
'Options' => sub { ... },
'Quit' => sub { ... },
);
show { $menu->render( app ) };
37. 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.'
);