9b2d2e0b6e83cf2c15c6111394c789413db5eed8
[cs356-p1-elevator.git] / main.cpp
1 #include "main.hpp"
2
3 ElevatorGUI *thegui = NULL;
4
5 int main (int argc, char *argv[])
6 {
7         int floors = 7;
8         int elevators = 3;
9
10 #define USE_STATIC_FLOORS 1
11 #ifndef USE_STATIC_FLOORS
12         do
13         {
14                 std::cout << "Enter the number of floors to use [2-10]: ";
15                 std::cin >> floors;
16
17                 if (floors < 2 || floors > 10)
18                 {
19                         std::cout << "You entered: " << floors
20                                           << " which is outside the acceptable range." << std::endl;
21                         std::cout << "Please try again..." << std::endl << std::endl;
22                 }
23                 else
24                 {
25                         // Good input, leave now
26                         break;
27                 }
28         } while (true);
29
30         do
31         {
32                 std::cout << "Enter the number of elevators to use [1-5]: ";
33                 std::cin >> elevators;
34
35                 if (elevators < 1 || elevators > 5)
36                 {
37                         std::cout << "You entered: " << elevators
38                                           << " which is outside the acceptable range." << std::endl;
39                         std::cout << "Please try again..." << std::endl << std::endl;
40                 }
41                 else
42                 {
43                         // Good input, leave now
44                         break;
45                 }
46         } while (true);
47 #endif
48
49         // Start GTK
50         Gtk::Main app(argc, argv);
51
52         // Start the GUI
53         ElevatorGUI eg(floors, elevators);
54         thegui = &eg;
55
56         // Show the GUI
57         eg.show ();
58
59         // Run it!
60         Gtk::Main::run (eg);
61
62         return 0;
63 }
64
65 /* vim: set ts=4 sts=4 sw=4 noet tw=112: */