~rabbits/dito

36c88988b41d44e19ef071458dc592e4d638e66c — Jordan Christiansen 6 months ago 2122464
Add keys 1-4 to pick up the correspending picker

If you move a picker onto a black area of the image, the picker doesn't
stand out against the background. This makes it easy to lose pickers in
black areas and difficult to pick them up again.

This change adds an alternative method of moving pickers. Even if you
can't find the picker to click on it with the mouse, you can press the
corresponding keyboard key to grab and move it to your mouse cursor.
2 files changed, 6 insertions(+), 1 deletions(-)

M README.md
M dito.c
M README.md => README.md +1 -0
@@ 33,3 33,4 @@ To open a bitmap:
### Paint

- `mouse1` Move Picker
- `1234` Pick up Picker 1-4. `mouse1` to drop.

M dito.c => dito.c +5 -1
@@ 440,7 440,7 @@ domouse(SDL_Event *event)
		DOWN = 1;
		break;
	case SDL_MOUSEMOTION:
		if(DOWN && selected)
		if(selected)
			setpicker(selected, event->motion.x / ZOOM - PAD * 8, event->motion.y / ZOOM - PAD * 8);
		break;
	}


@@ 460,6 460,10 @@ dokey(SDL_Event *event)
	} else {
		switch(event->key.keysym.sym) {
		case SDLK_SPACE: savemode(&COLORS, !COLORS); break;
		case SDLK_1: selected = &pickers[0]; break;
		case SDLK_2: selected = &pickers[1]; break;
		case SDLK_3: selected = &pickers[2]; break;
		case SDLK_4: selected = &pickers[3]; break;
		}
	}
}