Ignore:
Timestamp:
Nov 16, 2003, 1:33:35 AM (19 years ago)
Author:
Sam Hocevar
Message:
  • Renamed libee to libcaca. Far less collisions.
Location:
libcaca/trunk/libcaca
Files:
10 edited
4 moved

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/libcaca/Makefile.am

    r183 r185  
    11###############################################################################
    2 # Automake targets and declarations for libee
     2# Automake targets and declarations for libcaca
    33###############################################################################
    44
    5 lib_LIBRARIES = libee.a
    6 libee_a_SOURCES = \
    7         ee.c \
    8         ee.h \
    9         ee_internals.h \
     5lib_LIBRARIES = libcaca.a
     6libcaca_a_SOURCES = \
     7        caca.c \
     8        caca.h \
     9        caca_internals.h \
    1010        graphics.c \
    1111        io.c \
  • libcaca/trunk/libcaca/blit.c

    r183 r185  
    11/*
    2  *   libee         ASCII-Art library
     2 *   libcaca       ASCII-Art library
    33 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    44 *                 All Rights Reserved
     
    3131#include <stdlib.h>
    3232
    33 #include "ee.h"
    34 #include "ee_internals.h"
     33#include "caca.h"
     34#include "caca_internals.h"
    3535
    3636#include <stdio.h>
    37 void ee_blit(int x1, int y1, int x2, int y2, void *pixels, int w, int h)
     37void caca_blit(int x1, int y1, int x2, int y2, void *pixels, int w, int h)
    3838{
    3939    char foo[] = { ' ', '.', ':', ';', '=', '$', '%', '@', '#', '8', 'W' };
     
    5252    pitch = (3 * w + 3) / 4 * 4;
    5353
    54     for(y = y1 > 0 ? y1 : 0; y <= y2 && y <= ee_get_height(); y++)
    55         for(x = x1 > 0 ? x1 : 0; x <= x2 && x <= ee_get_width(); x++)
     54    for(y = y1 > 0 ? y1 : 0; y <= y2 && y <= caca_get_height(); y++)
     55        for(x = x1 > 0 ? x1 : 0; x <= x2 && x <= caca_get_width(); x++)
    5656        {
    5757            int fromx = w * (x - x1) / (x2 - x1 + 1);
     
    6363            if(r == g && g == b)
    6464            {
    65                 ee_set_color(EE_LIGHTGRAY);
     65                caca_set_color(EE_LIGHTGRAY);
    6666            }
    6767            else
     
    8989                        hue += 360;
    9090
    91                     ee_set_color(foo_colors[(int)(hue + 30) / 60]);
     91                    caca_set_color(foo_colors[(int)(hue + 30) / 60]);
    9292                }
    9393                else
    9494                {
    95                     ee_set_color(EE_LIGHTGRAY);
     95                    caca_set_color(EE_LIGHTGRAY);
    9696                }
    9797            }
    9898
    99             ee_putchar(x, y, foo[(r + g + b) / 3 / 25]);
     99            caca_putchar(x, y, foo[(r + g + b) / 3 / 25]);
    100100        }
    101101}
  • libcaca/trunk/libcaca/box.c

    r159 r185  
    11/*
    2  *   libee         ASCII-Art library
     2 *   libcaca       ASCII-Art library
    33 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    44 *                 All Rights Reserved
     
    2525#include <stdlib.h>
    2626
    27 #include "ee.h"
    28 #include "ee_internals.h"
     27#include "caca.h"
     28#include "caca_internals.h"
    2929
    30 void ee_draw_box(int x1, int y1, int x2, int y2, char c)
     30void caca_draw_box(int x1, int y1, int x2, int y2, char c)
    3131{
    32     ee_draw_line(x1, y1, x1, y2, c);
    33     ee_draw_line(x1, y2, x2, y2, c);
    34     ee_draw_line(x2, y2, x2, y1, c);
    35     ee_draw_line(x2, y1, x1, y1, c);
     32    caca_draw_line(x1, y1, x1, y2, c);
     33    caca_draw_line(x1, y2, x2, y2, c);
     34    caca_draw_line(x2, y2, x2, y1, c);
     35    caca_draw_line(x2, y1, x1, y1, c);
    3636}
    3737
    38 void ee_draw_thin_box(int x1, int y1, int x2, int y2)
     38void caca_draw_thin_box(int x1, int y1, int x2, int y2)
    3939{
    4040    int x, y, xmax, ymax;
     
    5252    }
    5353
    54     xmax = ee_get_width() - 1;
    55     ymax = ee_get_height() - 1;
     54    xmax = caca_get_width() - 1;
     55    ymax = caca_get_height() - 1;
    5656
    5757    if(x2 < 0 || y2 < 0 || x1 > xmax || y1 > ymax)
     
    6161    if(y1 >= 0)
    6262        for(x = x1 < 0 ? 1 : x1 + 1; x < x2 && x < xmax; x++)
    63             ee_putchar(x, y1, '-');
     63            caca_putchar(x, y1, '-');
    6464
    6565    if(y2 <= ymax)
    6666        for(x = x1 < 0 ? 1 : x1 + 1; x < x2 && x < xmax; x++)
    67             ee_putchar(x, y2, '-');
     67            caca_putchar(x, y2, '-');
    6868
    6969    if(x1 >= 0)
    7070        for(y = y1 < 0 ? 1 : y1 + 1; y < y2 && y < ymax; y++)
    71             ee_putchar(x1, y, '|');
     71            caca_putchar(x1, y, '|');
    7272
    7373    if(x2 <= xmax)
    7474        for(y = y1 < 0 ? 1 : y1 + 1; y < y2 && y < ymax; y++)
    75             ee_putchar(x2, y, '|');
     75            caca_putchar(x2, y, '|');
    7676
    7777    /* Draw corners */
    7878    if(x1 >= 0 && y1 >= 0)
    79         ee_putchar(x1, y1, ',');
     79        caca_putchar(x1, y1, ',');
    8080
    8181    if(x1 >= 0 && y2 <= ymax)
    82         ee_putchar(x1, y2, '`');
     82        caca_putchar(x1, y2, '`');
    8383
    8484    if(x2 <= xmax && y1 >= 0)
    85         ee_putchar(x2, y1, '.');
     85        caca_putchar(x2, y1, '.');
    8686
    8787    if(x2 <= xmax && y2 <= ymax)
    88         ee_putchar(x2, y2, '\'');
     88        caca_putchar(x2, y2, '\'');
    8989}
    9090
    91 void ee_fill_box(int x1, int y1, int x2, int y2, char c)
     91void caca_fill_box(int x1, int y1, int x2, int y2, char c)
    9292{
    9393    int x, y, xmax, ymax;
     
    105105    }
    106106
    107     xmax = ee_get_width() - 1;
    108     ymax = ee_get_height() - 1;
     107    xmax = caca_get_width() - 1;
     108    ymax = caca_get_height() - 1;
    109109
    110110    if(x2 < 0 || y2 < 0 || x1 > xmax || y1 > ymax)
     
    118118    for(y = y1; y <= y2; y++)
    119119        for(x = x1; x <= x2; x++)
    120             ee_putchar(x, y, c);
     120            caca_putchar(x, y, c);
    121121}
    122122
  • libcaca/trunk/libcaca/caca.c

    r184 r185  
    11/*
    2  *   libee         ASCII-Art library
     2 *   libcaca       ASCII-Art library
    33 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    44 *                 All Rights Reserved
     
    4343#include <time.h>
    4444
    45 #include "ee.h"
    46 #include "ee_internals.h"
    47 
    48 static unsigned int _ee_delay;
    49 static unsigned int _ee_rendertime;
    50 char *_ee_empty_line;
    51 char *_ee_scratch_line;
     45#include "caca.h"
     46#include "caca_internals.h"
     47
     48static unsigned int _caca_delay;
     49static unsigned int _caca_rendertime;
     50char *_caca_empty_line;
     51char *_caca_scratch_line;
    5252
    5353#if defined(USE_NCURSES)
    54 int _ee_attr[16];
     54int _caca_attr[16];
    5555#endif
    5656
    5757#if defined(USE_CONIO)
    5858static struct text_info ti;
    59 char *_ee_screen;
    60 #endif
    61 
    62 int ee_init(void)
     59char *_caca_screen;
     60#endif
     61
     62int caca_init(void)
    6363{
    6464#if defined(USE_SLANG)
     
    144144    for(i = 0; i < 8; i++)
    145145    {
    146         _ee_attr[i] = COLOR_PAIR(1 + i);
    147         _ee_attr[i + 8] = A_BOLD | COLOR_PAIR(1 + i);
     146        _caca_attr[i] = COLOR_PAIR(1 + i);
     147        _caca_attr[i + 8] = A_BOLD | COLOR_PAIR(1 + i);
    148148    }
    149149
    150150#elif defined(USE_CONIO)
    151151    gettextinfo(&ti);
    152     _ee_screen = malloc(2 * ti.screenwidth * ti.screenheight);
    153     if(_ee_screen == NULL)
     152    _caca_screen = malloc(2 * ti.screenwidth * ti.screenheight);
     153    if(_caca_screen == NULL)
    154154        return -1;
    155155    _wscroll = 0;
     
    157157    clrscr();
    158158#   if defined(SCREENUPDATE_IN_PC_H)
    159     ScreenRetrieve(_ee_screen);
     159    ScreenRetrieve(_caca_screen);
    160160#   else
    161161    /* FIXME */
     
    163163
    164164#endif
    165     _ee_empty_line = malloc(ee_get_width() + 1);
    166     memset(_ee_empty_line, ' ', ee_get_width());
    167     _ee_empty_line[ee_get_width()] = '\0';
    168 
    169     _ee_scratch_line = malloc(ee_get_width() + 1);
    170 
    171     _ee_delay = 0;
    172     _ee_rendertime = 0;
     165    _caca_empty_line = malloc(caca_get_width() + 1);
     166    memset(_caca_empty_line, ' ', caca_get_width());
     167    _caca_empty_line[caca_get_width()] = '\0';
     168
     169    _caca_scratch_line = malloc(caca_get_width() + 1);
     170
     171    _caca_delay = 0;
     172    _caca_rendertime = 0;
    173173
    174174    return 0;
    175175}
    176176
    177 unsigned int ee_get_width(void)
     177unsigned int caca_get_width(void)
    178178{
    179179#if defined(USE_SLANG)
     
    186186}
    187187
    188 unsigned int ee_get_height(void)
     188unsigned int caca_get_height(void)
    189189{
    190190#if defined(USE_SLANG)
     
    197197}
    198198
    199 void ee_set_delay(unsigned int usec)
    200 {
    201     _ee_delay = usec;
    202 }
    203 
    204 unsigned int ee_get_rendertime(void)
    205 {
    206     return _ee_rendertime;
    207 }
    208 
    209 const char *ee_get_color_name(unsigned int color)
     199void caca_set_delay(unsigned int usec)
     200{
     201    _caca_delay = usec;
     202}
     203
     204unsigned int caca_get_rendertime(void)
     205{
     206    return _caca_rendertime;
     207}
     208
     209const char *caca_get_color_name(unsigned int color)
    210210{
    211211    static const char *color_names[16] =
     
    235235}
    236236
    237 static unsigned int _ee_getticks(void)
     237static unsigned int _caca_getticks(void)
    238238{
    239239    static unsigned int last_sec = 0, last_usec = 0;
     
    255255}
    256256
    257 void ee_refresh(void)
     257void caca_refresh(void)
    258258{
    259259#define IDLE_USEC 10000
    260260    static unsigned int lastticks = 0;
    261     unsigned int ticks = lastticks + _ee_getticks();
     261    unsigned int ticks = lastticks + _caca_getticks();
    262262
    263263#if defined(USE_SLANG)
     
    267267#elif defined(USE_CONIO)
    268268#   if defined(SCREENUPDATE_IN_PC_H)
    269     ScreenUpdate(_ee_screen);
     269    ScreenUpdate(_caca_screen);
    270270#   else
    271271    /* FIXME */
     
    273273#endif
    274274
    275     /* Wait until _ee_delay + time of last call */
    276     ticks += _ee_getticks();
    277     for(; ticks < _ee_delay - IDLE_USEC; ticks += _ee_getticks())
     275    /* Wait until _caca_delay + time of last call */
     276    ticks += _caca_getticks();
     277    for(; ticks < _caca_delay - IDLE_USEC; ticks += _caca_getticks())
    278278        usleep(IDLE_USEC);
    279279
    280280    /* Update the sliding mean of the render time */
    281     _ee_rendertime = (7 * _ee_rendertime + ticks) / 8;
    282 
    283     lastticks = ticks - _ee_delay;
     281    _caca_rendertime = (7 * _caca_rendertime + ticks) / 8;
     282
     283    lastticks = ticks - _caca_delay;
    284284
    285285    /* If we drifted too much, it's bad, bad, bad. */
    286     if(lastticks > _ee_delay)
     286    if(lastticks > _caca_delay)
    287287        lastticks = 0;
    288288}
    289289
    290 void ee_end(void)
     290void caca_end(void)
    291291{
    292292#if defined(USE_SLANG)
     
    301301    textcolor((enum COLORS)WHITE);
    302302    textbackground((enum COLORS)BLACK);
    303     gotoxy(ee_get_width(), ee_get_height());
     303    gotoxy(caca_get_width(), caca_get_height());
    304304    cputs("\r\n");
    305305    _setcursortype(_NORMALCURSOR);
  • libcaca/trunk/libcaca/caca.h

    r184 r185  
    11/*
    2  *   libee         ASCII-Art library
     2 *   libcaca       ASCII-Art library
    33 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    44 *                 All Rights Reserved
     
    3232 * Colors
    3333 */
    34 enum ee_colors
     34enum caca_colors
    3535{
    3636    EE_BLACK = 0,
     
    5555 * Types
    5656 */
    57 struct ee_sprite;
     57struct caca_sprite;
    5858
    5959/*
    6060 * Prototypes
    6161 */
    62 int ee_init(void);
    63 void ee_set_delay(unsigned int);
    64 unsigned int ee_get_rendertime(void);
    65 unsigned int ee_get_width(void);
    66 unsigned int ee_get_height(void);
    67 const char *ee_get_color_name(unsigned int);
    68 void ee_refresh(void);
    69 void ee_end(void);
     62int caca_init(void);
     63void caca_set_delay(unsigned int);
     64unsigned int caca_get_rendertime(void);
     65unsigned int caca_get_width(void);
     66unsigned int caca_get_height(void);
     67const char *caca_get_color_name(unsigned int);
     68void caca_refresh(void);
     69void caca_end(void);
    7070
    71 char ee_get_key(void);
     71char caca_get_key(void);
    7272
    73 void ee_set_color(int);
    74 int ee_get_color(void);
    75 void ee_putchar(int, int, char);
    76 void ee_putstr(int, int, const char *);
    77 void ee_printf(int, int, const char *, ...);
    78 void ee_clear(void);
     73void caca_set_color(int);
     74int caca_get_color(void);
     75void caca_putchar(int, int, char);
     76void caca_putstr(int, int, const char *);
     77void caca_printf(int, int, const char *, ...);
     78void caca_clear(void);
    7979
    80 void ee_draw_line(int, int, int, int, char);
    81 void ee_draw_polyline(const int[], const int[], int, char);
    82 void ee_draw_thin_line(int, int, int, int);
    83 void ee_draw_thin_polyline(const int[], const int[], int);
     80void caca_draw_line(int, int, int, int, char);
     81void caca_draw_polyline(const int[], const int[], int, char);
     82void caca_draw_thin_line(int, int, int, int);
     83void caca_draw_thin_polyline(const int[], const int[], int);
    8484
    85 void ee_draw_circle(int, int, int, char);
    86 void ee_draw_ellipse(int, int, int, int, char);
    87 void ee_draw_thin_ellipse(int, int, int, int);
    88 void ee_fill_ellipse(int, int, int, int, char);
     85void caca_draw_circle(int, int, int, char);
     86void caca_draw_ellipse(int, int, int, int, char);
     87void caca_draw_thin_ellipse(int, int, int, int);
     88void caca_fill_ellipse(int, int, int, int, char);
    8989
    90 void ee_draw_box(int, int, int, int, char);
    91 void ee_draw_thin_box(int, int, int, int);
    92 void ee_fill_box(int, int, int, int, char);
     90void caca_draw_box(int, int, int, int, char);
     91void caca_draw_thin_box(int, int, int, int);
     92void caca_fill_box(int, int, int, int, char);
    9393
    94 void ee_draw_triangle(int, int, int, int, int, int, char);
    95 void ee_draw_thin_triangle(int, int, int, int, int, int);
    96 void ee_fill_triangle(int, int, int, int, int, int, char);
     94void caca_draw_triangle(int, int, int, int, int, int, char);
     95void caca_draw_thin_triangle(int, int, int, int, int, int);
     96void caca_fill_triangle(int, int, int, int, int, int, char);
    9797
    98 int ee_rand(int, int);
    99 unsigned int ee_sqrt(unsigned int);
     98int caca_rand(int, int);
     99unsigned int caca_sqrt(unsigned int);
    100100
    101 struct ee_sprite * ee_load_sprite(const char *);
    102 int ee_get_sprite_frames(struct ee_sprite *);
    103 int ee_get_sprite_width(struct ee_sprite *, int);
    104 int ee_get_sprite_height(struct ee_sprite *, int);
    105 int ee_get_sprite_dx(struct ee_sprite *, int);
    106 int ee_get_sprite_dy(struct ee_sprite *, int);
    107 void ee_draw_sprite(int, int, struct ee_sprite *, int);
    108 void ee_free_sprite(struct ee_sprite *);
     101struct caca_sprite * caca_load_sprite(const char *);
     102int caca_get_sprite_frames(struct caca_sprite *);
     103int caca_get_sprite_width(struct caca_sprite *, int);
     104int caca_get_sprite_height(struct caca_sprite *, int);
     105int caca_get_sprite_dx(struct caca_sprite *, int);
     106int caca_get_sprite_dy(struct caca_sprite *, int);
     107void caca_draw_sprite(int, int, struct caca_sprite *, int);
     108void caca_free_sprite(struct caca_sprite *);
    109109
    110 void ee_blit(int, int, int, int, void *, int, int);
     110void caca_blit(int, int, int, int, void *, int, int);
    111111
    112112#ifdef __cplusplus
  • libcaca/trunk/libcaca/caca_internals.h

    r184 r185  
    11/*
    2  *   libee         ASCII-Art library
     2 *   libcaca       ASCII-Art library
    33 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    44 *                 All Rights Reserved
     
    2525
    2626#if defined(USE_NCURSES)
    27 extern int _ee_attr[];
     27extern int _caca_attr[];
    2828#endif
    2929
    3030#if defined(USE_CONIO)
    31 extern char *_ee_screen;
     31extern char *_caca_screen;
    3232#endif
    3333
    34 extern char *_ee_empty_line;
    35 extern char *_ee_scratch_line;
     34extern char *_caca_empty_line;
     35extern char *_caca_scratch_line;
    3636
    3737#endif /* __EE_INTERNALS_H__ */
  • libcaca/trunk/libcaca/conic.c

    r165 r185  
    11/*
    2  *   libee         ASCII-Art library
     2 *   libcaca       ASCII-Art library
    33 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    44 *                 All Rights Reserved
     
    3131#include <stdlib.h>
    3232
    33 #include "ee.h"
    34 #include "ee_internals.h"
     33#include "caca.h"
     34#include "caca_internals.h"
    3535
    3636static void ellipsepoints(int, int, int, int, char);
    3737
    38 void ee_draw_circle(int x, int y, int r, char c)
     38void caca_draw_circle(int x, int y, int r, char c)
    3939{
    4040    int test, dx, dy;
     
    5050}
    5151
    52 void ee_fill_ellipse(int xo, int yo, int a, int b, char c)
     52void caca_fill_ellipse(int xo, int yo, int a, int b, char c)
    5353{
    5454    int d2;
     
    6666        {
    6767            d1 += b*b*(2*x*1) + a*a*(-2*y+2);
    68             ee_draw_line(xo - x, yo - y, xo + x, yo - y, c);
    69             ee_draw_line(xo - x, yo + y, xo + x, yo + y, c);
     68            caca_draw_line(xo - x, yo - y, xo + x, yo - y, c);
     69            caca_draw_line(xo - x, yo + y, xo + x, yo + y, c);
    7070            y--;
    7171        }
     
    7373    }
    7474
    75     ee_draw_line(xo - x, yo - y, xo + x, yo - y, c);
    76     ee_draw_line(xo - x, yo + y, xo + x, yo + y, c);
     75    caca_draw_line(xo - x, yo - y, xo + x, yo - y, c);
     76    caca_draw_line(xo - x, yo + y, xo + x, yo + y, c);
    7777
    7878    d2 = b*b*(x+0.5)*(x+0.5) + a*a*(y-1)*(y-1) - a*a*b*b;
     
    9090
    9191        y--;
    92         ee_draw_line(xo - x, yo - y, xo + x, yo - y, c);
    93         ee_draw_line(xo - x, yo + y, xo + x, yo + y, c);
    94     }
    95 }
    96 
    97 void ee_draw_ellipse(int xo, int yo, int a, int b, char c)
     92        caca_draw_line(xo - x, yo - y, xo + x, yo - y, c);
     93        caca_draw_line(xo - x, yo + y, xo + x, yo + y, c);
     94    }
     95}
     96
     97void caca_draw_ellipse(int xo, int yo, int a, int b, char c)
    9898{
    9999    int d2;
     
    137137}
    138138
    139 void ee_draw_thin_ellipse(int xo, int yo, int a, int b)
     139void caca_draw_thin_ellipse(int xo, int yo, int a, int b)
    140140{
    141141    /* FIXME: this is not correct */
     
    184184    uint8_t b = 0;
    185185
    186     if(xo + x >= 0 && xo + x < ee_get_width())
     186    if(xo + x >= 0 && xo + x < caca_get_width())
    187187        b |= 0x1;
    188     if(xo - x >= 0 && xo - x < ee_get_width())
     188    if(xo - x >= 0 && xo - x < caca_get_width())
    189189        b |= 0x2;
    190     if(yo + y >= 0 && yo + y < ee_get_height())
     190    if(yo + y >= 0 && yo + y < caca_get_height())
    191191        b |= 0x4;
    192     if(yo - y >= 0 && yo - y < ee_get_height())
     192    if(yo - y >= 0 && yo - y < caca_get_height())
    193193        b |= 0x8;
    194194
    195195    if((b & (0x1|0x4)) == (0x1|0x4))
    196         ee_putchar(xo + x, yo + y, c);
     196        caca_putchar(xo + x, yo + y, c);
    197197
    198198    if((b & (0x2|0x4)) == (0x2|0x4))
    199         ee_putchar(xo - x, yo + y, c);
     199        caca_putchar(xo - x, yo + y, c);
    200200
    201201    if((b & (0x1|0x8)) == (0x1|0x8))
    202         ee_putchar(xo + x, yo - y, c);
     202        caca_putchar(xo + x, yo - y, c);
    203203
    204204    if((b & (0x2|0x8)) == (0x2|0x8))
    205         ee_putchar(xo - x, yo - y, c);
    206 }
    207 
     205        caca_putchar(xo - x, yo - y, c);
     206}
     207
  • libcaca/trunk/libcaca/graphics.c

    r181 r185  
    11/*
    2  *   libee         ASCII-Art library
     2 *   libcaca       ASCII-Art library
    33 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    44 *                 All Rights Reserved
     
    3737#include <stdarg.h>
    3838
    39 #include "ee.h"
    40 #include "ee_internals.h"
     39#include "caca.h"
     40#include "caca_internals.h"
    4141
    42 static int _ee_color = 0;
     42static int _caca_color = 0;
    4343
    44 void ee_set_color(int color)
     44void caca_set_color(int color)
    4545{
    4646    if(color < 0 || color > 15)
    4747        return;
    4848
    49     _ee_color = color;
     49    _caca_color = color;
    5050#if defined(USE_SLANG)
    5151    SLsmg_set_color(color + 1);
    5252#elif defined(USE_NCURSES)
    53     attrset(_ee_attr[color]);
     53    attrset(_caca_attr[color]);
    5454#elif defined(USE_CONIO)
    5555    textcolor(color);
     
    5757}
    5858
    59 int ee_get_color(void)
     59int caca_get_color(void)
    6060{
    61     return _ee_color;
     61    return _caca_color;
    6262}
    6363
    64 void ee_putchar(int x, int y, char c)
     64void caca_putchar(int x, int y, char c)
    6565{
    66     if(x < 0 || x >= ee_get_width() || y < 0 || y >= ee_get_height())
     66    if(x < 0 || x >= caca_get_width() || y < 0 || y >= caca_get_height())
    6767        return;
    6868
     
    7474    addch(c);
    7575#elif defined(USE_CONIO)
    76     _ee_screen[2 * (x + y * ee_get_width())] = c;
    77     _ee_screen[2 * (x + y * ee_get_width()) + 1] = _ee_color;
     76    _caca_screen[2 * (x + y * caca_get_width())] = c;
     77    _caca_screen[2 * (x + y * caca_get_width()) + 1] = _caca_color;
    7878//    gotoxy(x + 1, y + 1);
    7979//    putch(c);
     
    8181}
    8282
    83 void ee_putstr(int x, int y, const char *s)
     83void caca_putstr(int x, int y, const char *s)
    8484{
    8585    int len;
    8686
    87     if(y < 0 || y >= ee_get_height() || x >= ee_get_width())
     87    if(y < 0 || y >= caca_get_height() || x >= caca_get_width())
    8888        return;
    8989
     
    9999    }
    100100
    101     if(x + len >= ee_get_width())
     101    if(x + len >= caca_get_width())
    102102    {
    103         memcpy(_ee_scratch_line, s, ee_get_width() - x);
    104         _ee_scratch_line[ee_get_width() - x] = '\0';
    105         s = _ee_scratch_line;
     103        memcpy(_caca_scratch_line, s, caca_get_width() - x);
     104        _caca_scratch_line[caca_get_width() - x] = '\0';
     105        s = _caca_scratch_line;
    106106    }
    107107
     
    113113    addstr(s);
    114114#elif defined(USE_CONIO)
    115     char *buf = _ee_screen + 2 * (x + y * ee_get_width());
     115    char *buf = _caca_screen + 2 * (x + y * caca_get_width());
    116116    while(*s)
    117117    {
    118118        *buf++ = *s++;
    119         *buf++ = _ee_color;
     119        *buf++ = _caca_color;
    120120    }
    121121//    gotoxy(x + 1, y + 1);
     
    124124}
    125125
    126 void ee_printf(int x, int y, const char *format, ...)
     126void caca_printf(int x, int y, const char *format, ...)
    127127{
    128128    char tmp[BUFSIZ];
     
    130130    va_list args;
    131131
    132     if(y < 0 || y >= ee_get_height() || x >= ee_get_width())
     132    if(y < 0 || y >= caca_get_height() || x >= caca_get_width())
    133133        return;
    134134
    135     if(ee_get_width() - x + 1 > BUFSIZ)
    136         buf = malloc(ee_get_width() - x + 1);
     135    if(caca_get_width() - x + 1 > BUFSIZ)
     136        buf = malloc(caca_get_width() - x + 1);
    137137
    138138    va_start(args, format);
    139     vsnprintf(buf, ee_get_width() - x + 1, format, args);
    140     buf[ee_get_width() - x] = '\0';
     139    vsnprintf(buf, caca_get_width() - x + 1, format, args);
     140    buf[caca_get_width() - x] = '\0';
    141141    va_end(args);
    142142
    143     ee_putstr(x, y, buf);
     143    caca_putstr(x, y, buf);
    144144
    145145    if(buf != tmp)
     
    147147}
    148148
    149 void ee_clear(void)
     149void caca_clear(void)
    150150{
    151151    /* We could use SLsmg_cls() etc., but drawing empty lines is much faster */
    152     int y = ee_get_height();
     152    int y = caca_get_height();
    153153
    154154    while(y--)
    155         ee_putstr(0, y, _ee_empty_line);
     155        caca_putstr(0, y, _caca_empty_line);
    156156}
    157157
  • libcaca/trunk/libcaca/io.c

    r159 r185  
    11/*
    2  *   libee         ASCII-Art library
     2 *   libcaca       ASCII-Art library
    33 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    44 *                 All Rights Reserved
     
    3333#endif
    3434
    35 #include "ee.h"
    36 #include "ee_internals.h"
     35#include "caca.h"
     36#include "caca_internals.h"
    3737
    38 char ee_get_key(void)
     38char caca_get_key(void)
    3939{
    4040#if defined(USE_SLANG)
  • libcaca/trunk/libcaca/line.c

    r179 r185  
    11/*
    2  *   libee         ASCII-Art library
     2 *   libcaca       ASCII-Art library
    33 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    44 *                 All Rights Reserved
     
    3131#include <stdlib.h>
    3232
    33 #include "ee.h"
    34 #include "ee_internals.h"
     33#include "caca.h"
     34#include "caca_internals.h"
    3535
    3636struct line
     
    5757 * \return nothing
    5858 */
    59 void ee_draw_line(int x1, int y1, int x2, int y2, char c)
     59void caca_draw_line(int x1, int y1, int x2, int y2, char c)
    6060{
    6161    struct line s;
     
    6969}
    7070
    71 void ee_draw_polyline(const int x[], const int y[], int n, char c)
     71void caca_draw_polyline(const int x[], const int y[], int n, char c)
    7272{
    7373    int i;
     
    9595 * \return nothing
    9696 */
    97 void ee_draw_thin_line(int x1, int y1, int x2, int y2)
     97void caca_draw_thin_line(int x1, int y1, int x2, int y2)
    9898{
    9999    struct line s;
     
    106106}
    107107
    108 void ee_draw_thin_polyline(const int x[], const int y[], int n)
     108void caca_draw_thin_polyline(const int x[], const int y[], int n)
    109109{
    110110    int i;
     
    164164    else if(bits1 & (1<<1))
    165165    {
    166         int xmax = ee_get_width() - 1;
     166        int xmax = caca_get_width() - 1;
    167167        s->y1 = s->y2 - (s->x2 - xmax) * (s->y2 - s->y1) / (s->x2 - s->x1);
    168168        s->x1 = xmax;
     
    175175    else if(bits1 & (1<<3))
    176176    {
    177         int ymax = ee_get_height() - 1;
     177        int ymax = caca_get_height() - 1;
    178178        s->x1 = s->x2 - (s->y2 - ymax) * (s->x2 - s->x1) / (s->y2 - s->y1);
    179179        s->y1 = ymax;
     
    196196    if(x < 0)
    197197        b |= (1<<0);
    198     else if(x >= ee_get_width())
     198    else if(x >= caca_get_width())
    199199        b |= (1<<1);
    200200
    201201    if(y < 0)
    202202        b |= (1<<2);
    203     else if(y >= ee_get_height())
     203    else if(y >= caca_get_height())
    204204        b |= (1<<3);
    205205
     
    236236        for(; dx>=0; dx--)
    237237        {
    238             ee_putchar(x1, y1, s->c);
     238            caca_putchar(x1, y1, s->c);
    239239            if(delta > 0)
    240240            {
     
    258258        for(; dy >= 0; dy--)
    259259        {
    260             ee_putchar(x1, y1, s->c);
     260            caca_putchar(x1, y1, s->c);
    261261            if(delta > 0)
    262262            {
     
    330330            if(delta > 0)
    331331            {
    332                 ee_putchar(x1, y1, charmapy[1]);
     332                caca_putchar(x1, y1, charmapy[1]);
    333333                x1++;
    334334                y1 += yinc;
     
    339339            {
    340340                if(prev)
    341                     ee_putchar(x1, y1, charmapy[0]);
     341                    caca_putchar(x1, y1, charmapy[0]);
    342342                else
    343                     ee_putchar(x1, y1, '-');
     343                    caca_putchar(x1, y1, '-');
    344344                x1++;
    345345                delta += dpr;
     
    358358            if(delta > 0)
    359359            {
    360                 ee_putchar(x1, y1, charmapx[0]);
    361                 ee_putchar(x1 + 1, y1, charmapx[1]);
     360                caca_putchar(x1, y1, charmapx[0]);
     361                caca_putchar(x1 + 1, y1, charmapx[1]);
    362362                x1++;
    363363                y1 += yinc;
     
    366366            else
    367367            {
    368                 ee_putchar(x1, y1, '|');
     368                caca_putchar(x1, y1, '|');
    369369                y1 += yinc;
    370370                delta += dpr;
  • libcaca/trunk/libcaca/math.c

    r171 r185  
    11/*
    2  *   libee         ASCII-Art library
     2 *   libcaca       ASCII-Art library
    33 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    44 *                 All Rights Reserved
     
    2525#include <stdlib.h>
    2626
    27 #include "ee.h"
    28 #include "ee_internals.h"
     27#include "caca.h"
     28#include "caca_internals.h"
    2929
    30 int ee_rand(int min, int max)
     30int caca_rand(int min, int max)
    3131{
    3232    return min + (int)((1.0*(max-min+1)) * rand() / (RAND_MAX+1.0));
    3333}
    3434
    35 unsigned int ee_sqrt(unsigned int a)
     35unsigned int caca_sqrt(unsigned int a)
    3636{
    3737    if(a == 0)
     
    5555    }
    5656
    57     return 2 * ee_sqrt(a / 4);
     57    return 2 * caca_sqrt(a / 4);
    5858}
    5959
  • libcaca/trunk/libcaca/sprite.c

    r167 r185  
    11/*
    2  *   libee         ASCII-Art library
     2 *   libcaca       ASCII-Art library
    33 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    44 *                 All Rights Reserved
     
    2727#include <string.h>
    2828
    29 #include "ee.h"
    30 #include "ee_internals.h"
    31 
    32 struct ee_frame
     29#include "caca.h"
     30#include "caca_internals.h"
     31
     32struct caca_frame
    3333{
    3434    int w, h;
     
    3838};
    3939
    40 struct ee_sprite
     40struct caca_sprite
    4141{
    4242    int nf;
    43     struct ee_frame *frames;
     43    struct caca_frame *frames;
    4444};
    4545
    46 struct ee_sprite *ee_load_sprite(const char *file)
     46struct caca_sprite *caca_load_sprite(const char *file)
    4747{
    4848    char buf[BUFSIZ];
    49     struct ee_sprite *sprite;
     49    struct caca_sprite *sprite;
    5050    FILE *fd;
    5151
     
    5454        return NULL;
    5555
    56     sprite = malloc(sizeof(struct ee_sprite));
     56    sprite = malloc(sizeof(struct caca_sprite));
    5757    if(sprite == NULL)
    5858        goto sprite_alloc_failed;
     
    6565        int x, y;
    6666        int w = 0, h = 0, dx = 0, dy = 0;
    67         struct ee_frame *frame;
     67        struct caca_frame *frame;
    6868
    6969        /* Get width and height */
     
    7878        {
    7979            void *tmp = realloc(sprite->frames,
    80                                 (sprite->nf + 1) * sizeof(struct ee_frame));
     80                                (sprite->nf + 1) * sizeof(struct caca_frame));
    8181            if(tmp == NULL)
    8282                goto frame_failed;
     
    8686        else
    8787        {
    88             sprite->frames = malloc((sprite->nf + 1) * sizeof(struct ee_frame));
     88            sprite->frames = malloc((sprite->nf + 1) * sizeof(struct caca_frame));
    8989            if(sprite->frames == NULL)
    9090                goto sprite_failed;
     
    159159}
    160160
    161 int ee_get_sprite_frames(struct ee_sprite *sprite)
     161int caca_get_sprite_frames(struct caca_sprite *sprite)
    162162{
    163163    if(sprite == NULL)
     
    167167}
    168168
    169 int ee_get_sprite_width(struct ee_sprite *sprite, int f)
     169int caca_get_sprite_width(struct caca_sprite *sprite, int f)
    170170{
    171171    if(sprite == NULL)
     
    178178}
    179179
    180 int ee_get_sprite_height(struct ee_sprite *sprite, int f)
     180int caca_get_sprite_height(struct caca_sprite *sprite, int f)
    181181{
    182182    if(sprite == NULL)
     
    189189}
    190190
    191 int ee_get_sprite_dx(struct ee_sprite *sprite, int f)
     191int caca_get_sprite_dx(struct caca_sprite *sprite, int f)
    192192{
    193193    if(sprite == NULL)
     
    200200}
    201201
    202 int ee_get_sprite_dy(struct ee_sprite *sprite, int f)
     202int caca_get_sprite_dy(struct caca_sprite *sprite, int f)
    203203{
    204204    if(sprite == NULL)
     
    211211}
    212212
    213 void ee_draw_sprite(int x, int y, struct ee_sprite *sprite, int f)
     213void caca_draw_sprite(int x, int y, struct caca_sprite *sprite, int f)
    214214{
    215215    int i, j, oldcol;
    216     struct ee_frame *frame;
     216    struct caca_frame *frame;
    217217
    218218    if(sprite == NULL)
     
    224224    frame = &sprite->frames[f];
    225225
    226     oldcol = ee_get_color();
     226    oldcol = caca_get_color();
    227227
    228228    for(j = 0; j < frame->h; j++)
     
    233233            if(col >= 0)
    234234            {
    235                 ee_set_color(col);
    236                 ee_putchar(x + i - frame->dx, y + j - frame->dy,
     235                caca_set_color(col);
     236                caca_putchar(x + i - frame->dx, y + j - frame->dy,
    237237                           frame->chars[frame->w * j + i]);
    238238            }
     
    240240    }
    241241
    242     ee_set_color(oldcol);
    243 }
    244 
    245 void ee_free_sprite(struct ee_sprite *sprite)
     242    caca_set_color(oldcol);
     243}
     244
     245void caca_free_sprite(struct caca_sprite *sprite)
    246246{
    247247    int i;
     
    252252    for(i = sprite->nf; i--;)
    253253    {
    254         struct ee_frame *frame = &sprite->frames[i];
     254        struct caca_frame *frame = &sprite->frames[i];
    255255        free(frame->chars);
    256256        free(frame->color);
  • libcaca/trunk/libcaca/triangle.c

    r159 r185  
    11/*
    2  *   libee         ASCII-Art library
     2 *   libcaca       ASCII-Art library
    33 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
    44 *                 All Rights Reserved
     
    2525#include <stdlib.h>
    2626
    27 #include "ee.h"
    28 #include "ee_internals.h"
     27#include "caca.h"
     28#include "caca_internals.h"
    2929
    30 void ee_draw_triangle(int x1, int y1, int x2, int y2, int x3, int y3, char c)
     30void caca_draw_triangle(int x1, int y1, int x2, int y2, int x3, int y3, char c)
    3131{
    32     ee_draw_line(x1, y1, x2, y2, c);
    33     ee_draw_line(x2, y2, x3, y3, c);
    34     ee_draw_line(x3, y3, x1, y1, c);
     32    caca_draw_line(x1, y1, x2, y2, c);
     33    caca_draw_line(x2, y2, x3, y3, c);
     34    caca_draw_line(x3, y3, x1, y1, c);
    3535}
    3636
    37 void ee_draw_thin_triangle(int x1, int y1, int x2, int y2, int x3, int y3)
     37void caca_draw_thin_triangle(int x1, int y1, int x2, int y2, int x3, int y3)
    3838{
    39     ee_draw_thin_line(x1, y1, x2, y2);
    40     ee_draw_thin_line(x2, y2, x3, y3);
    41     ee_draw_thin_line(x3, y3, x1, y1);
     39    caca_draw_thin_line(x1, y1, x2, y2);
     40    caca_draw_thin_line(x2, y2, x3, y3);
     41    caca_draw_thin_line(x3, y3, x1, y1);
    4242}
    4343
    44 void ee_fill_triangle(int x1, int y1, int x2, int y2, int x3, int y3, char c)
     44void caca_fill_triangle(int x1, int y1, int x2, int y2, int x3, int y3, char c)
    4545{
    4646    int x, y, xa, xb, xmax, ymax;
     
    4949    if(y1 > y2)
    5050    {
    51         ee_fill_triangle(x2, y2, x1, y1, x3, y3, c);
     51        caca_fill_triangle(x2, y2, x1, y1, x3, y3, c);
    5252        return;
    5353    }
     
    5555    if(y2 > y3)
    5656    {
    57         ee_fill_triangle(x1, y1, x3, y3, x2, y2, c);
     57        caca_fill_triangle(x1, y1, x3, y3, x2, y2, c);
    5858        return;
    5959    }
     
    6464    x3 *= 4;
    6565
    66     xmax = ee_get_width() - 1;
    67     ymax = ee_get_height() - 1;
     66    xmax = caca_get_width() - 1;
     67    ymax = caca_get_height() - 1;
    6868
    6969    /* Rasterize our triangle */
     
    9797
    9898        for(x = xa; x <= xb; x++)
    99             ee_putchar(x, y, c);
     99            caca_putchar(x, y, c);
    100100    }
    101101}
Note: See TracChangeset for help on using the changeset viewer.