Like this?
Strict
'virtual canvas size - 640,480 more likely...
Local WIDTH=48,HEIGHT=16
SetGraphicsDriver GLMax2DDriver()
Local window:TGadget=CreateWindow( "Window!",0,0,640,480 )
Local canvas:TGadget=CreateCanvas( 0,0,ClientWidth(window),ClientHeight(window),window )
SetGadgetLayout canvas,1,1,1,1
While WaitEvent()<>EVENT_WINDOWCLOSE
Select EventID()
Case EVENT_TIMERTICK,EVENT_GADGETPAINT
'setup code
SetGraphics CanvasGraphics( canvas )
Local w#=GraphicsWidth(),h#=GraphicsHeight()
SetViewport 0,0,w,h
glLoadIdentity
glScalef w/WIDTH,h/HEIGHT,1
'your paint code - note: viewport might not work as expected
Cls
For Local x=0 Until 6
SetColor Sin(x*15)*255,Cos(x*30)*255,0
DrawRect x*8,0,8,16
Next
SetColor 255,255,255
DrawText "Hello!",0,0
Flip
End Select
Wend
|