aboutsummaryrefslogtreecommitdiff
path: root/View.h
blob: 58dc33d9d9f3eeb189bb44182655751c53c9675a (plain)
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
#pragma once

#include <SDL2/SDL.h>
#include <thread>

#include "Color.h"
#include "Rectangle.h"

class ViewController;

class View {
public:
	View(ViewController & vc);
	virtual ~View();

public:
	virtual void set_size(unsigned int width, unsigned int height);
	virtual void draw_rect(Rectangle r, Color c);

private:
	virtual void draw_begin();
	virtual void draw_end();
	virtual void window_init();
	virtual void window_deinit();

public:
	bool open = true;

private:
	ViewController & controller;

private:
	unsigned int width = 0, height = 0;
	SDL_Window * window = nullptr;
	SDL_Renderer * renderer = nullptr;

private:
	std::thread * worker = nullptr;
	void work();
};