+ Removed draw_circle, use ee_draw_circle instead.
* libee/circle.c:
+ New ee_draw_circle function.
* libee/line.c:
+ Changed an internal function's name.
tags/v0.99.beta14
| @@ -19,6 +19,7 @@ libee_a_SOURCES = \ | |||||
| ee.c \ | ee.c \ | ||||
| ee.h \ | ee.h \ | ||||
| io.c \ | io.c \ | ||||
| circle.c \ | |||||
| line.c \ | line.c \ | ||||
| math.c \ | math.c \ | ||||
| $(NULL) | $(NULL) | ||||
| @@ -0,0 +1,49 @@ | |||||
| /* | |||||
| * libee ASCII-Art library | |||||
| * Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org> | |||||
| * All Rights Reserved | |||||
| * | |||||
| * $Id$ | |||||
| * | |||||
| * This program is free software; you can redistribute it and/or modify | |||||
| * it under the terms of the GNU General Public License as published by | |||||
| * the Free Software Foundation; either version 2 of the License, or | |||||
| * (at your option) any later version. | |||||
| * | |||||
| * This program is distributed in the hope that it will be useful, | |||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| * GNU General Public License for more details. | |||||
| * | |||||
| * You should have received a copy of the GNU General Public License | |||||
| * along with this program; if not, write to the Free Software | |||||
| * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||||
| */ | |||||
| #include "config.h" | |||||
| #include <stdlib.h> | |||||
| #include "ee.h" | |||||
| void ee_draw_circle(int x, int y, int r, char c) | |||||
| { | |||||
| int test, dx, dy; | |||||
| /* Optimized Bresenham. Kick ass. */ | |||||
| for(test = 0, dx = 0, dy = r ; dx <= dy ; dx++) | |||||
| { | |||||
| ee_putcharTO(x + dx, y + dy / 2, c); | |||||
| ee_putcharTO(x - dx, y + dy / 2, c); | |||||
| ee_putcharTO(x + dx, y - dy / 2, c); | |||||
| ee_putcharTO(x - dx, y - dy / 2, c); | |||||
| ee_putcharTO(x + dy, y + dx / 2, c); | |||||
| ee_putcharTO(x - dy, y + dx / 2, c); | |||||
| ee_putcharTO(x + dy, y - dx / 2, c); | |||||
| ee_putcharTO(x - dy, y - dx / 2, c); | |||||
| test += test > 0 ? dx - dy-- : dx; | |||||
| } | |||||
| } | |||||
| @@ -73,6 +73,7 @@ void ee_end(void); | |||||
| char ee_get_key(void); | char ee_get_key(void); | ||||
| void ee_draw_circle(int, int, int, char); | |||||
| void ee_draw_line(int, int, int, int, char); | void ee_draw_line(int, int, int, int, char); | ||||
| int ee_rand(int, int); | int ee_rand(int, int); | ||||
| @@ -28,7 +28,7 @@ | |||||
| #include "ee.h" | #include "ee.h" | ||||
| static uint8_t clip_bits(int, int); | static uint8_t clip_bits(int, int); | ||||
| static void _ee_draw_line(int, int, int, int, char); | |||||
| static void draw_solid_line(int, int, int, int, char); | |||||
| void ee_draw_line(int x1, int y1, int x2, int y2, char c) | void ee_draw_line(int x1, int y1, int x2, int y2, char c) | ||||
| { | { | ||||
| @@ -43,7 +43,7 @@ void ee_draw_line(int x1, int y1, int x2, int y2, char c) | |||||
| if(bits1 == 0) | if(bits1 == 0) | ||||
| { | { | ||||
| if(bits2 == 0) | if(bits2 == 0) | ||||
| _ee_draw_line(x1, y1, x2, y2, c); | |||||
| draw_solid_line(x1, y1, x2, y2, c); | |||||
| else | else | ||||
| ee_draw_line(x2, y2, x1, y1, c); | ee_draw_line(x2, y2, x1, y1, c); | ||||
| @@ -76,7 +76,7 @@ void ee_draw_line(int x1, int y1, int x2, int y2, char c) | |||||
| ee_draw_line(x1, y1, x2, y2, c); | ee_draw_line(x1, y1, x2, y2, c); | ||||
| } | } | ||||
| static void _ee_draw_line(int x1, int y1, int x2, int y2, char c) | |||||
| static void draw_solid_line(int x1, int y1, int x2, int y2, char c) | |||||
| { | { | ||||
| int dx = abs(x2-x1); | int dx = abs(x2-x1); | ||||
| int dy = abs(y2-y1); | int dy = abs(y2-y1); | ||||
| @@ -27,7 +27,6 @@ | |||||
| static void draw_bomb(int x, int y, int vx, int vy); | static void draw_bomb(int x, int y, int vx, int vy); | ||||
| static void draw_nuke(int x, int y, int frame); | static void draw_nuke(int x, int y, int frame); | ||||
| static void draw_beam(int x, int y, int frame); | static void draw_beam(int x, int y, int frame); | ||||
| static void draw_circle(int x, int y, int r, char c); | |||||
| static void draw_fragbomb(int x, int y, int frame); | static void draw_fragbomb(int x, int y, int frame); | ||||
| void init_weapons(game *g, weapons *wp) | void init_weapons(game *g, weapons *wp) | ||||
| @@ -703,32 +702,11 @@ static void draw_nuke(int x, int y, int frame) | |||||
| /* Lots of duplicate pixels, but we don't care */ | /* Lots of duplicate pixels, but we don't care */ | ||||
| ee_color(EE_BLUE); | ee_color(EE_BLUE); | ||||
| draw_circle(x, y, r++, ':'); | |||||
| ee_draw_circle(x, y, r++, ':'); | |||||
| ee_color(EE_CYAN); | ee_color(EE_CYAN); | ||||
| draw_circle(x, y, r++, '%'); | |||||
| ee_draw_circle(x, y, r++, '%'); | |||||
| ee_color(EE_WHITE); | ee_color(EE_WHITE); | ||||
| draw_circle(x, y, r++, '#'); | |||||
| draw_circle(x, y, r++, '#'); | |||||
| } | |||||
| static void draw_circle(int x, int y, int r, char c) | |||||
| { | |||||
| int test, dx, dy; | |||||
| /* Optimized Bresenham. Kick ass. */ | |||||
| for(test = 0, dx = 0, dy = r ; dx <= dy ; dx++) | |||||
| { | |||||
| ee_putcharTO(x + dx, y + dy / 2, c); | |||||
| ee_putcharTO(x - dx, y + dy / 2, c); | |||||
| ee_putcharTO(x + dx, y - dy / 2, c); | |||||
| ee_putcharTO(x - dx, y - dy / 2, c); | |||||
| ee_putcharTO(x + dy, y + dx / 2, c); | |||||
| ee_putcharTO(x - dy, y + dx / 2, c); | |||||
| ee_putcharTO(x + dy, y - dx / 2, c); | |||||
| ee_putcharTO(x - dy, y - dx / 2, c); | |||||
| test += test > 0 ? dx - dy-- : dx; | |||||
| } | |||||
| ee_draw_circle(x, y, r++, '#'); | |||||
| ee_draw_circle(x, y, r++, '#'); | |||||
| } | } | ||||