Code: Select all
InitKeyboard()
InitSprite()
UseJPEGImageEncoder()
#width=1000
#height=1000
#height1=4000
#width1=4000
#ImgGadget=0
Global.i x,y,xo,yo,ti,c,h,col
Global.i c=1,re=1,gr=1,bl=1
Global.i reo=1,gro=1,blo=1
x=#width/2:y=#height/2
Global.i h=1:ti=1
Global main=OpenWindow(#PB_Any,10,10,#width,#height,"Drawing")
Global wmain=OpenWindowedScreen(WindowID(main),0,0,#width,#height)
Global image=CreateImage(#PB_Any, #width1,#height1)
ImageGadget(#ImgGadget, 0, 0, #width1, #height1, ImageID(image))
Global imagesc=CreateImage(#PB_Any, #width,#height)
ImageGadget(#ImgGadget, 0, 0, #width, #height, ImageID(imagesc))
Procedure SDRAW()
StartDrawing(ImageOutput(image))
Circle(Random(3800,200),Random(3800,200),Random(200,1),Random(16777216,1))
StopDrawing()
EndProcedure
Repeat
ExamineKeyboard()
Event = WindowEvent()
SDRAW()
CopyImage(image,copy)
ResizeImage(copy,1000,1000)
StartDrawing(ImageOutput(imagesc))
DrawImage(ImageID(scaled),0,0)
StopDrawing()
SetGadgetState(#ImgGadget, ImageID(imagesc))
;FlipBuffers()
;Delay(100)
If Event = #PB_Event_CloseWindow
End
EndIf
If KeyboardPushed(#PB_Key_Escape)
quit=#True
EndIf
If KeyboardPushed(#PB_Key_Space)
Delay(800)
EndIf
If KeyboardPushed(#PB_Key_W)
SaveImage(image,"Randraw - "+FormatDate("%yyyy%mm%dd_%hh%ii%ss", Date())+Str(Random(9999,1))+".bmp", #PB_ImagePlugin_BMP)
Delay(500)
EndIf
If Event = #PB_Event_CloseWindow Or KeyboardPushed(#PB_Key_Escape)
Quit=#True
ElseIf Event = #PB_Event_Gadget
EventGadget = EventGadget()
Select EventGadget
EndSelect
EndIf
Until quit=#True
I assume it is something to do with how I update the window or have the program react with the window.
One thing I have noticed is that, the mouse pointer appears as a timer until the screen goes black, and after it is back from being black, then the pointer is a proper mouse pointer again. Any ideas what might cause this?