diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-10 00:41:59 -0400 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-10 00:41:59 -0400 |
| commit | 7f0e8c7ef70c62814c274f110367db92f01cbb26 (patch) | |
| tree | 750bcfec923a826609034ebe9185014521400c68 /src/renderer.h | |
| parent | b53826079429939cdfbda073608cb85be8ba0738 (diff) | |
| download | therapy-7f0e8c7ef70c62814c274f110367db92f01cbb26.tar.gz therapy-7f0e8c7ef70c62814c274f110367db92f01cbb26.tar.bz2 therapy-7f0e8c7ef70c62814c274f110367db92f01cbb26.zip | |
C++11'd everything!
Also moved location information from physics components into entity.
Diffstat (limited to 'src/renderer.h')
| -rw-r--r-- | src/renderer.h | 44 |
1 files changed, 18 insertions, 26 deletions
| diff --git a/src/renderer.h b/src/renderer.h index a4e21f7..509e935 100644 --- a/src/renderer.h +++ b/src/renderer.h | |||
| @@ -1,9 +1,5 @@ | |||
| 1 | #include <GL/glew.h> | 1 | #include <GL/glew.h> |
| 2 | #include <GLFW/glfw3.h> | 2 | #include <GLFW/glfw3.h> |
| 3 | #include <glm/glm.hpp> | ||
| 4 | #include <glm/gtc/matrix_transform.hpp> | ||
| 5 | |||
| 6 | using namespace glm; | ||
| 7 | 3 | ||
| 8 | #ifndef RENDERER_H | 4 | #ifndef RENDERER_H |
| 9 | #define RENDERER_H | 5 | #define RENDERER_H |
| @@ -13,33 +9,29 @@ struct Rectangle { | |||
| 13 | int y; | 9 | int y; |
| 14 | int w; | 10 | int w; |
| 15 | int h; | 11 | int h; |
| 16 | |||
| 17 | Rectangle() {}; | ||
| 18 | |||
| 19 | Rectangle(int m_x, int m_y, int m_w, int m_h) | ||
| 20 | { | ||
| 21 | x = m_x; | ||
| 22 | y = m_y; | ||
| 23 | w = m_w; | ||
| 24 | h = m_h; | ||
| 25 | } | ||
| 26 | }; | 12 | }; |
| 27 | 13 | ||
| 28 | struct Texture { | 14 | class Texture { |
| 29 | GLuint texID; | 15 | public: |
| 30 | int width; | 16 | Texture(int width, int height); |
| 31 | int height; | 17 | Texture(const char* file); |
| 18 | Texture(Texture& tex); | ||
| 19 | Texture(Texture&& tex); | ||
| 20 | ~Texture(); | ||
| 21 | Texture& operator= (Texture tex); | ||
| 22 | friend void swap(Texture& tex1, Texture& tex2); | ||
| 23 | void fill(Rectangle loc, int r, int g, int b); | ||
| 24 | void blit(Texture& src, Rectangle srcrect, Rectangle dstrect); | ||
| 25 | void renderScreen(); | ||
| 26 | Rectangle entirety(); | ||
| 27 | |||
| 28 | private: | ||
| 29 | GLuint texID; | ||
| 30 | int width; | ||
| 31 | int height; | ||
| 32 | }; | 32 | }; |
| 33 | 33 | ||
| 34 | GLFWwindow* initRenderer(); | 34 | GLFWwindow* initRenderer(); |
| 35 | void destroyRenderer(); | 35 | void destroyRenderer(); |
| 36 | Texture* createTexture(int width, int height); | ||
| 37 | void destroyTexture(Texture* tex); | ||
| 38 | Texture* loadTextureFromFile(char* filename); | ||
| 39 | void saveTextureToBMP(Texture* tex, char* filename); | ||
| 40 | void fillTexture(Texture* tex, Rectangle* loc, int r, int g, int b); | ||
| 41 | void blitTexture(Texture* srctex, Texture* dsttex, Rectangle* srcrect, Rectangle* dstrect); | ||
| 42 | void renderWithoutEffects(Texture* tex); | ||
| 43 | void renderScreen(Texture* tex); | ||
| 44 | 36 | ||
| 45 | #endif | 37 | #endif |
