Add alot of memory leak fixes

This commit is contained in:
Bram Verhulst
2024-04-23 11:17:17 +02:00
parent e75b80eea8
commit 1b90f222a4
27 changed files with 234 additions and 48 deletions

View File

@@ -2,6 +2,7 @@
#include "Game.h"
#include <ostream>
#include <algorithm>
#include "colors.h"
#include "utils.h"
@@ -26,6 +27,10 @@ void Game::Initialize() {
}
void Game::Cleanup() {
//TODO: ask how 2 delete the TextureManager
ScreenManager::DestroyInstance();
TextureManager::DestroyInstance();
}
void Game::Update(float elapsedSec) {
@@ -93,7 +98,11 @@ void Game::ProcessMouseWheelEvent(const SDL_MouseWheelEvent& e) {
scroll = Vector2f { 0, -1 };
}
//camera zoom
m_Camera.SetScale((m_Camera.GetScale() - e.preciseY * 0.1f));
float newScale = m_Camera.GetScale() - e.preciseY * 0.1f;
if(newScale < 0.0f) {
newScale = 0.0f;
}
m_Camera.SetScale(newScale);
}
void Game::ProcessImGui() {
m_pCurrentLevel->ProcessImGui();