Page 1 of 2

ResizeScreen

Posted: Mon Apr 23, 2007 1:17 am
by Hroudtwolf
Hello,

I have a little wish, again.
A ResizeScreen-Function for OpenWindowedScreen would be very helpful.
I believe, that wouldn't be a problem. 'Cause you only would have to change the buffer- and clientarea-size.


Best regards


Wolf

Posted: Mon Apr 23, 2007 3:14 pm
by AND51
Yeah, this would be really nice!

Posted: Tue Apr 24, 2007 3:19 pm
by PureLust
Where is the Problem with closing and reopening a new WindowedScreen?

Posted: Tue Apr 24, 2007 3:44 pm
by Kaeru Gaman
PureLust wrote:Where is the Problem with closing and reopening a new WindowedScreen?
you'll have to reload every single sprite.
I think that is the background of this request....

Posted: Tue Apr 24, 2007 11:19 pm
by Hroudtwolf
Yes, that's true.

It's very much more performance to resize only the buffer and the clientarea
instead of the closing and the following reopening of the screen.

Kaeru said it already.
All sprites would be droped while a reopening of the screen.

Posted: Wed Apr 25, 2007 12:03 pm
by Derek
As a workaround you can always put the windowedscreen() in a containergadget and then just resize the gadget.

Just open the screen/gadget combo to the biggest size you will need to start with.

Code: Select all

InitSprite()
OpenWindow(0,0,0,800,600,"",$ca0001)
CreateGadgetList(WindowID(0))
ContainerGadget(1,0,0,600,600)
OpenWindowedScreen(GadgetID(1),0,0,600,600,0,0,0)
CloseGadgetList()
ButtonGadget(2,650,300,100,20,"Click to resize")
CreateSprite(2,40,40)
StartDrawing(SpriteOutput(2))
Box(0,0,40,40,0)
StopDrawing()
x=100
y=100
xd=-1
yd=-1
maxx=560
maxy=560
Repeat
  ClearScreen(#White)
  DisplaySprite(2,x,y)
  FlipBuffers()
  x+xd
  y+yd
  If x=0 Or x=maxx
    xd=-xd
  EndIf
  If y=0 Or y=maxy
    yd=-yd
  EndIf
  e=WindowEvent()
  If e=#PB_Event_Gadget
    gad=EventGadget()
    If gad=2
      x=100
      y=100
      maxx=400
      maxy=400
      ResizeGadget(1,0,0,440,440)
    EndIf
  EndIf
Until e=#PB_Event_CloseWindow

Posted: Wed Apr 25, 2007 1:51 pm
by Kaeru Gaman
hm... not a bad idea...

seemed strange at first glance, but gets better the longer I think about... :D

Posted: Wed Apr 25, 2007 2:11 pm
by Hroudtwolf
@Derek

Sorry.
But it isn't an appropriate option.
It should be possible to resize the windowed screen free while receiving #WM_PAINT message.
Your way does just cover the screen. It isn't a real resizing.

Posted: Wed Apr 25, 2007 2:14 pm
by Derek
True, but until you can resize the screen it is a workaround that preserves your sprites etc.

Posted: Wed Apr 25, 2007 2:36 pm
by Kaeru Gaman
I also think it's a appropriate workaround.

you always would have to keep track of the actual size after resizing,
store the actual size in variables to adjust your display according to it.
it's not that a big difference to do that with a risizing container instead of a resizing screen...

Posted: Wed Apr 25, 2007 2:50 pm
by Hroudtwolf
This is an resizing of the containergadget and not of the screen.
If I would want to resize the screen after an resolutions-switch (from i.ex. 1024x768 to 1280x800) of my desktop, then it wouldn't work.

Posted: Wed Apr 25, 2007 3:00 pm
by Derek
If you had a windowscreen of 1024*768 and you change the resolution of the desktop to 1280*800 then you would have to change the size of your window anyway as it would not automatically change so what is the difference in using a containergadget set to 1024*768 to startwith and opening a screen of 1280*800 in it.

Anyway, you are right it is not the idea solution.

Posted: Wed Jan 16, 2008 9:08 am
by Hroudtwolf
*push* ^^

Posted: Wed Jan 16, 2008 9:09 am
by ZeHa
ResizeScreen() would also be nice for non-windowed screens of course ;)

Posted: Fri Apr 04, 2008 4:59 pm
by nco2k
even if this wish is already old, i have to total agree. closing and reopening a windowed screen, is just a waste of performance. a real ResizeWindowedScreen() function, without the need for reloading the sprites again, would be very awesome. :)

c ya,
nco2k