Skip to content
Snippets Groups Projects
display_result.cpp 4.3 KiB
Newer Older
#include <ncurses.h>
#include <string.h>

#include "display_result.h"

char *win_string[] = {
"                                                                                ",
"                                                                                ",
"                                                                                ",
"                                                               *                ",
"                                      **                      ***               ",
"                                      **                       *                ",
"**   ****      ****   **   ****        **    ***    ****                        ",
" **    ***  * * ***  * **    ***  *     **    ***     ***  * ***   ***  ****    ",
" **     **** *   ****  **     ****      **     ***     ****   ***   **** **** * ",
" **      ** **    **   **      **       **      **      **     **    **   ****  ",
" **      ** **    **   **      **       **      **      **     **    **    **   ",
" **      ** **    **   **      **       **      **      **     **    **    **   ",
" **      ** **    **   **      **       **      **      **     **    **    **   ",
" **      ** **    **   **      **       **      **      *      **    **    **   ",
"  *********  ******     ******* **       ******* *******       **    **    **   ",
"    **** ***  ****       *****   **       *****   *****        *** * ***   ***  ",
"          ***                                                   ***   ***   *** ",
"   *****   ***                                                                  ",
" ********  **                                                                   ",
"*      ****                                                                     ",
"                                                                                ",
"                                                                                ",
"                                                                                "
};

char *lose_string[] = {
"                                                                                ",
"                                                                                ",
"                                          ***                                   ",
"                                           ***                                  ",
"                                            **                                  ",
"                                            **                                  ",
"    **   ****      ****   **   ****         **     ****     ****                ",
"     **    ***  * * ***  * **    ***  *     **    * ***  * * **** *   ***       ",
"     **     **** *   ****  **     ****      **   *   **** **  ****   * ***      ",
"     **      ** **    **   **      **       **  **    ** ****       *   ***     ",
"     **      ** **    **   **      **       **  **    **   ***     **    ***    ",
"     **      ** **    **   **      **       **  **    **     ***   ********     ",
"     **      ** **    **   **      **       **  **    **       *** *******      ",
"     **      ** **    **   **      **       **  **    **  ****  ** **           ",
"      *********  ******     ******* **      **   ******  * **** *  ****    *    ",
"        **** ***  ****       *****   **     *** * ****      ****    *******     ",
"              ***                            ***                     *****      ",
"       *****   ***                                                              ",
"     ********  **                                                               ",
"    *      ****                                                                 ",
"                                                                                ",
"                                                                                ",
"                                                                                "
};

char *instruction = "Press any key to exit.";

void display_win() {
	int i;
	clear();
	for (i = 0; i < 23; i++) {
		mvaddstr(i, 0, win_string[i]);
	}
	mvaddstr(23, (80 - strlen(instruction)) / 2, instruction);
	refresh();
	getch();
}

void display_lose() {
	int i;
	for (i = 0; i < 23; i++) {
		mvaddstr(i, 0, lose_string[i]);
	}
	mvaddstr(23, (80 - strlen(instruction)) / 2, instruction);
	refresh();
	getch();
}