void EscapeMenuOpen(void) { DebugRoutine("EscapeMenuOpen"); if (!G_escMenuIsOpen) { // We are now open (or will be soon) G_escMenuIsOpen = TRUE; ConfigClose(); G_iniFile = ConfigOpen(); // INIFileOpen("config.ini"); EscMenuLoadSettings(); // Force the mouse out of relative mode MouseRelativeModeOff(); // Save the current form FormPush(); // Tell the view we want to update form graphics per update ViewUpdateFormsOverViewEnable(); G_previousKeyHandler = KeyboardGetEventHandler(); KeyboardSetEventHandler(EscapeMenuKeyHandler); G_escMenuState = 0; EscapeMenuLoadState(); } DebugEnd(); }
T_void FormGenericControl(E_Boolean *exitflag) { static T_word32 delta = 0, lastupdate = 0; T_keyboardEventHandler keyhandl; T_mouseEventHandler mousehandl; T_bitmap *p_bitmap; T_resource r_bitmap; T_bitmap *p_oldBitmap; T_word16 hotX, hotY; DebugRoutine("FormGenericControl"); lastupdate = TickerGet(); *exitflag = FALSE; /** Initialize the mouse. **/ MouseGetBitmap(&hotX, &hotY, &p_oldBitmap); p_bitmap = (T_bitmap *)PictureLock("UI/MOUSE/DEFAULT", &r_bitmap); DebugCheck(p_bitmap != NULL); MouseSetDefaultBitmap(0, 0, p_bitmap); MouseUseDefaultBitmap(); /* show the mouse and set the keyboard/mouse event handlers */ keyhandl = KeyboardGetEventHandler(); mousehandl = MouseGetEventHandler(); /* flush the keyboard */ KeyboardDebounce(); MouseSetEventHandler(FormHandleMouse); KeyboardSetEventHandler(FormHandleKey); // MouseShow(); do { delta = TickerGet(); /* update color every 4 ticks */ if ((delta - lastupdate) > 0) { lastupdate = delta; ColorUpdate(delta - lastupdate); } /* update events */ GraphicUpdateAllGraphics(); // MouseHide(); MouseUpdateEvents(); KeyboardUpdateEvents(); SoundUpdate(); // MouseShow(); // delay (20); } while (*exitflag == FALSE && KeyboardGetScanCode(KEY_SCAN_CODE_ESC) == FALSE); /* clean up */ // MouseHide(); FormCleanUp(); MouseSetEventHandler(mousehandl); KeyboardSetEventHandler(keyhandl); KeyboardDebounce(); /** free up the mouse pointer resource. **/ ResourceUnlock(r_bitmap); ResourceUnfind(r_bitmap); /* Turn off the mouse */ MouseSetDefaultBitmap(hotX, hotY, p_oldBitmap); MouseUseDefaultBitmap(); DebugEnd(); }