source: libcaca/trunk/ruby/ruby-caca.dox @ 2042

Last change on this file since 2042 was 2042, checked in by Pascal Terjan, 13 years ago
  • Add Caca::Event#quit? to make tests nicer
File size: 1.6 KB
Line 
1/* $Id$ */ /** \page libcaca-ruby-api Libcaca Ruby API
2
3The classes available for libcaca are :
4
5\li \b Caca::Display
6\li \b Caca::Event
7\li \b Caca::Event::Key
8\li \b Caca::Event::Key::Press
9\li \b Caca::Event::Key::Release
10\li \b Caca::Event::Mouse
11\li \b Caca::Event::Mouse::Press
12\li \b Caca::Event::Mouse::Release
13\li \b Caca::Event::Mouse::Motion
14\li \b Caca::Event::Resize
15\li \b Caca::Event::Quit
16
17\code
18irb(main):007:0> Caca::Display.instance_methods.sort -
19Caca::Display.ancestors[1].instance_methods
20=> ["get_event", "height", "mouse=", "mouse_x", "mouse_y", "refresh",
21"set_mouse", "set_time", "set_title", "time", "time=", "title=", "width"]
22\endcode
23
24\code
25irb(main):008:0> Caca::Event.constants
26=> ["Key", "Quit", "TYPE", "Mouse", "Resize"]
27\endcode
28
29\code
30irb(main):009:0> Caca::Event::Key.instance_methods - Caca::Event::Key.ancestors[1].instance_methods
31=> ["ch", "utf32", "utf8"]
32\endcode
33
34\code
35irb(main):010:0> Caca::Event::Key.instance_methods - Caca::Event::Mouse.ancestors[1].instance_methods
36=> ["ch", "utf32", "utf8"]
37\endcode
38
39\code
40irb(main):011:0> Caca::Event::Mouse.instance_methods - Caca::Event::Mouse.ancestors[1].instance_methods
41=> ["button", "x", "y"]
42\endcode
43
44\code
45irb(main):018:0> Caca::Event::Resize.instance_methods - Caca::Event::Resize.ancestors[1].instance_methods
46=> ["w", "h"]
47\endcode
48
49\section Samples
50
51\code
52require 'caca'
53c = Cucul::Canvas.new(20,10)
54c.put_str(2, 3, "plop!")
55c.draw_thin_polyline([[0,0], [0,2], [5,2], [0,0]])
56d = Caca::Display.new(c)
57d.title = "Test !"
58d.refresh
59while((e = d.get_event(Caca::Event, -1)) && ! e.quit?)
60    p e
61    d.refresh
62end
63\endcode
64
65*/
Note: See TracBrowser for help on using the repository browser.