ResizeScreen

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

ResizeScreen

Post 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
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Yeah, this would be really nice!
PB 4.30

Code: Select all

onErrorGoto(?Fred)
PureLust
Enthusiast
Enthusiast
Posts: 477
Joined: Mon Apr 16, 2007 3:57 am
Location: Germany, NRW

Post by PureLust »

Where is the Problem with closing and reopening a new WindowedScreen?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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....
oh... and have a nice day.
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post 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.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post 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
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

hm... not a bad idea...

seemed strange at first glance, but gets better the longer I think about... :D
oh... and have a nice day.
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post 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.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

True, but until you can resize the screen it is a workaround that preserves your sprites etc.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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...
oh... and have a nice day.
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post 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.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post 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.
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

*push* ^^
ZeHa
User
User
Posts: 38
Joined: Sun Apr 24, 2005 11:39 pm

Post by ZeHa »

ResizeScreen() would also be nice for non-windowed screens of course ;)
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Post Reply