Browse Source

* examples/cacaball.c:

+ Crop the palette so that it looks a bit more like metaballs.
  * AUTHORS THANKS:
    + Credited Jylam and Jan Hubicka.
tags/v0.99.beta14
Sam Hocevar sam 21 years ago
parent
commit
3680abc23e
4 changed files with 12 additions and 8 deletions
  1. +1
    -0
      AUTHORS
  2. +1
    -0
      THANKS
  3. +1
    -4
      examples/aafire.c
  4. +9
    -4
      examples/cacaball.c

+ 1
- 0
AUTHORS View File

@@ -1,4 +1,5 @@
$Id$ $Id$


Sam Hocevar <sam@zoy.org> - main programmer Sam Hocevar <sam@zoy.org> - main programmer
Jean-Yves Lamoureux <jylam@lnxscene.org> - cacaball



+ 1
- 0
THANKS View File

@@ -1,4 +1,5 @@
$Id$ $Id$


Jan Hubicka <hubicka@freesoft.cz> - aafire
Richard Zidlicky <rz@linux-m68k.org> - rpm specfile Richard Zidlicky <rz@linux-m68k.org> - rpm specfile



+ 1
- 4
examples/aafire.c View File

@@ -1,10 +1,7 @@
/* /*
* cacafire fire demo for libcaca * cacafire fire demo for libcaca
* Copyright (c) 2003 Sam Hocevar <sam@zoy.org> * Copyright (c) 2003 Sam Hocevar <sam@zoy.org>
* Jan Hubicka (hubicka@freesoft.cz)
* Thomas A. K. Kjaer (takjaer@daimi.aau.dk)
* Tim Newsome (nuisance@cmu.edu)
* Kamil Toman (toman@artax.karlin.mff.cuni.cz)
* 1998, 1999, 2001 Jan Hubicka <hubicka@freesoft.cz>
* All Rights Reserved * All Rights Reserved
* *
* $Id$ * $Id$


+ 9
- 4
examples/cacaball.c View File

@@ -36,8 +36,8 @@


#define METASIZE 128 #define METASIZE 128


static void create_ball(void);
static void draw_ball(unsigned int, unsigned int); static void draw_ball(unsigned int, unsigned int);
static void generate_ball(void);


static unsigned char pixels[XSIZ * YSIZ]; static unsigned char pixels[XSIZ * YSIZ];
static unsigned char metaball[METASIZE * METASIZE]; static unsigned char metaball[METASIZE * METASIZE];
@@ -64,6 +64,10 @@ int main(int argc, char **argv)
a[p] = 0x0; a[p] = 0x0;
} }


/* Crop the palette */
for(p = 0; p < 150; p++)
r[p] = g[p] = b[p] = a[p] = 0x0;

/* Create the bitmap */ /* Create the bitmap */
caca_bitmap = caca_create_bitmap(8, XSIZ, YSIZ, XSIZ, 0, 0, 0, 0); caca_bitmap = caca_create_bitmap(8, XSIZ, YSIZ, XSIZ, 0, 0, 0, 0);


@@ -71,7 +75,7 @@ int main(int argc, char **argv)
caca_set_bitmap_palette(caca_bitmap, r, g, b, a); caca_set_bitmap_palette(caca_bitmap, r, g, b, a);


/* Generate ball sprite */ /* Generate ball sprite */
generate_ball();
create_ball();


/* Go ! */ /* Go ! */
while(!caca_get_event(CACA_EVENT_KEY_PRESS)) while(!caca_get_event(CACA_EVENT_KEY_PRESS))
@@ -113,7 +117,7 @@ int main(int argc, char **argv)


/* Generate ball sprite /* Generate ball sprite
* You should read the comments, I already wrote that before ... */ * You should read the comments, I already wrote that before ... */
static void generate_ball(void)
static void create_ball(void)
{ {
int x, y; int x, y;
float distance; float distance;
@@ -135,7 +139,7 @@ static void draw_ball(unsigned int bx, unsigned int by)
unsigned int i, e = 0; unsigned int i, e = 0;
unsigned int b = (by * XSIZ) + bx; unsigned int b = (by * XSIZ) + bx;


for( i = 0; i < METASIZE * METASIZE; i++)
for(i = 0; i < METASIZE * METASIZE; i++)
{ {
color = pixels[b] + metaball[i]; color = pixels[b] + metaball[i];


@@ -152,3 +156,4 @@ static void draw_ball(unsigned int bx, unsigned int by)
e++; e++;
} }
} }


Loading…
Cancel
Save