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?
PineapplePen/menulist.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
62 lines (49 sloc)
1.21 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
#ifndef MENULIST_H | |
#define MENULIST_H | |
#include <iostream> | |
#include "mainmenu.h" | |
#include "playermenu.h" | |
#include "jobmenu.h" | |
#include "librarymenu.h" | |
#include "menuoptions.h" | |
#include "menuclass.h" | |
using namespace std; | |
class MenuList | |
{ | |
MenuList() | |
{ | |
} | |
int mList() | |
{ | |
MenuSwitch* game = new MenuSwitch(); // declares a pointer (game) and allocates memory to (size of(MenuSwitch)) | |
MainMenu* mainMenu = new MainMenu(game); | |
PlayerMenu* playerMenu = new PlayerMenu(game); | |
JobMenu* jobMenu = new JobMenu(game); | |
LibraryMenu* libraryMenu = new LibraryMenu(game); | |
game->assignMenu(mainMenu, playerMenu, jobMenu, libraryMenu); | |
cout << "Input 0 to exit the game." << endl; | |
cout << "Input 9 for Main Menu." << endl; | |
cout << "Input 8 for Player Menu." << endl; | |
cout << "Input 7 for Job Menu." << endl; | |
cout << "Input 6 for Library Menu" << endl; | |
int menuInput; | |
cin >> menuInput; | |
while (true) | |
{ | |
if (menuInput == 0) | |
{ | |
return 0; | |
} | |
if (menuInput == 9 || menuInput == 8 || menuInput == 7 || menuInput == 6) | |
{ | |
game->currentMenu->update(menuInput); | |
} | |
else | |
{ | |
cout << "Input 9,8,7, or 6 to change menu, or 0 to exit the game." << endl; | |
} | |
cin >> menuInput; | |
} | |
} | |
}; | |
#endif |