-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphics.cpp
More file actions
49 lines (35 loc) · 982 Bytes
/
graphics.cpp
File metadata and controls
49 lines (35 loc) · 982 Bytes
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
48
49
#include "graphics.h"
#include "editor.h"
#include <iostream>
const int SCREEN_WIDTH = 1280;
const int SCREEN_HEIGHT = 720;
Graphics::tile default = {};
Graphics::Graphics()
{
SDL_CreateWindowAndRenderer(SCREEN_WIDTH, SCREEN_HEIGHT, 0, &this->_window, &Editor::renderer);
SDL_SetWindowTitle(this->_window, "Tilemap Editor");
SDL_SetRenderDrawColor(Editor::renderer, 255, 255, 255, 255);
_textures.insert(std::pair<std::string, tile>());
}
Graphics::~Graphics()
{
}
/*SDL_Surface* Graphics::loadTexture(std::string &filepath)
{
}*/
void Graphics::blitTexture(SDL_Texture* texture, SDL_Rect* sourceRectangle, SDL_Rect* destinationRectangle)
{
SDL_RenderCopy(Editor::renderer, texture, sourceRectangle, destinationRectangle);
}
SDL_Rect Graphics::getSize(SDL_Texture* texture) {
SDL_Rect size;
SDL_QueryTexture(texture, NULL, NULL, &size.w, &size.h);
return size;
}
void Graphics::flip()
{
SDL_RenderPresent(Editor::renderer);
}
void Graphics::drawTiles()
{
}