Guest User

Untitled

a guest
Apr 8th, 2014
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import graphics, sdl, sdl_image, colors
  2. import os, strutils
  3.  
  4. var surface: graphics.PSurface = newScreenSurface(640, 480)
  5. var event: TEvent
  6. var x:int=0
  7.  
  8. block game_loop:
  9.  
  10. while true:
  11. sleep(50)
  12.  
  13. while pollEvent(addr event) > 0:
  14. surface.FillRect((0,0,640,480), colBlack);
  15. surface.drawCircle((x, 100), 60, colRed)
  16. SDL.UpdateRect(surface.s, 0, 0, 640, 480)
  17. x=x+1
  18.  
  19. if event.kind == KEYDOWN:
  20. echo "hello"
  21. break game_loop
  22. if event.kind == QUITEV:
  23. echo "hello"
  24. break game_loop
Add Comment
Please, Sign In to add comment