Ignore:
Timestamp:
Nov 15, 2003, 10:58:20 AM (16 years ago)
Author:
Sam Hocevar
Message:
  • libee/graphics.c: + Correct clipping in ee_putstr() for long strings.
  • libee/ee.c: + New ee_get_rendertime() call to provide framerate information.
  • libee/ee.h: + Added const keywords where it was meaningful, despite Slang's blatant

omission of such keywords in its prototypes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/libee/ee.c

    r177 r179  
    4747
    4848/* Global array with color names */
    49 char *ee_color_names[16] =
     49const char *ee_color_names[16] =
    5050{
    5151    "black",
     
    6767};
    6868
    69 static int _ee_delay;
     69static unsigned int _ee_delay;
     70static unsigned int _ee_rendertime;
    7071char *_ee_empty_line;
     72char *_ee_scratch_line;
    7173
    7274#if defined(USE_NCURSES)
     
    186188    _ee_empty_line[ee_get_width()] = '\0';
    187189
     190    _ee_scratch_line = malloc(ee_get_width() + 1);
     191
    188192    _ee_delay = 0;
     193    _ee_rendertime = 0;
    189194
    190195    return 0;
    191196}
    192197
    193 int ee_get_width(void)
     198unsigned int ee_get_width(void)
    194199{
    195200#if defined(USE_SLANG)
     
    202207}
    203208
    204 int ee_get_height(void)
     209unsigned int ee_get_height(void)
    205210{
    206211#if defined(USE_SLANG)
     
    213218}
    214219
    215 void ee_set_delay(int usec)
     220void ee_set_delay(unsigned int usec)
    216221{
    217222    _ee_delay = usec;
     223}
     224
     225unsigned int ee_get_rendertime(void)
     226{
     227    return _ee_rendertime;
    218228}
    219229
     
    240250void ee_refresh(void)
    241251{
    242     static int lastticks = 0;
     252    static unsigned int lastticks = 0;
    243253    unsigned int ticks = lastticks + _ee_getticks();
    244254
     
    258268    for(ticks += _ee_getticks(); ticks < _ee_delay; ticks += _ee_getticks())
    259269        usleep(10000);
     270
     271    /* Update the sliding mean of the render time */
     272    _ee_rendertime = (7 * _ee_rendertime + ticks) / 8;
    260273
    261274    lastticks = ticks - _ee_delay;
Note: See TracChangeset for help on using the changeset viewer.