ManaPlus
client.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef PROGS_DYECMD_CLIENT_H
25 #define PROGS_DYECMD_CLIENT_H
26 
27 #include "enums/state.h"
28 
30 
31 #include "localconsts.h"
32 
33 class Button;
34 class Skin;
35 class Window;
36 
37 extern bool isSafeMode;
38 extern int serverVersion;
39 extern unsigned int tmwServerVersion;
40 extern time_t start_time;
41 extern int textures_count;
42 
43 extern std::string errorMessage;
44 
49 class Client final : public ActionListener
50 {
51  public:
52  Client();
53 
55 
56  ~Client() override final;
57 
58  void gameInit();
59 
60  void testsInit();
61 
62  int gameExec();
63 
64  static int testsExec();
65 
66  void setState(const StateT state)
67  { mState = state; }
68 
70  { return mState; }
71 
72  void action(const ActionEvent &event) override final;
73 
74  void moveButtons(const int width);
75 
76  void windowRemoved(const Window *const window);
77 
78  void updatePinState();
79 
80  void focusWindow();
81 
82  void slowLogic();
83 
84  static bool isTmw();
85 
86  private:
87  void stateGame();
88 
89  void initSoundManager();
90 
91  static void initGraphics();
92 
93  static void initPaths();
94 
95  void gameClear();
96 
97  void testsClear();
98 
99  static void logVars();
100 
108 #ifdef ANDROID
109  Button *mCloseButton;
110 #endif // ANDROID
111 
114 
118 };
119 
120 extern Client *client;
121 extern unsigned int mLastHost;
122 extern unsigned long mSearchHash;
123 
124 #endif // PROGS_DYECMD_CLIENT_H
Definition: button.h:102
Definition: client.h:50
static void initPaths()
Definition: client.cpp:850
void setState(const StateT state)
Definition: client.h:66
void action(const ActionEvent &event)
Definition: client.cpp:732
StateT mState
Definition: client.h:112
int mButtonPadding
Definition: client.h:116
void gameInit()
Definition: client.cpp:170
int mButtonSpacing
Definition: client.h:117
Button * mAboutButton
Definition: client.h:105
StateT mOldState
Definition: client.h:113
Button * mPerfomanceButton
Definition: client.h:107
static int testsExec()
Definition: client.cpp:833
void focusWindow()
Definition: client.cpp:809
void windowRemoved(const Window *const window)
Definition: client.cpp:803
void moveButtons(const int width)
Definition: client.cpp:774
static void initGraphics()
Definition: client.cpp:413
void slowLogic()
Definition: client.cpp:829
void updatePinState()
Definition: client.cpp:817
static void logVars()
Definition: client.cpp:821
~Client()
Definition: client.cpp:382
void testsInit()
Definition: client.cpp:161
void stateGame()
Definition: client.cpp:535
Button * mVideoButton
Definition: client.h:103
void initSoundManager()
Definition: client.cpp:390
void gameClear()
Definition: client.cpp:435
Button * mHelpButton
Definition: client.h:104
Button * mSetupButton
Definition: client.h:102
int gameExec()
Definition: client.cpp:577
static bool isTmw()
Definition: client.cpp:838
Client()
Definition: client.cpp:140
Button * mThemesButton
Definition: client.h:106
StateT getState() const
Definition: client.h:69
void testsClear()
Definition: client.cpp:165
Skin * mSkin
Definition: client.h:115
Window * mCurrentDialog
Definition: client.h:101
Definition: skin.h:37
Definition: window.h:102
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define noexcept2
Definition: localconsts.h:50
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
Client * client
Definition: client.cpp:118
int textures_count
Definition: client.cpp:138
unsigned int tmwServerVersion
Definition: client.cpp:134
unsigned int mLastHost
Definition: client.cpp:136
unsigned long mSearchHash
Definition: client.cpp:137
std::string errorMessage
Definition: client.cpp:116
bool isSafeMode
Definition: client.cpp:123
int serverVersion
Definition: client.cpp:124
time_t start_time
Definition: client.cpp:135
State ::T StateT
Definition: state.h:71