Import MaxGUI.Drivers
Local Window:TGadget = CreateWindow("test",0,0,1920,1080,Null,0)
Local Canvas:TGadget = CreateCanvas(0,0,Window.ClientWidth(), Window.ClientHeight(),Window,0)
SetGadgetLayout(Canvas,1,1,1,1)
CreateTimer(60)
Local FPS:Short
Local FPSFrames:Short
Local FPSTime:Int
EnablePolledInput()
While Not (AppTerminate() Or KeyHit(KEY_ESCAPE))
SetGraphics CanvasGraphics(Canvas)
Cls
If MilliSecs() - FPSTime > 1000 Then
FPS = FPSFrames
FPSFrames = 0
FPSTime = MilliSecs()
Else
FPSFrames = FPSFrames + 1
EndIf
DrawText(FPS, 0, 0)
If KeyHit(KEY_F1) Then
EndGraphics()
FreeGadget(Canvas)
FreeGadget(Window)
Window = CreateWindow("test",0,0,800,600,Null,WINDOW_CENTER)
Canvas = CreateCanvas(0,0,Window.ClientWidth(), Window.ClientHeight(),Window,0)
SetGadgetLayout(Canvas,1,1,1,1)
SetGraphics CanvasGraphics(Canvas)
EndIf
Flip 0
Wend
Can someone help me out here?
After I free the Canvas and Window and remake them, everything goes smooth until it's time to draw anything (DrawText)
|