\code
#include
/* libcaca program - 0.x API */
int main(void)
{
/* Initialise libcaca */
caca_init();
/* Set window title */
caca_set_window_title("Window");
/* Choose drawing colours */
caca_set_color(CACA_COLOR_BLACK,
CACA_COLOR_WHITE);
/* Draw a string at (0, 0) */
caca_putstr(0, 0, "Hello world!");
/* Refresh display */
caca_refresh();
/* Wait for a key press event */
caca_wait_event(CACA_EVENT_KEY_PRESS);
/* Clean up library */
caca_end();
return 0;
}
\endcode
|
\code
#include
/* libcaca program - 1.0 API */
int main(void)
{
/* Initialise libcaca */
caca_canvas_t *cv;
caca_display_t *dp;
dp = caca_create_display(NULL);
cv = caca_get_canvas(dp);
/* Set window title */
caca_set_display_title(dp, "Window");
/* Choose drawing colours */
caca_set_color_ansi(cv, CACA_BLACK,
CACA_WHITE);
/* Draw a string at (0, 0) */
caca_put_str(cv, 0, 0, "Hello world!");
/* Refresh display */
caca_refresh_display();
/* Wait for a key press event */
caca_get_event(dp, CACA_EVENT_KEY_PRESS,
NULL, -1);
/* Clean up library */
caca_free_display(dp);
return 0;
}
\endcode
|