diff options
Diffstat (limited to 'src/common/image.cpp')
-rw-r--r-- | src/common/image.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/common/image.cpp b/src/common/image.cpp index e3d1ef7..dd905a7 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -18,6 +18,7 @@ #include "common/image.h" #include "math/func.h" +#include "common/resources/resourcemanager.h" #include <stdlib.h> #include <stdio.h> @@ -381,7 +382,16 @@ bool CImage::Load(const std::string& fileName) m_error = ""; - m_data->surface = IMG_Load(fileName.c_str()); + SDL_RWops* pointer = CResourceManager::GetSDLFileHandler(fileName.c_str()); + if (pointer == nullptr) + { + delete m_data; + m_data = nullptr; + + m_error = "Unable to open file"; + return false; + } + m_data->surface = IMG_Load_RW(pointer, 1); if (m_data->surface == nullptr) { delete m_data; @@ -458,4 +468,4 @@ void CImage::flipVertically(){ SDL_FreeSurface(m_data->surface); m_data->surface = result; -}
\ No newline at end of file +} |