home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Caml Light 0.61 / Source / src / lib / graphics.ml < prev    next >
Encoding:
Text File  |  1993-09-24  |  970 b   |  52 lines  |  [TEXT/MPS ]

  1. #open "int";;
  2. #open "fstring";;
  3. #open "eq";;
  4.  
  5. let rgb r g b =
  6.   r lsl 16 + g lsl 8 + b
  7. ;;
  8.  
  9. let black   = 0
  10. and white   = 0xFFFFFF
  11. and red     = 0xFF0000
  12. and green   = 0x00FF00
  13. and blue    = 0x0000FF
  14. and yellow  = 0xFFFF00
  15. and cyan    = 0x00FFFF
  16. and magenta = 0xFF00FF
  17. ;;
  18.  
  19. let background = white
  20. and foreground = black
  21. ;;
  22.  
  23. let draw_ellipse x y rx ry = draw_arc x y rx ry 0 360;;
  24.  
  25. let draw_circle x y r = draw_arc x y r r 0 360;;
  26.  
  27. let fill_ellipse x y rx ry = fill_arc x y rx ry 0 360;;
  28.  
  29. let fill_circle x y r = fill_arc x y r r 0 360;;
  30.  
  31. let set_text_size sz = ();;
  32.  
  33. let transp = -1
  34. ;;
  35.  
  36. let get_image x y w h =
  37.   let image = create_image w h in
  38.   blit_image image x y;
  39.   image;;
  40.  
  41. let mouse_pos () =
  42.   let e = wait_next_event [Poll] in (e.mouse_x, e.mouse_y);;
  43.  
  44. let button_down () =
  45.   let e = wait_next_event [Poll] in e.button;;
  46.  
  47. let read_key () =
  48.   let e = wait_next_event [Key_pressed] in e.key;;
  49.  
  50. let key_pressed () =
  51.   let e = wait_next_event [Poll] in e.keypressed;;
  52.