-
âDo or do not... there is no try.â
-
--yoda
+
+Beep ... Boop
+
-
The design before
-The bindings before were all in
one huge XS file. This was then exported into the SDL module. This means that the XS file has to handle with macros if any component (e.x SDL_Mixer) is not compiled. Moreover having ever binding in one XS file prevents use to treat C structs as object with only one point of free and malloc. This would be BEGIN and DESTROY in Perl. Also the monolithic design introduces a lot of bugs because we have to use free and malloc all over the place. Lastly SDL monolithic design has the constructor for all structs in both Perl and in XS.
+So I am preparing a presentation of the new SDL perl for February's Toronto Perl Mongers meeting. What better way to so off SDL perl then with a game?
-
The design we are aiming for
Simple
one XS per Module. This would also simplify the Build code.
+I started hacking a small point an click game a few days back. I really didn't have a idea in mind, but I did have a goal. I wanted to make a game that shows the basics of a game in SDL. Drawing to screen, game loops, physics and so on. I think I have accomplished it so far.
-
First Step
-We have began with SDL Rect. It is in github master branch now. We are in the progress of making it back compatible. Originally SDL::Rect took named variables as parameters for new(). Now since the constructor
is in XS we have only unnamed parameters.
+Take a look at it
here. Download that and call it
[Shooter.pl]. To win click the balls.
+To play this game you need the following:
-
Before
-SDL::Rect->new( -x => 0, -y => 0, -width => 0, -height => 0);
+
- Only for Linux) sudo apt-get install libsdl-dev libsdl_gfx-dev
+- cpan Alien::SDL
+- Click Download Source http://github.com/kthakore/SDL_perl/tree/redesign
+- Extract it
+- perl Build.PL; perl Build; perl Build install
+- perl Shooter.pl
+
+I will put up binaries soon-ish.
-
After
-SDL::Rect->new(0, 0, 0, 0);
+It is a playable (albeit hard) game right now. All 7 seven levels of it. The purpose of the game is simple click the balls to win. Sounds easy but it isn't. You also get a time in milliseconds after each level. Share your scores on here! I will leave it up to you guys to be honest.
-Ideally we would like both ways of constructing Rect.
-
-