Changeset 845


Ignore:
Timestamp:
Apr 22, 2006, 9:14:49 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Updated the migration guide.
Location:
libcaca/trunk/doc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/doc/libcaca.dox

    r836 r845  
    11/* $Id$ */
    22
    3 /** \mainpage libcaca Developer Documentation
     3/** \mainpage libcaca Documentation
    44
    55 \section intro Introduction
  • libcaca/trunk/doc/migrating.dox

    r836 r845  
    1212 you used to do:
    1313
     14<table border="0"><tr><td valign="top">
    1415\code
    1516#include <caca.h>
     
    2021    caca_init();
    2122    /* Set window title */
    22     caca_set_window_title("Hello!");
     23    caca_set_window_title("Window");
    2324    /* Choose drawing colours */
    24     caca_set_color(CACA_COLOR_BLACK, CACA_COLOR_WHITE);
    25     /* Draw a string at coordinates (0, 0) */
    26     caca_putstr(0, 0, "This is a message");
     25    caca_set_color(CACA_COLOR_BLACK,
     26                   CACA_COLOR_WHITE);
     27    /* Draw a string at (0, 0) */
     28    caca_putstr(0, 0, "Hello world!");
    2729    /* Refresh display */
    2830    caca_refresh();
     
    3537}
    3638\endcode
    37 
    38  You now do:
    39 
     39</td><td>
    4040\code
    4141#include <cucul.h>
     
    4545{
    4646    /* Initialise libcaca */
    47     cucul_canvas_t *cv; caca_display_t *dp; caca_event_t ev;
     47    cucul_canvas_t *cv;
     48    caca_display_t *dp; caca_event_t ev;
    4849    cv = cucul_create_canvas(0, 0);
    4950    dp = caca_create_display(cv);
    5051    /* Set window title */
    51     caca_set_display_title(dp, "Hello!");
     52    caca_set_display_title(dp, "Window");
    5253    /* Choose drawing colours */
    53     cucul_set_color(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_WHITE);
    54     /* Draw a string at coordinates (0, 0) */
    55     cucul_putstr(cv, 0, 0, "This is a message");
     54    cucul_set_color(cv, CUCUL_COLOR_BLACK,
     55                        CUCUL_COLOR_WHITE);
     56    /* Draw a string at (0, 0) */
     57    cucul_putstr(cv, 0, 0, "Hello world!");
    5658    /* Refresh display */
    5759    caca_refresh_display();
    5860    /* Wait for a key press event */
    59     caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1);
     61    caca_get_event(dp, CACA_EVENT_KEY_PRESS,
     62                   &ev, -1);
    6063    /* Clean up library */
    6164    caca_free_display(dp);
     
    6568}
    6669\endcode
     70</td></tr></table>
    6771
    6872 Note the following important things:
     
    97101 \subsection bar2 Event handling
    98102
    99  - \b caca_get_event(): unchanged.
     103 - \b caca_get_event(): unchanged, but the event information retrieval
     104   changed a lot.
    100105 - \b caca_wait_event(): use caca_get_event() with a \c timeout argument
    101106   of \b -1.
     
    115120
    116121 \subsection bar4 Primitives drawing
     122
     123 These functions are almost unchanged, except for Unicode support and the
     124 fact that they now act on a given canvas.
    117125
    118126 - \b caca_draw_line(): use cucul_draw_line().
     
    136144 \subsection bar5 Mathematical functions
    137145
    138  - \b caca_rand(): use cucul_rand()
    139  - \b caca_sqrt(): this function is now deprecated
     146 - \b caca_rand(): use cucul_rand(). The second argument is different, make
     147   sure you take that into account.
     148 - \b caca_sqrt(): this function is now deprecated, use your system's
     149   \b sqrt() call instead.
    140150
    141151 \subsection bar6 Sprite handling
    142152
    143  The sprite handling functions are currently being reworked.
     153 The newly introduced canvases can have several frames. Sprites are hence
     154 completely deprecated.
     155
     156 - \b caca_load_sprite(): use cucul_import_canvas().
     157 - \b caca_get_sprite_frames(): use cucul_get_canvas_frame_count().
     158 - \b caca_get_sprite_width(): use cucul_get_canvas_width().
     159 - \b caca_get_sprite_height(): use cucul_get_canvas_height().
     160 - \b caca_get_sprite_dx(): this function is now deprecated.
     161 - \b caca_get_sprite_dy(): this function is now deprecated.
     162 - \b caca_draw_sprite(): use cucul_set_canvas_frame() and cucul_blit().
     163 - \b caca_free_sprite(): use cucul_free_canvas().
    144164
    145165 \subsection bar7 Bitmap handling
     166
     167 Bitmaps have been renamed to dithers, because these objects do not in fact
     168 store any pixels, they just have information on how bitmaps will be dithered.
    146169
    147170 - \b caca_create_bitmap(): use cucul_create_dither().
Note: See TracChangeset for help on using the changeset viewer.