summary refs log tree commit diff stats
path: root/src/renderer.h
blob: 377b9eed51116a5066837941f0873f97ce45d11a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <GL/glew.h>
#include <GLFW/glfw3.h>

#ifndef RENDERER_H
#define RENDERER_H

struct Rectangle {
  int x;
  int y;
  int w;
  int h;
};

class Texture {
  public:
    Texture(int width, int height);
    Texture(const char* file);
    Texture(Texture& tex);
    Texture(Texture&& tex);
    ~Texture();
    Texture& operator= (Texture tex);
    friend void swap(Texture& tex1, Texture& tex2);
    void fill(Rectangle loc, int r, int g, int b);
    void blit(const Texture& src, Rectangle srcrect, Rectangle dstrect);
    void renderScreen() const;
    Rectangle entirety() const;
    
  private:
    GLuint texID;
    int width;
    int height;
};

GLFWwindow* initRenderer();
void destroyRenderer();

#endif