|
Setting widow constraints cross platform? |
jmasterx
Member #11,410
October 2009
|
I'm using Allegro 5.0.4. For my game, which will work for Windows, OSX, and Linux, it will be important for the window never to get any smaller than 320,240. Is there some way I can use ifdefs and native APU calls to do this myself since Allegro has not yet implemented this feature? Thanks Agui GUI API -> https://github.com/jmasterx/Agui |
J-Gamer
Member #12,491
January 2011
|
You could have a response to resize events which resizes the screen to 320,240 if it gets smaller trough the bool al_resize_display(ALLEGRO_DISPLAY *display, int width, int height) function. Example: if(ev.type==ALLEGRO_DISPLAY_RESIZE) { if(ev.display.width<320 || ev.display.height<240) al_resize_display(ev.display.source,320,240); }
" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo |
Tobias Dammers
Member #2,604
August 2002
|
J-Gamer: Your code would resize the window to 320x240 if the user drags it to 640x230. Not sure if that is desirable - 640x240 would be much more intuitive. --- |
jmasterx
Member #11,410
October 2009
|
The problem here is the screen can still be resized to smaller then it pops to 320x240. Agui GUI API -> https://github.com/jmasterx/Agui |
J-Gamer
Member #12,491
January 2011
|
Tobias Dammers said: J-Gamer: Your code would resize the window to 320x240 if the user drags it to 640x230. Not sure if that is desirable - 640x240 would be much more intuitive. I wrote that kind of in a hurry... This would be better: if(ev.type==ALLEGRO_DISPLAY_RESIZE) { if(ev.display.width<320 || ev.display.height<240) { int new_height = ev.display.height; int new_width = ev.display.width; if(new_width<320) new_width = 320; if(new_height<240) new_height = 240; al_resize_display(ev.display.source,new_width,new_height); } } Better now? jmasterx said: The problem here is the screen can still be resized to smaller then it pops to 320x240. I don't know a fix for that, but I don't see why you would even want the behaviour in the first place. " There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo |
|