Qbasicnews.com

Full Version: ALERT - n00b to Allegro - ALERT
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
This afternoon I downloaded the Allegro binaries for Mingw32 (I'm using Dev-C++, ver 4.9). I copied the contents of the include directory of Allegro into the mingw32 include dir, and the lib files into the lib directory. Of course, the dlls I copied into the windows/system directory.
This thread will probably house many questions of mine re Allegro...and here's the first one:
How can I set the screen mode to the equivalent of SCREEN 13? I didn't understand the set_gfx_mode() documentation.
set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 320, 200, 0, 0);

Or, if you want a window:
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 200, 0, 0);
Thanks!
Do you have the help file in .chm format? Else download it,
it describes every? allegro function, and is split up in "chapters"
like keyboard routines, blitting and sprites, etc.
Where can I get it?
http://alleg.sourceforge.net/api.html

This (the english version 4.1.12 doc in chm format) is probably what you want.
Cool, thanks!
Another qustion: Does Allegro have the equivalent of GET/PUT in QB?
Read the manual: "blitting and sprites" and "bitmap objects".

You just have bitmaps, like I told you in MSN messenger. In that chapter it explains what you can do with those bitmaps. Functions like blit cover all the functionality of GET/PUT.

Look at this tiny proggie (I wrote this directly here, it may be wrong Tongue):

Code:
#include <allegro.h>

int main(void)
{
   BITMAP *sprite;
   BITMAP *buffer;
   int x=320, y=240, mx = 1, my = 1;

   allegro_init();
   install_keyboard();

   set_color_depth(16);
   set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 640, 480, 0, 0);

   buffer = create_bitmap (640, 480);

   /* Draw some gfx to our sprite: */
   sprite = create_bitmap(32, 32);
   rectfill (sprite, 0, 0, 31, 31, makecol(255, 0, 0));
   rectfill (sprite, 4, 4, 27, 27, makecol(0,255,0));
   rect (sprite, 6, 6, 25, 25, makecol(0,255,255));

   while (!key[KEY_ESC])
   {
      /* move */
      x += mx;
      y += my;

      if (x == 0 || x == 608) mx = -mx;
      if (y == 0 || y == 448) my = -my;

      /* clear buffer */
      clear_bitmap (buffer);
      
      /* draw sprite */
      blit (sprite, buffer, 0, 0, x, y, 32, 32);

      /* vsync */
      vsync ();

      /* make stuff visible */
      blit (buffer, screen, 0, 0, 0, 0, 640, 480);
   }

   remove_keyboard();
   allegro_exit();

   return (0);
}END_OF_MAIN;
Okay - So everything runs off bitmaps, I see. And "screen" is a predefined one?
Yeah. As it says on the reference (Wink) screen is a predefined bitmap that is created when you call to set_screen_mode and represents your actual screen. It measures SCREEN_W x SCREEN_H pixels.
Pages: 1 2 3