allegro

Allegro and euphoria - a game programming kit

Allegro is a game programming library, which allows the use of sprites, maps, graphics, joystick controls and so on to create games. It will not create a game for you, you still need your imagination to do that.

Why allegro? There are other multimedia and game creation libraries for euphoria, notably SDL (including Musubi) and OpenGL, but IMHO, allegro is the easiest to get going. When playing with I found some deficiencies, but hopfully have addressed these to get you writing simple (and not so simple) games. I have gathered together a set of utilities and wrappers to make game programming as simple as possible.

The version of Allegro I will use here is version 4.2, based on Ray Smith's excellent, and mostly complete library. There are one or two bits and pieces where I have had to add additional libraries to get the full functionality, for instance

  • mp3 s - while allegro comes with almp3.dll, this dll will not work with allegro 4.2, and unless you regress to 4.0 then you cannot use it. I have therefore created a fmod wrapper (loosely based and much mangled from a wrapper written by Aku), which will allow the playing of mp3 music and samples (and incidentally mods and xms - but jgmod can already do this) - the fmod.dll is version 3.6, which is frankly ancient, but it does it's job.
  • the joystick - while allegro is supposed to support the use of the joystick, Ray could never get it to work - and neither can I - I therefore added in another joystick reading function based on the joystick wrapper created by Mic
  • allegro 4.2 can't use jpgs, so I've added Freeimage (by Greg Haberek, modified for Phix) to the kit, with a wrapper to create bmps from jpgs (you can do what you want with the new files after, delete or keep). As an aside I've also created a stand alone jpg to bmp convertor which works form the command line or by drag'n'drop. Use in a batch for multiple file conversion, very easy to produce with freeimage - there is full documentation in the jpg folder.

I have also rewritten parts of the library with the primary focus on Phix - I have concentrated on Phix modifications for the main libraries, but have put untested ifdefs - by all means try with Eu, but I won't be re writing it for Eu - by all means feel free to do so yourself.

There are a lot of allegro functions not wrapped, a lot of them have eu equivalents, so not worth wrapping, and a lot of them I have no use for, so unless I do develop a use for them, it is unlikely they will be added - see euallegro.ew for specifics. However, it's unlikely the lack of these will hinder game development. Of course you are more than welcome to add them yourself, and I would happily integrate them into the wrapper.

I have also decided not to use the euallegro 5 library, mostly because the demos are very sparse - I have modified it's libraries for Phix, and the demos are running as they look like they should, and I am sure that one day I will revisit it. It is highly unlikely that I, or even you, will run out of functions for the foreseeable future, and be able to create some great games with the 4.2 library.

To see some of the possibilities that can be achieved with allegro, go to http://allegro.cc - there are a lot of documents and examples there too. Other resources would be the allegro wiki - http://wiki.allegro.cc, and the allegro home page http://liballeg.org/.

The organisation of this article - I will arrange the pages as chapters, indexed from here, so hopefully you can read them much like a book, and referencing them as you need to. The first chapter is about the installation of the 'pack' with lots of demos to get you started, and hopefully whet your whistles for the enthralling world of game programming.

  1. Chapter 1 - installing the allegro pack Install allegro 4.2 for euphoria
  2. Chapter 2 - the 'modules'
  3. Chapter 3 - quick reference for functions - better job than me of quickly going through it.
  4. Chapter 3a - some interesting graphic programs / demos Graphics demos from SDLBasic
  5. Chapter 4 - Some more detail on sound|sound
  6. Chapter 5 - Creating games

Search



Quick Links

User menu

Not signed in.

Misc Menu