FIXME: To be completed
Example 2.5. A UFO main loop
// main event loop bool done = false; while (!done) { // pumps events from the system event queue display.pumpEvents(); // dispatchEvents returns true when a quit event was processed. done = display.dispatchEvents(); if (!done) { // repaint the frame frame->repaint(); // give other processes a chance tk.sleep(1); } }
Example 2.6. A UFO main loop for custom windows
// main event loop bool done = false; while (!done) { // pump your own events // of course, you should only push events you have processed from the system display.pushKeyDown(&context, keyCode, unicodeChar); display.pushKeyUp(&context, keyCode, 0); display.pushMouseMove(&context, x, y); display.pushMouseButtonDown(&context, x, y, UMod::LeftButton); display.pushMouseButtonUp(&context, x, y, UMod::RightButton); display.pushMouseWheelDown(&context, x, y); display.pushMouseWheelUp(&context, x, y); // dispatchEvents returns true when a quit event was processed. done = display.dispatchEvents(); if (!done) { // repaint the context context.repaint(); // give other processes a chance tk.sleep(1); } }