Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ALERT - n00b to Allegro - ALERT
#1
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.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#2
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);
Reply
#3
Thanks!
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#4
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.
/post]
Reply
#5
Where can I get it?
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#6
http://alleg.sourceforge.net/api.html

This (the english version 4.1.12 doc in chm format) is probably what you want.
Reply
#7
Cool, thanks!
Another qustion: Does Allegro have the equivalent of GET/PUT in QB?
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#8
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;
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#9
Okay - So everything runs off bitmaps, I see. And "screen" is a predefined one?
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#10
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.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)