~vcs-imports/aethyra/client

« back to all changes in this revision

Viewing changes to src/eathena/statemanager.cpp

  • Committer: Tametomo
  • Date: 2010-10-07 21:11:23 UTC
  • Revision ID: git-v1:dd62b9e123b6d7e4b0efb9b634dc1596d81bfea6
Instead of automatically defaulting to OpenGL, start the client in SDL
mode, then allow the user to select whether they want to use SDL or OpenGl.
Issue originally brought up by Srauls.

Also updated Code::Blocks dependencies to match up with a forthcoming
Windows devpack.

TODO: Eventually make restarting the client doable from within the running
instance, instead of relying on the user to do so themselves.

Signed-off-by: Tametomo <irarice@gmail.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
#include "../bindings/guichan/dialogs/confirmdialog.h"
55
55
#include "../bindings/guichan/dialogs/helpdialog.h"
56
56
#include "../bindings/guichan/dialogs/okdialog.h"
 
57
#include "../bindings/guichan/dialogs/selectiondialog.h"
57
58
#include "../bindings/guichan/dialogs/setupdialog.h"
58
59
 
59
60
#include "../bindings/guichan/widgets/desktop.h"
70
71
#include "../core/utils/gettext.h"
71
72
#include "../core/utils/stringutils.h"
72
73
 
 
74
#include "../../config.h"
 
75
 
73
76
LoginData loginData;
74
77
Desktop *desktop = NULL;
75
78
Game *game = NULL;
79
82
ConfirmDialog *exitConfirm = NULL;
80
83
ConfirmDialog *warningDialog = NULL;
81
84
OkDialog *errorDialog = NULL;
 
85
SelectionDialog *selectionDialog = NULL;
82
86
Setup* setupWindow = NULL;
83
87
 
84
88
Palette *guiPalette = NULL;
136
140
    }
137
141
} errorListener;
138
142
 
 
143
class SelectionListener : public gcn::ActionListener
 
144
{
 
145
    void action(const gcn::ActionEvent &event)
 
146
    {
 
147
        selectionDialog = NULL;
 
148
        config.setValue("opengl", event.getId() == "opengl");
 
149
 
 
150
        if (event.getId() == "sdl")
 
151
            stateManager->setState(LOGIN_STATE);
 
152
        else if (event.getId() == "opengl")
 
153
            stateManager->handleWarning(_("Change won't take effect until you "
 
154
                                          "restart the client. Would you like "
 
155
                                          "to quit now?"), QUIT_STATE,
 
156
                                          LOGIN_STATE);
 
157
    }
 
158
} selectionListener;
 
159
 
139
160
StateManager::StateManager() :
140
161
    mState(EXIT_STATE),
141
162
    mCharInfo(MAX_PLAYER_SLOTS),
226
247
 
227
248
            sound.playMusic("Magick - Real.ogg");
228
249
 
229
 
            setState(LOGIN_STATE);
 
250
#ifdef USE_OPENGL
 
251
            if (options.promptForGraphicsMode)
 
252
                setState(MODE_SELECTION_STATE);
 
253
            else
 
254
#endif
 
255
                setState(LOGIN_STATE);
 
256
            break;
 
257
 
 
258
        case MODE_SELECTION_STATE:
 
259
            logger->log("State: MODE_SELECTION");
 
260
 
 
261
            selectionDialog = new SelectionDialog(_("Welcome to Aethyra"),
 
262
                                                  _("You haven't selected a "
 
263
                                                    "graphical mode to use yet. "
 
264
                                                    "Which mode would you like "
 
265
                                                    "to use?"), NULL, false);
 
266
            selectionDialog->addOption("sdl", "SDL");
 
267
            selectionDialog->addOption("opengl", "OpenGL");
 
268
            selectionDialog->addActionListener(&selectionListener);
 
269
            selectionDialog->requestMoveToTop();
230
270
            break;
231
271
 
232
272
        case LOGIN_STATE: