(12-22-2010, 10:25 PM)algorithm Wrote: Yeah I will, what is it like some kind of gaming app?
It's a 2d Graphics library. Here's an example i've just started.
Code:
#include <allegro.h>
BITMAP * ship;
BITMAP * background;
BITMAP * buffer;
SAMPLE * music;
int x = 300;
int y = 400;
int main(){
allegro_init();
install_keyboard();
install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, "A");
music = load_sample("music.wav");
play_sample(music,255,128,1000,-1);
set_color_depth(16);
set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);
ship = load_bitmap("ship.bmp", NULL);
background = load_bitmap("background.bmp", NULL);
buffer = create_bitmap(640, 480);
while(!key[KEY_ESC])
{
clear_keybuf();
acquire_screen();
draw_sprite( buffer, background, 0, 0);
draw_sprite( buffer, ship, x, y);
blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
textout_ex(screen, font, "Game by Scorch", 50, 10, makecol(0, 0, 255), makecol(0, 0, 0));
textout_ex(screen, font, "Stratovarius - Fight", 50, 30, makecol(255, 0, 0), makecol(0, 0, 0));
if(key[KEY_LEFT])
{
x--;
}
if(key[KEY_RIGHT])
{
x++;
}
if(key[KEY_UP])
{
y--;
}
if(key[KEY_DOWN])
{
y++;
}
else if(key[KEY_Z])
{
clear(screen);
draw_sprite( buffer, background, 0, 0);
draw_sprite( buffer, ship, x, y);
blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
}
release_screen();
readkey();
rest(2);
}
clear(screen);
destroy_bitmap(ship);
destroy_bitmap(background);
destroy_bitmap(buffer);
destroy_sample(music);
return 0;
}
END_OF_MAIN();