Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
TxtAdv/InformationPage.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
102 lines (83 sloc)
2.13 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ncurses.h> | |
#include <string> | |
#include "Main_Menu.h" | |
#include <iostream> | |
#include "window.h" | |
#include "newWindow.h" | |
#include "Print_Output.h" | |
using namespace std; | |
void WindowPrint(string text, Window outputWindow, bool isOutput, int outputY); | |
void InformationPage() | |
{ | |
initscr(); | |
noecho(); | |
cbreak(); | |
int selection = 0; | |
int yMax, xMax; | |
getmaxyx(stdscr, yMax, xMax); | |
refresh(); | |
WINDOW * menuwin = newwin(5, xMax-36, yMax-10, 25); | |
box(menuwin, 3, 0); | |
refresh(); | |
wrefresh(menuwin); | |
keypad(menuwin, true); | |
//TEXT OUTPUT | |
Window dialogWin(3, 70, yMax - 11, xMax - 11); | |
newWindow(dialogWin); | |
WindowPrint("Created by Callum Byrne, Reece Lock, Chris Staples and Ben Townsend.", dialogWin, false, 0); | |
refresh(); | |
string choices[2] = {"RETURN TO MAIN MENU ", | |
"EXIT GAME "}; | |
int choice; | |
int highlight = 0; | |
while(1) | |
{ | |
for(int i = 0; i < 2; i++) | |
{ | |
if(i == highlight) | |
wattron(menuwin, A_REVERSE); | |
mvwprintw(menuwin, i+1, 60, choices[i].c_str()); | |
wattroff(menuwin, A_REVERSE); | |
} | |
choice = wgetch(menuwin); | |
switch(choice) | |
{ | |
case KEY_UP: | |
highlight--; | |
if(highlight == -1) | |
highlight = 1; | |
break; | |
case KEY_DOWN: | |
highlight++; | |
if(highlight == 2) | |
highlight = 0; | |
break; | |
case 10: | |
selection = highlight + 1; | |
break; | |
default: | |
refresh(); | |
break; | |
} | |
if (selection != 0) | |
{ | |
if (selection == 1) | |
{ | |
refresh(); | |
break; | |
} | |
if (selection == 2) | |
{ | |
endwin(); | |
exit(0); | |
} | |
} | |
} | |
//clear(); | |
endwin(); | |
//Main_Menu(); | |
refresh(); | |
wrefresh(menuwin); | |
refresh(); | |
} | |
//Made by Chris with edits by Callum |