~rabbits/nasu

2362c222611e11b66f4ac6e41c564e7aff3ac09e — neauoire 2 years ago 268aba2
Added missing type
2 files changed, 8 insertions(+), 7 deletions(-)

M build.sh
M nasu.c
M build.sh => build.sh +2 -2
@@ 7,10 7,10 @@ clang-format -i nasu.c
rm ./nasu

# debug(slow)
cc -std=c89 -DDEBUG -Wall -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined nasu.c -L/usr/local/lib -lSDL2 -o nasu
# cc -std=c89 -DDEBUG -Wall -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined nasu.c -L/usr/local/lib -lSDL2 -o nasu

# build(fast)
# cc nasu.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -L/usr/local/lib -lSDL2 -o nasu
cc nasu.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -L/usr/local/lib -lSDL2 -o nasu

# Size
echo "Size: $(du -sk ./nasu)"

M nasu.c => nasu.c +6 -5
@@ 15,9 15,10 @@ WITH REGARD TO THIS SOFTWARE.
#define HOR 32
#define VER 16
#define PAD 8

#define SZ (HOR * VER * 16)

typedef unsigned char Uint8;

typedef struct Brush {
	int x, y, px, py;
	int mode, size, color;


@@ 46,7 47,7 @@ Uint8 icons[7][8] = {
	{0x38, 0x7c, 0xee, 0xd6, 0xee, 0x7c, 0x38, 0x00},
	{0x44, 0xba, 0x44, 0x44, 0x44, 0xba, 0x44, 0x00}};

unsigned char chrbuf[SZ];
Uint8 chrbuf[SZ];
SDL_Window *gWindow;
SDL_Renderer *gRenderer;
SDL_Texture *gTexture;


@@ 60,7 61,7 @@ distance(int ax, int ay, int bx, int by)
	return (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
}

unsigned char
Uint8
chex(char c)
{
	if(c >= 'a' && c <= 'f')


@@ 232,12 233,12 @@ drawchr(Uint32 *dst, int x, int y, int id)
}

void
drawicon(Uint32 *dst, int x, int y, unsigned char *icon, Uint32 color)
drawicon(Uint32 *dst, int x, int y, Uint8 *icon, int color)
{
	int v, h;
	for(v = 0; v < 8; v++)
		for(h = 0; h < 8; h++) {
			int c = theme[(icon[v] >> (8 - h)) & 0x1];
			int c = (icon[v] >> (8 - h)) & 0x1;
			putpixel(dst, x + h, y + v, c ? color : 0);
		}
}