From 55dce5776a6a076bfe7b3e4764f9693e1ec56ab89520cc7321027b9a1eb0774d Mon Sep 17 00:00:00 2001 From: Mexpert_PRO Date: Mon, 9 Feb 2026 15:25:01 +0100 Subject: [PATCH] small fixes for windows --- TSE_Core/src/elements/Texture.cpp | 16 ++++++++++++++-- TSE_Core/src/elements/TileSet.cpp | 3 ++- TSE_Core/src/interfaces/IWindow.cpp | 5 +++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/TSE_Core/src/elements/Texture.cpp b/TSE_Core/src/elements/Texture.cpp index 336a3fe..c2351cc 100644 --- a/TSE_Core/src/elements/Texture.cpp +++ b/TSE_Core/src/elements/Texture.cpp @@ -2,6 +2,7 @@ #include "Debug.hpp" #include "Color.hpp" #include "ErrorTextureData.hpp" +#include TSE::Texture::Texture(const string &path) { @@ -10,9 +11,20 @@ TSE::Texture::Texture(const string &path) imagePtr = nullptr; Size = Vector2(0,0); - fif = FreeImage_GetFileType(path.c_str(), 0); + string name = std::filesystem::absolute(path).string(); + + if(!std::filesystem::exists(name)) + { + string msg = string("File dose not exist: ") + std::filesystem::absolute(path).string(); + TSE_ERROR(msg); + Bpp = 24; + makeError(*this); + return; + } + + fif = FreeImage_GetFileType(name.c_str(), 0); if(fif == FREE_IMAGE_FORMAT::FIF_UNKNOWN) - fif = FreeImage_GetFIFFromFilename(path.c_str()); + fif = FreeImage_GetFIFFromFilename(name.c_str()); if(fif == FREE_IMAGE_FORMAT::FIF_UNKNOWN) { TSE_ERROR("Failed to load image. Unsupported Format."); diff --git a/TSE_Core/src/elements/TileSet.cpp b/TSE_Core/src/elements/TileSet.cpp index 9a0720b..be4deed 100644 --- a/TSE_Core/src/elements/TileSet.cpp +++ b/TSE_Core/src/elements/TileSet.cpp @@ -1,5 +1,6 @@ #include "TileSet.hpp" #include "Debug.hpp" +#include "Types.hpp" #define PADDING 0.0f @@ -45,7 +46,7 @@ int TSE::TileSet::GetSpriteIdAt(int x, int y) return y * resx + x; } -uint TSE::TileSet::GetTextueID() +TSE::uint TSE::TileSet::GetTextueID() { return tex->GetTextureId(); } diff --git a/TSE_Core/src/interfaces/IWindow.cpp b/TSE_Core/src/interfaces/IWindow.cpp index 5bcdcbd..c2e0961 100644 --- a/TSE_Core/src/interfaces/IWindow.cpp +++ b/TSE_Core/src/interfaces/IWindow.cpp @@ -6,6 +6,9 @@ #include "IInputManager.hpp" #include "elements/AudioEngine.hpp" +#define FREEIMAGE_LIB +#include "FI/FreeImage.h" + TSE::IWindow* TSE::IWindow::lastWindow = nullptr; bool TSE::IWindow::BaseInit() const @@ -14,6 +17,7 @@ bool TSE::IWindow::BaseInit() const Debug::Init(); Debug::Log("TSE:" + TSE_VERSION_STRING); AudioEngine::Init(); + FreeImage_Initialise(true); return true; } @@ -29,6 +33,7 @@ TSE::Vector2 TSE::IWindow::GetSize() const TSE::IWindow::~IWindow() { + FreeImage_DeInitialise(); AudioEngine::Destroy(); IInputManager::instance()->Delete(); Time::Destroy();