Advertisement
Volatile_Pulse

Menu_Example.cpp

Jun 15th, 2012
2,018
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.74 KB | None | 0 0
  1. /******************************************************************************
  2.  *                                                                            *
  3.  *                            Volatile Programming                            *
  4.  *                              Menu_Example.cpp                              *
  5.  *                                                                            *
  6.  ******************************************************************************
  7.  *                                                                            *
  8.  * By: Volatile Pulse                                                         *
  9.  * What: An example to demonstrate the different features of the Menu class   *
  10.  * Date: 06.15.2012                                                           *
  11.  *                                                                            *
  12.  ******************************************************************************/
  13.  
  14. #include "lib\menu.h"
  15. #include "lib\header.h"
  16.  
  17. using namespace std;
  18.  
  19. int main() {
  20.     // Disable Console Cursor
  21.     VP_SetConsoleCursor(false);
  22.  
  23.     // Declare MenuExample
  24.     Menu MenuExample;
  25.     MenuExample.SetSelectors(">");
  26.     MenuExample.AddOption("Exit");
  27.     MenuExample.AddOption("Give Me a Title");
  28.  
  29.     // Handle Menu
  30.     do {
  31.         switch(MenuExample.Play(MenuExample.Size())) {
  32.             // Exit
  33.             case 1:
  34.                 break;
  35.             // Give Me a Title
  36.             case 2:
  37.                 if(MenuExample.Size() == 2) {
  38.                     MenuExample.SetTitle("Here Is My Title");
  39.                     MenuExample.AddOption("Change My Selectors");
  40.                 }
  41.                 break;
  42.             // Change My Selectors
  43.             case 3:
  44.                 if(MenuExample.Size() == 3) {
  45.                     MenuExample.SetSelectors("-> ", " <-");
  46.                     MenuExample.AddOption("Move Me To Yhe Bottom Right");
  47.                 }
  48.                 break;
  49.             // Move Me To The Bottom Right
  50.             // Cemterize Me!
  51.             case 4:
  52.                 if(MenuExample.Size() == 5) {
  53.                     MenuExample.SetLocation(CENTER, CENTER);
  54.                     MenuExample.AddOption("_Volatile Pulse Productions_");
  55.                 }
  56.                 if(MenuExample.Size() == 4) {
  57.                     MenuExample.SetLocation(BOTTOM, RIGHT);
  58.                     MenuExample.AddOption("Change My Previous Option");
  59.                 }
  60.                 break;
  61.             // Change My Previous Option
  62.             case 5:
  63.                 if(MenuExample.Size() == 5)
  64.                     MenuExample.SetOption(4, "Centerize Me!");
  65.                 break;
  66.         }
  67.     } while (MenuExample.LastSelection() != 1);
  68.  
  69.     return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement