summary refs log tree commit diff stats
path: root/src/renderer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderer.h')
-rw-r--r--src/renderer.h44
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
6using 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
28struct Texture { 14class 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
34GLFWwindow* initRenderer(); 34GLFWwindow* initRenderer();
35void destroyRenderer(); 35void destroyRenderer();
36Texture* createTexture(int width, int height);
37void destroyTexture(Texture* tex);
38Texture* loadTextureFromFile(char* filename);
39void saveTextureToBMP(Texture* tex, char* filename);
40void fillTexture(Texture* tex, Rectangle* loc, int r, int g, int b);
41void blitTexture(Texture* srctex, Texture* dsttex, Rectangle* srcrect, Rectangle* dstrect);
42void renderWithoutEffects(Texture* tex);
43void renderScreen(Texture* tex);
44 36
45#endif 37#endif