~rabbits/nasu

ea88f27bafbbd42a3d3b09d5cce85c8eebefaf58 — Devine Lu Linvega 2 years ago 1277319
Added line mode
1 files changed, 10 insertions(+), 4 deletions(-)

M nasu.c
M nasu.c => nasu.c +10 -4
@@ 290,13 290,19 @@ domouse(SDL_Event* event, Brush* b)
		update(b);
		break;
	case SDL_MOUSEBUTTONDOWN:
		if(event->button.button == SDL_BUTTON_LEFT) {
		if(event->button.button == SDL_BUTTON_LEFT)
			b->down = 1;
			b->px = (event->motion.x - (PAD * ZOOM)) / ZOOM;
			b->py = (event->motion.y - (PAD * ZOOM)) / ZOOM;
		}
		if(event->button.button == SDL_BUTTON_RIGHT)
			b->erase = 1;
		if(event->button.button == SDL_BUTTON_MIDDLE) {
			b->erase = 0;
			b->x = (event->motion.x - (PAD * ZOOM)) / ZOOM;
			b->y = (event->motion.y - (PAD * ZOOM)) / ZOOM;
			line(b->px, b->py, b->x, b->y, b->erase ? 0 : b->color);
			draw(pixels);
		}
		b->px = (event->motion.x - (PAD * ZOOM)) / ZOOM;
		b->py = (event->motion.y - (PAD * ZOOM)) / ZOOM;
	case SDL_MOUSEMOTION:
		if(b->down) {
			b->x = (event->motion.x - (PAD * ZOOM)) / ZOOM;