Ignore:
Timestamp:
Dec 23, 2003, 2:27:40 PM (18 years ago)
Author:
Sam Hocevar
Message:
  • src/io.c: + Added caca_wait_event(), a blocking caca_get_event().
  • src/ examples/: + More documentation.
  • doc/doxygen.cfg.in: + doc/doxygen.cfg is now generated by configure, so that we can use

@top_srcdir@ and we no longer need to hardcode PROJECT_NUMBER.

+ Create manpages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/src/graphics.c

    r265 r268  
    11/*
    2  *   libcaca       ASCII-Art library
    3  *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    4  *                 All Rights Reserved
    5  *
    6  *   This library is free software; you can redistribute it and/or
    7  *   modify it under the terms of the GNU Lesser General Public
    8  *   License as published by the Free Software Foundation; either
    9  *   version 2 of the License, or (at your option) any later version.
    10  *
    11  *   This library is distributed in the hope that it will be useful,
    12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    14  *   Lesser General Public License for more details.
    15  *
    16  *   You should have received a copy of the GNU Lesser General Public
    17  *   License along with this library; if not, write to the Free Software
    18  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    19  *   02111-1307  USA
    20  */
    21 
    22 /**  \file graphics.c
    23  *   \version \$Id$
    24  *   \author Sam Hocevar <sam@zoy.org>
    25  *   \brief Character drawing functions
    26  *
    27  *   This file contains character and string drawing functions.
     2 *  libcaca       ASCII-Art library
     3 *  Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
     4 *                All Rights Reserved
     5 *
     6 *  This library is free software; you can redistribute it and/or
     7 *  modify it under the terms of the GNU Lesser General Public
     8 *  License as published by the Free Software Foundation; either
     9 *  version 2 of the License, or (at your option) any later version.
     10 *
     11 *  This library is distributed in the hope that it will be useful,
     12 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14 *  Lesser General Public License for more details.
     15 *
     16 *  You should have received a copy of the GNU Lesser General Public
     17 *  License along with this library; if not, write to the Free Software
     18 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
     19 *  02111-1307  USA
     20 */
     21
     22/** \file graphics.c
     23 *  \version \$Id$
     24 *  \author Sam Hocevar <sam@zoy.org>
     25 *  \brief Character drawing functions
     26 *
     27 *  This file contains character and string drawing functions.
    2828 */
    2929
     
    100100static enum caca_color _caca_bgcolor = CACA_COLOR_BLACK;
    101101
    102 /**
    103  * \brief Set the default colour pair.
    104  *
    105  * \param fgcolor The desired foreground colour.
    106  * \param bgcolor The desired background colour.
    107  * \return void
     102/** \brief Set the default colour pair.
     103 *
     104 *  This function sets the default colour pair. String functions such as
     105 *  caca_printf() and graphical primitive functions such as caca_draw_line()
     106 *  will use these colour pairs.
     107 *
     108 *  \param fgcolor The requested foreground colour.
     109 *  \param bgcolor The requested background colour.
    108110 */
    109111void caca_set_color(enum caca_color fgcolor, enum caca_color bgcolor)
     
    142144}
    143145
    144 /**
    145  * \brief Get the current foreground colour.
    146  *
    147  * \return The current foreground colour.
     146/** \brief Get the current foreground colour.
     147 *
     148 *  This function returns the current foreground colour that was set with
     149 *  caca_set_color().
     150 *
     151 *  \return The current foreground colour.
    148152 */
    149153enum caca_color caca_get_fg_color(void)
     
    152156}
    153157
    154 /**
    155  * \brief Get the current background colour.
    156  *
    157  * \return The current background colour.
     158/** \brief Get the current background colour.
     159 *
     160 *  This function returns the current background colour that was set with
     161 *  caca_set_color().
     162 *
     163 *  \return The current background colour.
    158164 */
    159165enum caca_color caca_get_bg_color(void)
     
    162168}
    163169
    164 /**
    165  * \brief Print a character at given coordinates.
    166  *
    167  * \param x The X coordinate of the character.
    168  * \param y The Y coordinate of the character.
    169  * \param c The character to print.
    170  * \return void
     170/** \brief Print a character.
     171 *
     172 *  This function prints a character at the given coordinates, using the
     173 *  default foreground and background values. If the coordinates are outside
     174 *  the screen boundaries, nothing is printed.
     175 *
     176 *  \param x X coordinate.
     177 *  \param y Y coordinate.
     178 *  \param c The character to print.
    171179 */
    172180void caca_putchar(int x, int y, char c)
     
    213221}
    214222
    215 /**
    216  * \brief Print a string at given coordinates.
    217  *
    218  * \param x The X coordinate of the string.
    219  * \param y The Y coordinate of the string.
    220  * \param s The string to print.
    221  * \return void
     223/** \brief Print a string.
     224 *
     225 *  This function prints a string at the given coordinates, using the
     226 *  default foreground and background values. The coordinates may be outside
     227 *  the screen boundaries (eg. a negative Y coordinate) and the string will
     228 *  be cropped accordingly if it is too long.
     229 *
     230 *  \param x X coordinate.
     231 *  \param y Y coordinate.
     232 *  \param s The string to print.
    222233 */
    223234void caca_putstr(int x, int y, const char *s)
     
    291302}
    292303
    293 /**
    294  * \brief Format a string at given coordinates.
    295  *
    296  * \param x The X coordinate of the string.
    297  * \param y The Y coordinate of the string.
    298  * \param format The format string to print.
    299  * \param ... Arguments to the format string.
    300  * \return void
     304/** \brief Format a string.
     305 *
     306 *  This function formats a string at the given coordinates, using the
     307 *  default foreground and background values. The coordinates may be outside
     308 *  the screen boundaries (eg. a negative Y coordinate) and the string will
     309 *  be cropped accordingly if it is too long. The syntax of the format
     310 *  string is the same as for the C printf() function.
     311 *
     312 *  \param x X coordinate.
     313 *  \param y Y coordinate.
     314 *  \param format The format string to print.
     315 *  \param ... Arguments to the format string.
    301316 */
    302317void caca_printf(int x, int y, const char *format, ...)
     
    327342}
    328343
    329 /**
    330  * \brief Clear the screen.
    331  *
    332  * \return void
     344/** \brief Clear the screen.
     345 *
     346 *  This function clears the screen using a black background.
    333347 */
    334348void caca_clear(void)
     
    638652}
    639653
    640 /**
    641  * \brief Set the refresh delay.
    642  *
    643  * \param usec The refresh delay in microseconds.
    644  * \return void
     654/** \brief Set the refresh delay.
     655 *
     656 *  This function sets the refresh delay in microseconds. The refresh delay
     657 *  is used by caca_refresh() to achieve constant framerate. See the
     658 *  caca_refresh() documentation for more details.
     659 *
     660 *  If the argument is zero, constant framerate is disabled. This is the
     661 *  default behaviour.
     662 *
     663 *  \param usec The refresh delay in microseconds.
    645664 */
    646665void caca_set_delay(unsigned int usec)
     
    649668}
    650669
    651 /**
    652  * \brief Get the average rendering time.
    653  *
    654  * \return The render time in microseconds.
     670/** \brief Get the average rendering time.
     671 *
     672 *  This function returns the average rendering time, which is the average
     673 *  measured time between two caca_refresh() calls, in microseconds. If
     674 *  constant framerate was activated by calling caca_set_delay(), the average
     675 *  rendering time will not be considerably shorter than the requested delay
     676 *  even if the real rendering time was shorter.
     677 *
     678 *  \return The render time in microseconds.
    655679 */
    656680unsigned int caca_get_rendertime(void)
     
    679703}
    680704
    681 /**
    682  * \brief Flush pending changes and redraw the screen.
    683  *
    684  * \return void
     705/** \brief Flush pending changes and redraw the screen.
     706 *
     707 *  This function flushes all graphical operations and prints them to the
     708 *  screen. Nothing will show on the screen caca_refresh() is not called.
     709 *
     710 *  If caca_set_delay() was called with a non-zero value, caca_refresh()
     711 *  will use that value to achieve constant framerate: if two consecutive
     712 *  calls to caca_refresh() are within a time range shorter than the value
     713 *  set with caca_set_delay(), the second call will wait a bit before
     714 *  performing the screen refresh.
    685715 */
    686716void caca_refresh(void)
Note: See TracChangeset for help on using the changeset viewer.