createtimer_1.bmx 530 B

1234567891011121314151617181920212223242526
  1. 'Animation on MaxGUI canvas
  2. SuperStrict
  3. Import MaxGUI.Drivers
  4. Local MyWindow:TGadget=CreateWindow("Canvas Example", 200,200,320,240)
  5. Local MyCanvas:TGadget=CreateCanvas(10,10,290,140,MyWindow)
  6. Local timer:TTimer=CreateTimer(60)
  7. Local x:Int=0
  8. Repeat
  9. WaitEvent()
  10. Select EventID()
  11. Case EVENT_WINDOWCLOSE
  12. End
  13. Case EVENT_TIMERTICK
  14. x=x+1
  15. If x>240 x=0
  16. RedrawGadget(MyCanvas)
  17. Case EVENT_GADGETPAINT
  18. SetGraphics CanvasGraphics (MyCanvas)
  19. Cls
  20. DrawRect x,20,50,80
  21. Flip
  22. End Select
  23. Forever