caca_wherey(), in order to match the old <conio.h> naming scheme.tags/v0.99.beta17
@@ -120,12 +120,12 @@ class Canvas { | |||
return caca_get_canvas_handle_y($this->cv); | |||
} | |||
function getCursorX() { | |||
return caca_get_cursor_x($this->cv); | |||
function whereX() { | |||
return caca_wherex($this->cv); | |||
} | |||
function getCursorY() { | |||
return caca_get_cursor_y($this->cv); | |||
function whereY() { | |||
return caca_wherey($this->cv); | |||
} | |||
function getChars() { | |||
@@ -31,8 +31,8 @@ static function_entry caca_functions[] = { | |||
PHP_FE(caca_rand, NULL) | |||
PHP_FE(caca_get_version, NULL) | |||
PHP_FE(caca_gotoxy, NULL) | |||
PHP_FE(caca_get_cursor_x, NULL) | |||
PHP_FE(caca_get_cursor_y, NULL) | |||
PHP_FE(caca_wherex, NULL) | |||
PHP_FE(caca_wherey, NULL) | |||
PHP_FE(caca_put_char, NULL) | |||
PHP_FE(caca_get_char, NULL) | |||
PHP_FE(caca_put_str, NULL) | |||
@@ -492,16 +492,16 @@ PHP_FUNCTION(caca_gotoxy) { | |||
RETURN_SUCCESS(caca_gotoxy(canvas, x, y)); | |||
} | |||
PHP_FUNCTION(caca_get_cursor_x) { | |||
PHP_FUNCTION(caca_wherex) { | |||
caca_canvas_t *canvas; | |||
FETCH_CANVAS(canvas); | |||
RETURN_LONG(caca_get_cursor_x(canvas)); | |||
RETURN_LONG(caca_wherex(canvas)); | |||
} | |||
PHP_FUNCTION(caca_get_cursor_y) { | |||
PHP_FUNCTION(caca_wherey) { | |||
caca_canvas_t *canvas; | |||
FETCH_CANVAS(canvas); | |||
RETURN_LONG(caca_get_cursor_y(canvas)); | |||
RETURN_LONG(caca_wherey(canvas)); | |||
} | |||
PHP_FUNCTION(caca_put_char) { | |||
@@ -44,8 +44,8 @@ PHP_FUNCTION(caca_get_canvas_attrs); | |||
PHP_FUNCTION(caca_rand); | |||
PHP_FUNCTION(caca_get_version); | |||
PHP_FUNCTION(caca_gotoxy); | |||
PHP_FUNCTION(caca_get_cursor_x); | |||
PHP_FUNCTION(caca_get_cursor_y); | |||
PHP_FUNCTION(caca_wherex); | |||
PHP_FUNCTION(caca_wherey); | |||
PHP_FUNCTION(caca_put_char); | |||
PHP_FUNCTION(caca_get_char); | |||
PHP_FUNCTION(caca_put_str); | |||
@@ -1,7 +1,7 @@ | |||
/* | |||
* libcaca .NET bindings for libcaca | |||
* Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | |||
* 2007 Sam Hocevar <sam@zoy.org> | |||
* 2007-2009 Sam Hocevar <sam@hocevar.net> | |||
* All Rights Reserved | |||
* | |||
* $Id$ | |||
@@ -115,14 +115,13 @@ namespace Caca | |||
private static extern int caca_gotoxy(IntPtr cv, int x, int y); | |||
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), | |||
SuppressUnmanagedCodeSecurity] | |||
private static extern int caca_get_cursor_x(IntPtr cv); | |||
private static extern int caca_wherex(IntPtr cv); | |||
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), | |||
SuppressUnmanagedCodeSecurity] | |||
private static extern int caca_get_cursor_y(IntPtr cv); | |||
private static extern int caca_wherey(IntPtr cv); | |||
public Point Cursor | |||
{ | |||
get { return new Point(caca_get_cursor_x(_c_cv), | |||
caca_get_cursor_y(_c_cv)); } | |||
get { return new Point(caca_wherex(_c_cv), caca_wherey(_c_cv)); } | |||
set { caca_gotoxy(_c_cv, value.X, value.Y); } | |||
} | |||
@@ -225,8 +225,8 @@ __extern char const * caca_get_version(void); | |||
* @{ */ | |||
#define CACA_MAGIC_FULLWIDTH 0x000ffffe /**< Used to indicate that the previous character was a fullwidth glyph. */ | |||
__extern int caca_gotoxy(caca_canvas_t *, int, int); | |||
__extern int caca_get_cursor_x(caca_canvas_t const *); | |||
__extern int caca_get_cursor_y(caca_canvas_t const *); | |||
__extern int caca_wherex(caca_canvas_t const *); | |||
__extern int caca_wherey(caca_canvas_t const *); | |||
__extern int caca_put_char(caca_canvas_t *, int, int, uint32_t); | |||
__extern uint32_t caca_get_char(caca_canvas_t const *, int, int); | |||
__extern int caca_put_str(caca_canvas_t *, int, int, char const *); | |||
@@ -506,7 +506,7 @@ typedef struct cucul_buffer cucul_buffer_t; | |||
# endif | |||
/* Aliases from old libcucul functions */ | |||
/* Aliases from old libcaca and libcucul functions */ | |||
__extern int cucul_putchar(caca_canvas_t *, int, int, | |||
unsigned long int) CACA_DEPRECATED; | |||
__extern unsigned long int cucul_getchar(caca_canvas_t *, | |||
@@ -600,6 +600,8 @@ __extern char const * const * cucul_get_dither_mode_list(caca_dither_t const *) | |||
# define CUCUL_BLINK CACA_BLINK | |||
# if !defined __LIBCACA__ | |||
# define caca_get_cursor_x caca_wherex | |||
# define caca_get_cursor_y caca_wherey | |||
# define cucul_draw_triangle caca_draw_triangle | |||
# define cucul_draw_thin_triangle caca_draw_thin_triangle | |||
# define cucul_fill_triangle caca_fill_triangle | |||
@@ -611,8 +613,8 @@ __extern char const * const * cucul_get_dither_mode_list(caca_dither_t const *) | |||
# define cucul_render_canvas caca_render_canvas | |||
# define cucul_free_font caca_free_font | |||
# define cucul_gotoxy caca_gotoxy | |||
# define cucul_get_cursor_x caca_get_cursor_x | |||
# define cucul_get_cursor_y caca_get_cursor_y | |||
# define cucul_get_cursor_x caca_wherex | |||
# define cucul_get_cursor_y caca_wherey | |||
# define cucul_put_char caca_put_char | |||
# define cucul_get_char caca_get_char | |||
# define cucul_put_str caca_put_str | |||
@@ -375,8 +375,8 @@ static void ncurses_display(caca_display_t *dp) | |||
} | |||
} | |||
x = caca_get_cursor_x(dp->cv); | |||
y = caca_get_cursor_y(dp->cv); | |||
x = caca_wherex(dp->cv); | |||
y = caca_wherey(dp->cv); | |||
move(y, x); | |||
refresh(); | |||
@@ -287,7 +287,7 @@ static void slang_display(caca_display_t *dp) | |||
cvattrs += dp->cv->width - dw; | |||
} | |||
} | |||
SLsmg_gotorc(caca_get_cursor_y(dp->cv), caca_get_cursor_x(dp->cv)); | |||
SLsmg_gotorc(caca_wherey(dp->cv), caca_wherex(dp->cv)); | |||
SLsmg_refresh(); | |||
} | |||
@@ -376,8 +376,8 @@ static void x11_display(caca_display_t *dp) | |||
{ | |||
XSetForeground(dp->drv.p->dpy, dp->drv.p->gc, | |||
dp->drv.p->colors[0xfff]); | |||
x = caca_get_cursor_x(dp->cv); | |||
y = caca_get_cursor_y(dp->cv); | |||
x = caca_wherex(dp->cv); | |||
y = caca_wherey(dp->cv); | |||
XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap, dp->drv.p->gc, | |||
x * dp->drv.p->font_width, y * dp->drv.p->font_height, | |||
dp->drv.p->font_width, dp->drv.p->font_height); | |||
@@ -68,7 +68,7 @@ int caca_gotoxy(caca_canvas_t *cv, int x, int y) | |||
* \param cv A handle to the libcaca canvas. | |||
* \return The cursor's X coordinate. | |||
*/ | |||
int caca_get_cursor_x(caca_canvas_t const *cv) | |||
int caca_wherex(caca_canvas_t const *cv) | |||
{ | |||
return cv->frames[cv->frame].x; | |||
} | |||
@@ -82,7 +82,7 @@ int caca_get_cursor_x(caca_canvas_t const *cv) | |||
* \param cv A handle to the libcaca canvas. | |||
* \return The cursor's Y coordinate. | |||
*/ | |||
int caca_get_cursor_y(caca_canvas_t const *cv) | |||
int caca_wherey(caca_canvas_t const *cv) | |||
{ | |||
return cv->frames[cv->frame].y; | |||
} | |||
@@ -582,8 +582,10 @@ int caca_set_canvas_boundaries(caca_canvas_t *cv, int x, int y, int w, int h) | |||
*/ | |||
int cucul_gotoxy(cucul_canvas_t *, int, int) CACA_ALIAS(caca_gotoxy); | |||
int cucul_get_cursor_x(cucul_canvas_t const *) CACA_ALIAS(caca_get_cursor_x); | |||
int cucul_get_cursor_y(cucul_canvas_t const *) CACA_ALIAS(caca_get_cursor_y); | |||
int cucul_get_cursor_x(cucul_canvas_t const *) CACA_ALIAS(caca_wherex); | |||
int cucul_get_cursor_y(cucul_canvas_t const *) CACA_ALIAS(caca_wherey); | |||
int caca_get_cursor_x(caca_canvas_t const *) CACA_ALIAS(caca_wherex); | |||
int caca_get_cursor_y(caca_canvas_t const *) CACA_ALIAS(caca_wherey); | |||
int cucul_put_char(cucul_canvas_t *, int, int, uint32_t) | |||
CACA_ALIAS(caca_put_char); | |||
uint32_t cucul_get_char(cucul_canvas_t const *, int, int) | |||
@@ -109,8 +109,15 @@ static VALUE gotoxy(VALUE self, VALUE x, VALUE y) | |||
return self; | |||
} | |||
get_int(cursor_x) | |||
get_int(cursor_y) | |||
static VALUE wherex(VALUE self) | |||
{ | |||
return INT2NUM(caca_wherex(_SELF)); | |||
} | |||
static VALUE wherey(VALUE self) | |||
{ | |||
return INT2NUM(caca_wherey(_SELF)); | |||
} | |||
simple_func(clear_canvas) | |||
@@ -585,8 +592,8 @@ void Init_caca_canvas(VALUE mCaca) | |||
rb_define_method(cCanvas, "set_size", set_canvas_size, 2); | |||
rb_define_method(cCanvas, "gotoxy", gotoxy, 2); | |||
rb_define_method(cCanvas, "cursor_x", get_cursor_x, 0); | |||
rb_define_method(cCanvas, "cursor_y", get_cursor_y, 0); | |||
rb_define_method(cCanvas, "wherex", wherex, 0); | |||
rb_define_method(cCanvas, "wherey", wherey, 0); | |||
rb_define_method(cCanvas, "handle_x", get_canvas_handle_x, 0); | |||
rb_define_method(cCanvas, "handle_y", get_canvas_handle_y, 0); | |||
rb_define_method(cCanvas, "set_handle", set_canvas_handle, 2); | |||
@@ -37,9 +37,9 @@ irb(main):008:1>end | |||
\code | |||
irb(main):009:0>Caca.constants | |||
=>["BROWN", "BOLD", "GREEN", "LIGHTMAGENTA", "LIGHTBLUE", "BLINK", | |||
"MAGENTA","DEFAULT", "TRANSPARENT", "BLUE", "LIGHTRED", "DARKGRAY", | |||
"UNDERLINE","RED", "WHITE", "BLACK", "LIGHTCYAN", "LIGHTGRAY", | |||
"ITALICS","CYAN", "YELLOW", "LIGHTGREEN", "Canvas", "Dither", "Font"] | |||
"MAGENTA", "DEFAULT", "TRANSPARENT", "BLUE", "LIGHTRED", "DARKGRAY", | |||
"UNDERLINE", "RED", "WHITE", "BLACK", "LIGHTCYAN", "LIGHTGRAY", | |||
"ITALICS", "CYAN", "YELLOW", "LIGHTGREEN", "Canvas", "Dither", "Font"] | |||
\endcode | |||
\code | |||
@@ -54,19 +54,19 @@ irb(main):011:0>Caca::Canvas.my_methods | |||
\code | |||
irb(main):012:0>Caca::Canvas.my_instance_methods | |||
=>["attr=", "blit", "clear", "create_frame", "cursor_x", "cursor_y", | |||
"dither_bitmap","draw_box", "draw_circle", "draw_cp437_box", "draw_ellipse", | |||
"draw_line","draw_polyline", "draw_thin_box", "draw_thin_ellipse", | |||
"draw_thin_line","draw_thin_polyline", "draw_thin_triangle", | |||
"draw_triangle","export_to_memory", "fill_box", "fill_ellipse", | |||
"fill_triangle","flip", "flop", "frame=", "frame_count", "frame_name", | |||
"frame_name=","free_frame", "get_attr", "get_char", "gotoxy", | |||
"handle_x","handle_y", "height", "height=", "import_file", | |||
"import_from_memory","invert", "printf", "put_attr", "put_char", "put_str", | |||
"rotate_180","rotate_left", "rotate_right", "set_attr", | |||
"set_boundaries","set_color_ansi", "set_color_argb", "set_frame", | |||
"set_frame_name","set_handle", "set_height", "set_size", "set_width", | |||
"stretch_left","stretch_right", "width", "width="] | |||
=>["attr=", "blit", "clear", "create_frame", | |||
"dither_bitmap", "draw_box", "draw_circle", "draw_cp437_box", "draw_ellipse", | |||
"draw_line", "draw_polyline", "draw_thin_box", "draw_thin_ellipse", | |||
"draw_thin_line", "draw_thin_polyline", "draw_thin_triangle", | |||
"draw_triangle", "export_to_memory", "fill_box", "fill_ellipse", | |||
"fill_triangle", "flip", "flop", "frame=", "frame_count", "frame_name", | |||
"frame_name=", "free_frame", "get_attr", "get_char", "gotoxy", | |||
"handle_x", "handle_y", "height", "height=", "import_file", | |||
"import_from_memory", "invert", "printf", "put_attr", "put_char", "put_str", | |||
"rotate_180", "rotate_left", "rotate_right", "set_attr", | |||
"set_boundaries", "set_color_ansi", "set_color_argb", "set_frame", | |||
"set_frame_name", "set_handle", "set_height", "set_size", "set_width", | |||
"stretch_left", "stretch_right", "wherex", "wherey", "width", "width="] | |||
\endcode | |||
\code | |||
@@ -82,16 +82,16 @@ irb(main):014:0>Caca::Font.my_instance_methods | |||
\code | |||
irb(main):015:0>Caca::Dither.my_instance_methods | |||
=>["algorithm=", "algorithm_list", "antialias=", "antialias_list", | |||
"brightness=","charset=", "charset_list", "color=", "color_list", | |||
"contrast=","gamma=", "palette=", "set_algorithm", "set_antialias", | |||
"set_brightness","set_charset", "set_color", "set_contrast", | |||
"set_gamma","set_palette"] | |||
"brightness=", "charset=", "charset_list", "color=", "color_list", | |||
"contrast=", "gamma=", "palette=", "set_algorithm", "set_antialias", | |||
"set_brightness", "set_charset", "set_color", "set_contrast", | |||
"set_gamma", "set_palette"] | |||
\endcode | |||
\code | |||
irb(main):010:0>Caca::Display.my_instance_methods | |||
=>["canvas", "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 | |||
\code | |||
@@ -140,10 +140,10 @@ $ruby -e 'puts Caca::Canvas.new(6,3).draw_thin_polyline([[0,0], [0,2], | |||
\code | |||
$ruby -rcaca -e 'p Caca::Canvas.export_list' | |||
[["caca","native libcaca format"], ["ansi", "ANSI"], ["utf8", "UTF-8 | |||
[["caca", "native libcaca format"], ["ansi", "ANSI"], ["utf8", "UTF-8 | |||
withANSI escape codes"], ["utf8cr", "UTF-8 with ANSI escape codes and | |||
MS-DOS\\r"], ["html", "HTML"], ["html3", "backwards-compatible HTML"], | |||
["irc","IRC with mIRC colours"], ["ps", "PostScript document"], ["svg", | |||
["irc", "IRC with mIRC colours"], ["ps", "PostScript document"], ["svg", | |||
"SVGvector image"], ["tga", "TGA image"]] | |||
\endcode | |||
@@ -31,8 +31,8 @@ class TC_Canvas < Test::Unit::TestCase | |||
end | |||
def test_cursor | |||
@c.gotoxy(1,1) | |||
assert_equal(1, @c.cursor_x) | |||
assert_equal(1, @c.cursor_y) | |||
assert_equal(1, @c.wherex) | |||
assert_equal(1, @c.wherey) | |||
end | |||
def test_clear | |||
@c.put_char(1, 1, 64) | |||