bool LoadState::Input() { SGD::InputManager* pInput = SGD::InputManager::GetInstance(); if (pInput->IsKeyPressed(SGD::Key::Escape) || pInput->IsButtonDown(0, 6)) { Game::GetInstance()->RemoveState(); } if (pInput->GetCursorMovement().x || pInput->GetCursorMovement().y) { if (pInput->GetCursorPosition().IsPointInRectangle(newRect)) m_nCursor = 0; else if (pInput->GetCursorPosition().IsPointInRectangle(saveslot1)) m_nCursor = 1; else if (pInput->GetCursorPosition().IsPointInRectangle(saveslot2)) m_nCursor = 2; else if (pInput->GetCursorPosition().IsPointInRectangle(saveslot3)) m_nCursor = 3; else if (pInput->GetCursorPosition().IsPointInRectangle(exit)) m_nCursor = 4; else m_nCursor = -1; } if (m_fArcadeTimer >= 1.0f) { if (pInput->IsKeyPressed(SGD::Key::Left) || pInput->IsKeyPressed(SGD::Key::A) || pInput->GetLeftJoystick(0).x == -1) { m_nCursor--; if (m_nCursor < 0) m_nCursor = 4; m_fArcadeTimer = 0.0f; } else if (pInput->IsKeyPressed(SGD::Key::Right) || pInput->IsKeyPressed(SGD::Key::D) || pInput->GetLeftJoystick(0).x == 1) { m_nCursor++; if (m_nCursor > 4) m_nCursor = 0; m_fArcadeTimer = 0.0f; } else if (pInput->IsKeyPressed(SGD::Key::Up) || pInput->IsKeyPressed(SGD::Key::W) || pInput->GetLeftJoystick(0).y == -1) { m_nCursor--; if (m_nCursor < 0) m_nCursor = 4; m_fArcadeTimer = 0.0f; } else if (pInput->IsKeyPressed(SGD::Key::Down) || pInput->IsKeyPressed(SGD::Key::S) || pInput->GetLeftJoystick(0).y == 1) { m_nCursor++; if (m_nCursor > 4) m_nCursor = 0; m_fArcadeTimer = 0.0f; } } if (pInput->IsKeyPressed(SGD::Key::Enter) || pInput->IsKeyPressed(SGD::Key::MouseLeft) || pInput->IsButtonDown(0, 0)) { switch (m_nCursor) { case 0: Game::GetInstance()->AddState(GameplayState::GetInstance()); break; case 1: Load("resource/Save/Save.xml"); break; case 2: Load2("resource/Save/Save2.xml"); break; case 3: Load3("resource/Save/Save3.xml"); break; case 4: Game::GetInstance()->RemoveState(); break; default: break; } } return true; }