Ignore:
Timestamp:
Nov 11, 2006, 3:24:35 PM (16 years ago)
Author:
Sam Hocevar
Message:
  • Add cursor and handle support to canvases. Unused yet.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cucul/canvas.c

    r1341 r1342  
    4242#include "cucul_internals.h"
    4343
     44/** \brief Set cursor position.
     45 *
     46 *  Put the cursor at the given coordinates. Functions making use of the
     47 *  cursor will use the new values. Setting the cursor position outside the
     48 *  canvas is legal but the cursor will not be shown.
     49 *
     50 *  This function never fails.
     51 *
     52 *  \param cv A handle to the libcucul canvas.
     53 *  \param x X cursor coordinate.
     54 *  \param y Y cursor coordinate.
     55 *  \return This function always returns 0.
     56 */
     57int cucul_gotoxy(cucul_canvas_t *cv, int x, int y)
     58{
     59    cv->frames[cv->frame].x = x;
     60    cv->frames[cv->frame].y = y;
     61
     62    return 0;
     63}
     64
     65/** \brief Get X cursor position.
     66 *
     67 *  Retrieve the X coordinate of the cursor's position.
     68 *
     69 *  This function never fails.
     70 *
     71 *  \param cv A handle to the libcucul canvas.
     72 *  \return The cursor's X coordinate.
     73 */
     74int cucul_get_cursor_x(cucul_canvas_t *cv)
     75{
     76    return cv->frames[cv->frame].x;
     77}
     78
     79/** \brief Get Y cursor position.
     80 *
     81 *  Retrieve the Y coordinate of the cursor's position.
     82 *
     83 *  This function never fails.
     84 *
     85 *  \param cv A handle to the libcucul canvas.
     86 *  \return The cursor's Y coordinate.
     87 */
     88int cucul_get_cursor_y(cucul_canvas_t *cv)
     89{
     90    return cv->frames[cv->frame].y;
     91}
     92
    4493/** \brief Print an ASCII or Unicode character.
    4594 *
     
    263312
    264313    return 0;
     314}
     315
     316/** \brief Set cursor handle.
     317 *
     318 *  Set the canvas' handle. Blitting functions will use the handle value
     319 *  to put the canvas at the proper coordinates.
     320 *
     321 *  This function never fails.
     322 *
     323 *  \param cv A handle to the libcucul canvas.
     324 *  \param x X handle coordinate.
     325 *  \param y Y handle coordinate.
     326 *  \return This function always returns 0.
     327 */
     328int cucul_set_canvas_handle(cucul_canvas_t *cv, int x, int y)
     329{
     330    cv->frames[cv->frame].handlex = x;
     331    cv->frames[cv->frame].handley = y;
     332
     333    return 0;
     334}
     335
     336/** \brief Get X handle position.
     337 *
     338 *  Retrieve the X coordinate of the canvas' handle.
     339 *
     340 *  This function never fails.
     341 *
     342 *  \param cv A handle to the libcucul canvas.
     343 *  \return The canvas' handle's X coordinate.
     344 */
     345int cucul_get_canvas_handle_x(cucul_canvas_t *cv)
     346{
     347    return cv->frames[cv->frame].handlex;
     348}
     349
     350/** \brief Get Y handle position.
     351 *
     352 *  Retrieve the Y coordinate of the canvas' handle.
     353 *
     354 *  This function never fails.
     355 *
     356 *  \param cv A handle to the libcucul canvas.
     357 *  \return The canvas' handle's Y coordinate.
     358 */
     359int cucul_get_canvas_handle_y(cucul_canvas_t *cv)
     360{
     361    return cv->frames[cv->frame].handley;
    265362}
    266363
Note: See TracChangeset for help on using the changeset viewer.