about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--sol.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/sol.c b/sol.c
index ed5981d..cde7b2b 100644
--- a/sol.c
+++ b/sol.c
@@ -307,6 +307,20 @@ static void layoutTableau(void) {
 	}
 }
 
+static bool keyDown(SDL_KeyboardEvent key) {
+	switch (key.keysym.sym) {
+		case SDLK_F2: gameDeal(); return true;
+		case SDLK_b: {
+			layout.backTexture -= Cards_Back1;
+			layout.backTexture += 1;
+			layout.backTexture %= 12;
+			layout.backTexture += Cards_Back1;
+			return true;
+		}
+		default: return false;
+	}
+}
+
 static bool mouseButtonDown(SDL_MouseButtonEvent button) {
 	struct SDL_Point point = { button.x, button.y };
 	if (SDL_PointInRect(&point, &layout.stacks[Stock])) {
@@ -408,9 +422,6 @@ int main(void) {
 
 	gameDeal();
 
-	// FIXME: Use a portable random.
-	layout.backTexture = Cards_Back1 + arc4random_uniform(12);
-
 	for (;;) {
 		layoutClear();
 		layoutStock();
@@ -430,6 +441,8 @@ int main(void) {
 			SDL_WaitEvent(&event);
 			if (event.type == SDL_QUIT) {
 				goto quit;
+			} else if (event.type == SDL_KEYDOWN) {
+				if (keyDown(event.key)) break;
 			} else if (event.type == SDL_MOUSEBUTTONDOWN) {
 				if (mouseButtonDown(event.button)) break;
 			} else if (event.type == SDL_MOUSEBUTTONUP) {
el listed in the status. 2019-02-22Add /znc commandJune McEnroe Only because ZNC tells you to use it and expects it to work. 2019-02-22Update status line after scrolling and term eventsJune McEnroe 2019-02-22Reorganize input.cJune McEnroe 2019-02-22Fix name of <raw> window in man pageJune McEnroe 2019-02-22Rename global tags with angle bracketsJune McEnroe 2019-02-22Show status window while connectingJune McEnroe 2019-02-22Reorganize UI code for the umpteenth timeJune McEnroe It's actually in a good state now, I think. 2019-02-21Replace "view" with "window"June McEnroe I think originally I didn't want to use the same word as curses WINDOW but it's really much clearer for the user if they're just called windows. UI code probably needs yet another rewrite though. Still feels messy. 2019-02-21Remove ROT13June McEnroe It's just not convenient when it can only do the whole line... 2019-02-21Clean up man pageJune McEnroe 2019-01-26Draw UI before connectingJune McEnroe Otherwise the "Traveling" message isn't visible while connecting. 2019-01-25Avoid unused variable warnings with getyxJune McEnroe 2019-01-25Add GNU/Linux build instructionsJune McEnroe