void VoxGame::CameraModeChanged() { if (m_pDebugCameraOptionBox->GetToggled()) { SetCameraMode(CameraMode_Debug); TurnCursorOn(true, false); } else if (m_pMouseRotateCameraOptionBox->GetToggled()) { SetCameraMode(CameraMode_MouseRotate); InitializeCameraRotation(); TurnCursorOff(false); } else if (m_pAutoCameraOptionBox->GetToggled()) { SetCameraMode(CameraMode_AutoCamera); InitializeCameraRotation(); TurnCursorOff(false); } else if (m_pFrontendCameraOptionBox->GetToggled()) { SetCameraMode(CameraMode_Frontend); TurnCursorOn(true, false); } }
void VoxGame::MouseLeftReleased() { m_bPressedCursorDown = false; if (IsCursorOn()) { m_pGUI->MouseReleased(MOUSE_BUTTON1); } if (m_gameMode == GameMode_Debug || m_cameraMode == CameraMode_Debug) { if (!m_pGUI->IsMouseInteractingWithGUIComponent(false)) { // Turn cursor on if (IsCursorOn() == false) { TurnCursorOn(true, false); } } m_bCameraRotate = false; } else if (m_gameMode == GameMode_Game) { m_bAttackReleased_Mouse = true; m_bAttackPressed_Mouse = false; m_bCanDoAttack_Mouse = true; } }
void VoxGame::KeyReleased(int key, int scancode, int mods) { m_pGUI->KeyReleased(key, mods); if (m_pGUI->IsKeyboardInteractingWithGUIComponent() && key != GLFW_KEY_ESCAPE) { return; // For textbox entry } switch (key) { // Player movement case GLFW_KEY_W: { m_bKeyboardForward = false; break; } case GLFW_KEY_S: { m_bKeyboardBackward = false; break; } case GLFW_KEY_A: { m_bKeyboardLeft = false; m_bKeyboardStrafeLeft = false; break; } case GLFW_KEY_D: { m_bKeyboardRight = false; m_bKeyboardStrafeRight = false; break; } case GLFW_KEY_F: { m_bKeyboardUp = false; break; } case GLFW_KEY_V: { m_bKeyboardDown = false; break; } case GLFW_KEY_SPACE: { m_bKeyboardSpace = false; break; } case GLFW_KEY_ESCAPE: { m_bKeyboardMenu = false; break; } case GLFW_KEY_O: { if (STEAM_BUILD == false) { m_pDebugCameraOptionBox->SetToggled(true); CameraModeChanged(); } break; } case GLFW_KEY_L: { if (STEAM_BUILD == false) { SetPaused(!IsPaused()); } break; } case GLFW_KEY_P: { if (STEAM_BUILD == false) { if (m_pGUI->IsKeyboardInteractingWithGUIComponent() == false) { if (m_pMainWindow->IsVisible() == false) { ShowGUI(); } else { HideGUI(); } } } break; } // Game GUI case GLFW_KEY_I: { if (GetGameMode() == GameMode_Game) { if (m_pPlayer->IsDead() == false) { if (m_pInventoryGUI->IsLoaded()) { m_pInventoryGUI->Unload(); if (VoxGame::GetInstance()->IsGUIWindowStillDisplayed() == false) { TurnCursorOff(false); } } else if (m_pFrontendManager->GetFrontendScreen() == FrontendScreen_None) { m_pInventoryGUI->Load(); m_pPlayer->StopMoving(); TurnCursorOn(false, false); } } } break; } case GLFW_KEY_C: { if (GetGameMode() == GameMode_Game) { if (m_pPlayer->IsDead() == false) { if (m_pCharacterGUI->IsLoaded()) { m_pCharacterGUI->Unload(); if (VoxGame::GetInstance()->IsGUIWindowStillDisplayed() == false) { TurnCursorOff(false); } } else if (m_pFrontendManager->GetFrontendScreen() == FrontendScreen_None) { m_pCharacterGUI->Load(); m_pPlayer->StopMoving(); TurnCursorOn(false, false); } } } break; } case GLFW_KEY_K: { if (GetGameMode() == GameMode_Game) { if (m_pPlayer->IsDead() == false) { if (m_pQuestGUI->IsLoaded()) { m_pQuestGUI->Unload(); if (VoxGame::GetInstance()->IsGUIWindowStillDisplayed() == false) { TurnCursorOff(false); } } else if (m_pFrontendManager->GetFrontendScreen() == FrontendScreen_None) { m_pQuestGUI->Load(); m_pPlayer->StopMoving(); TurnCursorOn(false, false); } } } break; } // Number keys case GLFW_KEY_1: { m_pActionBar->UseActionBarslot(0); break; } case GLFW_KEY_2: { m_pActionBar->UseActionBarslot(1); break; } case GLFW_KEY_3: { m_pActionBar->UseActionBarslot(2); break; } case GLFW_KEY_4: { m_pActionBar->UseActionBarslot(3); break; } case GLFW_KEY_5: { m_pActionBar->UseActionBarslot(4); break; } case GLFW_KEY_6: { m_pActionBar->UseActionBarslot(5); break; } case GLFW_KEY_7: { m_pActionBar->UseActionBarslot(6); break; } case GLFW_KEY_8: { m_pActionBar->UseActionBarslot(7); break; } case GLFW_KEY_9: { m_pActionBar->UseActionBarslot(8); break; } case GLFW_KEY_0: { m_pActionBar->UseActionBarslot(9); break; } } }