Esempio n. 1
0
void Parallaction::runGameFrame(int event) {
	if (_input->_inputMode != Input::kInputModeGame) {
		return;
	}

	if (!processGameEvent(event)) {
		return;
	}

	_gfx->beginFrame();

	runPendingZones();

	if (shouldQuit())
		return;

	if (_engineFlags & kEngineChangeLocation) {
		changeLocation();
	}

	_programExec->runScripts(_location._programs.begin(), _location._programs.end());
	_char._ani->resetZ();
	updateWalkers();
	updateZones();
}
Esempio n. 2
0
/**
 * Traitement des events keyboard
 *
 * @param event         Event keyboard a traiter
 */
void EventsEngine::processKeyboardEvent(irr::SEvent& event)
{
    // Verifie que la touche a changé d'état depuis le dernier appel
    if(l_keyState[event.KeyInput.Key] == event.KeyInput.PressedDown)
        return;

    l_keyState[event.KeyInput.Key] = event.KeyInput.PressedDown;

    module_message msg = module_message(getId(), GUI, ACTION_CHANGE_MENU);

    switch(event.KeyInput.Key) {
    case irr::KEY_ESCAPE:
        if(!event.KeyInput.PressedDown) break;

        switch(guiEngine->getMenuState()) {
        case IN_MAIN_MENU:
            core->stop();
            return;

        case IN_CHOOSE_LEVEL_MENU:
            msg.intData["menu"] = IN_MAIN_MENU;
            break;

        case IN_OPTIONS_MENU:
            if(gameEngine->isPartieEnCours())
                msg.intData["menu"] = IN_PAUSE_MENU;
            else
                msg.intData["menu"] = IN_MAIN_MENU;
            break;

        case IN_PAUSE_MENU:
            msg.intData["menu"] = IN_GAME;
            break;

        case IN_GAME:
            msg.intData["menu"] = IN_PAUSE_MENU;
            break;
        }

        core->sendMessage(msg);
        break;

    default:
        if(gameEngine->isPartieEnCours() && !gameEngine->isPartieEnPause())
            processGameEvent(event);
        break;
    }
}