source: libcaca/trunk/doc/tutorial.dox @ 1016

Last change on this file since 1016 was 923, checked in by Jean-Yves Lamoureux, 15 years ago
  • Fixed error in tutorial, updated caca_get_event() doc
  • Property svn:keywords set to Id
File size: 827 bytes
Line 
1/* $Id: tutorial.dox 923 2006-05-02 18:26:02Z jylam $ */
2
3/** \page tutorial A libcucul and libcaca tutorial
4
5 Super short example:
6
7\code
8#include <cucul.h>
9#include <caca.h>
10
11int main(void)
12{
13    /* Initialise libcaca */
14    cucul_canvas_t *cv; caca_display_t *dp; caca_event_t ev;
15    cv = cucul_create_canvas(0, 0);
16    dp = caca_create_display(cv);
17    /* Set window title */
18    caca_set_display_title(dp, "Hello!");
19    /* Choose drawing colours */
20    cucul_set_color(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_WHITE);
21    /* Draw a string at coordinates (0, 0) */
22    cucul_putstr(cv, 0, 0, "This is a message");
23    /* Refresh display */
24    caca_refresh_display(dp);
25    /* Wait for a key press event */
26    caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1);
27    /* Clean up library */
28    caca_free_display(dp);
29    cucul_free_canvas(cv);
30
31    return 0;
32}
33\endcode
34
35*/
Note: See TracBrowser for help on using the repository browser.