diff options
Diffstat (limited to 'src/graphics/engine/engine.cpp')
-rw-r--r-- | src/graphics/engine/engine.cpp | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index e4bf068..5af7ced 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); @@ -1124,10 +1123,10 @@ void CEngine::ChangeSecondTexture(int objRank, const std::string& tex2Name) p1.next[l2].next.clear(); if (!newP2.tex1.Valid()) - newP2.tex1 = LoadTexture(newP2.tex1Name); + newP2.tex1 = LoadTexture("textures/"+newP2.tex1Name); if (!newP2.tex2.Valid()) - newP2.tex2 = LoadTexture(newP2.tex2Name); + newP2.tex2 = LoadTexture("textures/"+newP2.tex2Name); } } @@ -2258,7 +2257,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()); @@ -2309,27 +2308,27 @@ 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/effect00.png"); + LoadTexture("textures/effect01.png"); + LoadTexture("textures/effect02.png"); + LoadTexture("textures/interface/map.png"); if (! m_backgroundName.empty()) { TextureCreateParams params = m_defaultTexParams; params.padToNearestPowerOfTwo = true; - m_backgroundTex = LoadTexture(m_backgroundName, params); + m_backgroundTex = LoadTexture("textures/"+m_backgroundName, params); } else m_backgroundTex.SetInvalid(); if (! m_foregroundName.empty()) - m_foregroundTex = LoadTexture(m_foregroundName); + m_foregroundTex = LoadTexture("textures/"+m_foregroundName); else m_foregroundTex.SetInvalid(); @@ -2363,9 +2362,9 @@ bool CEngine::LoadAllTextures() if (! p2.tex1Name.empty()) { if (terrain) - p2.tex1 = LoadTexture(p2.tex1Name, m_terrainTexParams); + p2.tex1 = LoadTexture("textures/"+p2.tex1Name, m_terrainTexParams); else - p2.tex1 = LoadTexture(p2.tex1Name); + p2.tex1 = LoadTexture("textures/"+p2.tex1Name); if (! p2.tex1.Valid()) ok = false; @@ -2374,9 +2373,9 @@ bool CEngine::LoadAllTextures() if (! p2.tex2Name.empty()) { if (terrain) - p2.tex2 = LoadTexture(p2.tex2Name, m_terrainTexParams); + p2.tex2 = LoadTexture("textures/"+p2.tex2Name, m_terrainTexParams); else - p2.tex2 = LoadTexture(p2.tex2Name); + p2.tex2 = LoadTexture("textures/"+p2.tex2Name); if (! p2.tex2.Valid()) ok = false; @@ -2426,7 +2425,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()); @@ -2771,7 +2770,7 @@ void CEngine::SetBackground(const std::string& name, Color up, Color down, { TextureCreateParams params = m_defaultTexParams; params.padToNearestPowerOfTwo = true; - m_backgroundTex = LoadTexture(m_backgroundName, params); + m_backgroundTex = LoadTexture("textures/"+m_backgroundName, params); } } @@ -2797,7 +2796,7 @@ void CEngine::SetForegroundName(const std::string& name) m_foregroundName = name; if (! m_foregroundName.empty()) - m_foregroundTex = LoadTexture(m_foregroundName); + m_foregroundTex = LoadTexture("textures/"+m_foregroundName); } void CEngine::SetOverFront(bool front) @@ -3736,7 +3735,7 @@ void CEngine::UpdateGroundSpotTextures() } std::stringstream str; - str << "shadow" << std::setfill('0') << std::setw(2) << s << ".png"; + str << "textures/shadow" << std::setfill('0') << std::setw(2) << s << ".png"; std::string texName = str.str(); DeleteTexture(texName); @@ -3785,7 +3784,7 @@ void CEngine::DrawShadow() SetMaterial(material); // TODO: create a separate texture - SetTexture("text.png"); + SetTexture("textures/interface/text.png"); Math::Point ts, ti; |