summary refs log tree commit diff homepage
path: root/2048.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--2048.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/2048.c b/2048.c
index 8546d4b..48c13cb 100644
--- a/2048.c
+++ b/2048.c
@@ -186,6 +186,8 @@ enum {
 	GridX = 2,
 	ScoreY = 0,
 	ScoreX = GridX + 4 * TileWidth - 10,
+	HelpY = GridY,
+	HelpX = GridX + 5 * TileWidth,
 };
 
 static void drawTile(uint y, uint x) {
@@ -225,6 +227,12 @@ static void draw(void) {
 	}
 }
 
+static void drawHelp(void) {
+	mvaddstr(HelpY + 0, HelpX, "Use the arrow keys to");
+	mvaddstr(HelpY + 1, HelpX, "slide and merge tiles.");
+	mvaddstr(HelpY + 2, HelpX, "Press q to quit.");
+}
+
 static bool input(void) {
 	switch (getch()) {
 		break; case 'h': case KEY_LEFT: if (left()) spawn();
@@ -240,7 +248,10 @@ uint play2048(void) {
 	curse();
 	spawn();
 	spawn();
+	drawHelp();
+	uint help = 0;
 	do {
+		if (help++ == 3) erase();
 		draw();
 	} while (input());
 	return score;
a372e38896506031f&follow=1'>Move cgit_print_date into ui-shared, reuse in ui-summaryLars Hjemli 2006-12-16Add ui-commit.c + misc ui cleanupsLars Hjemli 2006-12-15Add a common commit parserLars Hjemli 2006-12-14Add simple pager to log pageLars Hjemli 2006-12-13Add separate makefile-rule to clear current cacheLars Hjemli 2006-12-13Remove implementation details from READMELars Hjemli 2006-12-13Small layout adjustments to summary and blob viewLars Hjemli 2006-12-13Add display of tree content w/ui-tree.cLars Hjemli 2006-12-12cache_lock: do xstrdup/free on lockfileLars Hjemli 2006-12-11Don't truncate valid cachefilesLars Hjemli 2006-12-11Move global variables + callback functions into shared.cLars Hjemli 2006-12-11Move functions for generic object output into ui-view.cLars Hjemli 2006-12-11Move log-functions into ui-log.cLars Hjemli 2006-12-11Move repo summary functions into ui-summary.cLars Hjemli 2006-12-11Move functions for repolist output into ui-repolist.cLars Hjemli 2006-12-11Move common output-functions into ui-shared.cLars Hjemli 2006-12-11Rename config.c to parsing.c + move cgit_parse_query from cgit.c to parsing.cLars Hjemli 2006-12-11Avoid infinite loops in caching layerLars Hjemli 2006-12-11Let 'make install' clear all cachefilesLars Hjemli 2006-12-11Fix cache algorithm loopholeLars Hjemli 2006-12-10Add version identifier in generated filesLars Hjemli 2006-12-10Add license file and copyright noticesLars Hjemli 2006-12-10Add caching infrastructureLars Hjemli