summaryrefslogtreecommitdiffstats
path: root/src/graphics
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-22 14:40:13 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-22 14:40:13 +0200
commitfd09071c29452bdfea2c519f0defbffebee42f4c (patch)
tree44d2d9d59d4c98204cb1d60bf101414bfc45b708 /src/graphics
parent37e7c73f439c0d8cbfd0f1c02b7ef5916fd748ae (diff)
downloadcolobot-fd09071c29452bdfea2c519f0defbffebee42f4c.tar.gz
colobot-fd09071c29452bdfea2c519f0defbffebee42f4c.tar.bz2
colobot-fd09071c29452bdfea2c519f0defbffebee42f4c.zip
Data dir paths
- changed access to paths in data directory in CApplication - models now load from data directory
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/engine/engine.cpp8
-rw-r--r--src/graphics/engine/engine.h5
-rw-r--r--src/graphics/engine/terrain.cpp4
-rw-r--r--src/graphics/engine/text.cpp3
-rw-r--r--src/graphics/engine/text.h1
5 files changed, 4 insertions, 17 deletions
diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp
index b737555..beb7508 100644
--- a/src/graphics/engine/engine.cpp
+++ b/src/graphics/engine/engine.cpp
@@ -210,7 +210,6 @@ CEngine::CEngine(CInstanceManager *iMan, CApplication *app)
m_lastFrameTime = CreateTimeStamp();
m_currentFrameTime = CreateTimeStamp();
- m_texPath = "textures/";
m_defaultTexParams.format = TEX_IMG_AUTO;
m_defaultTexParams.mipmap = true;
m_defaultTexParams.minFilter = TEX_MIN_FILTER_LINEAR_MIPMAP_LINEAR;
@@ -497,11 +496,6 @@ Math::IntPoint CEngine::InterfaceToWindowSize(Math::Point size)
static_cast<int>(size.y * m_size.y));
}
-std::string CEngine::GetTextureDir()
-{
- return m_texPath;
-}
-
void CEngine::AddStatisticTriangle(int count)
{
m_statisticTriangle += count;
@@ -2108,7 +2102,7 @@ Texture CEngine::CreateTexture(const std::string& texName, const TextureCreatePa
// TODO: detect alpha channel?
CImage img;
- if (! img.Load(m_app->GetDataFilePath(m_texPath, texName)))
+ if (! img.Load(m_app->GetDataFilePath(DIR_TEXTURE, 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/engine.h b/src/graphics/engine/engine.h
index 9d69a28..e36865c 100644
--- a/src/graphics/engine/engine.h
+++ b/src/graphics/engine/engine.h
@@ -738,9 +738,6 @@ public:
Math::IntPoint InterfaceToWindowSize(Math::Point size);
//@}
- //! Returns the name of directory with textures
- std::string GetTextureDir();
-
//! Increments the triangle counter for the current frame
void AddStatisticTriangle(int nb);
//! Returns the number of triangles in current frame
@@ -1349,8 +1346,6 @@ protected:
Math::Point m_highlightP2;
//@}
- //! Texture directory name
- std::string m_texPath;
//! Default texture create params
TextureCreateParams m_defaultTexParams;
diff --git a/src/graphics/engine/terrain.cpp b/src/graphics/engine/terrain.cpp
index 05b7a2d..427e7f6 100644
--- a/src/graphics/engine/terrain.cpp
+++ b/src/graphics/engine/terrain.cpp
@@ -197,7 +197,7 @@ void CTerrain::AddMaterial(int id, const std::string& texName, const Math::Point
bool CTerrain::LoadResources(const std::string& fileName)
{
CImage img;
- if (! img.Load(CApplication::GetInstance().GetDataFilePath(m_engine->GetTextureDir(), fileName)))
+ if (! img.Load(CApplication::GetInstance().GetDataFilePath(DIR_TEXTURE, fileName)))
return false;
ImageData *data = img.GetData();
@@ -268,7 +268,7 @@ bool CTerrain::LoadRelief(const std::string &fileName, float scaleRelief,
m_scaleRelief = scaleRelief;
CImage img;
- if (! img.Load(CApplication::GetInstance().GetDataFilePath(m_engine->GetTextureDir(), fileName)))
+ if (! img.Load(CApplication::GetInstance().GetDataFilePath(DIR_TEXTURE, fileName)))
return false;
ImageData *data = img.GetData();
diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp
index 7e226a0..36ad660 100644
--- a/src/graphics/engine/text.cpp
+++ b/src/graphics/engine/text.cpp
@@ -58,7 +58,6 @@ CText::CText(CInstanceManager *iMan, CEngine* engine)
m_engine = engine;
m_defaultSize = 12.0f;
- m_fontPath = "fonts";
m_lastFontType = FONT_COLOBOT;
m_lastFontSize = 0;
@@ -738,7 +737,7 @@ CachedFont* CText::GetOrOpenFont(FontType font, float size)
return m_lastCachedFont;
}
- std::string path = CApplication::GetInstance().GetDataFilePath(m_fontPath, mf->fileName);
+ std::string path = CApplication::GetInstance().GetDataFilePath(DIR_FONT, mf->fileName);
m_lastCachedFont = new CachedFont();
m_lastCachedFont->font = TTF_OpenFont(path.c_str(), pointSize);
diff --git a/src/graphics/engine/text.h b/src/graphics/engine/text.h
index 61996b8..e587609 100644
--- a/src/graphics/engine/text.h
+++ b/src/graphics/engine/text.h
@@ -301,7 +301,6 @@ protected:
std::string m_error;
float m_defaultSize;
- std::string m_fontPath;
std::map<FontType, MultisizeFont*> m_fonts;