aboutsummaryrefslogtreecommitdiffstats
path: root/yage/core
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-12-31 18:00:01 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-12-31 18:00:01 +0000
commit34908f108ad7c2ee6cff96491a0bc40381477424 (patch)
treef58c6bdde485d07a7136f78055240bab923bd4a6 /yage/core
parent943e3a5bc98ebcc2aa1b1d576700f7c4010c143c (diff)
downloadYAGE-34908f108ad7c2ee6cff96491a0bc40381477424.tar.gz
YAGE-34908f108ad7c2ee6cff96491a0bc40381477424.zip
[Test] Benchmarking the engine and trying to optimize.
Diffstat (limited to 'yage/core')
-rw-r--r--yage/core/imageloader.cpp2
-rw-r--r--yage/core/logger.h8
-rw-r--r--yage/core/resourcemanager.cpp4
-rw-r--r--yage/core/resourcemanager.h5
-rw-r--r--yage/core/texturecache.cpp6
-rw-r--r--yage/core/texturecache.h2
6 files changed, 15 insertions, 12 deletions
diff --git a/yage/core/imageloader.cpp b/yage/core/imageloader.cpp
index 60290058..7b34312d 100644
--- a/yage/core/imageloader.cpp
+++ b/yage/core/imageloader.cpp
@@ -48,7 +48,7 @@ Texture ImageLoader::loadPng(const std::string &file_path)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
diff --git a/yage/core/logger.h b/yage/core/logger.h
index 98c64b88..d1f75aec 100644
--- a/yage/core/logger.h
+++ b/yage/core/logger.h
@@ -13,13 +13,13 @@
#include <string>
#include <vector>
+#include "../util/active.h"
+#include "logmessage.h"
+#include "logsink.h"
+
namespace yage
{
-class Active;
-class LogMessage;
-class LogSink;
-
class Logger
{
public:
diff --git a/yage/core/resourcemanager.cpp b/yage/core/resourcemanager.cpp
index eac09305..ec3761b8 100644
--- a/yage/core/resourcemanager.cpp
+++ b/yage/core/resourcemanager.cpp
@@ -14,9 +14,9 @@ namespace yage
TextureCache ResourceManager::texture_cache_;
-Texture ResourceManager::getTexture(const std::string &texture_path)
+Texture ResourceManager::getTexture(const std::string &texture_path, int x, int y)
{
- return texture_cache_.getTexture(texture_path);
+ return texture_cache_.getTexture(texture_path, x, y);
}
} // namespace yage
diff --git a/yage/core/resourcemanager.h b/yage/core/resourcemanager.h
index a0249436..11a16f63 100644
--- a/yage/core/resourcemanager.h
+++ b/yage/core/resourcemanager.h
@@ -24,7 +24,7 @@
namespace yage
{
-class Texture;
+struct Texture;
class ResourceManager
{
@@ -32,7 +32,8 @@ private:
static TextureCache texture_cache_;
public:
- static Texture getTexture(const std::string &texture_path);
+ static Texture getTexture(const std::string &texture_path, int x = 1,
+ int y = 1);
};
} // namespace yage
diff --git a/yage/core/texturecache.cpp b/yage/core/texturecache.cpp
index 447051b7..66251de5 100644
--- a/yage/core/texturecache.cpp
+++ b/yage/core/texturecache.cpp
@@ -7,19 +7,21 @@
*/
#include "texturecache.h"
-#include "imageloader.h"
#include "../data/texture.h"
+#include "imageloader.h"
namespace yage
{
-Texture TextureCache::getTexture(const std::string &texture_path)
+Texture TextureCache::getTexture(const std::string &texture_path, int x, int y)
{
auto itr = texture_map_.find(texture_path);
if (itr == texture_map_.end()) {
Texture new_texture = ImageLoader::loadPng(texture_path);
texture_map_.insert(make_pair(texture_path, new_texture));
+ new_texture.x = x;
+ new_texture.y = y;
return new_texture;
}
diff --git a/yage/core/texturecache.h b/yage/core/texturecache.h
index ac57aaba..fbedab9d 100644
--- a/yage/core/texturecache.h
+++ b/yage/core/texturecache.h
@@ -24,7 +24,7 @@ private:
public:
TextureCache() = default;
- Texture getTexture(const std::string &texture_path);
+ Texture getTexture(const std::string &texture_path, int x = 1, int y = 1);
Texture getTextureFromSpriteSheet();
};