Changing Offsets of a WindowedScreen?

Advanced game related topics
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Changing Offsets of a WindowedScreen?

Post by Kaeru Gaman »

it just occurred to me, is there such function?

I can resize a Window anyway I want.
If I want to keep the aspect ratio of a WindowedScreen,
I may happen to need to change the Offsets.

Is this possible somehow?
oh... and have a nice day.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

What exactly do you mean by offsets?
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

I think he means repostioning the screen (X/Y) during runtime, does he?
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

the x/y Position AND the RightOffset / BottomOffset.

Imagine you have a squarish WindowedScreen, say 640x640.
as windowed display, you will have it in a 640x640 window,
at position 0,0 with rightoffset 0 and bottomoffset 0.

now you want to maximize the Window to fit the whole 1024x768 Desktop.
you want the WindowedScreen autostretching, to fill the Desktop height.

so, you got to make the WindowedScreen autostretching to 768x768, to keep it's aspect ratio.
mich means, you need to change position to 128,0 and rightoffset to 128.


I was just pondering if I could open a windowedscreen autostretched in a ContainerGadget,
the Container I can resize any way I want.
oh... and have a nice day.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

I am not sure if you actually can resize a windowed screen without reopening it but you repostion it using a child window:

Code: Select all

InitSprite() : InitKeyboard()

OpenWindow(0,0,0,800,600,"void",#WS_OVERLAPPEDWINDOW | 1)
OpenWindow(1,10,10,640,480,"void",#WS_CHILD,WindowID(0))
OpenWindowedScreen(WindowID(1),0,0,640,480,0,0,0)

Repeat
	Repeat
		EventID = WindowEvent()
		
		Select EventID
			Case #PB_Event_SizeWindow
			ResizeWindow(1,WindowWidth(0)/2 - 320,WindowHeight(0)/2 - 240,#PB_Ignore,#PB_Ignore)
						
			Case #PB_Event_CloseWindow : End
		EndSelect
	Until EventID = 0
	
	FlipBuffers() 
	ClearScreen($AA6040)
		
	Delay(1)
ForEver
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

ah, I see. nice idea, I will keep it in mind.
something like that I already thought about, just missing the last jota with the child and overlapped.
thnx for adding this to my concept.

in fact, my question is not about resizing the screen, but its area of display.
the screen stays at same buffer size, say, 640x640.
it s on autostretch.

now you can resize the container window thus resizing the display area to any desired size, the screen stays 640x640.

this is why I thought about using a ContainerGadged as parent for the autostretch WindowedScreen,
I would not need a second window and can resize the Gadget.
oh... and have a nice day.
Post Reply