-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMapController.hpp
50 lines (43 loc) · 1.26 KB
/
MapController.hpp
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
#pragma once
#include "Map.hpp"
#include <SFML/Graphics.hpp>
class MapView;
class MapController
{
Map * mapHandler; // Pointer to map (to perform actions of mark and reveal)
MapView * viewHandler; // Pointer to view (to perform focus at the tiles)
int mouseCount; // Mouse states. Look below
enum mouseCount {
LPM = 1, // Left mouse pressed
PPM, // Right mouse pressed
LPM_PPM, // Left and right mouse pressed
BLOCKED // Special case after LPM_PPM - both must be released
};
bool mouseDeltaActive;
int mouseDelta;
public:
MapController() { mouseCount = 0; mouseDelta = 20; mouseDeltaActive = false; }
void handleMap(Map * map) // Handle the pointer to map
{
mapHandler = map;
mouseDelta = mapHandler->getMineCount();
}
void handleView(MapView * view) // Handle the pointer to view
{
viewHandler = view;
}
int getNextMineNumber()
{
return mouseDelta;
}
void setMineNumber(int mineNumber)
{
mouseDelta = mineNumber;
}
// Hotkeys
void preceedKeyboard(const sf::Event & event);
// Perform action when mouse button is released base on the mouseCount
void preceedMouse(sf::Vector2i clickPos, const sf::Event & event);
// Set the mouseCount and notify viewHandler to display the focus
void continiousMouse(sf::Vector2i pos);
};