diff --git a/data/alien.ans b/data/alien.ans new file mode 100644 index 0000000..78f6a6f --- /dev/null +++ b/data/alien.ans @@ -0,0 +1,4 @@ + ____ + / \ +(|_()|_) + \____/ diff --git a/data/roflcopter.ans b/data/roflcopter.ans new file mode 100644 index 0000000..d9b90c0 --- /dev/null +++ b/data/roflcopter.ans @@ -0,0 +1,8 @@ + ROFL:ROFL:LOL:ROFL:ROFL + ^ + L /-------- + O === []\ + L \ \ + \_______ ] + I I + ----------/ diff --git a/data/ship.ans b/data/ship.ans new file mode 100644 index 0000000..a7ae138 --- /dev/null +++ b/data/ship.ans @@ -0,0 +1,3 @@ +_ rofl|rofl +\\___/v\ + \______) diff --git a/src/aliens.c b/src/aliens.c index 42d58f0..dcb5c0b 100644 --- a/src/aliens.c +++ b/src/aliens.c @@ -26,12 +26,13 @@ #include "common.h" -struct cucul_sprite *foo_sprite; -struct cucul_sprite *bar_sprite; -struct cucul_sprite *baz_sprite; +cucul_canvas_t *foo_sprite; +cucul_canvas_t *bar_sprite; +cucul_canvas_t *baz_sprite; void init_aliens(game *g, aliens *al) { + cucul_buffer_t *b; int i; for(i = 0; i < ALIENS; i++) @@ -39,9 +40,17 @@ void init_aliens(game *g, aliens *al) al->type[i] = ALIEN_NONE; } - foo_sprite = cucul_load_sprite(g->qq, "data/foofight.txt"); - bar_sprite = cucul_load_sprite(g->qq, "data/barfight.txt"); - baz_sprite = cucul_load_sprite(g->qq, "data/bazfight.txt"); + b = cucul_load_file("data/foofight.caca"); + foo_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); + + b = cucul_load_file("data/barfight.caca"); + bar_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); + + b = cucul_load_file("data/bazfight.caca"); + baz_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); } void draw_aliens(game *g, aliens *al) @@ -53,13 +62,16 @@ void draw_aliens(game *g, aliens *al) switch(al->type[i]) { case ALIEN_FOO: - cucul_draw_sprite(g->qq, al->x[i], al->y[i], foo_sprite, al->img[i] % 5); + cucul_set_canvas_frame(foo_sprite, al->img[i] % 5); + cucul_blit(g->cv, al->x[i], al->y[i], foo_sprite, NULL); break; case ALIEN_BAR: - cucul_draw_sprite(g->qq, al->x[i], al->y[i], bar_sprite, al->img[i] % 2); + cucul_set_canvas_frame(bar_sprite, al->img[i] % 2); + cucul_blit(g->cv, al->x[i], al->y[i], bar_sprite, NULL); break; case ALIEN_BAZ: - cucul_draw_sprite(g->qq, al->x[i], al->y[i], baz_sprite, al->img[i] % 4); + cucul_set_canvas_frame(baz_sprite, al->img[i] % 4); + cucul_blit(g->cv, al->x[i], al->y[i], baz_sprite, NULL); break; case ALIEN_NONE: break; diff --git a/src/bonus.c b/src/bonus.c index ce0f1c0..12d5e2b 100644 --- a/src/bonus.c +++ b/src/bonus.c @@ -26,11 +26,12 @@ #include "common.h" -struct cucul_sprite *heart_sprite; -struct cucul_sprite *gem_sprite; +cucul_canvas_t *heart_sprite; +cucul_canvas_t *gem_sprite; void init_bonus(game *g, bonus *bo) { + cucul_buffer_t *b; int i; for(i = 0; i < BONUS; i++) @@ -38,8 +39,13 @@ void init_bonus(game *g, bonus *bo) bo->type[i] = BONUS_NONE; } - heart_sprite = cucul_load_sprite(g->qq, "data/bonheart.txt"); - gem_sprite = cucul_load_sprite(g->qq, "data/bongem.txt"); + b = cucul_load_file("data/bonheart.caca"); + heart_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); + + b = cucul_load_file("data/bongem.caca"); + gem_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); } void draw_bonus(game *g, bonus *bo) @@ -51,12 +57,12 @@ void draw_bonus(game *g, bonus *bo) switch(bo->type[i]) { case BONUS_GREEN: - cucul_draw_sprite(g->qq, bo->x[i], bo->y[i], gem_sprite, - (bo->n[i]/2 % 3) ? 0 : 1); + cucul_set_canvas_frame(gem_sprite, (bo->n[i]/2 % 3) ? 0 : 1); + cucul_blit(g->cv, bo->x[i], bo->y[i], gem_sprite, NULL); break; case BONUS_LIFE: - cucul_draw_sprite(g->qq, bo->x[i], bo->y[i], heart_sprite, - (bo->n[i] % 3) ? 0 : 1); + cucul_set_canvas_frame(heart_sprite, (bo->n[i] % 3) ? 0 : 1); + cucul_blit(g->cv, bo->x[i], bo->y[i], heart_sprite, NULL); break; case BONUS_NONE: break; diff --git a/src/box.c b/src/box.c index caf6e30..86a2307 100644 --- a/src/box.c +++ b/src/box.c @@ -45,37 +45,37 @@ void draw_box(game *g, box *b) { int j, frame; - cucul_set_color(g->qq, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); + cucul_set_color(g->cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); /* Draw the thin horizontal line */ if(b->frame < 8) { - cucul_draw_line(g->qq, b->x - b->w * b->frame / 16, b->y, - b->x + b->w * b->frame / 16 - 1, b->y, 'X'); + cucul_draw_line(g->cv, b->x - b->w * b->frame / 16, b->y, + b->x + b->w * b->frame / 16 - 1, b->y, "X"); return; } /* Draw the frame */ frame = b->frame < 12 ? b->frame : 12; - cucul_draw_line(g->qq, b->x - b->w / 2, b->y - b->h * (frame - 8) / 8, - b->x + b->w / 2 - 1, b->y - b->h * (frame - 8) / 8, 'X'); - cucul_draw_line(g->qq, b->x - b->w / 2, b->y + b->h * (frame - 8) / 8, - b->x + b->w / 2 - 1, b->y + b->h * (frame - 8) / 8, 'X'); + cucul_draw_line(g->cv, b->x - b->w / 2, b->y - b->h * (frame - 8) / 8, + b->x + b->w / 2 - 1, b->y - b->h * (frame - 8) / 8, "X"); + cucul_draw_line(g->cv, b->x - b->w / 2, b->y + b->h * (frame - 8) / 8, + b->x + b->w / 2 - 1, b->y + b->h * (frame - 8) / 8, "X"); - cucul_draw_line(g->qq, b->x - b->w / 2, b->y - b->h * (frame - 8) / 8, - b->x - b->w / 2, b->y + b->h * (frame - 8) / 8 - 1, 'X'); - cucul_draw_line(g->qq, b->x + b->w / 2 - 1, b->y - b->h * (frame - 8) / 8, - b->x + b->w / 2 - 1, b->y + b->h * (frame - 8) / 8 - 1, 'X'); + cucul_draw_line(g->cv, b->x - b->w / 2, b->y - b->h * (frame - 8) / 8, + b->x - b->w / 2, b->y + b->h * (frame - 8) / 8 - 1, "X"); + cucul_draw_line(g->cv, b->x + b->w / 2 - 1, b->y - b->h * (frame - 8) / 8, + b->x + b->w / 2 - 1, b->y + b->h * (frame - 8) / 8 - 1, "X"); - cucul_set_color(g->qq, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK); + cucul_set_color(g->cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK); for(j = b->y - b->h * (frame - 8) / 8 + 1; j < b->y + b->h * (frame - 8) / 8; j++) { - cucul_draw_line(g->qq, b->x - b->w / 2 + 1, j, - b->x + b->w / 2 - 2, j, 'X'); + cucul_draw_line(g->cv, b->x - b->w / 2 + 1, j, + b->x + b->w / 2 - 2, j, "X"); } if(b->frame < 12) @@ -84,18 +84,18 @@ void draw_box(game *g, box *b) } /* Draw the text inside the frame */ - cucul_set_color(g->qq, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); + cucul_set_color(g->cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); /* FIXME: use a font */ - cucul_putstr(g->qq, b->x - b->w / 2 + 12, b->y - b->h / 2 + 2, + cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 2, "XXXX. .XXXX X X .XXXX .XXXX XXXX."); - cucul_putstr(g->qq, b->x - b->w / 2 + 12, b->y - b->h / 2 + 3, + cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 3, "X `X X' X X X X' X' X `X"); - cucul_putstr(g->qq, b->x - b->w / 2 + 12, b->y - b->h / 2 + 4, + cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 4, "XXXX' XXXXX X X `XXX XXXX X X"); - cucul_putstr(g->qq, b->x - b->w / 2 + 12, b->y - b->h / 2 + 5, + cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 5, "X' X' `X X. ,X `X X' X ,X"); - cucul_putstr(g->qq, b->x - b->w / 2 + 12, b->y - b->h / 2 + 6, + cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 6, "X X X `XXXX XXXX' `XXXX XXXX'"); } diff --git a/src/ceo.c b/src/ceo.c index 02b9107..ab5639a 100644 --- a/src/ceo.c +++ b/src/ceo.c @@ -33,17 +33,19 @@ void ceo_alert(game *g) while(!end) { - cucul_clear(g->qq); + caca_event_t ev; - if(caca_get_event(g->kk, CACA_EVENT_KEY_PRESS) - == (CACA_EVENT_KEY_PRESS | '\t')) + cucul_clear_canvas(g->cv); + + if(caca_get_event(g->dp, CACA_EVENT_KEY_PRESS, &ev, 0) + && ev.data.key.ch == '\t') { end = 1; } fprintf(stderr, "foo\n"); - caca_display(g->qq); + caca_refresh_display(g->cv); usleep(40000); } diff --git a/src/common.h b/src/common.h index 6a453a7..74bc904 100644 --- a/src/common.h +++ b/src/common.h @@ -42,7 +42,7 @@ /* * Graphics primitives */ -#include "caca.h" +#include /* * Useful macros @@ -132,8 +132,8 @@ typedef struct { int w, h; - cucul_t *qq; - caca_t *kk; + cucul_canvas_t *cv; + caca_display_t *dp; starfield *sf; weapons *wp; diff --git a/src/explosions.c b/src/explosions.c index 69ab93a..1eae95a 100644 --- a/src/explosions.c +++ b/src/explosions.c @@ -26,11 +26,12 @@ #include "common.h" -struct cucul_sprite *medium_sprite; -struct cucul_sprite *small_sprite; +cucul_canvas_t *medium_sprite; +cucul_canvas_t *small_sprite; void init_explosions(game *g, explosions *ex) { + cucul_buffer_t *b; int i; for(i = 0; i < EXPLOSIONS; i++) @@ -38,8 +39,13 @@ void init_explosions(game *g, explosions *ex) ex->type[i] = EXPLOSION_NONE; } - medium_sprite = cucul_load_sprite(g->qq, "data/xplmed.txt"); - small_sprite = cucul_load_sprite(g->qq, "data/xplsmall.txt"); + b = cucul_load_file("data/xplmed.caca"); + medium_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); + + b = cucul_load_file("data/xplsmall.caca"); + small_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); } void add_explosion(game *g, explosions *ex, int x, int y, int vx, int vy, int type) @@ -76,39 +82,39 @@ void draw_explosions(game *g, explosions *ex) for(i = 0; i < EXPLOSIONS; i++) { #if 0 - cucul_set_fg_color(g->qq, CACA_COLOR_GREEN); - cucul_goto(g->qq, ex->x[i] + 3, ex->y[i]); + cucul_set_fg_color(g->cv, CACA_COLOR_GREEN); + cucul_goto(g->cv, ex->x[i] + 3, ex->y[i]); switch(cucul_rand(0,2)) { case 0: - cucul_putchar(g->qq, 'p'); - cucul_putchar(g->qq, 'i'); - cucul_putchar(g->qq, 'f'); + cucul_putchar(g->cv, 'p'); + cucul_putchar(g->cv, 'i'); + cucul_putchar(g->cv, 'f'); break; case 1: - cucul_putchar(g->qq, 'p'); - cucul_putchar(g->qq, 'a'); - cucul_putchar(g->qq, 'f'); + cucul_putchar(g->cv, 'p'); + cucul_putchar(g->cv, 'a'); + cucul_putchar(g->cv, 'f'); break; case 2: - cucul_putchar(g->qq, 'p'); - cucul_putchar(g->qq, 'o'); - cucul_putchar(g->qq, 'u'); - cucul_putchar(g->qq, 'f'); + cucul_putchar(g->cv, 'p'); + cucul_putchar(g->cv, 'o'); + cucul_putchar(g->cv, 'u'); + cucul_putchar(g->cv, 'f'); break; } - cucul_putchar(g->qq, '!'); + cucul_putchar(g->cv, '!'); #endif switch(ex->type[i]) { case EXPLOSION_MEDIUM: - cucul_draw_sprite(g->qq, ex->x[i], ex->y[i], medium_sprite, - 10 - ex->n[i]); + cucul_set_canvas_frame(medium_sprite, 10 - ex->n[i]); + cucul_blit(g->cv, ex->x[i], ex->y[i], medium_sprite, NULL); break; case EXPLOSION_SMALL: - cucul_draw_sprite(g->qq, ex->x[i], ex->y[i], small_sprite, - 6 - ex->n[i]); + cucul_set_canvas_frame(small_sprite, 6 - ex->n[i]); + cucul_blit(g->cv, ex->x[i], ex->y[i], small_sprite, NULL); break; case EXPLOSION_NONE: break; diff --git a/src/intro.c b/src/intro.c index 2d3712a..6f13ecb 100644 --- a/src/intro.c +++ b/src/intro.c @@ -30,27 +30,40 @@ void intro(game *g) { - struct cucul_sprite *foo_sprite = cucul_load_sprite(g->qq, "data/foofight.txt"); - struct cucul_sprite *bar_sprite = cucul_load_sprite(g->qq, "data/barfight.txt"); - struct cucul_sprite *baz_sprite = cucul_load_sprite(g->qq, "data/bazfight.txt"); - + caca_event_t ev; + cucul_canvas_t *foo_sprite; + cucul_canvas_t *bar_sprite; + cucul_canvas_t *baz_sprite; + cucul_buffer_t *b; int frame = 0; - while(caca_get_event(g->kk, CACA_EVENT_KEY_PRESS) == 0) + b = cucul_load_file("data/foofight.caca"); + foo_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); + + b = cucul_load_file("data/barfight.caca"); + bar_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); + + b = cucul_load_file("data/bazfight.caca"); + baz_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); + + while(caca_get_event(g->dp, CACA_EVENT_KEY_PRESS, &ev, 0) == 0) { int i, xo, yo, x[5], y[5]; frame++; - cucul_clear(g->qq); + cucul_clear_canvas(g->cv); - xo = cucul_get_width(g->qq) / 2; - yo = cucul_get_height(g->qq) / 2; + xo = cucul_get_canvas_width(g->cv) / 2; + yo = cucul_get_canvas_height(g->cv) / 2; - cucul_set_color(g->qq, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK); - cucul_fill_ellipse(g->qq, xo, yo, 16, 8, '#'); - cucul_set_color(g->qq, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK); - cucul_draw_thin_ellipse(g->qq, xo, yo, 16, 8); + cucul_set_color(g->cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK); + cucul_fill_ellipse(g->cv, xo, yo, 16, 8, "#"); + cucul_set_color(g->cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK); + cucul_draw_thin_ellipse(g->cv, xo, yo, 16, 8); for(i = 0; i < 4; i ++) { @@ -60,16 +73,17 @@ void intro(game *g) x[4] = x[0]; y[4] = y[0]; - cucul_set_color(g->qq, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK); - cucul_fill_triangle(g->qq, x[0], y[0], x[1], y[1], x[2], y[2], ' '); - cucul_fill_triangle(g->qq, x[0], y[0], x[3], y[3], x[2], y[2], ' '); - cucul_draw_line(g->qq, x[0], y[0], x[2], y[2], ' '); - cucul_set_color(g->qq, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK); - cucul_draw_thin_polyline(g->qq, x, y, 4); + cucul_set_color(g->cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK); + cucul_fill_triangle(g->cv, x[0], y[0], x[1], y[1], x[2], y[2], " "); + cucul_fill_triangle(g->cv, x[0], y[0], x[3], y[3], x[2], y[2], " "); + cucul_draw_line(g->cv, x[0], y[0], x[2], y[2], " "); + cucul_set_color(g->cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK); + cucul_draw_thin_polyline(g->cv, x, y, 4); - cucul_draw_sprite(g->qq, xo, yo, foo_sprite, frame % 5); + cucul_set_canvas_frame(foo_sprite, frame % 5); + cucul_blit(g->cv, xo, yo, foo_sprite, NULL); - caca_display(g->kk); + caca_refresh_display(g->dp); usleep(40000); } diff --git a/src/main.c b/src/main.c index f679008..98bc1e0 100644 --- a/src/main.c +++ b/src/main.c @@ -33,7 +33,7 @@ static void start_game (game *); -int main (int argc, char **argv) +int _main (int argc, char **argv) { game *g = malloc(sizeof(game)); if(g == NULL) @@ -41,19 +41,19 @@ int main (int argc, char **argv) srand(time(NULL)); - g->qq = cucul_init(); - if(!g->qq) + g->cv = cucul_create_canvas(0, 0); + if(!g->cv) return 1; - g->kk = caca_attach(g->qq); - if(!g->kk) + g->dp = caca_create_display(g->cv); + if(!g->dp) return 1; - caca_set_delay(g->kk, 40000); + caca_set_display_time(g->dp, 40000); /* Initialize our program */ - g->w = cucul_get_width(g->qq); - g->h = cucul_get_height(g->qq); + g->w = cucul_get_canvas_width(g->cv); + g->h = cucul_get_canvas_height(g->cv); intro(g); @@ -61,8 +61,8 @@ intro(g); start_game(g); /* Clean up */ - caca_detach(g->kk); - cucul_end(g->qq); + caca_free_display(g->dp); + cucul_free_canvas(g->cv); return 0; } @@ -102,13 +102,11 @@ static void start_game (game *g) while(!quit) { - int event, key; + caca_event_t ev; - while((event = caca_get_event(g->kk, CACA_EVENT_KEY_PRESS))) + while(caca_get_event(g->dp, CACA_EVENT_KEY_PRESS, &ev, 0)) { - key = event & 0xffffff; - - switch(key) + switch(ev.data.key.ch) { case 'q': quit = 1; @@ -138,7 +136,7 @@ static void start_game (game *g) break; } - switch(key) + switch(ev.data.key.ch) { case 'h': g->p->vx = -2; @@ -237,7 +235,7 @@ static void start_game (game *g) } /* Clear screen */ - cucul_clear(g->qq); + cucul_clear_canvas(g->cv); /* Print starfield, tunnel, aliens, player and explosions */ draw_starfield(g, g->sf); @@ -257,7 +255,7 @@ static void start_game (game *g) } /* Refresh */ - caca_display(g->kk); + caca_refresh_display(g->dp); purcompteur++; } diff --git a/src/overlay.c b/src/overlay.c index 6f933f1..bea91dc 100644 --- a/src/overlay.c +++ b/src/overlay.c @@ -32,50 +32,50 @@ void draw_status(game *g) static char dashes30[] = "=============================="; /* Draw life jauge */ - cucul_set_color(g->qq, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, 4, 1, dots30); + cucul_set_color(g->cv, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, 4, 1, dots30); if(g->p->life > MAX_LIFE * 7 / 10) { - cucul_set_color(g->qq, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK); + cucul_set_color(g->cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK); } else if(g->p->life > MAX_LIFE * 3 / 10) { - cucul_set_color(g->qq, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); + cucul_set_color(g->cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); } else { - cucul_set_color(g->qq, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK); + cucul_set_color(g->cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK); } - cucul_putstr(g->qq, 4, 1, dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE); + cucul_putstr(g->cv, 4, 1, dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE); - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, 1, 1, "L |"); - cucul_putstr(g->qq, 34, 1, "|"); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, 1, 1, "L |"); + cucul_putstr(g->cv, 34, 1, "|"); /* Draw weapon jauge */ - cucul_set_color(g->qq, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, 42, 1, dots30 + 10); + cucul_set_color(g->cv, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, 42, 1, dots30 + 10); if(g->p->special > MAX_SPECIAL * 9 / 10) { - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); } else if(g->p->special > MAX_SPECIAL * 3 / 10) { - cucul_set_color(g->qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); + cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); } else { - cucul_set_color(g->qq, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); + cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); } - cucul_putstr(g->qq, 42, 1, dashes30 + 10 + cucul_putstr(g->cv, 42, 1, dashes30 + 10 + (MAX_SPECIAL - g->p->special) * 20 / MAX_SPECIAL); - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, 39, 1, "S |"); - cucul_putstr(g->qq, 62, 1, "|"); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, 39, 1, "S |"); + cucul_putstr(g->cv, 62, 1, "|"); } diff --git a/src/player.c b/src/player.c index ec539b1..c0c7d93 100644 --- a/src/player.c +++ b/src/player.c @@ -26,11 +26,13 @@ #include "common.h" -struct cucul_sprite *ship_sprite; +cucul_canvas_t *ship_sprite; /* Init tunnel */ player * create_player(game *g) { + cucul_buffer_t *b; + player *p = malloc(sizeof(player)); if(p == NULL) exit(1); @@ -44,7 +46,9 @@ player * create_player(game *g) p->life = MAX_LIFE; p->dead = 0; - ship_sprite = cucul_load_sprite(g->qq, "data/ship.txt"); + b = cucul_load_file("data/ship.caca"); + ship_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); return p; } @@ -59,7 +63,8 @@ void draw_player(game *g, player *p) if(p->dead) return; - cucul_draw_sprite(g->qq, p->x, p->y, ship_sprite, 0); + cucul_set_canvas_frame(ship_sprite, 0); + cucul_blit(g->cv, p->x, p->y, ship_sprite, NULL); } void update_player(game *g, player *p) diff --git a/src/starfield.c b/src/starfield.c index 840a22d..120f75f 100644 --- a/src/starfield.c +++ b/src/starfield.c @@ -55,8 +55,8 @@ void draw_starfield(game *g, starfield *s) { if(s[i].x >= 0) { - cucul_set_color(g->qq, s[i].c, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, s[i].x, s[i].y, s[i].ch); + cucul_set_color(g->cv, s[i].c, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, s[i].x, s[i].y, s[i].ch); } } } diff --git a/src/ttyvaders.c b/src/ttyvaders.c index a505ac3..89d8ea0 100644 --- a/src/ttyvaders.c +++ b/src/ttyvaders.c @@ -130,19 +130,19 @@ static void display_ground(void) /* Draw the ground */ j = h - ground[i]; cucul_set_color(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_LIGHTBLUE); - if(i >= 4 && ground[i] == ground[i - 3] - && ground[i] != ground[i - 4]) + if(i >= 4 && ground[i] == ground[i - 6] + && ground[i] != ground[i - 7]) { - cucul_putstr(cv, i - 3, j - 2, "||\\"); - cucul_putstr(cv, i - 3, j - 1, "o--o"); + cucul_putstr(cv, i - 3, j - 2, "Omm"); + cucul_putstr(cv, i - 6, j - 1, "(/)-(/)"); } cucul_set_color(cv, CUCUL_COLOR_RED, CUCUL_COLOR_GREEN); if(ground[i + 1] > ground[i]) - cucul_putchar(cv, i, j++, 0x259f); + cucul_putchar(cv, i, j++, 0x2588); // UTF-8: 0x259f else if(ground[i + 1] < ground[i]) { j++; - cucul_putchar(cv, i, j++, 0x2599); + cucul_putchar(cv, i, j++, 0x2588); // UTF-8: 0x2599 } else cucul_putchar(cv, i, j++, 0x2584); diff --git a/src/tunnel.c b/src/tunnel.c index 9d6639d..5620a6a 100644 --- a/src/tunnel.c +++ b/src/tunnel.c @@ -77,7 +77,7 @@ void draw_tunnel(game *g, tunnel *t) int i, j; char c; - cucul_set_color(g->qq, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK); + cucul_set_color(g->cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK); /* Left border */ for(i = 0; i < g->h ; i++) @@ -90,11 +90,11 @@ void draw_tunnel(game *g, tunnel *t) else c = (i == 0 || t->left[i] > t->left[i-1]) ? '\\' : '<'; - cucul_putchar(g->qq, t->left[i] + 1, i, c); + cucul_putchar(g->cv, t->left[i] + 1, i, c); if(i + 1 < g->h) for(j = 1; j < t->left[i+1] - t->left[i]; j++) - cucul_putchar(g->qq, t->left[i] + j + 1, i, '_'); + cucul_putchar(g->cv, t->left[i] + j + 1, i, '_'); } /* Right border */ @@ -110,22 +110,22 @@ void draw_tunnel(game *g, tunnel *t) if(i + 1 < g->h) for(j = 1; j < t->right[i] - t->right[i+1]; j++) - cucul_putchar(g->qq, t->right[i+1] + j - 1, i, '_'); + cucul_putchar(g->cv, t->right[i+1] + j - 1, i, '_'); - cucul_putchar(g->qq, t->right[i] - 1, i, c); + cucul_putchar(g->cv, t->right[i] - 1, i, c); } - cucul_set_color(g->qq, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_RED); + cucul_set_color(g->cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_RED); /* Left concrete */ for(i = 0; i < g->h ; i++) for(j = 0 ; j <= t->left[i]; j++) - cucul_putchar(g->qq, j, i, '#'); + cucul_putchar(g->cv, j, i, '#'); /* Right concrete */ for(i = 0; i < g->h ; i++) for(j = t->right[i] ; j < g->w ; j++) - cucul_putchar(g->qq, j, i, '#'); + cucul_putchar(g->cv, j, i, '#'); } void update_tunnel(game *g, tunnel *t) diff --git a/src/weapons.c b/src/weapons.c index e889d33..72f4807 100644 --- a/src/weapons.c +++ b/src/weapons.c @@ -23,6 +23,7 @@ #include "config.h" #include +#include #include "common.h" @@ -31,11 +32,12 @@ static void draw_nuke(game *g, int x, int y, int frame); static void draw_beam(game *g, int x, int y, int frame); static void draw_fragbomb(game *g, int x, int y, int frame); -struct cucul_sprite *bomb_sprite; -struct cucul_sprite *fragbomb_sprite; +cucul_canvas_t *bomb_sprite; +cucul_canvas_t *fragbomb_sprite; void init_weapons(game *g, weapons *wp) { + cucul_buffer_t *b; int i; for(i = 0; i < WEAPONS; i++) @@ -43,8 +45,13 @@ void init_weapons(game *g, weapons *wp) wp->type[i] = WEAPON_NONE; } - bomb_sprite = cucul_load_sprite(g->qq, "data/wpnbomb.txt"); - fragbomb_sprite = cucul_load_sprite(g->qq, "data/wpnfrag.txt"); + b = cucul_load_file("data/wpnbomb.caca"); + bomb_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); + + b = cucul_load_file("data/wpnfrag.caca"); + bomb_sprite = cucul_import_canvas(b, ""); + cucul_free_buffer(b); } void draw_weapons(game *g, weapons *wp) @@ -56,25 +63,25 @@ void draw_weapons(game *g, weapons *wp) switch(wp->type[i]) { case WEAPON_LASER: - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, wp->x[i] >> 4, wp->y[i] >> 4, '|'); - cucul_set_color(g->qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, wp->x[i] >> 4, (wp->y[i] >> 4) + 1, '|'); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, wp->x[i] >> 4, wp->y[i] >> 4, '|'); + cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, wp->x[i] >> 4, (wp->y[i] >> 4) + 1, '|'); break; case WEAPON_SEEKER: - cucul_set_color(g->qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, wp->x3[i] >> 4, wp->y3[i] >> 4, '.'); - cucul_putchar(g->qq, wp->x2[i] >> 4, wp->y2[i] >> 4, 'o'); - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, wp->x[i] >> 4, wp->y[i] >> 4, '@'); + cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, wp->x3[i] >> 4, wp->y3[i] >> 4, '.'); + cucul_putchar(g->cv, wp->x2[i] >> 4, wp->y2[i] >> 4, 'o'); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, wp->x[i] >> 4, wp->y[i] >> 4, '@'); break; case WEAPON_BOMB: - cucul_set_color(g->qq, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, (wp->x[i] - wp->vx[i]) >> 4, (wp->y[i] - wp->vy[i]) >> 4, '.'); - cucul_putchar(g->qq, (wp->x3[i] - wp->vx[i]) >> 4, (wp->y3[i] - wp->vy[i]) >> 4, '.'); - cucul_putchar(g->qq, (wp->x2[i] - wp->vx[i]) >> 4, (wp->y2[i] - wp->vy[i]) >> 4, '.'); - cucul_putchar(g->qq, wp->x3[i] >> 4, wp->y3[i] >> 4, '.'); - cucul_putchar(g->qq, wp->x2[i] >> 4, wp->y2[i] >> 4, '.'); + cucul_set_color(g->cv, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, (wp->x[i] - wp->vx[i]) >> 4, (wp->y[i] - wp->vy[i]) >> 4, '.'); + cucul_putchar(g->cv, (wp->x3[i] - wp->vx[i]) >> 4, (wp->y3[i] - wp->vy[i]) >> 4, '.'); + cucul_putchar(g->cv, (wp->x2[i] - wp->vx[i]) >> 4, (wp->y2[i] - wp->vy[i]) >> 4, '.'); + cucul_putchar(g->cv, wp->x3[i] >> 4, wp->y3[i] >> 4, '.'); + cucul_putchar(g->cv, wp->x2[i] >> 4, wp->y2[i] >> 4, '.'); draw_bomb(g, wp->x[i] >> 4, wp->y[i] >> 4, wp->vx[i], wp->vy[i]); break; case WEAPON_FRAGBOMB: @@ -170,7 +177,7 @@ void update_weapons(game *g, weapons *wp) /* Normalize direction */ if(dx | dy) { - unsigned int norm = cucul_sqrt(dx * dx + 4 * dy * dy); + unsigned int norm = (int)sqrt((double)(dx * dx + 4 * dy * dy)); dx = dx * 32 / norm; dy = dy * 32 / norm; } @@ -182,7 +189,7 @@ void update_weapons(game *g, weapons *wp) /* Normalize speed */ if(dx | dy) { - unsigned int norm = cucul_sqrt(dx * dx + 4 * dy * dy); + unsigned int norm = (int)sqrt((double)(dx * dx + 4 * dy * dy)); wp->vx[i] = dx * 32 / norm; wp->vy[i] = dy * 32 / norm; } @@ -334,16 +341,19 @@ static void draw_bomb(game *g, int x, int y, int vx, int vy) } } - cucul_draw_sprite(g->qq, x, y, bomb_sprite, frame); + cucul_set_canvas_frame(bomb_sprite, frame); + cucul_blit(g->cv, x, y, bomb_sprite, NULL); } static void draw_fragbomb(game *g, int x, int y, int frame) { /* Draw the head */ - cucul_draw_sprite(g->qq, x, y, fragbomb_sprite, frame & 1); + cucul_set_canvas_frame(fragbomb_sprite, frame & 1); + cucul_blit(g->cv, x, y, fragbomb_sprite, NULL); /* Draw the tail */ - cucul_draw_sprite(g->qq, x, y, fragbomb_sprite, 2 + (frame % 4)); + cucul_set_canvas_frame(fragbomb_sprite, 2 + (frame % 4)); + cucul_blit(g->cv, x, y, fragbomb_sprite, NULL); } static void draw_beam(game *g, int x, int y, int frame) @@ -354,86 +364,86 @@ static void draw_beam(game *g, int x, int y, int frame) switch(frame) { case 24: - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, x, y-3, "__"); - cucul_putchar(g->qq, x-1, y-2, '\''); - cucul_putchar(g->qq, x+2, y-2, '`'); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, x, y-3, "__"); + cucul_putchar(g->cv, x-1, y-2, '\''); + cucul_putchar(g->cv, x+2, y-2, '`'); break; case 23: - cucul_set_color(g->qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, x, y-3, "__"); - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, x-2, y-2, "-'"); - cucul_putstr(g->qq, x+2, y-2, "`-"); + cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, x, y-3, "__"); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, x-2, y-2, "-'"); + cucul_putstr(g->cv, x+2, y-2, "`-"); break; case 22: - cucul_set_color(g->qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, x, y-3, "__"); - cucul_putchar(g->qq, x-1, y-2, '\''); - cucul_putchar(g->qq, x+2, y-2, '`'); - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, x-3, y-2, ",-"); - cucul_putstr(g->qq, x+3, y-2, "-."); + cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, x, y-3, "__"); + cucul_putchar(g->cv, x-1, y-2, '\''); + cucul_putchar(g->cv, x+2, y-2, '`'); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, x-3, y-2, ",-"); + cucul_putstr(g->cv, x+3, y-2, "-."); break; case 21: - cucul_set_color(g->qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, x-1, y-3, "____"); - cucul_putchar(g->qq, x-2, y-2, '\''); - cucul_putchar(g->qq, x+3, y-2, '`'); - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, x-4, y-2, ",-"); - cucul_putstr(g->qq, x+4, y-2, "-."); + cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, x-1, y-3, "____"); + cucul_putchar(g->cv, x-2, y-2, '\''); + cucul_putchar(g->cv, x+3, y-2, '`'); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, x-4, y-2, ",-"); + cucul_putstr(g->cv, x+4, y-2, "-."); break; case 20: - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, x, y-3, "%%"); - cucul_putchar(g->qq, x-4, y-2, ','); - cucul_putchar(g->qq, x+5, y-2, '.'); - cucul_set_color(g->qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, x-1, y-3, ':'); - cucul_putchar(g->qq, x+2, y-3, ':'); - cucul_putstr(g->qq, x-3, y-2, "-'"); - cucul_putstr(g->qq, x+3, y-2, "`-"); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, x, y-3, "%%"); + cucul_putchar(g->cv, x-4, y-2, ','); + cucul_putchar(g->cv, x+5, y-2, '.'); + cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, x-1, y-3, ':'); + cucul_putchar(g->cv, x+2, y-3, ':'); + cucul_putstr(g->cv, x-3, y-2, "-'"); + cucul_putstr(g->cv, x+3, y-2, "`-"); break; case 19: - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, x, y-4, "%%"); - cucul_putstr(g->qq, x, y-3, "##"); - cucul_set_color(g->qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, x-1, y-4, ':'); - cucul_putchar(g->qq, x+2, y-4, ':'); - cucul_putchar(g->qq, x-1, y-3, '%'); - cucul_putchar(g->qq, x+2, y-3, '%'); - cucul_putstr(g->qq, x-4, y-2, ",-'"); - cucul_putstr(g->qq, x+3, y-2, "`-."); - cucul_set_color(g->qq, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, x-2, y-3, ':'); - cucul_putchar(g->qq, x+3, y-3, ':'); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, x, y-4, "%%"); + cucul_putstr(g->cv, x, y-3, "##"); + cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, x-1, y-4, ':'); + cucul_putchar(g->cv, x+2, y-4, ':'); + cucul_putchar(g->cv, x-1, y-3, '%'); + cucul_putchar(g->cv, x+2, y-3, '%'); + cucul_putstr(g->cv, x-4, y-2, ",-'"); + cucul_putstr(g->cv, x+3, y-2, "`-."); + cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, x-2, y-3, ':'); + cucul_putchar(g->cv, x+3, y-3, ':'); break; case 18: default: r = (18 - frame) * (18 - frame); - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, x-1, y-5-r, ":%%:"); - cucul_putstr(g->qq, x-1, y-4-r, "%##%"); - cucul_set_color(g->qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, x-2, y-4-r, ':'); - cucul_putchar(g->qq, x+3, y-4-r, ':'); - cucul_putchar(g->qq, x-2, y-2, '\''); - cucul_putchar(g->qq, x+3, y-2, '`'); - cucul_set_color(g->qq, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, x-3, y-2, ':'); - cucul_putchar(g->qq, x+4, y-2, ':'); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, x-1, y-5-r, ":%%:"); + cucul_putstr(g->cv, x-1, y-4-r, "%##%"); + cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, x-2, y-4-r, ':'); + cucul_putchar(g->cv, x+3, y-4-r, ':'); + cucul_putchar(g->cv, x-2, y-2, '\''); + cucul_putchar(g->cv, x+3, y-2, '`'); + cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, x-3, y-2, ':'); + cucul_putchar(g->cv, x+4, y-2, ':'); for(i = 0; i <= r; i++) { - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); - cucul_putstr(g->qq, x-1, y-3-i, ((i+frame) % 5) ? "####" : "%%%%"); - cucul_set_color(g->qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, x-2, y-3-i, '%'); - cucul_putchar(g->qq, x+3, y-3-i, '%'); - cucul_set_color(g->qq, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); - cucul_putchar(g->qq, x-3, y-3-i, ':'); - cucul_putchar(g->qq, x+4, y-3-i, ':'); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); + cucul_putstr(g->cv, x-1, y-3-i, ((i+frame) % 5) ? "####" : "%%%%"); + cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, x-2, y-3-i, '%'); + cucul_putchar(g->cv, x+3, y-3-i, '%'); + cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); + cucul_putchar(g->cv, x-3, y-3-i, ':'); + cucul_putchar(g->cv, x+4, y-3-i, ':'); } break; } @@ -444,20 +454,20 @@ static void draw_nuke(game *g, int x, int y, int frame) int r = (29 - frame) * (29 - frame) / 8; /* Lots of duplicate pixels, but we don't care */ - cucul_set_color(g->qq, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); - cucul_draw_ellipse(g->qq, x, y, r, r / 2, ':'); - cucul_set_color(g->qq, CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_BLUE); - cucul_draw_ellipse(g->qq, x, y, r + 1, r / 2, '#'); - cucul_set_color(g->qq, CUCUL_COLOR_BLUE, CUCUL_COLOR_LIGHTBLUE); - cucul_draw_ellipse(g->qq, x, y, r + 2, r / 2, '#'); - cucul_set_color(g->qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_LIGHTBLUE); - cucul_draw_ellipse(g->qq, x, y, r + 2, r / 2 + 1, '#'); - cucul_set_color(g->qq, CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_CYAN); - cucul_draw_ellipse(g->qq, x, y, r + 3, r / 2 + 1, '#'); - cucul_set_color(g->qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_CYAN); - cucul_draw_ellipse(g->qq, x, y, r + 3, r / 2 + 2, '#'); - cucul_set_color(g->qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_WHITE); - cucul_draw_ellipse(g->qq, x, y, r + 4, r / 2 + 2, '#'); - cucul_draw_ellipse(g->qq, x, y, r + 4, r / 2 + 3, ' '); + cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); + cucul_draw_ellipse(g->cv, x, y, r, r / 2, ":"); + cucul_set_color(g->cv, CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_BLUE); + cucul_draw_ellipse(g->cv, x, y, r + 1, r / 2, "#"); + cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_LIGHTBLUE); + cucul_draw_ellipse(g->cv, x, y, r + 2, r / 2, "#"); + cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_LIGHTBLUE); + cucul_draw_ellipse(g->cv, x, y, r + 2, r / 2 + 1, "#"); + cucul_set_color(g->cv, CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_CYAN); + cucul_draw_ellipse(g->cv, x, y, r + 3, r / 2 + 1, "#"); + cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_CYAN); + cucul_draw_ellipse(g->cv, x, y, r + 3, r / 2 + 2, "#"); + cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_WHITE); + cucul_draw_ellipse(g->cv, x, y, r + 4, r / 2 + 2, "#"); + cucul_draw_ellipse(g->cv, x, y, r + 4, r / 2 + 3, " "); }