by StephC » Nov 23, 2004 @ 10:59pm
I agree, ease of use must be the first requirement of any software library.
I think that uEngine is really easy to use and yet very fast and powerful.
Very simple example with some functions
enum // list of handles
{
FONT = 1,
BGTEXTURE,
SPRITE1,
TILESET,
SOUND = TILESET + 256, // 256 handles
EXPLOSION, // 12 handle (animated sprite)
}
// loading code
UE_LoadFont("font.tga", FONT);
UE_LoadTexture("background.jpg", BGTEXTURE);
UE_LoadSprites("spaceship1.tga", SPRITE1);
UE_LoadTiles("tileset.tga", 16, 256);
UE_LoadSound("beep.wav", SOUND);
UE_LoadSprites("explosion.tga", EXPLOSION, 12);
// filling screen width a background image
UE_DrawTexture(BGTEXTURE, 0, 0, SOLID);
// filling screen with an ugly gradient (realtime dithering)
UE_DrawFillRect(0, 0, SCREENWIDTH, SCREENHEIGHT, GRADIENT, COLOR(0,255,0), COLOR(255,0,0));
// filling screen with a tile + scrolling
UE_DrawFillRect(0, 0, SCREENWIDTH, SCREENHEIGHT, TILE, TILESET + index, xscroll, yscroll);
// drawing hello world at (10 10), white, and 50% alphablending
UE_DrawText("hello world", 10, 10, FONT, FLAT|ALPHABLEND, COLOR(255,255,255), 16);
// drawing our spaceship at (50 50)
UE_DrawSprite(SPRITE1, 50, 50);
// drawing the frame "n" of our explosion, with 80% additive blending
UE_DrawSprite(EXPLOSION + n, 100, 100, ADDBLEND, 25);
// playing a sound when the "UP" key is pressed
if(UE_GetKey() == UP) UE_PlaySound(SOUND);
// playing a sound when "LEFT" & "ACTION1" keys are pressed
if(UE_GetKeyCount(LEFT) && UE_GetKeyCount(ACTION1)) UE_PlaySound(SOUND);
Stephane Cocquereaumont / Game Developer at <a href=http://int13.net>int13 production</a> (code monkey)