예제 #1
0
/*
 *	Update the position of the DebugCamera based on user input.
 *	@param	dt		The deltaTime value this frame.
 */
void DebugCamera::Update(float dt)
{
	InputManager* pManager = InputManager::Instance();

	// Current speed
	float moveSpeed = m_moveSpeed * dt;
    float rotSpeed = m_rotationSpeed * dt;

	// Speed up when shift is pressed
	if (pManager->IsKeyDown(VK_SHIFT)) { moveSpeed *= 5; }

	// Movement
	if (pManager->IsKeyDown('W')) { MoveRelative(0, 0, moveSpeed); }
	if (pManager->IsKeyDown('S')) { MoveRelative(0, 0, -moveSpeed); }
	if (pManager->IsKeyDown('A')) { MoveRelative(-moveSpeed, 0, 0); }
	if (pManager->IsKeyDown('D')) { MoveRelative(moveSpeed, 0, 0); }
	if (pManager->IsKeyDown('X')) { MoveAbsolute(0, -moveSpeed, 0); }
	if (pManager->IsKeyDown(' ')) { MoveAbsolute(0, moveSpeed, 0); }
	if (pManager->IsKeyDown('Q')) { Rotate(0.0f, -rotSpeed); }
	if (pManager->IsKeyDown('E')) { Rotate(0.0f, rotSpeed); }

	// Handle rotation
	if (pManager->IsMouseDown(MouseButton::LMB))
	{
		POINT   prevMousePos = pManager->GetPreviousMousePos(),
				currMousePos = pManager->GetCurrentMousePos();

		float xDiff = (currMousePos.x - prevMousePos.x) * 0.005f;
		float yDiff = (currMousePos.y - prevMousePos.y) * 0.005f;

		Rotate(yDiff, xDiff);
	}
}
예제 #2
0
bool DeleteMap::HandleAction(QString &action, uint64_t frame, uint64_t played)
{
    bool handled = true;
    if (action == ACTION_UP)
        UpdateSeekAmount(1);
    else if (action == ACTION_DOWN)
        UpdateSeekAmount(-1);
    else if (action == ACTION_CLEARMAP)
        Clear(tr("Clear Cuts"));
    else if (action == ACTION_INVERTMAP)
        ReverseAll();
    else if (action == "MOVEPREV")
        MoveRelative(frame, false);
    else if (action == "MOVENEXT")
        MoveRelative(frame, true);
    else if (action == "CUTTOBEGINNING")
    {
        Push(tr("Cut to Beginning"));
        AddMark(frame, MARK_CUT_END);
    }
    else if (action == "CUTTOEND")
    {
        Push(tr("Cut to End"));
        AddMark(frame, MARK_CUT_START);
        // If the recording is still in progress, add an explicit end
        // mark at the end.
        if (m_ctx->player && m_ctx->player->IsWatchingInprogress())
            AddMark(m_ctx->player->GetTotalFrameCount() - 1, MARK_CUT_END);
    }
    else if (action == "NEWCUT")
        NewCut(frame);
    else if (action == "DELETE")
        //: Delete the current cut or preserved region
        Delete(frame, tr("Delete"));
    else if (action == "UNDO")
        Undo();
    else if (action == "REDO")
        Redo();
    else
        handled = false;
    return handled;
}