aboutsummaryrefslogtreecommitdiffstats
path: root/include
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 /include
parent905f72775fa91b0a467f3c0847c60cf0f85a6d80 (diff)
downloadYAGE-afe623ba793f9f4c51f94abe6464020d22387c9d.tar.gz
YAGE-afe623ba793f9f4c51f94abe6464020d22387c9d.zip
Improved files
Diffstat (limited to 'include')
-rw-r--r--include/YAGE/camera2d.hpp9
-rw-r--r--include/YAGE/imageloader.hpp4
-rw-r--r--include/YAGE/resourcemanager.hpp4
-rw-r--r--include/YAGE/sprite.hpp4
-rw-r--r--include/YAGE/texture.hpp (renamed from include/YAGE/gltexture.hpp)2
-rw-r--r--include/YAGE/texturecache.hpp6
-rw-r--r--include/YAGE/vertex.hpp28
7 files changed, 41 insertions, 16 deletions
diff --git a/include/YAGE/camera2d.hpp b/include/YAGE/camera2d.hpp
index 0c86fc31..4c035ba3 100644
--- a/include/YAGE/camera2d.hpp
+++ b/include/YAGE/camera2d.hpp
@@ -1,6 +1,8 @@
#ifndef CAMERA_2D_HPP
#define CAMERA_2D_HPP
+#include "glslprogram.hpp"
+
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
@@ -23,14 +25,9 @@ public:
virtual ~Camera2D();
// update camera location
- void update();
+ void update(GlslProgram &program);
// camera movement
void move(const glm::vec2 &direction);
-
- // getters
- float getScale() { return scale_; }
- glm::vec2 getPosition() { return position_; }
- glm::mat4 getCameraMatrix() { return camera_matrix_; }
};
} // yage
diff --git a/include/YAGE/imageloader.hpp b/include/YAGE/imageloader.hpp
index 632897dc..de190ea4 100644
--- a/include/YAGE/imageloader.hpp
+++ b/include/YAGE/imageloader.hpp
@@ -1,7 +1,7 @@
#ifndef IMAGE_LOADER_HPP
#define IMAGE_LOADER_HPP
-#include "gltexture.hpp"
+#include "texture.hpp"
#include <string>
@@ -11,7 +11,7 @@ namespace yage
class ImageLoader
{
public:
- static GlTexture loadPng(const std::string &file_path);
+ static Texture loadPng(const std::string &file_path);
};
} // yage
diff --git a/include/YAGE/resourcemanager.hpp b/include/YAGE/resourcemanager.hpp
index 08ab31e0..61642caf 100644
--- a/include/YAGE/resourcemanager.hpp
+++ b/include/YAGE/resourcemanager.hpp
@@ -1,7 +1,7 @@
#ifndef RESOURCE_MANAGER_HPP
#define RESOURCE_MANAGER_HPP
-#include "gltexture.hpp"
+#include "texture.hpp"
#include "texturecache.hpp"
#include <string>
@@ -14,7 +14,7 @@ class ResourceManager
private:
static TextureCache texture_cache_;
public:
- static GlTexture getTexture(const std::string &texture_path);
+ static Texture getTexture(const std::string &texture_path);
};
} // yage
diff --git a/include/YAGE/sprite.hpp b/include/YAGE/sprite.hpp
index 8abc339a..fa214686 100644
--- a/include/YAGE/sprite.hpp
+++ b/include/YAGE/sprite.hpp
@@ -1,7 +1,7 @@
#ifndef SPRITE_HPP
#define SPRITE_HPP
-#include "gltexture.hpp"
+#include "texture.hpp"
#include <GL/glew.h>
@@ -18,7 +18,7 @@ private:
float width_;
float height_;
GLuint vbo_id_ = 0;
- GlTexture texture_;
+ Texture texture_;
public:
Sprite();
~Sprite();
diff --git a/include/YAGE/gltexture.hpp b/include/YAGE/texture.hpp
index 7446d560..c72c80d7 100644
--- a/include/YAGE/gltexture.hpp
+++ b/include/YAGE/texture.hpp
@@ -6,7 +6,7 @@
namespace yage
{
-struct GlTexture
+struct Texture
{
GLuint id;
int width;
diff --git a/include/YAGE/texturecache.hpp b/include/YAGE/texturecache.hpp
index 43266ee9..4969b27b 100644
--- a/include/YAGE/texturecache.hpp
+++ b/include/YAGE/texturecache.hpp
@@ -1,7 +1,7 @@
#ifndef TEXTURE_CACHE_HPP
#define TEXTURE_CACHE_HPP
-#include "gltexture.hpp"
+#include "texture.hpp"
#include <unordered_map>
@@ -11,12 +11,12 @@ namespace yage
class TextureCache
{
private:
- std::unordered_map<std::string, GlTexture> texture_map_;
+ std::unordered_map<std::string, Texture> texture_map_;
public:
TextureCache();
~TextureCache();
- GlTexture getTexture(const std::string &texture_path);
+ Texture getTexture(const std::string &texture_path);
};
} // yage
diff --git a/include/YAGE/vertex.hpp b/include/YAGE/vertex.hpp
index 5826aeee..bbf8a7d3 100644
--- a/include/YAGE/vertex.hpp
+++ b/include/YAGE/vertex.hpp
@@ -10,6 +10,13 @@ struct Position
{
float x;
float y;
+
+ Position()
+ {}
+
+ Position(float x_, float y_) :
+ x(x_), y(y_)
+ {}
};
struct Color
@@ -18,12 +25,26 @@ struct Color
GLubyte g;
GLubyte b;
GLubyte a;
+
+ Color()
+ {}
+
+ Color(GLubyte r_, GLubyte g_, GLubyte b_, GLubyte a_) :
+ r(r_), g(g_), b(b_), a(a_)
+ {}
};
struct UV
{
float u;
float v;
+
+ UV()
+ {}
+
+ UV(float u_, float v_) :
+ u(u_), v(v_)
+ {}
};
struct Vertex
@@ -32,6 +53,13 @@ struct Vertex
Color color;
UV uv;
+ Vertex()
+ {}
+
+ Vertex(const Position &position_, const Color &color_, const UV &uv_) :
+ position(position_), color(color_), uv(uv_)
+ {}
+
void setPosition(float x, float y)
{
position.x = x;