OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
StartState.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_STARTSTATE_H
20 #define OPENXCOM_STARTSTATE_H
21 
22 #include "../Engine/State.h"
23 #include <sstream>
24 
25 namespace OpenXcom
26 {
27 
28 class Text;
29 class Font;
30 class Timer;
31 class Language;
32 
33 enum LoadingPhase { LOADING_STARTED, LOADING_FAILED, LOADING_SUCCESSFUL, LOADING_DONE };
34 
38 class StartState : public State
39 {
40 private:
41  Text *_text, *_cursor;
42  Font *_font;
43  Timer *_timer;
44  Language *_lang;
45  int _anim;
46 
47  SDL_Thread *_thread;
48  std::wostringstream _output;
49 public:
50  static LoadingPhase loading;
51  static std::string error;
52 
54  StartState(Game *game);
56  ~StartState();
58  void init();
60  void think();
62  void handle(Action *action);
64  void animate();
66  void addLine(const std::wstring &str);
68  static int load(void *game_ptr);
69 };
70 
71 }
72 
73 #endif
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
static int load(void *game_ptr)
Loads the game resources.
Definition: StartState.cpp:302
A game state that receives user input and reacts accordingly.
Definition: State.h:44
Timer used to run code in fixed intervals.
Definition: Timer.h:37
Text string displayed on screen.
Definition: Text.h:41
void animate()
Animates the terminal.
Definition: StartState.cpp:231
void init()
Reset everything.
Definition: StartState.cpp:128
Initializes the game and loads all required content.
Definition: StartState.h:38
Contains strings used throughout the game for localization.
Definition: Language.h:42
Takes care of loading and storing each character in a sprite font.
Definition: Font.h:40
void think()
Displays messages.
Definition: StartState.cpp:154
StartState(Game *game)
Creates the Start state.
Definition: StartState.cpp:56
~StartState()
Cleans up the Start state.
Definition: StartState.cpp:114
The core of the game engine, manages the game's entire contents and structure.
Definition: Game.h:44
void handle(Action *action)
Handles key clicks.
Definition: StartState.cpp:216
void addLine(const std::wstring &str)
Adds a line of text.
Definition: StartState.cpp:287