Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Resizing Window  (Read 28615 times)

0 Members and 6 Guests are viewing this topic.

aface

  • Newbie
  • *
  • Posts: 8
    • View Profile
Resizing Window
« on: May 24, 2008, 03:59:09 am »
It would be very useful to be able to set a minimum screen size for resizable windows (ie a user can't resize smaller than x width and y height.)

When resizing a window, it currently goes black. It should allow redrawing as normal (or at least have a special callback function for drawing during resize).
Alex

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Resizing Window
« Reply #1 on: May 24, 2008, 05:44:06 am »
Quote
It would be very useful to be able to set a minimum screen size for resizable windows (ie a user can't resize smaller than x width and y height.)

That's a very specific feature. If I start implementing such functions, I would possibly have plenty of them to add. That's always the same problem, defining a limit to the windowing features of SFML (which is not a GUI library).

However, you can still use a real GUI library which provide such features,  like Qt or wxWidgets, and embed a SFML view into it.
Laurent Gomila - SFML developer

aface

  • Newbie
  • *
  • Posts: 8
    • View Profile
Resizing Window
« Reply #2 on: May 24, 2008, 08:55:07 am »
I certainly agree with you in the need to keep the interface as minimal and simple as possible.

I'm trying to think of a situation where somebody would want the user to be able to resize to very small proportions and can't. :lol:

If the user is able to resize to any proportions without restriction, then I can't see any use to the resize style.

Nice library by the way. Very well set out, and a nice small set of functions for each interface that just get's the job done.

Alex
Alex

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Resizing Window
« Reply #3 on: May 24, 2008, 09:06:24 am »
Quote
If the user is able to resize to any proportions without restriction, then I can't see any use to the resize style

What do you mean ?
Laurent Gomila - SFML developer

aface

  • Newbie
  • *
  • Posts: 8
    • View Profile
Resizing Window
« Reply #4 on: May 24, 2008, 01:49:19 pm »
I mean that the user is able to resize a window down to 1pixel x 1pixel if he wants and i can't think of any reason this would be a useful thing. I think there will always be a minimum screen size the programmer should be able to set. - Also im talking about windowed mode here.

Also - as a separate question - is there any way to change the size of a renderwindow after it's creation? If not - then I can see i'll have great troubles switching to sfml. Because
a) you cant use the resize flag for windows (because the user can make his screen rediculously small for example), and b) I cant see how you change the width/height of an existing renderwindow.

Any info you could provide would be much appreciated.
Alex

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Resizing Window
« Reply #5 on: May 24, 2008, 05:47:02 pm »
Quote
I mean that the user is able to resize a window down to 1pixel x 1pixel if he wants and i can't think of any reason this would be a useful thing

Or just assume that users won't do such stupid things, or at least they shouldn't expect much when doing it. What's the problem of this on your side ?

Quote
I cant see how you change the width/height of an existing renderwindow

There's no direct way, but you can still recreate the window.
Laurent Gomila - SFML developer

aface

  • Newbie
  • *
  • Posts: 8
    • View Profile
Resizing Window
« Reply #6 on: May 25, 2008, 12:15:22 am »
Hmm not sure i agree with you about assuming users won't do stupid things. I've worked as a programmer in the games industry for too long :)
The problem with assuming users wont do stupid things is that it's a false assumption. People *always* do stupid things.

For a little background - our game is mostly gui based - in our current engine when you stretch the screen, the gui elements re-arrange themselves automatically as they are set in relation to the screen size. Now if you go below a certain level, they will overlap and be cut off (because there is a minimum you can resize some things like text and buttons). If this happens in our game, we will get support emails complaining 'bugs'. There is currently no way around this - short of not allowing the user to resize the window.

Ok - Is there any possible way to provide a SetSize function for the window? (It should probably be there as there is a SetPosition already existing). That way, if we received a resize event which is smaller than our minimum value, we can simply call window.SetSize to our minimum size?

Lastly - having to destroy / create the window again just to set it's width/height seems way too much work for a function that should probably be there. I tried this suggestion, but it also suffers from the problem that the X/Y position of the window changes when you go through the destroy/create (on my winXP using SFML1.2). There is a way to set the X/Y position of a window - but no way to get the current x/y position.

So In Short - Can you add a SetSize() function to window, and GetPosition() (or GetLeft(), GetTop()) ?
Alex

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Resizing Window
« Reply #7 on: May 25, 2008, 08:57:25 am »
I understand your point of view. I know that users always do stupid things, however I couldn't imagine anyone sending a bug report after resizing the game window to ridiculous dimensions :D

I'll think about adding such features to the window class.
Laurent Gomila - SFML developer

aface

  • Newbie
  • *
  • Posts: 8
    • View Profile
Resizing Window
« Reply #8 on: May 25, 2008, 09:27:07 am »
Thank you for thinking about it.

Otherwise the conversion process for my project has been really easy.
Alex

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
Resizing Window
« Reply #9 on: May 25, 2008, 11:33:50 am »
I also think the addition of the methods above would be useful.

quasius

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Resizing Window
« Reply #10 on: May 25, 2008, 06:39:17 pm »
Thirded.  Never, never underestimate the stupidity of end users.  "An idiot with a computer is a faster, better idiot..."

Kernelpanic

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • http://eisenholz.bplaced.net
Resizing Window
« Reply #11 on: May 26, 2008, 06:05:42 pm »
Hey, you can use SetView and Create instead of something like SetHeight.

aface

  • Newbie
  • *
  • Posts: 8
    • View Profile
Resizing Window
« Reply #12 on: May 27, 2008, 12:51:07 am »
As i understand it, setview will allow me to scale the whole screen.
Most games will actually adjust the GUI layout at different screen sizes so you can see more of the map etc at higher resolutions, not just scale the screen (which is what i understand setview does). You also would get image quality issues when scaling.

Using create to create a whole new window when you want to perform something like a size change seems unnecessarily complicated. It also adds the need to store a pointer to a renderwindow allocated on the heap, so you can destroy/recreate it. Also, when you re-create the window, it's x/y position changes.
Alex

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Resizing Window
« Reply #13 on: May 27, 2008, 06:07:14 pm »
Everything is right, except that you don't need to dynamically allocate a window to recreate it ; just use the Create function.
Laurent Gomila - SFML developer