~rabbits/nasu

8300a33fca3c31a36a14aa150aeefc02ac785a77 — Devine Lu Linvega 2 years ago b7f3644
cleanup
2 files changed, 19 insertions(+), 11 deletions(-)

M nasu.c
M sprite.chr
M nasu.c => nasu.c +19 -11
@@ 1,7 1,7 @@
#include <SDL2/SDL.h>
#include <stdio.h>

#define HOR 16
#define HOR 32
#define VER 16
#define PAD 8
#define ZOOM 4


@@ 45,12 45,16 @@ SDL_Renderer* gRenderer = NULL;
SDL_Texture* gTexture = NULL;
uint32_t* pixels;

/* helpers */

int
distance(int ax, int ay, int bx, int by)
{
	return (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
}

/* chr */

int
rowchr(int x, int y)
{


@@ 92,6 96,14 @@ putchr(int x, int y, int color)
	}
}

void
newchr(void)
{
	int i;
	for(i = 0; i < SZ; ++i)
		chrbuf[i] = 0x00;
}

int
jagg(int x, int y)
{


@@ 163,6 175,8 @@ line(int ax, int ay, int bx, int by, int color)
	}
}

/* draw */

void
draw(uint32_t* dst)
{


@@ 201,6 215,8 @@ update(Brush* b)
	SDL_SetWindowTitle(gWindow, title);
}

/* options */

int
error(char* msg, const char* err)
{


@@ 209,14 225,6 @@ error(char* msg, const char* err)
}

void
create(void)
{
	int i;
	for(i = 0; i < SZ; ++i)
		chrbuf[i] = 0x00;
}

void
load(char* path)
{
	FILE* f = fopen(path, "rb");


@@ 326,7 334,7 @@ dokey(SDL_Event* event, Brush* b)
		draw(pixels);
		break;
	case SDLK_n:
		create();
		newchr();
		break;
	case SDLK_BACKQUOTE:
		b->mode = 7;


@@ 414,7 422,7 @@ main(int argc, char** argv)
	if(argc > 1)
		load(argv[1]);
	else
		create();
		newchr();
	draw(pixels);
	update(&brush);


M sprite.chr => sprite.chr +0 -0