draw.4th 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. \ draw with dots
  2. base @ decimal
  3. variable pixel
  4. : dot-draw ( -- )
  5. lcd-cls
  6. s" CTP Dot Plotting" lcd-type
  7. lcd-cr lcd-cr
  8. s" Touch screen to place dot" lcd-type
  9. 9 lcd-text-rows 1- lcd-at-xy
  10. s" Clear" lcd-type
  11. 10 lcd-spaces
  12. s" Exit" lcd-type
  13. button-flush
  14. key-flush
  15. ctp-flush
  16. 1 pixel !
  17. begin
  18. ctp-pos? if
  19. ctp-pos dup 0<
  20. if
  21. 2drop
  22. else
  23. pixel @ if
  24. lcd-set-pixel
  25. else
  26. lcd-clear-pixel
  27. then
  28. then
  29. then
  30. button? if
  31. button
  32. case
  33. button-left of
  34. lcd-clear-all
  35. 1 pixel !
  36. endof
  37. button-centre of
  38. lcd-set-all
  39. 0 pixel !
  40. endof
  41. button-right of
  42. exit
  43. endof
  44. endcase
  45. then
  46. key? if
  47. key-flush
  48. then
  49. wait-for-event
  50. again
  51. ;
  52. base !