Browse Source

* Fixed sprite functions (it compiles now) (Y'a des connards qui font ce qu'ils veulent, mais qui finissent pas)

tags/v0.99.beta14
Jean-Yves Lamoureux jylam 19 years ago
parent
commit
a4de38b97e
2 changed files with 11 additions and 11 deletions
  1. +3
    -3
      test/demo.c
  2. +8
    -8
      test/spritedit.c

+ 3
- 3
test/demo.c View File

@@ -55,11 +55,11 @@ int main(int argc, char **argv)
caca_set_delay(kk, 40000); caca_set_delay(kk, 40000);


/* Initialize data */ /* Initialize data */
sprite = cucul_load_sprite(qq, DATADIR "/caca.txt");
sprite = cucul_load_sprite(DATADIR "/caca.txt");
if(!sprite) if(!sprite)
sprite = cucul_load_sprite(qq, "caca.txt");
sprite = cucul_load_sprite("caca.txt");
if(!sprite) if(!sprite)
sprite = cucul_load_sprite(qq, "examples/caca.txt");
sprite = cucul_load_sprite("examples/caca.txt");


/* Disable cursor */ /* Disable cursor */
caca_set_mouse(kk, 0); caca_set_mouse(kk, 0);


+ 8
- 8
test/spritedit.c View File

@@ -44,7 +44,7 @@ int main(int argc, char **argv)
if(!kk) if(!kk)
return 1; return 1;


sprite = cucul_load_sprite(qq, argv[1]);
sprite = cucul_load_sprite(argv[1]);


if(!sprite) if(!sprite)
{ {
@@ -75,7 +75,7 @@ int main(int argc, char **argv)
frame--; frame--;
break; break;
case '+': case '+':
if(frame < cucul_get_sprite_frames(qq, sprite) - 1)
if(frame < cucul_get_sprite_frames(sprite) - 1)
frame++; frame++;
break; break;
case 'p': case 'p':
@@ -86,7 +86,7 @@ int main(int argc, char **argv)


if(play) { if(play) {
if(!delay) { if(!delay) {
if(frame < cucul_get_sprite_frames(qq, sprite) - 1) {
if(frame < cucul_get_sprite_frames(sprite) - 1) {
frame++; frame++;
} }
else { else {
@@ -109,7 +109,7 @@ int main(int argc, char **argv)


sprintf(buf, "sprite `%s'", argv[1]); sprintf(buf, "sprite `%s'", argv[1]);
cucul_putstr(qq, 3, 2, buf); cucul_putstr(qq, 3, 2, buf);
sprintf(buf, "frame %i/%i", frame, cucul_get_sprite_frames(qq, sprite) - 1);
sprintf(buf, "frame %i/%i", frame, cucul_get_sprite_frames(sprite) - 1);
cucul_putstr(qq, 3, 3, buf); cucul_putstr(qq, 3, 3, buf);


/* Crosshair */ /* Crosshair */
@@ -118,10 +118,10 @@ int main(int argc, char **argv)
cucul_putchar(qq, 57, 10, '+'); cucul_putchar(qq, 57, 10, '+');


/* Boxed sprite */ /* Boxed sprite */
xa = -1 - cucul_get_sprite_dx(qq, sprite, frame);
ya = -1 - cucul_get_sprite_dy(qq, sprite, frame);
xb = xa + 1 + cucul_get_sprite_width(qq, sprite, frame);
yb = ya + 1 + cucul_get_sprite_height(qq, sprite, frame);
xa = -1 - cucul_get_sprite_dx(sprite, frame);
ya = -1 - cucul_get_sprite_dy(sprite, frame);
xb = xa + 1 + cucul_get_sprite_width(sprite, frame);
yb = ya + 1 + cucul_get_sprite_height(sprite, frame);
cucul_set_color(qq, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK); cucul_set_color(qq, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK);
cucul_fill_box(qq, 57 + xa, 10 + ya, 57 + xb, 10 + yb, " "); cucul_fill_box(qq, 57 + xa, 10 + ya, 57 + xb, 10 + yb, " ");
cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);


Loading…
Cancel
Save