Scalable canvas / Graphics mode 3

BlitzPlus Forums/BlitzPlus Programming/Scalable canvas / Graphics mode 3

Hotcakes(Posted 2004) [#1]
I've forgotten how to do this. Or, rather, I've done what I thought should do it, but it's not happenning =] I'm trying to set up a 800x600 canvas on a window that covers the full screen:

Global dw=GadgetWidth(Desktop())
Global dh=GadgetHeight(Desktop())
Global pWindow=CreateWindow("",0,0,800,600,0,16+3)
Global menubuffer=CreateCanvas(0,0,800,600,pWindow)
SetGadgetLayout menubuffer,1,1,1,1
SetGadgetShape pWindow,0,0,dw,dh
SetBuffer CanvasBuffer(menubuffer)
ClsColor 0,0,0
Cls
FlipCanvas menubuffer
MouseWait
End

But as you can see, it remains an 800x600 canvas with the remaining space acting as a dead zone.


MattVonFat(Posted 2004) [#2]
It seems to work fine for me.


Eikon(Posted 2004) [#3]
Works fine for me too, but heres a better method that gets above the taskbar for true full screen in windowed mode:

userlib entry:
.lib "user32.dll"
SetWindowPos%(hWnd%,hAfter%,x%,y%,cx%,cy%,flags%)
B+ Code:
Window = CreateWindow("Full screen window", ClientWidth(Desktop())/2 - 403, ClientHeight(Desktop())/2 - 312, 806, 625, 0, 1)
Canvas = CreateCanvas(0, 0, 800, 600, Window)
SetGadgetLayout Canvas, 1, 2, 1, 2
SetBuffer CanvasBuffer(Canvas)

AutoSuspend 1
CreateTimer 60
Repeat

Select WaitEvent()
	Case $803: End ; X

	Case $101      ; Keydown
	If EventData() = 1 Then ; ESC
		End
	ElseIf EventData() = 57 Then ; Full screen
                SetWindowPos QueryObject(Window, 1), -1, 0, 0, ClientWidth(Desktop()), ClientHeight(Desktop()), 0
	EndIf
	
	Case $4001     ; Tick
	Cls

	If GadgetWidth(Window) <> ClientWidth(Desktop()) Then Text 1, 1, "Press SPACE to go full screen"
	
	VWait 1: FlipCanvas Canvas, 0

End Select
Forever



Hotcakes(Posted 2004) [#4]
Then, OK, my machine is doing stupid things. Time for a reset again probably.

Thanks for the code Eikon, I'll take a look at that right now in fact.


Hotcakes(Posted 2004) [#5]
Oh, I know what's going on. I had my program running in Native mode. It only works in DX mode. That screws up my plans for down the track then... OpenGL mode actually crashes on exit. I'll report that.


Hotcakes(Posted 2004) [#6]
OK Eikon, or somebody, how do I use SetWindowPos to stop the window from being forced ontop of all other windows? I'm much too lazy to look it up myself. Currently I'm just destroying/rebuilding the window. =]