-
Notifications
You must be signed in to change notification settings - Fork 1
/
Renderer.h
33 lines (33 loc) · 944 Bytes
/
Renderer.h
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
#ifndef _RENDERER_H
#define _RENDERER_H
#include "Tetromino.h"
#include <GL/glew.h>
#include <SDL2/SDL.h>
#include <array>
#include <vector>
struct Renderer {
SDL_Window *WINDOW = nullptr;
const int32_t WINDOW_WIDTH = 300;
const int32_t WINDOW_HEIGHT = 600;
const int32_t PLAYFIELD_WIDTH = 300;
const int32_t PLAYFIELD_HEIGHT = 600;
int32_t BLOCKSIZE;
GLuint vertex_shader;
GLuint fragment_shader;
GLuint current_vao;
GLuint current_program;
std::vector<GLuint> programs;
std::vector<GLuint> vertex_buffer_objects;
std::vector<GLuint> vertex_array_objects;
std::vector<std::pair<GLuint, size_t>> element_buffer_objects;
void render_tetromino(const Tetromino&);
void update_tetromino(const Tetromino&);
void update_playfield(int32_t);
void delete_row(int32_t);
void render();
void create_program();
std::vector<float> convert_coords_to_vertices(const Tetromino&);
Renderer();
~Renderer();
};
#endif