Mail Archives: djgpp/1998/04/18/00:01:44
On Thu, 16 Apr 1998 08:33:32 -0500, Count Razumovsky
<umyumm AT cc DOT umanitoba DOT ca> wrote:
>#include<allegro.h>
>
>int main(){
>
> allegro_init();
>
> install_keyboard();
>
> set_gfx_mode(GFX_AUTODETECT,640,480,0,0); /* ******* */
You didn't check the return value. set_gfx_mode cannot always set the
mode you want; if it fails, it returns a negative number, and you
shouldn't try to draw any graphics to the screen if it does fail. Try
this:
if (set_gfx_mode(.....) < 0) {
fprintf (stderr, "Can't set graphics mode: %s\n", allegro_error);
exit (1);
}
>
> textout_centre(screen,font,"HI",160,100,255);
>
> readkey();
>
> return 0;
>}
>funny thing is that the line with the ******* will run just fine if I
>have:
>
>set_gfx_mode(GFX_AUTODETECT,320,200,0,0);
>
>but once I try to go to 640 by 480 I get that wierd message. I can't
>see what the problem would be.
That's because almost all cards support 320x200x256, but not all
support 640x480x256. You might have more luck if you install a VESA
driver, such as UniVBE. I suggest you play around with either the
demo game (in the `demo' directory) or the test program (in the `test'
directory), both of which let you try out different graphics modes.
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
- Raw text -