Code: Select all
#include <allegro.h>
int main()
{
//Allegro Initialization
allegro_init();
install_keyboard();
install_timer();
install_mouse();
install_sound( DIGI_AUTODETECT, MIDI_AUTODETECT, 0 );
set_color_depth( 16 );
bool fullscreen = false;
if(fullscreen == true) //For fullscreen
{
set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);
}
else
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
BITMAP *buffer = create_bitmap( 640, 480 );
//Main game loop
while ( !key[KEY_ESC] )
{
rectfill( buffer, 0, 0, 640, 480, makecol(255, 0, 0));
//Draw rectangle
blit( buffer, screen, 0, 0, 0, 0, 640, 480 );
clear_bitmap( buffer );
}
//Free memory of bitmap
destroy_bitmap( buffer );
return 0;
}
END_OF_MAIN();
I have no idea what Im doing wrong. Could someone please help me. And as for learning Allegro online, Im going a day after posting this to get a book.[Linker error] undefined reference to '_WinMain'