Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Allegro 4.2 window size constraints

This thread is locked; no one can reply to it. rss feed Print
Allegro 4.2 window size constraints
jmasterx
Member #11,410
October 2009

Hello,
I'm making a game in Allegro that requires the game to be a certain size based on the desktop resolution. I developed a resizing algorithm that ensures the window is never bigger than DESKTOP_WIDTH - 40, DESKTOP_HEIGHT - 40.
It seems however that at certain resolutions, Allegro crashes on initializing the graphics. my algorithm will for instance on 1280 * 800 resolution, -> Allegro Window of 1042 * 613... is there an additional constraint I should be imposing on my window sizing algorithm?

Thanks

gnolam
Member #2,030
March 2002
avatar

Try to keep your window sizes as multiples of four. But it shouldn't crash under any circumstances - how are you handling failures of set_gfx_mode()?

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Thomas Fjellstrom
Member #476
June 2000
avatar

I think set_gfx_mode will fail if you try to make a window larger than the screen (including the window border), so always check the return value of set_gfx_mode, and retry with a smaller size.

--
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

jmasterx
Member #11,410
October 2009

FIXED IT!!!

They HAVE to be multiples of 2...

Matthew Leverton
Supreme Loser
January 1999
avatar

It needs to be a multiple of four.

jmasterx
Member #11,410
October 2009

After testing, multiples of 8 fixed everything, thanks all

Trent Gamblin
Member #261
April 2000
avatar

Just to make sure use multiples of 16.

Tobias Dammers
Member #2,604
August 2002
avatar

To make really really extra super sure, use multiples of 0x1000.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Mark Oates
Member #1,146
March 2001
avatar

use multiples of PI.

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

GullRaDriel
Member #3,861
September 2003
avatar

You're all wrong. It's just a parameter of the gold number derivative.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

type568
Member #8,381
March 2007
avatar

You're all wrong. It's just a parameter of the gold number derivative.

Nope, it's all about multiple of current NASDAQ index.

Neil Black
Member #7,867
October 2006
avatar

I just make my resolution be 42.

Go to: