瀏覽代碼

* 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 年之前
父節點
當前提交
3680abc23e
共有 4 個文件被更改,包括 12 次插入8 次删除
  1. +1
    -0
      AUTHORS
  2. +1
    -0
      THANKS
  3. +1
    -4
      examples/aafire.c
  4. +9
    -4
      examples/cacaball.c

+ 1
- 0
AUTHORS 查看文件

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

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


+ 1
- 0
THANKS 查看文件

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

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


+ 1
- 4
examples/aafire.c 查看文件

@@ -1,10 +1,7 @@
/*
* cacafire fire demo for libcaca
* 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
*
* $Id$


+ 9
- 4
examples/cacaball.c 查看文件

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

#define METASIZE 128

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

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

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

/* Create the bitmap */
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);

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

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

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

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


Loading…
取消
儲存