small fixes for windows

This commit is contained in:
2026-02-09 15:25:01 +01:00
parent 330d4b26dc
commit 55dce5776a
3 changed files with 21 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
#include "Debug.hpp" #include "Debug.hpp"
#include "Color.hpp" #include "Color.hpp"
#include "ErrorTextureData.hpp" #include "ErrorTextureData.hpp"
#include <filesystem>
TSE::Texture::Texture(const string &path) TSE::Texture::Texture(const string &path)
{ {
@@ -10,9 +11,20 @@ TSE::Texture::Texture(const string &path)
imagePtr = nullptr; imagePtr = nullptr;
Size = Vector2(0,0); 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) 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) if(fif == FREE_IMAGE_FORMAT::FIF_UNKNOWN)
{ {
TSE_ERROR("Failed to load image. Unsupported Format."); TSE_ERROR("Failed to load image. Unsupported Format.");

View File

@@ -1,5 +1,6 @@
#include "TileSet.hpp" #include "TileSet.hpp"
#include "Debug.hpp" #include "Debug.hpp"
#include "Types.hpp"
#define PADDING 0.0f #define PADDING 0.0f
@@ -45,7 +46,7 @@ int TSE::TileSet::GetSpriteIdAt(int x, int y)
return y * resx + x; return y * resx + x;
} }
uint TSE::TileSet::GetTextueID() TSE::uint TSE::TileSet::GetTextueID()
{ {
return tex->GetTextureId(); return tex->GetTextureId();
} }

View File

@@ -6,6 +6,9 @@
#include "IInputManager.hpp" #include "IInputManager.hpp"
#include "elements/AudioEngine.hpp" #include "elements/AudioEngine.hpp"
#define FREEIMAGE_LIB
#include "FI/FreeImage.h"
TSE::IWindow* TSE::IWindow::lastWindow = nullptr; TSE::IWindow* TSE::IWindow::lastWindow = nullptr;
bool TSE::IWindow::BaseInit() const bool TSE::IWindow::BaseInit() const
@@ -14,6 +17,7 @@ bool TSE::IWindow::BaseInit() const
Debug::Init(); Debug::Init();
Debug::Log("TSE:" + TSE_VERSION_STRING); Debug::Log("TSE:" + TSE_VERSION_STRING);
AudioEngine::Init(); AudioEngine::Init();
FreeImage_Initialise(true);
return true; return true;
} }
@@ -29,6 +33,7 @@ TSE::Vector2 TSE::IWindow::GetSize() const
TSE::IWindow::~IWindow() TSE::IWindow::~IWindow()
{ {
FreeImage_DeInitialise();
AudioEngine::Destroy(); AudioEngine::Destroy();
IInputManager::instance()->Delete(); IInputManager::instance()->Delete();
Time::Destroy(); Time::Destroy();