28#include <guichan/actionlistener.hpp>
43static const short DEFAULT_PORT = 6901;
45extern volatile int fps;
112class Client final :
public gcn::ActionListener
160 const std::string &message,
190 void action(
const gcn::ActionEvent &event)
override;
242#if defined(_WIN32) || defined(__APPLE__)
248 class ExposeEventWatcher
251 ExposeEventWatcher() { SDL_AddEventWatch(&watch,
nullptr); }
252 ~ExposeEventWatcher() { SDL_DelEventWatch(&watch,
nullptr); }
254 static int watch(
void *, SDL_Event *event)
256 if (event->type == SDL_WINDOWEVENT && event->window.event == SDL_WINDOWEVENT_EXPOSED)
262 ExposeEventWatcher mExposeEventWatcher;
The core part of the client.
State mStateAfterOkDialog
void initConfiguration()
Initialize configuration.
void showErrorDialog(const std::string &message, State state)
Pops up an error dialog with the given message, and switches to the given state when Ok is pressed.
void action(const gcn::ActionEvent &event) override
bool initUpdatesDir()
Parse the update host and determine the updates directory Then verify that the directory exists (crea...
static const std::string & getConfigDirectory()
void accountLogin(LoginData *loginData)
void initHomeDir()
Initializes the home directory.
static bool hasMouseFocus()
std::string mLocalDataDir
static void setState(State state)
static bool hasInputFocus()
SDL_TimerID mSecondsCounterId
static const std::string & getLocalDataDirectory()
static Video & getVideo()
static const std::string & getPackageDirectory()
void showOkDialog(const std::string &title, const std::string &message, State state)
Pops up an OkDialog with the given title and message, and switches to the given state when Ok is pres...
std::string mScreenshotDir
static const std::string & getScreenshotDirectory()
ServerInfo mCurrentServer
static Client * mInstance
void handleWindowSizeChanged(int width, int height)
Should be called after the window has been resized.
static Client * instance()
Provides access to the client instance.
Desktop widget, for drawing a background image and color.
void limitFps(int fpsLimit)
A simple but effective frame rate limiter.
The main class responsible for running the game.
@ STATE_CHANGEPASSWORD_SUCCESS
@ STATE_CHANGEEMAIL_SUCCESS
@ STATE_UNREGISTER_ATTEMPT
@ STATE_ACCOUNTCHANGE_ERROR
@ STATE_UNREGISTER_SUCCESS
@ STATE_CHANGEPASSWORD_ATTEMPT
@ STATE_CHANGEEMAIL_ATTEMPT
@ STATE_WORLD_SELECT_ATTEMPT
bool isDoubleClick(int selected)
Returns whether this call and the last call were done for the same selected index and within a short ...
volatile int fps
Frames counted in the last second.
A structure holding the values of various options that can be passed from the command line.
std::string screenshotDir