A lousy javascript port of a game programming library

What is jAllegro?

jAllegro is a minimal javascript port of a really popular game programming library called Allegro 4 from the first decade of our century. Allegro 4 is a simple game programming library that abstracts a set of functions in C programming language to the developer allowing for simple and rapid creation of video games, without the need to program entity systems, classes and so on. Allegro 5 is the current Allegro version, but it varies greatly in how the API works, thus alienating many hardcore Allegro users. This library aims to provide a simple wrapper for a subset of canvas operations making it look like good old Allegro.

Who is jAllegro for?

jAllegro aims to be a game jam tool. The Hello World! example only takes 4 lines of code, and the example game needs no more than 50 lines of code (it has less text than this post). It is meant to be accessible for beginners, thus if you never made a game, or are struggling trying to find something that “suits you”, give jAllegro a try! It’s a bit different than anything out there, but doesn’t require a PhD in rocket science to install. The tutorial will let you indulge into the simple process of creating jAllegro games!

How does jAllegro work?

jAllegro is made out of standard HTML5 and JS code, it works consistently across all browsers, and you can be sure that the game you make with that will work fine for everyone (unless you’re doing something really crazy). It doesn’t have classes, it doesn’t have tons of files and support for stuff you will never use. It can draw stuff, play sounds, type text and read mouse and keyboard. That’s it, and that’s all you need to make games.

Where can I get jAllegro?

Any examples?

Here is a Hello World example code to show you how jAllegro really works:

function main()
 set_gfx_mode("canvas_id", 640, 480);
 textout_centre(canvas,font,"Hello World!",320,240,24,makecol(0,0,0));
 return 0;

Executing this code will result in this:

Want something more sophisticated? Here’s the jAllegro example game code. It’s under 50 lines of code!

Use jAllegro!

Planing to use jAllegro for Ludum Dare? Have any troubles? Found a bug? Wanna say hi? Let me know!


Here’s jAllegro unit test working consistently on all major browsers!

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]