@@ -173,7 +173,7 @@ class Canvas {
}
}
function drawLine($x1, $y1, $x2, $y2, $char) {
function drawLine($x1, $y1, $x2, $y2, $char) {
return caca_draw_line($this->cv, $x1, $y1, $x2, $y2, $colo r);
return caca_draw_line($this->cv, $x1, $y1, $x2, $y2, $cha r);
}
}
function drawPolyline($points, $char) {
function drawPolyline($points, $char) {
@@ -241,6 +241,38 @@ class Canvas {
}
}
}
}
class Event {
private $ev;
function getType() {
return caca_get_event_type($this->ev);
}
function getKeyCh() {
return caca_get_event_key_ch($this->ev);
}
function getMouseX() {
return caca_get_event_mouse_x($this->ev);
}
function getResizeWidth() {
return caca_get_event_resize_width($this->ev);
}
function getResizeHeight() {
return caca_get_event_resize_height($this->ev);
}
function __construct($_ev) {
$this->ev = $_ev;
}
function get_resource() {
return $this->ev;
}
}
class Display {
class Display {
private $dp;
private $dp;
@@ -296,6 +328,14 @@ class Display {
return caca_set_mouse($this->dp, $state);
return caca_set_mouse($this->dp, $state);
}
}
function getEvent($t, $timeout) {
$ev = caca_get_event($this->dp, $t, $timeout);
if(! $ev) {
return NULL;
}
return new Event($ev);
}
function __construct($canvas, $driver = false) {
function __construct($canvas, $driver = false) {
if ($driver)
if ($driver)
$this->dp = caca_create_display_with_driver($canvas->get_resource(), $driver);
$this->dp = caca_create_display_with_driver($canvas->get_resource(), $driver);
@@ -389,7 +429,7 @@ class Dither {
}
}
function bitmap($canvas, $x, $y, $width, $height, $load_palette = true) {
function bitmap($canvas, $x, $y, $width, $height, $load_palette = true) {
return caca_dither_bitmap($canvas, $x, $y, $width, $height, $this->dt, $this->img, $load_palette);
return caca_dither_bitmap($canvas->get_resource() , $x, $y, $width, $height, $this->dt, $this->img, $load_palette);
}
}
function __construct($image) {
function __construct($image) {
@@ -413,6 +453,14 @@ class Font {
return caca_get_font_blocks($this->f);
return caca_get_font_blocks($this->f);
}
}
function Render($cv, $image) {
return caca_render_canvas($cv->get_resource(), $this->f, $image);
}
static function getList() {
return caca_get_font_list();
}
function __construct($name) {
function __construct($name) {
$this->f = caca_load_builtin_font($name);
$this->f = caca_load_builtin_font($name);
}
}