Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » [al5] Setting the minimum and maximum window size?

This thread is locked; no one can reply to it. rss feed Print
 1   2 
[al5] Setting the minimum and maximum window size?
weapon_S
Member #7,859
October 2006
avatar

jmasterx said:

My biggest issue is that in Windows the old contents is stretched while resizing which I find ugly

::) Turn off 'show window contents while dragging'.

jmasterx
Member #11,410
October 2009

Where is this "show window contents while dragging" function you speak of?

If you mean for the OS, that's not what I mean, because that will not work for the end user.

Thomas Fjellstrom
Member #476
June 2000
avatar

jmasterx said:

If you mean for the OS, that's not what I mean, because that will not work for the end user

Thats exactly the point, the real end user of the game or app can have it set to what ever they want, so there is no way to enable/disable it properly from an app.

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

simast
Member #12,668
March 2011

+1 Would really love to see this implemented. I am currently restricting display window size using al_resize_display - but that feels more like a hack.

What if display constraints could be defined with display options? Like:

al_set_new_display_option(ALLEGRO_WINDOWED_MIN_WIDTH, 100, ALLEGRO_SUGGEST);
al_set_new_display_option(ALLEGRO_WINDOWED_MIN_HEIGHT, 100, ALLEGRO_SUGGEST);

And platforms that can't implement this functionality (iPhone or others?) will create or fail depending on display option importance parameter. I myself can't really see a scenario where someone will want to change display constraints after the display was created (thus a separate function like suggested al_set_window_constraints feels unnecessary).

Elias
Member #358
May 2000

The question then is why do we have al_set_new_window_position - you're even less likely to change the position than the size constraints.

But yes, my vote now is to use al_set_new_display_option and not add a new function.

--
"Either help out or stop whining" - Evert

jmasterx
Member #11,410
October 2009

Yea using the display options sounds good!
+1

Matthew Leverton
Supreme Loser
January 1999
avatar

I don't like the display options for this at all. This is something that you may want to change after creating the window.

And just typing:

al_set_new_display_option(ALLEGRO_WINDOWED_MIN_WIDTH, 100, ALLEGRO_SUGGEST);
al_set_new_display_option(ALLEGRO_WINDOWED_MIN_HEIGHT, 100, ALLEGRO_SUGGEST);
al_set_new_display_option(ALLEGRO_WINDOWED_MAX_WIDTH, 200, ALLEGRO_SUGGEST);
al_set_new_display_option(ALLEGRO_WINDOWED_MAX_HEIGHT, 200, ALLEGRO_SUGGEST);

vs:

al_set_window_constraints(display, 100,100, 200, 200);

No contest. :P

Edit:

Oh, we also need: bool al_set_display_flags/options(display, ... ); to change things that can be changed at run time regardless of which method the current topic uses.

Thomas Fjellstrom
Member #476
June 2000
avatar

Yeah, it'd be nice to be able to change certain options (like this one) without having to re-create the display.

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

kazzmir
Member #1,786
December 2001
avatar

Elias said:

The question then is why do we have al_set_new_window_position - you're even less likely to change the position than the size constraints.

To spawn the application at the same place the user left it last time.

Elias
Member #358
May 2000

kazzmir said:

To spawn the application at the same place the user left it last time.

That could be done with display options as well. A function is only needed if you want to change it after the display was created.

--
"Either help out or stop whining" - Evert

Matthew Leverton
Supreme Loser
January 1999
avatar

Elias said:

A function is only needed if you want to change it after the display was created.

I view it in the other way: a display option is only needed if you must set it before the display is created.

Evert
Member #794
November 2000
avatar

Elias said:

The question then is why do we have al_set_new_window_position - you're even less likely to change the position than the size constraints.

If I have a program with multiple windows (the interface to my chess program is what I'm thinking of), I want to arrange them on screen in a sensible way so they are neatly laid out. As opposed to letting the OS place each new window on top of the ones I already opened.

Matthew Leverton
Supreme Loser
January 1999
avatar

And to answer the question of why you would want to do it after the display is created... you might want to optionally "lock" the windows in such a way that as the user moves the main window, the toolbar windows are moved with it. This is particularly useful perhaps with a frameless window.

I think it's silly to artificially restrict Allegro just because we cannot think of a reason today of why something would be useful. Sooner or later somebody will stop by with a reason to need to change the constraints on the fly (etc).

I don't have a problem with constraints being part of window display options, as long as it can be set after the window is created as well. We already have a al_toggle_display_flag()... we basically just need an al_set_display_option() function as well.

But that said, I'd rather it not be a display option because I don't see any reason for it to be. Unlike things like "frameless" or window positions, the user isn't going to notice if the display is created and then subsequently constrained to a certain size.

 1   2 


Go to: