Repository navigation
Expand file tree
/
Copy pathDirector.h
More file actions
89 lines (72 loc) · 1.61 KB
/
Copy pathDirector.h
File metadata and controls
89 lines (72 loc) · 1.61 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef __Block_Frog__Menu__
#define __Block_Frog__Menu__
#include <iostream>
#include <SFML/Graphics.hpp>
#include "UDPNetwork.h"
class Textor;
class OSHandler;
class Game;
class Controller;
class StartMenu;
class Lobby;
struct Button;
using namespace std;
struct Button {
Button(sf::Vector2i position_, sf::Vector2i size_, string function_)
: position(position_), size(size_), function(function_) {}
sf::Vector2i position;
sf::Vector2i size;
string function;
};
enum State {
START,
LOBBY,
JOIN,
GAME
};
class Director
{
public:
Director(sf::RenderWindow* window, OSHandler* osHandler);
void run();
void update();
Game* getGame() {return game;};
StartMenu* getStartMenu() { return startMenu; }
Lobby* getLobby() { return lobby; }
vector<Button>& getButtons() { return buttons; }
void addButton(Button& button) { buttons.push_back(button); }
void setState(State state_) { state = state_; }
private:
void draw();
Game* game;
Lobby* lobby;
StartMenu* startMenu;
Controller* controller;
Textor* textor;
OSHandler* osHandler;
sf::RenderWindow* window;
sf::Event event;
vector<Button> buttons;
enum Enter {
IP,
PORT
};
enum JoinAs {
SERVER,
CLIENT
};
bool inGame;
bool inLobby;
State state;
Enter joinState;
JoinAs joinAs;
string ipAddress;
string portAddress;
string temp;
friend Controller;
// Server
sf::IpAddress* a;
string in;
unsigned short p;
};
#endif /* defined(__Block_Frog__Menu__) */