aboutsummaryrefslogtreecommitdiff
path: root/ViewController.h
blob: c74c72abcc57c40bca811e9c17002ee0591833f1 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once

#include <utility>

#include "Color.h"
#include "Command.h"
#include "KeyboardCode.h"
#include "MouseCode.h"
#include "Rectangle.h"
#include "XY.h"

class View;
class Museum;
class QuadTreeCollisionChecker;

class ViewController {
public:
	ViewController(Museum & m, View & v);
	virtual ~ViewController();

public:
	void update();
	void ev_keydown(KeyboardCode code);
	void ev_mousedown(MouseCode code);
	void ev_mousemove(unsigned x, unsigned y);

private:
	void update_size();
	void update_tiles();
	void update_artists();
	void update_pathfinding();
	void update_quadtree();
	void update_quadtree_recursive(QuadTreeCollisionChecker * tree);

private:
  void draw_pathfinding_dot(const XY &, const Color &);
  Rectangle center(Rectangle);

private:
	Museum & museum;
	View & view;
	const Command * cmd_base = nullptr;

private:
	bool draw_artists = true;
	bool draw_quadtree = true;
	bool draw_path = true;
	bool draw_visited = true;
	
private:
	float scale = 16;
	float artist_size = scale / 2;
	float pathfinding_size = artist_size;

private:
	XY mouse_pos;
};