diff options
author | June McEnroe <june@causal.agency> | 2018-12-25 17:48:21 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-12-25 17:48:21 -0500 |
commit | 8db76eebbda7d07a5bc8bcc0707b8de4f33dc24b (patch) | |
tree | 49321ed50dea964892614e9bdd824f9659055b51 | |
parent | Fix mode for score file create (diff) | |
download | play-8db76eebbda7d07a5bc8bcc0707b8de4f33dc24b.tar.gz play-8db76eebbda7d07a5bc8bcc0707b8de4f33dc24b.zip |
Add 2048 help text
-rw-r--r-- | 2048.c | 11 |
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; |