Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » fullscreen mode doesn't work!

This thread is locked; no one can reply to it. rss feed Print
fullscreen mode doesn't work!
henry wotton
Member #8,058
December 2006

I'm using Allegro with Dev-c++ in Windows,. Everything works fine apart from the fact that I can't use the fullscreen mode but it always opens my game in a window.
If I try to force the fullscreen mode, the program doesn't open. The code is the following

#include <stdio.h>
#include <stdlib.h>
#include "allegro.h"

int main(int argc, char *argv[])
{
allegro_init();
set_color_depth(24);
set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 400, 300, 0, 0);
}

END_OF_MAIN();

I tried the code in different computers, but I can never get the fullscreen mode! I hope somebody out there has a solution to my problem !!!
Thanks a lot guys

Matthew Leverton
Supreme Loser
January 1999
avatar

Does any video card support 24-bit at that resolution (400x300)? I doubt it. You need to pick a proper resolution (640x480, etc) if you want full screen to work.

Ceagon Xylas
Member #5,495
February 2005
avatar

Don't forget to use the code tags when posting code on the forums.

Also, drop the ';' at the end of END_OF_MAIN().

spork222
Member #7,263
May 2006

I am also needing a 400x300 video mode for my game. Here's what I did:

#include <allegro.h>

int main()
{
allegro_init();
set_color_depth(16);
set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 800, 600, 0, 0);
BITMAP *screenbuffer = create_bitmap(400, 300);
...
stretch_blit(screenbuffer, screen, 0, 0, 400, 300, 0, 0, 800, 600);
}
END_OF_MAIN()

Now just be sure and write to screenbuffer instead of screen when you want to draw, then do the stretch_blit to display it. It looks the same as if you were actually using 400x300.

Kris Asick
Member #1,424
July 2001

Though 400x300 without a stretched blit would be infinitely faster on a machine that supports it over 800x600!

So what would work better would be to first test if 400x300 is supported on the target machine at 24-bit. (Chances are: No.) Next, try to initialize 400x300 at 32-bit colour. (Which is much more likely to be supported.) If it still doesn't work, THEN try to do 800x600 and simply stretch your buffer to fill the screen. 800x600, being a standard resolution, will work on just about anyone's system.

Actually, PixelShips Retro does this. It prefers 320x240 with 8-bit colour when running full-screen, but if it can't assign it, it will scale up to 640x480 and stretch blit to the whole screen. (Actually... since the game is being processed at 160x240 resolution it has to stretch blit to the screen anyways, even at 320x240.)

24-bit is kinda obscure anymore and isn't well supported by many video cards. My video card doesn't, and it's a GeForce FX 5200. (But my card does support 400x300 resolution.)

--- Kris Asick (Gemini)
--- http://www.pixelships.com

--- Kris Asick (Gemini)
--- http://www.pixelships.com

Go to: