Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Resize window smoothly (avoiding flicker or other problems)

This thread is locked; no one can reply to it. rss feed Print
Resize window smoothly (avoiding flicker or other problems)
Markobar
Member #16,921
December 2018

Hello there!

I've been investigating this problem:

https://www.allegro.cc/forums/thread/614370

https://www.allegro.cc/forums/thread/616674

https://www.allegro.cc/forums/thread/616732

Making a smooth transition while resizing the window like happens in GDIs looks tricky since the function "al_acknowledge_resize" seems to reinitialise many things and this creates some flicker.

I had a silly idea, but I'm not sure how to program it or if it can work:

1) We get the screen resolution with "al_get_monitor_info".
2) we create a display with the screen resolution in windowed mode.
3) We can fix the initial position and size of the window with "al_set_window_position" and " al_resize_display". That means that part of the display is hidden, and it only makes sense to draw in the visible area of the display.
4) By using the "WinProcCallback" function, we can know when the user resizes the window and the new size, so now we can draw in the new area (bigger or smaller).

Like this, there is no need to reinitialise the display with new dimensions.
The drawback is that there will (almost) always be a part of the display unused, but maybe this is not that bad.

I appreciate all your comments!

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

The only way to do that is with a 'layered' or 'shaped' window the size of the screen. The best way to do that is with OpenGL and to create your own context. But allegro doesn't currently support using a pre-existing context.

Your idea is interesting. It could work. I don't know how the performance of running a transparent window for long periods like that might be affected though.

Go to: