-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenderer.h
47 lines (36 loc) · 883 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include "constants.h"
#include <cassert>
struct TileInfo {
TileInfo(std::size_t tile) {
assert(tile < numberOfTiles());
tile_column = tile % tiles_columns;
tile_row = tile / tiles_columns;
c_start = tile_column * TILE_SIZE;
r_start = tile_row * TILE_SIZE;
c_stop = c_start + TILE_SIZE;
r_stop = r_start + TILE_SIZE;
}
static std::size_t numberOfTiles() {
return tiles_rows * tiles_columns;
}
std::size_t tile_column;
std::size_t tile_row;
std::size_t c_start;
std::size_t r_start;
std::size_t c_stop;
std::size_t r_stop;
};
struct Renderer;
class Image;
class DRenderer {
public:
DRenderer();
~DRenderer();
void renderAllTiles();
void renderTile(int tile_id);
Image& getImageRef();
void writeImage();
private:
Renderer* r;
};