-
Notifications
You must be signed in to change notification settings - Fork 1
/
Window.h
60 lines (49 loc) · 1.41 KB
/
Window.h
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
//
// Created by zr on 23-2-16.
//
#ifndef TANK_TROUBLE_WINDOW_H
#define TANK_TROUBLE_WINDOW_H
#include <gtkmm.h>
#include <memory>
#include "view/EntryView.h"
#include "view/LoginView.h"
#include "Controller.h"
namespace TankTrouble
{
class GameView;
class GameLobby;
class Window : public Gtk::Window
{
public:
Window();
~Window() override;
bool on_key_press_event(GdkEventKey* key_event) override;
bool on_key_release_event(GdkEventKey* key_event) override;
void notifyLoginSuccess();
void notifyRoomUpdate();
void notifyGameOn();
void notifyGameOff();
private:
void onUserChooseLocal();
void onUserChooseOnline();
void onUserLogin(const std::string& nickname);
void toEntryView();
void onLoginSuccess();
void onRoomsUpdate();
void onGameBegin();
void onGameOff();
std::unique_ptr<Controller> ctl;
std::unique_ptr<GameView> gameView;
std::unique_ptr<GameLobby> gameLobby;
EntryView entryView;
LoginView loginView;
Glib::Dispatcher loginSuccessNotifier;
Glib::Dispatcher roomUpdateNotifier;
Glib::Dispatcher gameOnNotifier;
Glib::Dispatcher gameOffNotifier;
bool KeyUpPressed, KeyDownPressed,
KeyLeftPressed, KeyRightPressed,
spacePressed;
};
}
#endif //TANK_TROUBLE_WINDOW_H