]> git.localhorst.tv Git - blank.git/blob - src/client/MasterState.hpp
reorganized client state
[blank.git] / src / client / MasterState.hpp
1 #ifndef BLANK_CLIENT_CLIENTSTATE_HPP_
2 #define BLANK_CLIENT_CLIENTSTATE_HPP_
3
4 #include "InitialState.hpp"
5 #include "InteractiveState.hpp"
6 #include "../app/State.hpp"
7 #include "../net/Client.hpp"
8 #include "../net/PacketHandler.hpp"
9
10 #include <memory>
11
12
13 namespace blank {
14
15 class Environment;
16
17 namespace client {
18
19 class InteractiveState;
20
21 class MasterState
22 : public State
23 , public PacketHandler {
24
25 public:
26         MasterState(
27                 Environment &,
28                 const World::Config &,
29                 const Interface::Config &,
30                 const Client::Config &
31         );
32
33         Client &GetClient() noexcept { return client; }
34         Environment &GetEnv() noexcept { return env; }
35
36         World::Config &GetWorldConf() noexcept { return world_conf; }
37         const World::Config &GetWorldConf() const noexcept { return world_conf; }
38         const Interface::Config &GetInterfaceConf() const noexcept { return intf_conf; }
39         const Client::Config &GetClientConf() const noexcept { return client_conf; }
40
41         void Quit();
42
43         void OnEnter() override;
44
45         void Handle(const SDL_Event &) override;
46         void Update(int dt) override;
47         void Render(Viewport &) override;
48
49         void On(const Packet::Join &) override;
50         void On(const Packet::Part &) override;
51
52 private:
53         Environment &env;
54         World::Config world_conf;
55         const Interface::Config &intf_conf;
56         const Client::Config &client_conf;
57         std::unique_ptr<InteractiveState> state;
58         Client client;
59
60         InitialState init_state;
61
62 };
63
64 }
65 }
66
67 #endif