diff options
Diffstat (limited to 'include/yage')
-rw-r--r-- | include/yage/gl_texture.hpp | 13 | ||||
-rw-r--r-- | include/yage/glsl_program.hpp | 33 | ||||
-rw-r--r-- | include/yage/image_loader.hpp | 15 | ||||
-rw-r--r-- | include/yage/io_manager.hpp | 14 | ||||
-rw-r--r-- | include/yage/logger.hpp | 24 | ||||
-rw-r--r-- | include/yage/pico_png.hpp | 4 | ||||
-rw-r--r-- | include/yage/resource_manager.hpp | 18 | ||||
-rw-r--r-- | include/yage/sprite.hpp | 27 | ||||
-rw-r--r-- | include/yage/texture_cache.hpp | 20 | ||||
-rw-r--r-- | include/yage/vertex.hpp | 53 | ||||
-rw-r--r-- | include/yage/window.hpp | 30 |
11 files changed, 0 insertions, 251 deletions
diff --git a/include/yage/gl_texture.hpp b/include/yage/gl_texture.hpp deleted file mode 100644 index 808d86b1..00000000 --- a/include/yage/gl_texture.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef GL_TEXTURE_HPP -#define GL_TEXTURE_HPP - -#include <GL/glew.h> - -struct GlTexture -{ - GLuint id; - int width; - int height; -}; - -#endif diff --git a/include/yage/glsl_program.hpp b/include/yage/glsl_program.hpp deleted file mode 100644 index cef38a8e..00000000 --- a/include/yage/glsl_program.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef GLSL_PROGRAM_HPP -#define GLSL_PROGRAM_HPP - -#include <GL/glew.h> - -#include <string> - -class GlslProgram -{ -private: - // compiled shader program id - GLuint program_id_ = 0; - GLuint vertex_shader_id_ = 0; - GLuint fragment_shader_id_ = 0; - int attribute_index_ = 0; - - // compiles one shader - void compileShader(const GLuint &shader, const std::string &file_path); -public: - GlslProgram(); - ~GlslProgram(); - - // compiles vertex and fragment shader - void compileShaders(const std::string &vertex_shader_path, const std::string &fragment_shader_path); - void linkShaders(); - void addAttribute(const std::string &attribute_name); - GLint getUniformLocation(const std::string &uniform_name); - void use(); - void unuse(); -}; - - -#endif diff --git a/include/yage/image_loader.hpp b/include/yage/image_loader.hpp deleted file mode 100644 index 5f7b97f0..00000000 --- a/include/yage/image_loader.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef IMAGE_LOADER_HPP -#define IMAGE_LOADER_HPP - -#include "gl_texture.hpp" - -#include <string> - -class ImageLoader -{ -public: - static GlTexture loadPng(const std::string &file_path); -}; - - -#endif diff --git a/include/yage/io_manager.hpp b/include/yage/io_manager.hpp deleted file mode 100644 index 05d288b5..00000000 --- a/include/yage/io_manager.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef IO_MANAGER_HPP -#define IO_MANAGER_HPP - -#include <string> -#include <vector> - -class IoManager -{ -public: - static bool readFileToBuffer(const std::string &file_path, std::vector<unsigned char> &buffer); -}; - - -#endif diff --git a/include/yage/logger.hpp b/include/yage/logger.hpp deleted file mode 100644 index 36c7b9b3..00000000 --- a/include/yage/logger.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef LOGGER_HPP -#define LOGGER_HPP - -#include <string> - -class Logger -{ -public: - template<typename Tail> - static std::string log(std::ostream &out, Tail &&tail) - { - out<<tail; - } - - template<typename Head, typename... Tail> - static std::string log(std::ostream &out, Head &&head, Tail &&...tail) - { - out<<std::forward<Head>(head); - log(out, std::forward<Tail>(tail)...); - } -}; - - -#endif diff --git a/include/yage/pico_png.hpp b/include/yage/pico_png.hpp deleted file mode 100644 index ef123573..00000000 --- a/include/yage/pico_png.hpp +++ /dev/null @@ -1,4 +0,0 @@ -#include <vector> -#include <cstdlib> - -extern int decodePNG(std::vector<unsigned char> &out_image, unsigned long &image_width, unsigned long &image_height, const unsigned char *in_png, size_t in_size, bool convert_to_rgba32 = true); diff --git a/include/yage/resource_manager.hpp b/include/yage/resource_manager.hpp deleted file mode 100644 index 155515a3..00000000 --- a/include/yage/resource_manager.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef RESOURCE_MANAGER_HPP -#define RESOURCE_MANAGER_HPP - -#include "gl_texture.hpp" -#include "texture_cache.hpp" - -#include <string> - -class ResourceManager -{ -private: - static TextureCache texture_cache_; -public: - static GlTexture getTexture(const std::string &texture_path); -}; - - -#endif diff --git a/include/yage/sprite.hpp b/include/yage/sprite.hpp deleted file mode 100644 index 9f765c7d..00000000 --- a/include/yage/sprite.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef SPRITE_HPP -#define SPRITE_HPP - -#include "gl_texture.hpp" - -#include <GL/glew.h> - -#include <string> - -class Sprite -{ -private: - float x_; - float y_; - float width_; - float height_; - GLuint vbo_id_ = 0; - GlTexture texture_; -public: - Sprite(); - ~Sprite(); - - void init(float x, float y, float width, float height, const std::string &texture_path); - void draw(); -}; - -#endif diff --git a/include/yage/texture_cache.hpp b/include/yage/texture_cache.hpp deleted file mode 100644 index 44dba2f8..00000000 --- a/include/yage/texture_cache.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef TEXTURE_CACHE_HPP -#define TEXTURE_CACHE_HPP - -#include "gl_texture.hpp" - -#include <unordered_map> - -class TextureCache -{ -private: - std::unordered_map<std::string, GlTexture> texture_map_; -public: - TextureCache(); - ~TextureCache(); - - GlTexture getTexture(const std::string &texture_path); -}; - - -#endif diff --git a/include/yage/vertex.hpp b/include/yage/vertex.hpp deleted file mode 100644 index d9ab1138..00000000 --- a/include/yage/vertex.hpp +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef VERTEX_HPP -#define VERTEX_HPP - -#include <GL/glew.h> - -struct Position -{ - float x; - float y; -}; - -struct Color -{ - GLubyte r; - GLubyte g; - GLubyte b; - GLubyte a; -}; - -struct UV -{ - float u; - float v; -}; - -struct Vertex -{ - Position position; - Color color; - UV uv; - - void setPosition(float x, float y) - { - position.x = x; - position.y = y; - } - - void setColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a) - { - color.r = r; - color.g = g; - color.b = b; - color.a = a; - } - - void setUv(float u, float v) - { - uv.u = u; - uv.v = v; - } -}; - -#endif diff --git a/include/yage/window.hpp b/include/yage/window.hpp deleted file mode 100644 index 6f3058e9..00000000 --- a/include/yage/window.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef WINDOW_HPP -#define WINDOW_HPP - -#include <SDL2/SDL.h> - -#include <string> - -enum class WindowFlags -{ - SHOWN=0x1, - HIDDEN=0x2, - FULLSCREEN=0x4, - BORDERLESS=0x8, -}; - -class Window -{ -private: - SDL_Window *window_=nullptr; - int width_=1280; - int height_=720; - -public: - Window(); - ~Window(); - - void create(const std::string &window_name, int width, int height, WindowFlags flags=WindowFlags::SHOWN); -}; - -#endif |