diff options
Diffstat (limited to 'src/graphics')
-rw-r--r-- | src/graphics/engine/engine.cpp | 25 | ||||
-rw-r--r-- | src/graphics/engine/lightning.cpp | 2 | ||||
-rw-r--r-- | src/graphics/engine/modelmanager.cpp | 7 | ||||
-rw-r--r-- | src/graphics/engine/particle.cpp | 8 | ||||
-rw-r--r-- | src/graphics/engine/terrain.cpp | 13 | ||||
-rw-r--r-- | src/graphics/engine/text.cpp | 16 |
6 files changed, 32 insertions, 39 deletions
diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index d6e4415..072261b 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -19,7 +19,6 @@ #include "graphics/engine/engine.h" #include "app/app.h" -#include "app/gamedata.h" #include "common/image.h" #include "common/key.h" @@ -283,7 +282,7 @@ bool CEngine::Create() params.minFilter = TEX_MIN_FILTER_NEAREST; params.magFilter = TEX_MAG_FILTER_NEAREST; params.mipmap = false; - m_miceTexture = LoadTexture("mouse.png", params); + m_miceTexture = LoadTexture("textures/interface/mouse.png", params); GetSystemUtils()->GetCurrentTimeStamp(m_currentFrameTime); GetSystemUtils()->GetCurrentTimeStamp(m_lastFrameTime); @@ -2247,7 +2246,7 @@ Texture CEngine::CreateTexture(const std::string& texName, const TextureCreatePa if (image == nullptr) { - if (! img.Load(CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, texName))) + if (!img.Load(texName)) { std::string error = img.GetError(); GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", texName.c_str(), error.c_str()); @@ -2298,15 +2297,15 @@ Texture CEngine::LoadTexture(const std::string& name, const TextureCreateParams& bool CEngine::LoadAllTextures() { - LoadTexture("text.png"); - m_miceTexture = LoadTexture("mouse.png"); - LoadTexture("button1.png"); - LoadTexture("button2.png"); - LoadTexture("button3.png"); - LoadTexture("effect00.png"); - LoadTexture("effect01.png"); - LoadTexture("effect02.png"); - LoadTexture("map.png"); + LoadTexture("textures/interface/text.png"); + m_miceTexture = LoadTexture("textures/interface/mouse.png"); + LoadTexture("textures/interface/button1.png"); + LoadTexture("textures/interface/button2.png"); + LoadTexture("textures/interface/button3.png"); + LoadTexture("textures/interface/effect00.png"); + LoadTexture("textures/interface/effect01.png"); + LoadTexture("textures/interface/effect02.png"); + LoadTexture("textures/interface/map.png"); if (! m_backgroundName.empty()) { @@ -2415,7 +2414,7 @@ bool CEngine::ChangeTextureColor(const std::string& texName, CImage img; - if (! img.Load(CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, texName))) + if (!img.Load(texName)) { std::string error = img.GetError(); GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", texName.c_str(), error.c_str()); diff --git a/src/graphics/engine/lightning.cpp b/src/graphics/engine/lightning.cpp index 4395eec..69d8a3c 100644 --- a/src/graphics/engine/lightning.cpp +++ b/src/graphics/engine/lightning.cpp @@ -235,7 +235,7 @@ void CLightning::Draw() mat.LoadIdentity(); device->SetTransform(TRANSFORM_WORLD, mat); - m_engine->SetTexture("effect00.png"); + m_engine->SetTexture("textures/interface/effect00.png"); m_engine->SetState(ENG_RSTATE_TTEXTURE_BLACK); Math::Point texInf; diff --git a/src/graphics/engine/modelmanager.cpp b/src/graphics/engine/modelmanager.cpp index 0c0fb98..fc201fa 100644 --- a/src/graphics/engine/modelmanager.cpp +++ b/src/graphics/engine/modelmanager.cpp @@ -18,7 +18,6 @@ #include "graphics/engine/modelmanager.h" #include "app/app.h" -#include "app/gamedata.h" #include "common/logger.h" @@ -48,11 +47,9 @@ bool CModelManager::LoadModel(const std::string& fileName, bool mirrored) if (CApplication::GetInstance().IsDebugModeActive(DEBUG_MODELS)) modelFile.SetPrintDebugInfo(true); - std::string filePath = CGameData::GetInstancePointer()->GetFilePath(DIR_MODEL, fileName); - - if (!modelFile.ReadModel(filePath)) + if (!modelFile.ReadModel(fileName)) { - GetLogger()->Error("Loading model '%s' failed\n", filePath.c_str()); + GetLogger()->Error("Loading model '%s' failed\n", fileName.c_str()); return false; } diff --git a/src/graphics/engine/particle.cpp b/src/graphics/engine/particle.cpp index abee2e2..ead2387 100644 --- a/src/graphics/engine/particle.cpp +++ b/src/graphics/engine/particle.cpp @@ -198,10 +198,10 @@ void CParticle::FlushParticle(int sheet) //! Returns file name of the effect effectNN.png, with NN = number void NameParticle(std::string &name, int num) { - if (num == 1) name = "effect00.png"; - else if (num == 2) name = "effect01.png"; - else if (num == 3) name = "effect02.png"; - else if (num == 4) name = "text.png"; + if (num == 1) name = "textures/interface/effect00.png"; + else if (num == 2) name = "textures/interface/effect01.png"; + else if (num == 3) name = "textures/interface/effect02.png"; + else if (num == 4) name = "textures/interface/text.png"; else name = ""; } diff --git a/src/graphics/engine/terrain.cpp b/src/graphics/engine/terrain.cpp index 5f37cd8..037cba6 100644 --- a/src/graphics/engine/terrain.cpp +++ b/src/graphics/engine/terrain.cpp @@ -19,7 +19,6 @@ #include "graphics/engine/terrain.h" #include "app/app.h" -#include "app/gamedata.h" #include "common/image.h" #include "common/logger.h" @@ -190,10 +189,10 @@ void CTerrain::AddMaterial(int id, const std::string& texName, const Math::Point bool CTerrain::LoadResources(const std::string& fileName) { CImage img; - std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, fileName); - if (! img.Load(path)) + + if (! img.Load(fileName)) { - GetLogger()->Error("Cannot load resource file: '%s'\n", path.c_str()); + GetLogger()->Error("Cannot load resource file: '%s'\n", fileName.c_str()); return false; } @@ -287,10 +286,10 @@ bool CTerrain::LoadRelief(const std::string &fileName, float scaleRelief, m_scaleRelief = scaleRelief; CImage img; - std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, fileName); - if (! img.Load(path)) + + if (! img.Load(fileName)) { - GetLogger()->Error("Could not load relief file: '%s'!\n", path.c_str()); + GetLogger()->Error("Could not load relief file: '%s'!\n", fileName.c_str()); return false; } diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index 8fd01b7..78cf7b8 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -19,11 +19,11 @@ #include "graphics/engine/text.h" #include "app/app.h" -#include "app/gamedata.h" #include "common/image.h" #include "common/logger.h" #include "common/stringutils.h" +#include "common/resources/resourcemanager.h" #include "math/func.h" @@ -78,12 +78,12 @@ bool CText::Create() return false; } - m_fonts[FONT_COLOBOT] = new MultisizeFont("dvu_sans.ttf"); - m_fonts[FONT_COLOBOT_BOLD] = new MultisizeFont("dvu_sans_bold.ttf"); - m_fonts[FONT_COLOBOT_ITALIC] = new MultisizeFont("dvu_sans_italic.ttf"); + m_fonts[FONT_COLOBOT] = new MultisizeFont("fonts/dvu_sans.ttf"); + m_fonts[FONT_COLOBOT_BOLD] = new MultisizeFont("fonts/dvu_sans_bold.ttf"); + m_fonts[FONT_COLOBOT_ITALIC] = new MultisizeFont("fonts/dvu_sans_italic.ttf"); - m_fonts[FONT_COURIER] = new MultisizeFont("dvu_sans_mono.ttf"); - m_fonts[FONT_COURIER_BOLD] = new MultisizeFont("dvu_sans_mono_bold.ttf"); + m_fonts[FONT_COURIER] = new MultisizeFont("fonts/dvu_sans_mono.ttf"); + m_fonts[FONT_COURIER_BOLD] = new MultisizeFont("fonts/dvu_sans_mono_bold.ttf"); for (auto it = m_fonts.begin(); it != m_fonts.end(); ++it) { @@ -866,10 +866,8 @@ CachedFont* CText::GetOrOpenFont(FontType font, float size) return m_lastCachedFont; } - std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_FONT, mf->fileName); - m_lastCachedFont = new CachedFont(); - m_lastCachedFont->font = TTF_OpenFont(path.c_str(), pointSize); + m_lastCachedFont->font = TTF_OpenFontRW(CResourceManager::GetSDLFileHandler(mf->fileName), 1, pointSize); if (m_lastCachedFont->font == nullptr) m_error = std::string("TTF_OpenFont error ") + std::string(TTF_GetError()); |