~rabbits/nasu

a1cec2333f98412c5f2c2f193d4c45bc9fad2286 — Devine Lu Linvega 2 years ago 6a01e00
Added rounded brush
2 files changed, 17 insertions(+), 4 deletions(-)

M README.md
M chr6.c
M README.md => README.md +2 -1
@@ 27,11 27,12 @@ To resume working on a tileset:

### General

- `1-7` Patterns
- `TAB` Cycle between colors
- `H` Toggle Guides
- `Z` Decr. Brush Size
- `X` Incr. Brush Size
- `1-7` Patterns
- `N` Clear

### Paint


M chr6.c => chr6.c +15 -3
@@ 66,7 66,7 @@ inspt(Point* p, int w, int h)
int
dispt(Point* a, Point* b)
{
	return ((b->x - a->x) * (b->x - a->x)) + ((b->y - a->y) * (b->y - a->y));
	return (b->x - a->x) * (b->x - a->x) + (b->y - a->y) * (b->y - a->y);
}

void


@@ 169,7 169,7 @@ fill(Brush* b, int mode, int size, Point p0, int color)
	for(x = -size / 2; x < size; ++x)
		for(y = -size / 2; y < size; ++y) {
			setpt(&p, p0.x + x, p0.y + y);
			if(patt(p.x, p.y, mode, size))
			if(patt(p.x, p.y, mode, size) && dispt(&p0, &p) < size)
				edit(p.x, p.y, color);
		}
	b->edit = 1;


@@ 263,7 263,7 @@ load(char* path)
}

void
render()
render(void)
{
	SDL_Surface* surface = SDL_GetWindowSurface(gWindow);
	GUIDES = 0;


@@ 274,6 274,15 @@ render()
}

void
clear(void)
{
	int i;
	for(i = 0; i < SZ; i++)
		buffer[i] = color1;
	redraw(pixels);
}

void
quit(void)
{
	free(pixels);


@@ 374,6 383,9 @@ dokey(SDL_Event* event, Brush* b)
		if(b->size < 30)
			b->size += 1;
		break;
	case SDLK_n:
		clear();
		break;
	}
	update(b);
}