Update documentation for nmseffect library

modified:   src/nmseffect.c
This commit is contained in:
Brian Barto 2017-01-19 15:15:24 -05:00
parent ea6983113f
commit 0b44f64468
1 changed files with 29 additions and 23 deletions

View File

@ -47,10 +47,9 @@ static int inputPositionX = -1; // X coordinate for input position
static int inputPositionY = -1; // Y coordinate for input position static int inputPositionY = -1; // Y coordinate for input position
/* /*
* nmseffect_exec() - This function is passed a pointer to a character string * This function applies the data decryption effect to the character
* and displays the contents of the string in a way that mimicks the * string that is provided as an argument. It returns the last character
* "decrypting text" effect in the 1992 movie Sneakers. It returns the * pressed by the user.
* last character pressed by the user.
*/ */
char nmseffect_exec(char *string) { char nmseffect_exec(char *string) {
struct charAttr *list_pointer = NULL; struct charAttr *list_pointer = NULL;
@ -308,19 +307,21 @@ char nmseffect_exec(char *string) {
} }
/* /*
* nmseffect_set_foreground_color() sets the foreground color of the unencrypted * Pass the 'color' argument to the nmstermio module where it will set the
* characters as they are revealed to the color indicated by the 'color' * foreground color of the unencrypted characters as they are
* argument. Valid arguments are "white", "yellow", "magenta", "blue", * revealed. Valid arguments are "white", "yellow", "magenta", "blue",
* "green", "red", and "cyan". This function will default to blue if * "green", "red", and "cyan".
* passed an invalid color. No value is returned.
*/ */
void nmseffect_set_foregroundcolor(char *color) { void nmseffect_set_foregroundcolor(char *color) {
nmstermio_set_foregroundcolor(color); nmstermio_set_foregroundcolor(color);
} }
/* /*
* nmseffect_set_returnopts() takes a character sting and copies it to the * Copy the string argument to the 'returnOpts' variable. This string is
* returnOpts setting used by nms_exec(). * used to determine what character the user must choose from before
* nmseffect_exec() returns execution to the calling function. Normally
* this is left NULL. Use only when you want to present a menu with
* selection choices to the user.
*/ */
void nmseffect_set_returnopts(char *opts) { void nmseffect_set_returnopts(char *opts) {
returnOpts = realloc(returnOpts, strlen(opts) + 1); returnOpts = realloc(returnOpts, strlen(opts) + 1);
@ -328,8 +329,9 @@ void nmseffect_set_returnopts(char *opts) {
} }
/* /*
* nmseffect_set_autodecrypt() sets the autoDecrypt flag according to the * Set the autoDecrypt flag according to the true/false value of the
* true/false value of the 'setting' argument. * 'setting' argument. When set to true, nmseffect_exec() will not
* require a key press to start the decryption effect.
*/ */
void nmseffect_set_autodecrypt(int setting) { void nmseffect_set_autodecrypt(int setting) {
if (setting) if (setting)
@ -339,16 +341,20 @@ void nmseffect_set_autodecrypt(int setting) {
} }
/* /*
* nmseffect_set_clearscr() sets the clearScr flag according to the * Pass the 'setting' argument to the nmstermio module where it will set
* true/false value of the 'setting' argument. * the clearScr flag according to the true/false value. When set to true,
* nmseffect_exec() will clear the screen before displaying any characters.
*/ */
void nmseffect_set_clearscr(int s) { void nmseffect_set_clearscr(int setting) {
nmstermio_set_clearscr(s); nmstermio_set_clearscr(setting);
} }
/* /*
* nmseffect_set_color() sets the colorOn flag according to the * Set the 'colorOn' flag according to the true/false value of the 'setting'
* true/false value of the 'setting' argument. * argument. This flag tells nmseffect_exec() to use colors in it's output.
* This is true by default, and meant to be used only for terminals that
* do not support color. Though, compiling with ncurses support is perhaps
* a better option, as it will detect color capabilities automatically.
*/ */
void nmseffect_set_color(int setting) { void nmseffect_set_color(int setting) {
if (setting) if (setting)
@ -358,9 +364,9 @@ void nmseffect_set_color(int setting) {
} }
/* /*
* nmseffect_set_input_position() sets the desired coordinate of the cursor in * Set the desired coordinates of the cursor in the terminal window when
* the terminal when accepting user input after nms_exec() reveals the * nmseffect_exec() gets the character selection from the user that is set
* unencrypted characters. * with nmseffect_set_returnopts().
*/ */
void nmseffect_set_input_position(int x, int y) { void nmseffect_set_input_position(int x, int y) {
if (x >= 0 && y >= 0) { if (x >= 0 && y >= 0) {
@ -370,7 +376,7 @@ void nmseffect_set_input_position(int x, int y) {
} }
/* /*
* nmseffect_sleep() sleeps for the number of miliseconds indicated by 't'. * Sleep for the number of milliseconds indicated by argument 't'.
*/ */
static void nmseffect_sleep(int t) { static void nmseffect_sleep(int t) {
struct timespec ts; struct timespec ts;