Started on GuiIcon, General fixes

This commit is contained in:
Bram Verhulst
2024-05-09 00:46:05 +02:00
parent d3b932df22
commit 8c3a485c2d
22 changed files with 231 additions and 409 deletions

View File

@@ -30,7 +30,6 @@ void Game::Initialize() {
void Game::Cleanup() {
//TODO: ask how 2 delete the TextureManager
ScreenManager::DestroyInstance();
GroundTileTypeManager::DestroyInstance();
TextureManager::DestroyInstance();
@@ -40,7 +39,7 @@ void Game::Update(float elapsedSec) {
const Uint8* pStates = SDL_GetKeyboardState(nullptr);
if (m_IsRightMouseDown) {
const Vector2f newCameraPos = Vector2f { m_MousePos.x + m_MouseOffset.x, m_MousePos.y + m_MouseOffset.y };
const Vector2f newCameraPos = Vector2f { m_MousePosition.x + m_MouseOffset.x, m_MousePosition.y + m_MouseOffset.y };
m_Camera.SetPosition(Vector2f { -newCameraPos.x, -newCameraPos.y });
}
else {
@@ -64,33 +63,17 @@ void Game::ProcessKeyUpEvent(const SDL_KeyboardEvent& e) {
}
void Game::ProcessMouseMotionEvent(const SDL_MouseMotionEvent& e) {
m_MousePos = Vector2f { float(e.x), float(e.y) };
m_MousePosition = Vector2f { float(e.x), float(e.y) };
m_pCurrentLevel->MouseMove(Vector2f { float(e.x), float(e.y) });
}
void Game::ProcessMouseDownEvent(const SDL_MouseButtonEvent& e) {
m_IsRightMouseDown = e.button == SDL_BUTTON_RIGHT;
m_MouseOffset = Vector2f { -m_Camera.GetPosition().x - m_MousePos.x, -m_Camera.GetPosition().y - m_MousePos.y };
m_MouseOffset = Vector2f { -m_Camera.GetPosition().x - m_MousePosition.x, -m_Camera.GetPosition().y - m_MousePosition.y };
}
void Game::ProcessMouseUpEvent(const SDL_MouseButtonEvent& e) {
m_IsRightMouseDown = e.button == SDL_BUTTON_RIGHT ? false : m_IsRightMouseDown;
//std::cout << "MOUSEBUTTONUP event: ";
//switch ( e.button )
//{
//case SDL_BUTTON_LEFT:
// std::cout << " left button " << std::endl;
// break;
//case SDL_BUTTON_RIGHT:k
// std::cout << " right button " << std::endl;
// break;
//case SDL_BUTTON_MIDDLE:
// std::cout << " middle button " << std::endl;
// break;
//}
}
void Game::ProcessMouseWheelEvent(const SDL_MouseWheelEvent& e) {
float newScale = m_Camera.GetScale() - e.preciseY * 0.1f;