summary refs log tree commit diff stats
path: root/src/renderer.h
blob: 84ad6889e5ef55a8ca4d43cc93b973fd1244b619 (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(const 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, double alpha = 1.0);
    void renderScreen() const;
    Rectangle entirety() const;
    
  private:
    GLuint texID;
    int width;
    int height;
};

GLFWwindow* initRenderer();
void destroyRenderer();

#endif