@@ -15,10 +15,17 @@ | |||||
#include "caca-display.h" | #include "caca-display.h" | ||||
#include "caca-event.h" | #include "caca-event.h" | ||||
static VALUE get_version(VALUE self) | |||||
{ | |||||
return rb_str_new2(caca_get_version()); | |||||
} | |||||
void Init_caca() | void Init_caca() | ||||
{ | { | ||||
VALUE mCaca = rb_define_module("Caca"); | VALUE mCaca = rb_define_module("Caca"); | ||||
rb_define_singleton_method(mCaca, "version", get_version, 0); | |||||
Init_caca_display(mCaca); | Init_caca_display(mCaca); | ||||
Init_caca_event(mCaca); | Init_caca_event(mCaca); | ||||
} | } |
@@ -16,10 +16,17 @@ | |||||
#include "cucul-dither.h" | #include "cucul-dither.h" | ||||
#include "cucul-font.h" | #include "cucul-font.h" | ||||
static VALUE get_version(VALUE self) | |||||
{ | |||||
return rb_str_new2(cucul_get_version()); | |||||
} | |||||
void Init_cucul() | void Init_cucul() | ||||
{ | { | ||||
VALUE mCucul = rb_define_module("Cucul"); | VALUE mCucul = rb_define_module("Cucul"); | ||||
rb_define_singleton_method(mCucul, "version", get_version, 0); | |||||
rb_define_const(mCucul, "BLACK", INT2FIX(CUCUL_BLACK)); | rb_define_const(mCucul, "BLACK", INT2FIX(CUCUL_BLACK)); | ||||
rb_define_const(mCucul, "BLUE", INT2FIX(CUCUL_BLUE)); | rb_define_const(mCucul, "BLUE", INT2FIX(CUCUL_BLUE)); | ||||
rb_define_const(mCucul, "GREEN", INT2FIX(CUCUL_GREEN)); | rb_define_const(mCucul, "GREEN", INT2FIX(CUCUL_GREEN)); | ||||
@@ -24,34 +24,41 @@ irb(main):005:1> def Object.my_methods | |||||
irb(main):006:2> methods.sort - ancestors[1].methods | irb(main):006:2> methods.sort - ancestors[1].methods | ||||
irb(main):007:2> end | irb(main):007:2> end | ||||
irb(main):008:1> end | irb(main):008:1> end | ||||
\endcode | |||||
irb(main):009:0> Caca::Display.my_instance_methods | |||||
\code | |||||
irb(main):009:0> Caca.my_methods | |||||
=> ["version"] | |||||
\endcode | |||||
\code | |||||
irb(main):010:0> Caca::Display.my_instance_methods | |||||
=> ["get_event", "height", "mouse=", "mouse_x", "mouse_y", "refresh", | => ["get_event", "height", "mouse=", "mouse_x", "mouse_y", "refresh", | ||||
"set_mouse", "set_time", "set_title", "time", "time=", "title=", "width"] | "set_mouse", "set_time", "set_title", "time", "time=", "title=", "width"] | ||||
\endcode | \endcode | ||||
\code | \code | ||||
irb(main):010:0> Caca::Event.constants | |||||
irb(main):011:0> Caca::Event.constants | |||||
=> ["Key", "Quit", "TYPE", "Mouse", "Resize"] | => ["Key", "Quit", "TYPE", "Mouse", "Resize"] | ||||
\endcode | \endcode | ||||
\code | \code | ||||
irb(main):011:0> Caca::Event.my_instance_methods | |||||
irb(main):012:0> Caca::Event.my_instance_methods | |||||
=> ["quit?"] | => ["quit?"] | ||||
\endcode | \endcode | ||||
\code | \code | ||||
irb(main):012:0> Caca::Event::Key.my_instance_methods | |||||
irb(main):013:0> Caca::Event::Key.my_instance_methods | |||||
=> ["ch", "utf32", "utf8"] | => ["ch", "utf32", "utf8"] | ||||
\endcode | \endcode | ||||
\code | \code | ||||
irb(main):013:0> Caca::Event::Mouse.my_instance_methods | |||||
irb(main):014:0> Caca::Event::Mouse.my_instance_methods | |||||
=> ["button", "x", "y"] | => ["button", "x", "y"] | ||||
\endcode | \endcode | ||||
\code | \code | ||||
irb(main):014:0> Caca::Event::Resize.my_instance_methods | |||||
irb(main):015:0> Caca::Event::Resize.my_instance_methods | |||||
=> ["w", "h"] | => ["w", "h"] | ||||
\endcode | \endcode | ||||
@@ -20,7 +20,9 @@ irb(main):005:1> def Object.my_methods | |||||
irb(main):006:2> methods.sort - ancestors[1].methods | irb(main):006:2> methods.sort - ancestors[1].methods | ||||
irb(main):007:2> end | irb(main):007:2> end | ||||
irb(main):008:1> end | irb(main):008:1> end | ||||
\endcode | |||||
\code | |||||
irb(main):009:0> Cucul.constants | irb(main):009:0> Cucul.constants | ||||
=> ["BROWN", "BOLD", "GREEN", "LIGHTMAGENTA", "LIGHTBLUE", "BLINK", | => ["BROWN", "BOLD", "GREEN", "LIGHTMAGENTA", "LIGHTBLUE", "BLINK", | ||||
"MAGENTA", "DEFAULT", "TRANSPARENT", "BLUE", "LIGHTRED", "DARKGRAY", | "MAGENTA", "DEFAULT", "TRANSPARENT", "BLUE", "LIGHTRED", "DARKGRAY", | ||||
@@ -29,12 +31,17 @@ irb(main):009:0> Cucul.constants | |||||
\endcode | \endcode | ||||
\code | \code | ||||
irb(main):010:0> Cucul::Canvas.my_methods | |||||
irb(main):010:0> Cucul.my_methods | |||||
=> ["version"] | |||||
\endcode | |||||
\code | |||||
irb(main):011:0> Cucul::Canvas.my_methods | |||||
=> ["export_list", "import_list"] | => ["export_list", "import_list"] | ||||
\endcode | \endcode | ||||
\code | \code | ||||
irb(main):003:0> Cucul::Canvas.my_instance_methods | |||||
irb(main):012:0> Cucul::Canvas.my_instance_methods | |||||
=> ["attr=", "blit", "clear", "create_frame", "cursor_x", "cursor_y", | => ["attr=", "blit", "clear", "create_frame", "cursor_x", "cursor_y", | ||||
"dither_bitmap", "draw_box", "draw_circle", "draw_cp437_box", "draw_ellipse", | "dither_bitmap", "draw_box", "draw_circle", "draw_cp437_box", "draw_ellipse", | ||||
"draw_line", "draw_polyline", "draw_thin_box", "draw_thin_ellipse", | "draw_line", "draw_polyline", "draw_thin_box", "draw_thin_ellipse", | ||||
@@ -51,17 +58,17 @@ irb(main):003:0> Cucul::Canvas.my_instance_methods | |||||
\endcode | \endcode | ||||
\code | \code | ||||
irb(main):004:0> Cucul::Font.my_methods | |||||
irb(main):013:0> Cucul::Font.my_methods | |||||
=> ["list"] | => ["list"] | ||||
\endcode | \endcode | ||||
\code | \code | ||||
irb(main):005:0> Cucul::Font.my_instance_methods | |||||
irb(main):014:0> Cucul::Font.my_instance_methods | |||||
=> ["blocks", "height", "width"] | => ["blocks", "height", "width"] | ||||
\endcode | \endcode | ||||
\code | \code | ||||
irb(main):006:0> Cucul::Dither.my_instance_methods | |||||
irb(main):015:0> Cucul::Dither.my_instance_methods | |||||
=> ["algorithm=", "algorithm_list", "antialias=", "antialias_list", | => ["algorithm=", "algorithm_list", "antialias=", "antialias_list", | ||||
"brightness=", "charset=", "charset_list", "color=", "color_list", | "brightness=", "charset=", "charset_list", "color=", "color_list", | ||||
"contrast=", "gamma=", "palette=", "set_algorithm", "set_antialias", | "contrast=", "gamma=", "palette=", "set_algorithm", "set_antialias", | ||||