aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-04-06 16:16:59 +0100
committerYann Herklotz <ymherklotz@gmail.com>2017-04-06 16:16:59 +0100
commitafe623ba793f9f4c51f94abe6464020d22387c9d (patch)
treeea7c92ce42fb8645146007ab2d1398023efad448 /src
parent905f72775fa91b0a467f3c0847c60cf0f85a6d80 (diff)
downloadYAGE-afe623ba793f9f4c51f94abe6464020d22387c9d.tar.gz
YAGE-afe623ba793f9f4c51f94abe6464020d22387c9d.zip
Improved files
Diffstat (limited to 'src')
-rw-r--r--src/camera2d.cpp7
-rw-r--r--src/imageloader.cpp4
-rw-r--r--src/resourcemanager.cpp2
-rw-r--r--src/texturecache.cpp4
4 files changed, 11 insertions, 6 deletions
diff --git a/src/camera2d.cpp b/src/camera2d.cpp
index 75bbe9c6..041870ed 100644
--- a/src/camera2d.cpp
+++ b/src/camera2d.cpp
@@ -1,5 +1,7 @@
#include "camera2d.hpp"
+#include <GL/glew.h>
+
namespace yage
{
@@ -12,7 +14,7 @@ Camera2D::Camera2D(int screen_width, int screen_height) :
Camera2D::~Camera2D()
{}
-void Camera2D::update()
+void Camera2D::update(GlslProgram &program)
{
if(matrix_needs_update_)
{
@@ -24,6 +26,9 @@ void Camera2D::update()
matrix_needs_update_=false;
}
+
+ GLint matrix_location = program.getUniformLocation("P");
+ glUniformMatrix4fv(matrix_location, 1, GL_FALSE, &(camera_matrix_[0][0]));
}
void Camera2D::move(const glm::vec2 &direction)
diff --git a/src/imageloader.cpp b/src/imageloader.cpp
index 8325b7f6..359d0af5 100644
--- a/src/imageloader.cpp
+++ b/src/imageloader.cpp
@@ -7,9 +7,9 @@
namespace yage
{
-GlTexture ImageLoader::loadPng(const std::string &file_path)
+Texture ImageLoader::loadPng(const std::string &file_path)
{
- GlTexture texture = {};
+ Texture texture = {};
std::vector<unsigned char> in;
std::vector<unsigned char> out;
diff --git a/src/resourcemanager.cpp b/src/resourcemanager.cpp
index ca5ac3f3..06f71078 100644
--- a/src/resourcemanager.cpp
+++ b/src/resourcemanager.cpp
@@ -5,7 +5,7 @@ namespace yage
TextureCache ResourceManager::texture_cache_;
-GlTexture ResourceManager::getTexture(const std::string &texture_path)
+Texture ResourceManager::getTexture(const std::string &texture_path)
{
return texture_cache_.getTexture(texture_path);
}
diff --git a/src/texturecache.cpp b/src/texturecache.cpp
index e46566ff..9bebc72c 100644
--- a/src/texturecache.cpp
+++ b/src/texturecache.cpp
@@ -10,13 +10,13 @@ TextureCache::TextureCache()
TextureCache::~TextureCache()
{}
-GlTexture TextureCache::getTexture(const std::string &texture_path)
+Texture TextureCache::getTexture(const std::string &texture_path)
{
auto itr = texture_map_.find(texture_path);
if(itr == texture_map_.end())
{
- GlTexture new_texture = ImageLoader::loadPng(texture_path);
+ Texture new_texture = ImageLoader::loadPng(texture_path);
texture_map_.insert(make_pair(texture_path, new_texture));
return new_texture;
}