Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A5] Changing window flags

This thread is locked; no one can reply to it. rss feed Print
[A5] Changing window flags
Matias Persson
Member #15,093
May 2013

Hey, how would I go by changing the window flags while the program is running?
Right now, the program is operating in fullscreen mode, but I want the user to be able to push F1 to switch between Windowed || Fullscreen mode.

I tried this, but it didn't seem to work;
al_set_new_display_flags(ALLEGRO_WINDOWED || ALLEGRO_FULLSCREEN);

#SelectExpand
1if(ev.type == ALLEGRO_EVENT_KEY_DOWN) 2{ 3 //handle key presses 4 switch(ev.keyboard.keycode) 5 { 6 case ALLEGRO_KEY_F1: 7 { 8 al_set_new_display_flags(ALLEGRO_WINDOWED); 9 } 10 break; 11 } 12}

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Matias Persson
Member #15,093
May 2013

Thanks.

torhu
Member #2,727
September 2002
avatar

Allegro 5.1 is supposed to do the bitmap conversion automatically for you, but with 5.0 you have to do it manually, using al_clone_bitmap. You don't need to do this when using the "fullscreen window" mode, though.

Go to: