The goal of Luallegro project is to provide free multi-platform graphic
library for Lua. Allegro is a game library, which provides unicode,
configuration, mouse, timer, keyboard, joystick,
loading and handling image files, drawing primitives, blitting, RLE and
compiled sprites, transparency, blending and patterned drawing,
converting between color formats, direct access to video memory, and
much much more.....
5th of january, 2007. Release 0.39 version is ready.
Right now release 0.39 is compiled only for Windows.
Library luallegro comes now in standalone version luallegro.dll for lua5.1.
It has been compiled with official lua 5.1 binaries and it works.
In this release: Most of palette functions have been implemented,
utility functions: bmp_to_str, str_to_bmp (those functions convert lua strings to allegro bitmaps and vice versa)
Those utility functions may be very useful for providing dynamically generated images for the web.
Imagine you create a bitmap, draw statistics chart for instance, save it as gif string and send via web.
Added partial support for gif format.
Many thanks for Elias for providing the gif format handling code:
7th of november, 2005. Release 0.36 version is ready.
Right now only Windows 0.36 release.
Whole Allegro chapter: "Bitmap objects" has been introduced.
I have compiled first luaallegro.dll which is designed for LuaCheia.
I am not used to automake and autoconf, so luaallegro.dll is compiled under MSVC 6.0.
I would be very thankful, if somebody help me with automake and autoconf.
Other problem is that luaallegro.dll uses lua50.dll instead of liblua-5.dll provided by LuaCheia distribution. But it works anyway.
I believe in the future LuAllegro could be valuable part of LuaCheia distribution.
(don't forget to call allegro.allegro_init( ) before any other allegro call under LuaCheia)
27th of october, 2005. First Linux release is ready.
This is version 0.35 compiled under Mandrake Linux 10.0.
As I have promised, Luallegro is now multiplatform library. This is the first Linux release of LuAllegro. Allegro libraries has been compiled statically, after a huge problem I had with moving .so libs into another computer. MuadDib has been compiled on Mandrake Linux 10.0 so it supposed to work also on Red Hat Linux. No source this time because I have not prepared compile and link script yet.
26th of october, 2005. Release 0.35 is ready.
In this release:
"The whole new chapter: "Blitting and sprites" has been implemented. Most functions in this chapter have not been tested yet, so please use with care.
other functions have been implemented to speed-up graphic operations in
is the first release where allegro.LUALLEGRO_VERSION variable is ready.
10th of october, 2005. Release 0.33 is ready.
In this release:
"Loading image files" chapter has been introduced. Packed versions of load* and save* functions are not ready however, because they are waiting for pack_fopen , pack_fclose , and other pack* functions from "File and compression" chapter.
bool allegro.set_display_switch_mode(mode) - this function has been introduced into lua_mode.c
This function called with SWITCH_BACKGROUND parameter allows LuAllegro program to run while graphics window is in the background.
A bug in get_gfx_mode_list has been removed.
To run examples choose "DirectDraw window" or "GDI" modes. These modes are convenient, because you can easily switch between graphics and console window, and you can see both of those windows on the same screen.
Source release is available, code is self-explaining, I hope.
LuAllegro code stays in the LuAllegro subdirectory of a MuadDib project.
Include <*.h> files are divided the same way as Allegro API chapters. See Allegro html or chm documentation.
For example, Allegro functions described in chapter "Drawing Primitives" will be included in file "lua_prim.h".
I keep file names 8 characters short because of DOS limitations.
In the future, when all, or nearly all Allegro functions are implemented in LuAllegro, I will compile LuAllegro under DOS and Linux.
will make binary luaallegro.DLL library similar to those DLL libraries
LuaCheia project. I like them for their modularity.
Most of LuAllegro functions work in the same way as Allegro ones. There are, however several cases, where they are called different way than in Allegro. This is because of language differences between Lua and C. Lua function can return multiple values while C needs some close-to-assembler tricks like returning value given a pointer to it.
This is a C prototype for function
int gfx_mode_select(int *card, int *w, int *h);
...and this is its Lua equivalent:
card,w,h = gfx_mode_select( );
....And below there is an implementation:
static int l_gfx_mode_select(lua_State* L)
lua_pushnumber (L, card);
lua_pushnumber (L, w);
lua_pushnumber (L, h);
There are some cases, where Allegro
functions don't have their equivalents in LuAllegro.
LuAllegro can aggregate two or more Allegro functions (or volatile variables) in one LuAllegro function.
These are Allegro volatile variables that
are changed in the background by Allegro and can be read at any time by
extern volatile int mouse_x;
extern volatile int mouse_y;
extern volatile int mouse_z;
extern volatile int mouse_b;
And here is an Luallegro function equivalent call responsible for reading all these variables at once:
x , y , z , l_button , r_button , m_button = mouse.position( )
...and here is a C implementation for Lua
function mouse.position( ).
static int l_mouse_position(lua_State* L)
I have left in release some scripts
demonstrating and testing LuAllegro functions.
They should run when you type: dofile("scripts/scriptname.lua")
Graphical window should be in the foreground when drawing.
If not, the process will be frozen until you switch to the foreground. I am not sure why is that, I didn't have time to investigate. Maybe it has something to do with the set_display_switch_mode function and the SWITCH_AMNESIA parameter.
The problem disappears when you type text in a graphical window, so it is not really an issue. It will finally disappear when I get rid of a console. Right now I need it, because it helps me to debug.
The LuAllegro project is in initial stage
of development. LuAllegro covers about 30 percent of Allegro functions.
I have selected those functions I would need most to quickly write interesting script/effect.
So even at that point, LuAllegro can be useful in some cases. I tried to debug each function after I wrote it. So most of functions should work very well.
Download, write scripts and enjoy. If you
find a bug, please send me an e-mail with description of a bug.
Want to join to the project? Please send me an e-mail.