Example #1
0
/**
 * @remarks Originally called 'boot_help'
 */
void Help::run() {
	_vm->_graphics->saveScreen();
	_vm->fadeOut();
	switchPage(0);
	_vm->fadeIn();

	_vm->_graphics->loadMouse(kCurHelp);

	// Originally it was the body of 'continue_help':
	bool close = false;
	while (!_vm->shouldQuit() && !close) {
		Common::Event event;
		_vm->getEvent(event);
		if (event.type == Common::EVENT_KEYDOWN)
			close = handleKeyboard(event);
		else if ((event.type == Common::EVENT_LBUTTONDOWN) || (event.type == Common::EVENT_LBUTTONUP) || (event.type == Common::EVENT_MOUSEMOVE))
			close = handleMouse(event);

		_vm->_graphics->refreshScreen();
	}
	// End of 'continue_help'.

	_vm->fadeOut();
	_vm->_graphics->restoreScreen();
	_vm->_graphics->removeBackup();
	_vm->fadeIn();
}
Example #2
0
void RunnerView::readSocket()
{
//    qDebug() << "RunnerView::readSocket - bytes available:" << m_socket->bytesAvailable();
    Message* m(Message::read(m_socket));
    if (m) {
        switch (m->type()) {
            case MessageType::Undefined : qWarning("RunnerView::readSocket - message type: Undefined"); break;
            case MessageType::CloneRequest : {
                handleCloneRequest();
                break;
            }
            case MessageType::CloneData : {
                CloneDataMessage* cdm(dynamic_cast<CloneDataMessage*>(m));
                handleCloneData(cdm);
                break;
            }
            case MessageType::Mouse : {
                MouseMessage* mm(dynamic_cast<MouseMessage*>(m));
                handleMouse(mm);
                break;
            }
            case MessageType::Close : quitApplication(); break;
            default : {
                qDebug() << "RunnerView::readSocket - message:" << *m;
                break;
            }
        }
        delete m;
    }
    if (m_socket->bytesAvailable()) {
        QMetaObject::invokeMethod(this, "readSocket", Qt::QueuedConnection);
    }
}
/* Updates the engine logic, input and state of the objects */
void Engine::update(){
    //Calculates how many ticks has passed since the last uptade call
    state.fps = 1000/((GLdouble)timer.elapsed());

    //And then handles the input
    handleKeyboard();
    handleMouse();
}
Example #4
0
void Camera::update(double d)
{
	float delta = (float)d;
	handleKeyboard(delta);
	handleMouse(delta);

	//when all translations and rotations are done, update world matrix.
	updateView();
}
void GameInputHandler::update(float timeSinceLastFrame)
{
	rotX = 0;
	rotY = 0;
	translateVector = Vector3::ZERO;
	moveScale = cameraMoveSpeed * timeSinceLastFrame;

	// Handle mouse and keyboard
	handleMouse(timeSinceLastFrame);
	handleKeyboard(timeSinceLastFrame);

	// Move camera
	if (stateManager.getActState() == &game)
		game.moveCamera(rotX, rotY, translateVector);
}
Example #6
0
// global update method
void update(float dt)
{
	handleKeys(dt);
	handleMouse(dt);
	
	// check for shader file refresh
	FILETIME create, access, write;
	HANDLE fhandle = CreateFile(SHADER_SRC, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
	GetFileTime(fhandle, &create, &access, &write);
	ULONGLONG time = (((ULONGLONG) write.dwHighDateTime) << 32) + write.dwLowDateTime;
	if  (time > g_shader_modified) {
		// detach old stuff
		for(int i = 0; i < g_shader.progs.size(); i++) {
			glDetachShader(g_shader.id, g_shader.progs.at(i));
		}
		g_shader.progs.clear();
		refreshShaderProgram(SHADER_SRC);
		g_shader_modified = time;
	}
	CloseHandle(fhandle);
}
Example #7
0
LRESULT BSPanel::processEvent(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST ||
        uMsg == WM_MOUSEHOVER || uMsg == WM_MOUSELEAVE)
    {
        return handleMouse(uMsg, wParam, lParam);
    }
    else
    {
        switch (uMsg)
        {
        case WM_CREATE:
            return handleCreate(uMsg, wParam, lParam);
        case WM_DESTROY:
            return handleDestroy(uMsg, wParam, lParam);
        case WM_WINDOWPOSCHANGED:
            return handlePositionChanges(uMsg, wParam, lParam);
        case WM_PAINT:
            return handlePaint(uMsg, wParam, lParam);
        case WM_SETCURSOR:
            return handleSetCursor(uMsg, wParam, lParam);
        case WM_SETFOCUS:
        case WM_KILLFOCUS:
            return handleFocus(uMsg, wParam, lParam);
        case WM_KEYDOWN:
        case WM_KEYUP:
        case WM_CHAR:
        case WM_SYSKEYDOWN:
        case WM_SYSKEYUP:
        case WM_SYSCHAR:
            return handleKey(uMsg, wParam, lParam);
        case WM_IME_STARTCOMPOSITION:
        case WM_IME_COMPOSITION:
        case WM_IME_ENDCOMPOSITION:
            return handleIME(uMsg, wParam, lParam);
        default:
            return defProcessEvent(uMsg, wParam, lParam);
        }
    }
}
Example #8
0
bool BaseAppInput::runFrame(void)
{
	//ideally, we would be using events. However, that tended to result in either segfaults or a hang when I tried it. *sigh*
	//so, we'll fake events on our own
	if (! handleKeyboard(NULL) || ! handleMouse())
	{
		return false;
	}
	
	SDL_Event evt;
	while (SDL_PollEvent(&evt)) //need to make sure it's not null
	{
		if (!processEvent(&evt))
		{
			return false;
		}
	}
	
	frameDone();
	
	return true;
}
Example #9
0
void doPlayer(void)
{
	self = player;
	
	rechargeBoostECM();
	
	if (game.currentMission->challengeData.isChallenge)
	{
		applyRestrictions();
	}
	
	if (player->alive == ALIVE_ALIVE && player->systemPower > 0)
	{
		handleKeyboard();

		handleMouse();
		
		handleSuspicionLevel();

		if (!player->target || player->target->health <= 0 || player->target->systemPower <= 0 || targetOutOfRange())
		{
			selectTarget();
		}
	}

	player->angle = ((int)player->angle) % 360;

	if (player->health <= 0 && battle.status == MS_IN_PROGRESS)
	{
		if (game.currentMission->challengeData.isChallenge)
		{
			if (!game.currentMission->challengeData.allowPlayerDeath)
			{
				updateDeathStats();
				
				failMission();
			}
		}
		else if (!battle.isEpic)
		{
			updateDeathStats();
			
			failMission();
		}
		else if (player->health == -FPS)
		{
			updateDeathStats();
			
			updateCondition("PLAYER", TT_DESTROY);
			
			if (battle.status == MS_IN_PROGRESS)
			{
				initPlayerSelect();
			}
		}
	}

	if (battle.status == MS_IN_PROGRESS)
	{
		selectMissionTarget();
	}

	if (dev.playerUnlimitedMissiles)
	{
		player->missiles = 999;
	}
	
	/* really only used in challenge mode */
	if (player->systemPower <= 0 && battle.status == MS_IN_PROGRESS)
	{
		if (game.currentMission->challengeData.isChallenge)
		{
			addHudMessage(colors.red, _("Challenge Failed!"));
			failMission();
		}
	}

	if (battle.boostTimer == (int)BOOST_FINISHED_TIME)
	{
		deactivateBoost();
	}
}