You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

92 lines
2.0 KiB

  1. /* $Id$ */ /** \page libcaca-ruby-api Libcaca Ruby API
  2. The classes available for libcaca are :
  3. \li \b Caca::Display
  4. \li \b Caca::Event
  5. \li \b Caca::Event::Key
  6. \li \b Caca::Event::Key::Press
  7. \li \b Caca::Event::Key::Release
  8. \li \b Caca::Event::Mouse
  9. \li \b Caca::Event::Mouse::Press
  10. \li \b Caca::Event::Mouse::Release
  11. \li \b Caca::Event::Mouse::Motion
  12. \li \b Caca::Event::Resize
  13. \li \b Caca::Event::Quit
  14. \code
  15. $ irb -rcaca
  16. irb(main):001:0> class Object
  17. irb(main):002:1> def Object.my_instance_methods
  18. irb(main):003:2> instance_methods.sort - ancestors[1].instance_methods
  19. irb(main):004:2> end
  20. irb(main):005:1> def Object.my_methods
  21. irb(main):006:2> methods.sort - ancestors[1].methods
  22. irb(main):007:2> end
  23. irb(main):008:1> end
  24. \endcode
  25. \code
  26. irb(main):009:0> Caca.my_methods
  27. => ["version"]
  28. \endcode
  29. \code
  30. irb(main):010:0> Caca::Display.my_instance_methods
  31. => ["canvas", "get_event", "height", "mouse=", "mouse_x", "mouse_y", "refresh",
  32. "set_mouse", "set_time", "set_title", "time", "time=", "title=", "width"]
  33. \endcode
  34. \code
  35. irb(main):011:0> Caca::Event.constants
  36. => ["Key", "Quit", "TYPE", "Mouse", "Resize"]
  37. \endcode
  38. \code
  39. irb(main):012:0> Caca::Event.my_instance_methods
  40. => ["quit?"]
  41. \endcode
  42. \code
  43. irb(main):013:0> Caca::Event::Key.my_instance_methods
  44. => ["ch", "utf32", "utf8"]
  45. \endcode
  46. \code
  47. irb(main):014:0> Caca::Event::Mouse.my_instance_methods
  48. => ["button", "x", "y"]
  49. \endcode
  50. \code
  51. irb(main):015:0> Caca::Event::Resize.my_instance_methods
  52. => ["w", "h"]
  53. \endcode
  54. \section Samples
  55. \code
  56. require 'caca'
  57. c = Cucul::Canvas.new(20,10)
  58. c.put_str(2, 3, "plop!")
  59. c.draw_thin_polyline([[0,0], [0,2], [5,2], [0,0]])
  60. d = Caca::Display.new(c)
  61. d.title = "Test !"
  62. d.refresh
  63. # Redefine Event::Key#quit? so that q, Q, and Esc become exit keys
  64. module Caca
  65. class Event::Key
  66. def quit?
  67. "qQ^[".split('').member?(@ch.chr)
  68. end
  69. end
  70. end
  71. while((e = d.get_event(Caca::Event, -1)) && ! e.quit?)
  72. p e
  73. d.refresh
  74. end
  75. \endcode
  76. */