diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-16 16:04:32 -0500 | 
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-16 16:04:32 -0500 | 
| commit | ed08b673c50b076042d8f0c49501372168142764 (patch) | |
| tree | 18ecda99942ef11ce4023c3ad4437976f96b75da /src/renderer.h | |
| parent | 224645d1071c14b4829dbb3ae35870868fcff85a (diff) | |
| download | therapy-ed08b673c50b076042d8f0c49501372168142764.tar.gz therapy-ed08b673c50b076042d8f0c49501372168142764.tar.bz2 therapy-ed08b673c50b076042d8f0c49501372168142764.zip | |
Refactored renderer
Renderer is basically now more C++'y, as it makes more use of classes (a lot of GL types have been wrapped), and the renderer itself is now a class. The monitor mesh is also now indexed. Tweaked the NTSC artifacting after inadvertently fixing a bug with the way the image was loaded.
Diffstat (limited to 'src/renderer.h')
| -rw-r--r-- | src/renderer.h | 37 | 
1 files changed, 0 insertions, 37 deletions
| diff --git a/src/renderer.h b/src/renderer.h deleted file mode 100644 index 6dccf7a..0000000 --- a/src/renderer.h +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | #include <GL/glew.h> | ||
| 2 | #include <GLFW/glfw3.h> | ||
| 3 | |||
| 4 | #ifndef RENDERER_H | ||
| 5 | #define RENDERER_H | ||
| 6 | |||
| 7 | struct Rectangle { | ||
| 8 | int x; | ||
| 9 | int y; | ||
| 10 | int w; | ||
| 11 | int h; | ||
| 12 | }; | ||
| 13 | |||
| 14 | class Texture { | ||
| 15 | public: | ||
| 16 | Texture(int width, int height); | ||
| 17 | Texture(const char* file); | ||
| 18 | Texture(const 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(const Texture& src, Rectangle srcrect, Rectangle dstrect, double alpha = 1.0); | ||
| 25 | void renderScreen() const; | ||
| 26 | Rectangle entirety() const; | ||
| 27 | |||
| 28 | private: | ||
| 29 | GLuint texID; | ||
| 30 | int width; | ||
| 31 | int height; | ||
| 32 | }; | ||
| 33 | |||
| 34 | GLFWwindow* initRenderer(); | ||
| 35 | void destroyRenderer(); | ||
| 36 | |||
| 37 | #endif | ||
