// // CSE143, Summer 2001 // Homework 5 // Air Traffic Control Starter Code // main.cpp // #include "ATCUI.h" #include "Simulator.h" #include "time.h" int main(void) { GP142Display display; // Creates the global display object, only 1 can exist per program. srand( (unsigned)time( NULL ) ); // seeds the random number generator bool quit; // = "user has selected quit" char key_pressed; // last keyboard character from key event int mouse_x, mouse_y; // x and y coordinates of latest mouse event Simulator theSim; ATCUI theUI(&theSim,&display); // MAIN EVENT LOOP quit = false; while (!quit) { // perform appropriate action depending on kind of event switch (display.getNextEvent (mouse_x, mouse_y, key_pressed)) { case GP142_QUIT: // Quit selected quit = true; break; case GP142_MOUSE: // Mouse click. Determine if in a menu button // or elsewhere and process accordingly. theUI.handle_mouse_click(mouse_x, mouse_y); break; case GP142_PERIODIC: theSim.step(); break; } } return 0; }