Full Screen in Max Gui

BlitzMax Forums/BlitzMax Programming/Full Screen in Max Gui

I have a game that I have running in 1024*768 (using the graphics command). But I want to change this to enable it to use some of the GUI gadgets.

So I want to run the game within a window but at 1024*768 resolution, whilst still appearing that the game is running in full screen mode. I can hide the title bar and other bits of the window, and size it so it appears full screen on a monitor running at 1024*768 but if the resolution on the monitor is greater - say 1280*1024 then the window obviously doesn't look like full screen mode.

I can maximize the window but I am worried about how the graphics will be scaled and how calculations and positions will be affected - e.g. will an item positioned at 10,10 appear in the same position relatively on a maximized window compared to a normal one or is the some form of scaling required?

Any helpful tips would be much appreciated - or if I am just talking rubbish then sarcastic derision is fine too.

well heres some code you can try out:
SuperStrict

Global myWindow:TGadget = CreateWindow("Full screen", 0, 0, ClientWidth(Desktop()), ClientHeight(Desktop()), Null, 0)

Global myCanvas:TGadget = CreateCanvas(0, 0, ClientWidth(myWindow), ClientHeight(myWindow), myWindow)
SetGadgetLayout(myCanvas, 1, 1, 1, 1)

Global myButton:TGadget = CreateButton("Exit", (ClientWidth(myCanvas) / 2) - (75), (ClientHeight(myCanvas) / 2) - 20, 150, 40, myCanvas)

Global myTimer:TTimer = CreateTimer(60)

While True
	
	WaitEvent()
	
	Local event:TEvent = CurrentEvent
	
	Select event.id
	
		Case EVENT_WINDOWCLOSE
			End
		
		Case EVENT_GADGETACTION
			If event.source = myButton Then End
		
		Case EVENT_TIMERTICK
			RedrawGadget(myCanvas)
			
		Case EVENT_GADGETPAINT
			If event.source = myCanvas Then 
				Update(myCanvas)
				Render(myCanvas)
			EndIf
	
	End Select
	
Wend

Function Render(_canvas:TGadget)
	
	SetGraphics(CanvasGraphics(_canvas))
	
	Cls
	

	SetColor 0, 255, 0
	DrawRect 0, 0, GraphicsWidth(), 5
	DrawRect 0, 0, 5, GraphicsHeight()
	DrawRect 0, GraphicsHeight() - 5, GraphicsWidth(), 5
	DrawRect GraphicsWidth() - 5, 0, 5, GraphicsHeight()

	SetColor 255, 0, 0
	DrawRect(GraphicsWidth() - 105, GraphicsHeight() - 105, 100, 100) 
	
	SetColor 0, 0, 255
	DrawRect(5, 5, 100, 100)
	
	SetColor 255, 255, 255
	DrawRect(GraphicsWidth() - 5 - 100, 5, 100, 100)
	DrawRect(5, GraphicsHeight() - 5 - 100, 100, 100)
	
	Flip
	
End Function 

Function Update(_canvas:TGadget)
	
	SetGraphics(CanvasGraphics(_canvas))
	
End Function


I have tried it at 1024*768 and 1280*1024 and it looks perfect.

As far as I can tell with the above code is that you wont need to scale it, 10x10 is the same on any res.

OH and you may note that I use clientwidth/height(desktop) instead of maximize the window though it should work the same if you just maximize it.

Brill - that looks like the ticket! Thanks a lot Diablo