Author Topic: Allegro?  (Read 3081 times)

0 Members and 1 Guest are viewing this topic.

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Allegro?
« on: January 18, 2007 »
Does anyone out there used Allegro?

here simple code in Allegro.

Code: [Select]
include <allegro.h>

const int scrx = 640;
const int scry = 480;

int main(int argc, char* argv[]) {
 if (allegro_init()) {
   allegro_message("Cannot initalize Allegro.\n");
   return 1;
 }

 //Set the window title when in a GUI environment
 set_window_title("Hello World");

 if (install_keyboard()) {
   allegro_message("Cannot initalize keyboard input.\n");
   return 1;
 }

 //set graphics mode, trying all acceptable depths
 set_color_depth(32);
 if (set_gfx_mode(GFX_AUTODETECT, scrx, scry, 0, 0)) {
   set_color_depth(24);
   if (set_gfx_mode(GFX_AUTODETECT, scrx, scry, 0, 0)) {
     set_color_depth(16);
     if (set_gfx_mode(GFX_AUTODETECT, scrx, scry, 0, 0)) {
       set_color_depth(15);
       if (set_gfx_mode(GFX_AUTODETECT, scrx, scry, 0, 0)) {
         allegro_message("Video Error: %s.\n", allegro_error);
         return 1;
       }
     }
   }
 }

 //set text background color to bright blue
 text_mode(makecol(0, 0, 255));

 //prints yellow "Hello World!!!" in middle of screen
 textout_centre(screen, font, "Hello World!!!", scrx/2,
                scry/2, makecol(255, 255, 0));

 //Wait for a key to be pressed
 while (!keypressed()) {}

 return 0;
 //Allegro will automatically deinitalize itself on exit
}
END_OF_MAIN();


Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Allegro?
« Reply #1 on: January 18, 2007 »
Must be 10 years since I looked at Allegro, and I see it's still under active development
http://www.talula.demon.co.uk/allegro/
I have to admit, back then I didn't like it much.

Thanks for the sample Hotshot!

Jim
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: Allegro?
« Reply #2 on: January 26, 2007 »
IF you want allergo manual then please let me know.

cheers