Exemplo n.º 1
0
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();
}
Exemplo n.º 2
0
void EscapeMenuClose(void)
{
    DebugRoutine("EscapeMenuClose");

    if (G_escMenuIsOpen) {
        // We are now open (or will be soon)
        G_escMenuIsOpen = FALSE;

        // Go back to the previous form setup
        FormPop();

        // Tell the view we want to no longer update
        // form graphics per update
        ViewUpdateFormsOverViewDisable();

        KeyboardSetEventHandler(G_previousKeyHandler);

        // Save all the key strokes
        EscMenuSaveSettings();

        // Setup the new key controls
        KeyMapReinitialize(G_iniFile);

        // Use any new settings
        ConfigReadOptions(G_iniFile);

        //INIFileClose("config.ini", G_iniFile);

        // Force a save
        ConfigClose();
        ConfigOpen();

        // TODO: Now reload all the keys!
    }

    DebugEnd();
}
Exemplo n.º 3
0
Arquivo: FORM.C Projeto: LesInk/Test
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();
}