Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Toggle between fullscreen and windowed with alt+enter

This thread is locked; no one can reply to it. rss feed Print
Toggle between fullscreen and windowed with alt+enter
TeaRDoWN
Member #8,518
April 2007
avatar

EDIT: Forgot to write that this is an Allegro 5 question (of course)!

Tried to add a check for keys ALT+ENTER which toggles between a fullscreen and a windowed display. The switch is made by destroying the current display and creating a new one but after doing that a lot of white rectangular artifacts are visible on screen and framerate goes down from 60 to less than 1. I guess something does not approve of this operation but what/why? All my loaded and drawn bitmaps are stored as video bitmaps, but feels like the are changed to memory bitmaps when the display is updated.

Anyone know what could be wrong, and/or even better how should this be done to keep performance.

Note that if I change to windowed/fullscreen between runs (and not while running) the application it work just fine without any visual errors and low framerate.

Trent Gamblin
Member #261
April 2000
avatar

Recreate your bitmaps.

Edgar Reynaldo
Member #8,592
May 2007
avatar

Trent Gamblin
Member #261
April 2000
avatar

You can use al_convert_bitmaps if you're using 5.1. See docs here: http://www.liballeg.org/a5docs/refman/graphics.html#al_convert_bitmap

Thomas Fjellstrom
Member #476
June 2000
avatar

You can al_clone_bitmap each one of them if you're using 5.0 IIRC. Just remember this takes twice the memory till you free the old bitmaps.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Kris Asick
Member #1,424
July 2001

When you switch display modes, everything loaded into video memory will be lost. There are a number of ways to get around this (as you can tell from all of the above suggestions) but my recommendation is to actually clear and destroy all of your bitmaps manually before the switch, then do the switch, then reload and recreate them all. So long as the player hasn't been task switching and doing other things, everything that was previously loaded into video memory should still be cached and should reload very quickly.

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

Go to: