1
/***************************************************************************
2
* Copyright (C) 2006 by Frederic MARTIN *
3
* martin-frederic@users.sourceforge.net *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
22
#include "scene_init.h"
23
#include "globalInfos.h"
27
//--------------------------------------------------//
28
//--------------------------------------------------//
29
// ** Chess_Scene ** //
30
//--------------------------------------------------//
31
//--------------------------------------------------//
33
Chess_Scene::Chess_Scene()
38
Chess_Scene::~Chess_Scene()
43
void Chess_Scene::finish_loading()
48
pGlobalInfos->Update();
49
pGlobalInfos->Update();
54
//--------------------------------------------------//
55
//--------------------------------------------------//
56
// ** E_scene_init ** //
57
//--------------------------------------------------//
58
//--------------------------------------------------//
60
E_scene_init::E_scene_init()
66
E_scene_init::~E_scene_init()
72
bool E_scene_init::load()
78
language_selected = pGlobalInfos->LanguageExists();
79
if (!language_selected)
82
pGlobalInfos->GUI_SetEvenListener(this);
83
pGlobalInfos->GUI_setScene(GUI_SCENE_LANGUAGE_SELECTION);
84
language = "english";// default language
91
void E_scene_init::unload()
93
if (already_loaded==false)
101
void E_scene_init::update()
103
if (already_loaded==false)
107
Logger::writeErrorLog("Loading of 'E_scene_init' failed: exiting...");
108
pGlobalInfos->QuitGame();
113
if (language_selected)
115
pGlobalInfos->GUI_init_language(language);
116
pGlobalInfos->GUI_setScene(GUI_SCENE_EMPTY);
118
pGlobalInfos->SetCurrentScene(GAME_SCENE_INTRO);
124
pGlobalInfos->GUI_updateEvents();
125
pGlobalInfos->GUI_render();
134
void E_scene_init::actionPerformed(GUIEvent &evt)
136
const std::string &callbackString = evt.getCallbackString();
137
GUIRectangle *sourceRectangle = evt.getEventSource();
138
int widgetType = sourceRectangle->getWidgetType();
140
if(widgetType == WT_BUTTON)
142
GUIButton *button = (GUIButton*)sourceRectangle;
143
if(button->isClicked())
145
if (callbackString == "okButton")
146
language_selected=true;
149
else if (widgetType == WT_RADIO_BUTTON)
151
GUIRadioButton *button = (GUIRadioButton*)sourceRectangle;
153
if(button->isClicked())
154
language=callbackString;
161
//--------------------------------------------------//
162
//--------------------------------------------------//
163
// ** E_scene_intro ** //
164
//--------------------------------------------------//
165
//--------------------------------------------------//
167
E_scene_intro::E_scene_intro()
172
E_scene_intro::~E_scene_intro()
177
bool E_scene_intro::load()
190
void E_scene_intro::unload()
192
if (already_loaded==false)
197
already_loaded=false;
201
void E_scene_intro::update()
203
if (already_loaded==false)
207
Logger::writeErrorLog("Loading of 'E_scene_intro' failed: exiting...");
208
pGlobalInfos->QuitGame();
214
pGlobalInfos->SetCurrentScene(GAME_SCENE_MAIN_MENU);