Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Fullscreen window creation

This thread is locked; no one can reply to it. rss feed Print
Fullscreen window creation
APrince
Member #12,698
March 2011

Hi, I'm trying to create a fullscreen window and it does not seem, to work correctly. I have tried this with 5.0.6 and 5.0.8.

If I create the window like this:

al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW);
al_set_new_display_flags(ALLEGRO_NOFRAME);
ALLEGRO_MONITOR_INFO info;
int i = 0;
do{
  al_get_monitor_info(i++, &info);
} while (!(info.x1 == 0 && info.y1 == 0));
display_width = info.x2 - info.x1;
display_height = info.y2 - info.y1;

if (!(display = al_create_display(display_width,display_height))){    
  return false;
}
//...

...the the result is that the window is not really fullscreen since the bottom windows bar is drawn ontop of it and the bottom of the window seems to reach to approximately it's middle (i can see that because I use Aero on Windows 7, so the window actually shines through the task bar). And there's another interresting thing: the window content in this case seems to be somewhat shrunk, as if the window would be smaller than it should stretching it's content to a smaller size.

What seems to fix the problem is to call resize after creation of the window like this:

al_toggle_display_flag(display,  ALLEGRO_FULLSCREEN_WINDOW, true);
al_toggle_display_flag(display,  ALLEGRO_NOFRAME,true);        
        
al_resize_display(display, display_width, display_height);

I can live with that but I think it would really be good to fix the problem...

Arevil
Member #12,872
May 2011
avatar

I think you have to call only
al_set_new_display_flags(ALLEGRO_FULLSCREEN);

Did you try this?

My Project (Mi55ion):
www.Mi55ion.de

APrince
Member #12,698
March 2011

I read that it is actually not recommended with ALLEGRO. There are also problems with resizing it, problems with screen resolution and so on. That's why I use ALLEGRO_FULLSCREEN_WINDOW not ALLEGRO_FULLSCREEN.

Kris Asick
Member #1,424
July 2001

TL;DR: It's best to support both ALLEGRO_FULLSCREEN and ALLEGRO_FULLSCREEN_WINDOW to maximize the number of people who can run your game full-screen.

---

ALLEGRO_FULLSCREEN and ALLEGRO_FULLSCREEN_WINDOW are two completely different approaches to running a full-screen interface and, unfortunately, ALLEGRO_FULLSCREEN works best for some people, and ALLEGRO_FULLSCREEN_WINDOW works best for others. :-/

I've actually made it possible in my project to choose which fullscreen mode to use and have an information bar saying to use the "Full Window" mode if trouble arises with the standard fullscreen mode.

The difference between the two interfaces is that ALLEGRO_FULLSCREEN actually signals the OS to run a full-screen application, and this is what you SHOULD be doing since some background software like virus scanners and firewall programs may behave differently while a full-screen application is running, either by avoiding running updates or other such things.

ALLEGRO_FULLSCREEN_WINDOW creates a borderless, titleless window that fills the entire screen. For some people, this works fine. For other people, there will be issues, such as the task bar showing up overtop. This mode is also still technically a windowed mode, meaning things that background applications that detect full-screen applications won't detect this. ALLEGRO_FULLSCREEN_WINDOW also has the limitation of being unable to be set to a custom resolution, though really, that's not that big a deal nowadays, so long as you're developing your program to run at multiple resolutions.

That said, each time you call al_set_new_display_flags() you're overwriting the previous flags sent. Thus your initial setting of ALLEGRO_FULLSCREEN_WINDOW is being forgotten. You don't actually have to use the ALLEGRO_NOFRAME flag unless you're creating a borderless window that does NOT fill the entire screen.

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

APrince
Member #12,698
March 2011

ALLEGRO_FULLSCREEN and ALLEGRO_FULLSCREEN_WINDOW are two completely different approaches to running a full-screen interface and, unfortunately, ALLEGRO_FULLSCREEN works best for some people, and ALLEGRO_FULLSCREEN_WINDOW works best for others. :-/

I'see. Well, I belong to the latter group.

Anyway in my case it is not a game and I always need to preserve the desktop settings.

Quote:

That said, each time you call al_set_new_display_flags() you're overwriting the previous flags sent. Thus your initial setting of ALLEGRO_FULLSCREEN_WINDOW is being forgotten. You don't actually have to use the ALLEGRO_NOFRAME flag unless you're creating a borderless window that does NOT fill the entire screen.

That would explain much... The point is that I use those two lines based on some forum advice and the guy was really convincing :-D I don't remember however who that was... I'll try to fix that.

//Edit:

Quote:

Thus your initial setting of ALLEGRO_FULLSCREEN_WINDOW is being forgotten

Is this really true? Because it is a common thing in tutorials to set the flags by multiple call to al_set_new_display_flags()

Kris Asick
Member #1,424
July 2001

APrince said:

Is this really true? Because it is a common thing in tutorials to set the flags by multiple call to al_set_new_display_flags()

*looks through the docs*

...maybe not, but still, when dealing with flags it's better to join all the flags you want to use together with | symbols, like:

al_set_new_display_flags(ALLEGRO_FULLSCREEN|ALLEGRO_OPENGL);

Quote:

I always need to preserve the desktop settings.

Normally the desktop settings ARE preserved... Unless you mean you need to be able to access the imagery of the desktop while your application is running... in which case, why do you want to run a full-screen application? I'm confused... ???

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

Edgar Reynaldo
Member #8,592
May 2007
avatar

APrince said:

Thus your initial setting of ALLEGRO_FULLSCREEN_WINDOW is being forgotten

Is this really true? Because it is a common thing in tutorials to set the flags by multiple call to al_set_new_display_flags()

Uh, yeah, it is true. What do you think would happen when you set the flags to something else? Those tutorials are clearly wrong.

So yes, you need to set all flags that you need at the same time using the binary OR operator to add the flags together.

al_set_new_display_flags(ALLEGRO_WINDOWED | ALLEGRO_NOFRAME | ALLEGRO_OPENGL | ALLEGRO_RESIZABLE);

Go to: