diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-09-13 01:08:06 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-09-13 01:08:06 +0000 |
commit | 6a8f1f5914721d1e8b8f9688b1d6ab71c0ed9bce (patch) | |
tree | 1a846219c3fdf6b3a0b2f17f15c4da4fec406845 /src/gui/char_select.cpp | |
parent | 07b3632e605488221f34bff48f298b394af7083a (diff) | |
download | mana-6a8f1f5914721d1e8b8f9688b1d6ab71c0ed9bce.tar.gz mana-6a8f1f5914721d1e8b8f9688b1d6ab71c0ed9bce.tar.bz2 mana-6a8f1f5914721d1e8b8f9688b1d6ab71c0ed9bce.tar.xz mana-6a8f1f5914721d1e8b8f9688b1d6ab71c0ed9bce.zip |
Unified the loops for the various dialogs that are shown before the actual game starts.
Diffstat (limited to 'src/gui/char_select.cpp')
-rw-r--r-- | src/gui/char_select.cpp | 55 |
1 files changed, 11 insertions, 44 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index de01a571..cb85d39c 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -24,13 +24,11 @@ #include "char_select.h" #include <sstream> - -#include <guichan/sdl/sdlinput.hpp> +#include <SDL.h> #include <guichan/widgets/label.hpp> #include "button.h" -#include "gui.h" #include "ok_dialog.h" #include "playerbox.h" #include "textfield.h" @@ -38,7 +36,6 @@ #include "../being.h" #include "../game.h" -#include "../graphics.h" #include "../log.h" #include "../main.h" #include "../playerinfo.h" @@ -46,8 +43,6 @@ #include "../net/network.h" #include "../net/protocol.h" -extern Graphics *graphics; - CharSelectDialog::CharDeleteConfirm::CharDeleteConfirm(CharSelectDialog *m): ConfirmDialog(m, "Confirm", "Are you sure you want to delete this character?"), @@ -272,6 +267,13 @@ void CharSelectDialog::serverCharSelect() // Todo: add other packets } +void CharSelectDialog::logic() +{ + if (n_character > 0) { + setPlayerInfo(char_info); + } +} + CharCreateDialog::CharCreateDialog(Window *parent): Window("Create Character", true, parent) { @@ -447,45 +449,10 @@ void CharCreateDialog::serverCharCreate() } } -void charSelect() +void charSelectInputHandler(SDL_KeyboardEvent *keyEvent) { - CharSelectDialog *sel; - sel = new CharSelectDialog(); - - state = CHAR_SELECT; - - while (/*!key[KEY_ESC] && !key[KEY_ENTER] &&*/ state == CHAR_SELECT) + if (keyEvent->keysym.sym == SDLK_ESCAPE) { - // Handle SDL events - SDL_Event event; - while (SDL_PollEvent(&event)) { - switch (event.type) { - case SDL_QUIT: - state = EXIT; - break; - - case SDL_KEYDOWN: - if (event.key.keysym.sym == SDLK_ESCAPE) - { - state = EXIT; - } - break; - } - - guiInput->pushInput(event); - } - - if (n_character > 0) { - sel->setPlayerInfo(char_info); - } - - gui->logic(); - - graphics->drawImage(login_wallpaper, 0, 0); - gui->draw(); - graphics->updateScreen(); + state = EXIT; } - - delete sel; } - |