From d8cef1def4a248b7fbddfa9362d43efdf3ebc71b Mon Sep 17 00:00:00 2001 From: Tiehuis Date: Sun, 22 Feb 2015 16:08:11 +1300 Subject: [PATCH] Rewritten man page. Removed large dependencies by writing directly for man. --- Makefile | 3 +-- man/2048.1 | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/options.c | 17 +-------------- 3 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 man/2048.1 diff --git a/Makefile b/Makefile index 0807672..164cbef 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,6 @@ obj/%.o: src/%.c remake: clean all clean: - rm -f obj/* - rm -f 2048 + rm -f $(O_FILES) $(PROGRAM) .PHONY: clean remake diff --git a/man/2048.1 b/man/2048.1 new file mode 100644 index 0000000..db81d97 --- /dev/null +++ b/man/2048.1 @@ -0,0 +1,58 @@ +.TH 2048 1 + +.SH NAME +2048 \- play the game 2048 in your terminal + +.SH SYNOPSIS +.B 2048 +[\fB\-hrcCaA\fR] +[\fB\-s\fR \fISIZE\fR] +[\fB\-b\fR \fIRATE\fR] +[\fB\-g\fR \fIGOAL\fR] + +.SH DESCRIPTION +.B 2048 +is an implementation of the popular game, 2048, designed to be run on a +terminal. It is deisgned to be easy to understand and extend. + +.SH CONTROLS +.TP +.BR hjkl " " and " " wasd +Default movement keys. Depending on the graphics implementation, there may be +extra alternatives. +.TP +.BR \q +Quit the current game. + +.SH OPTIONS +.TP +.BR \-h +Print the program usage. +.TP +.BR \-c +Turn on color support (default). +.TP +.BR \-C +Turn off color support. +.TP +.BR \-a +Turn on animations (default). +.TP +.BR \-A +Turn off animations. +.TP +.BR \-s " " \fISIZE\fR +Set the size of the playing field. Default is 4. Maximum value is 16, minimum is 4. +.TP +.BR \-b " " \fIRATE\fR +Set the rate at which blocks are spawned. Default is 1. +.TP +.BR \-g " " \fIGOAL\fR +Set the target end condition. Default is 2048. + +.SH AUTHORS +Originally written by Tiehuis. +All contributions can be found at \fIhttps://github.com/Tiehuis/2048-cli\fR. + +.SH COPYRIGHT +MIT License (2014) diff --git a/src/options.c b/src/options.c index 2fa45a6..52d7d26 100644 --- a/src/options.c +++ b/src/options.c @@ -5,22 +5,7 @@ void print_usage(void) { - printf( - "usage: 2048 [-cCaArh] [-g ] [-b ] [-s ]\n" - "\n" - "controls\n" - " hjkl movement keys\n" - " q quit current game\n" - "\n" - "options\n" - " -s set the grid side lengths\n" - " -b set the block spawn rate\n" - " -g set a new goal (default 2048)\n" - " -a enable animations (default)\n" - " -A disable animations\n" - " -c enable color support\n" - " -C disable color support (default)\n" - ); + printf("usage: 2048 [-cCaArh] [-s SIZE] [-b RATE] [-g GOAL]\n"); }