Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/terrain.older/src/story_entities/simple_game_menu.cc @ 10769

Last change on this file since 10769 was 9140, checked in by bensch, 18 years ago

merged back

File size: 20.4 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program 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 2, or (at your option)
9   any later version.
10
11### File Specific:
12   main-programmer: Patrick Boenzli
13
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
17
18
19#include "simple_game_menu.h"
20
21#include "event_handler.h"
22
23#include "state.h"
24#include "class_list.h"
25
26#include "util/loading/load_param.h"
27#include "fast_factory.h"
28#include "util/loading/factory.h"
29#include "loading/resource_manager.h"
30
31#include "world_entity.h"
32#include "elements/image_entity.h"
33#include "terrain_entity.h"
34#include "camera.h"
35
36#include "graphics_engine.h"
37#include "object_manager.h"
38#include "sound_engine.h"
39#include "sound_source.h"
40
41#include "cd_engine.h"
42
43#include "glgui.h"
44#include "gui/gl/specials/glgui_notifier.h"
45
46//! This creates a Factory to fabricate a SimpleGameMenu
47CREATE_FACTORY(SimpleGameMenu, CL_SIMPLE_GAME_MENU);
48
49
50
51SimpleGameMenu::SimpleGameMenu(const TiXmlElement* root)
52    : GameWorld()
53{
54  this->setClassID(CL_SIMPLE_GAME_MENU, "SimpleGameMenu");
55  this->setName("SimpleGameMenu uninitialized");
56
57  this->dataTank = new SimpleGameMenuData();
58
59  this->cameraVector = Vector(50.0, 0.0, 0.0);
60  this->menuLayers.push_back(MenuLayer());
61  this->menuLayers.push_back(MenuLayer());
62
63  this->layerIndex = 0;
64  this->menuSelectedIndex = 0;
65  this->selectorSource = NULL;
66
67
68  /// GUI
69  ///(this is as modular as it is possible).
70  OrxGui::GLGuiPushButton* pb = new OrxGui::GLGuiPushButton("PUSH ME");
71  //pb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::enterGui));
72  pb->connect(SIGNAL(pb, released), this, SLOT(SimpleGameMenu, enterGui));
73  pb->show();
74  pb->setAbsCoor2D(50, 50);
75
76  OrxGui::GLGuiHandler::getInstance()->activateCursor();
77  OrxGui::GLGuiHandler::getInstance()->activate();
78  OrxGui::GLGuiHandler::getInstance()->cursor()->loadTextureSequence(ResourceManager::getInstance()->getDataDir() + "/" + "maps/reap_mouse/reap_mouse_##.png", 1, 49);
79  /////
80
81  if (root != NULL)
82    this->loadParams(root);
83
84  State::setMenuID(this->getNextStoryID());
85}
86
87/// HACK only for testing.
88void SimpleGameMenu::enterGui()
89{
90
91  OrxGui::GLGuiNotifier* notifier = new OrxGui::GLGuiNotifier();
92  notifier->show();
93  notifier->setAbsCoor2D(300, 300);
94
95
96
97  OrxGui::GLGuiBox* box = new OrxGui::GLGuiBox();
98  {
99    ///
100    OrxGui::GLGuiButton* dnpb = new OrxGui::GLGuiCheckButton("Push the button");
101
102    box->pack(dnpb);
103
104    OrxGui::GLGuiPushButton* rdnpb = new OrxGui::GLGuiPushButton("Quit ORXONOX!!");
105    rdnpb->connect(SIGNAL(rdnpb, released), this, SLOT(SimpleGameMenu, quitMenu));
106
107    box->pack(rdnpb);
108
109    OrxGui::GLGuiCheckButton* fullscreen = new OrxGui::GLGuiCheckButton("Fullscreen");
110    fullscreen->connect(SIGNAL(fullscreen, toggled), GraphicsEngine::getInstance(), SLOT(GraphicsEngine, setFullscreen));
111
112    box->pack(fullscreen);
113
114    OrxGui::GLGuiInputLine* input = new OrxGui::GLGuiInputLine();
115    input->setText("input some text here");
116    input->connect(SIGNAL(input, textChanged), notifier, SLOT(OrxGui::GLGuiNotifier, pushNotifyMessage));
117
118    box->pack(input);
119
120    OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider();
121    slider->connect(SIGNAL(slider, valueChanged), this, SLOT(SimpleGameMenu, TEST));
122    slider->setRange(0, 1);
123    slider->setValue(slider->min());
124    box->pack(slider);
125
126
127    OrxGui::GLGuiTable* table = new OrxGui::GLGuiTable(3, 3);
128    std::vector<std::string> headers;
129    headers.push_back("1");
130    headers.push_back("2");
131    headers.push_back("3");
132    table->setHeader(headers);
133    table->setEntry(1, 2, "Test");
134    table->setEntry(2, 1, "MultiLine SuperTest to see how it works");
135
136
137    box->pack(table);
138  }
139  box->setAbsCoor2D(50, 200);
140
141  box->showAll();
142
143
144  OrxGui::GLGuiBox* imageSelector = new OrxGui::GLGuiBox();
145  {
146    image = new OrxGui::GLGuiImage();
147    image->setWidgetSize(300, 300);
148    image->setAbsCoor2D(300, 300);
149    imageSelector->pack(image);
150
151    imageName = new OrxGui::GLGuiInputLine();
152    imageSelector->pack(imageName);
153
154    OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider();
155    slider->setWidgetSize(200, 30);
156    slider->setRange(0, 100);
157    slider->setStep(1);
158    slider->setValue(slider->min());
159    slider->connect(SIGNAL(slider, valueChanged), this, SLOT(SimpleGameMenu, setImage));
160
161    imageSelector->pack(slider);
162    slider->setValue(0);
163  }
164  imageSelector->showAll();
165  imageSelector->setAbsCoor2D(400, 30);
166
167
168  /////
169}
170
171
172#include "class_list.h"
173void SimpleGameMenu::setImage(int i)
174{
175  const std::list<BaseObject*>* textures = ClassList::getList(CL_TEXTURE);
176
177  if(textures)
178  {
179    std::list<BaseObject*>::const_iterator test = textures->begin();
180    std::list<BaseObject*>::const_iterator lastOK = textures->begin();
181    while (true)
182    {
183      if (--i == 0 || test == textures->end())
184        break;
185      if (dynamic_cast<Texture*>(*test)->getTexture() != 0)
186        lastOK = test;
187      test++;
188    }
189    this->image->loadImageFromTexture(*dynamic_cast<Texture*>(*lastOK));
190    this->imageName->setText((*lastOK)->getName());
191  }
192}
193
194
195#include "threading.h"
196void SimpleGameMenu::execURL() const
197{
198  std::string URL = "http://www.orxonox.net";
199  SDL_CreateThread(startURL, (void*)&URL);
200}
201
202#ifdef __OSX__
203#include <ApplicationServices/ApplicationServices.h>
204#elif defined __WIN32__
205//#include <shellapi.h>
206#endif
207
208int SimpleGameMenu::startURL(void* url)
209{
210  std::string URL = *(std::string*)url;
211#ifdef __linux__
212  system ((std::string("firefox ") + URL).c_str());
213#elif defined __OSX__
214  CFURLRef url_handle = CFURLCreateWithBytes (NULL, (UInt8 *)URL.c_str(), URL.size(),
215                        kCFStringEncodingASCII, NULL);
216  LSOpenCFURLRef (url_handle, NULL);
217  CFRelease (url_handle);
218#elif defined __WIN32__
219  /*  ShellExecute(GetActiveWindow(),
220               "open", URL.c_str(), NULL, NULL, SW_SHOWNORMAL);
221               }*/
222#endif
223  PRINTF(3)("loaded external webpage %s\n", URL.c_str());
224}
225
226/**
227*  @brief remove the SimpleGameMenu from memory
228*
229*  delete everything explicitly, that isn't contained in the parenting tree!
230*  things contained in the tree are deleted automaticaly
231*/
232SimpleGameMenu::~SimpleGameMenu ()
233{
234  PRINTF(3)("SimpleGameMenu::~SimpleGameMenu() - deleting current world\n");
235
236  if( this->dataTank)
237    delete this->dataTank;
238  delete OrxGui::GLGuiHandler::getInstance( );
239}
240
241
242/**
243* @brief loads the parameters of a SimpleGameMenu from an XML-element
244* @param root the XML-element to load from
245*/
246void SimpleGameMenu::loadParams(const TiXmlElement* root)
247{
248  /* skip the GameWorld, since it does not define any useful loadParams for this class */
249  //static_cast<GameWorld*>(this)->loadParams(root);
250  GameWorld::loadParams(root);
251
252  PRINTF(4)("Loaded SimpleGameMenu specific stuff\n");
253}
254
255
256/**
257* @brief this is executed just before load
258*
259* since the load function sometimes needs data, that has been initialized
260* before the load and after the proceeding storyentity has finished
261*/
262ErrorMessage SimpleGameMenu::init()
263{
264  /* call underlying init funciton */
265  GameWorld::init();
266
267  this->subscribeEvent(ES_MENU, SDLK_UP);
268  this->subscribeEvent(ES_MENU, SDLK_DOWN);
269  this->subscribeEvent(ES_MENU, SDLK_RETURN);
270  this->subscribeEvent(ES_MENU, SDLK_SPACE);
271  this->subscribeEvent(ES_MENU, SDLK_ESCAPE);
272
273  this->dataTank->localCamera->setRelCoor(this->cameraVector);
274
275  GraphicsEngine::getInstance()->displayFPS(false);
276
277  this->layerIndex = 0;
278  this->menuSelectedIndex = 0;
279}
280
281
282/**
283* @brief load the data
284*/
285ErrorMessage SimpleGameMenu::loadData()
286{
287  GameWorld::loadData();
288
289  if (this->dataXML != NULL)
290  {
291    LoadParam(dataXML, "selector-sound", this, SimpleGameMenu, setSelectorSound);
292
293    TiXmlElement* element = this->dataXML->FirstChildElement("Elements");
294
295
296    if( element == NULL)
297    {
298      PRINTF(1)("SimpleGameMenu is missing 'Elements'\n");
299    }
300    else
301    {
302      element = element->FirstChildElement();
303      // load Players/Objects/Whatever
304      PRINTF(4)("Loading Elements\n");
305      while( element != NULL)
306      {
307        BaseObject* created = Factory::fabricate(element);
308        if( created != NULL )
309        {
310          PRINTF(4)("Created a %s::%s\n", created->getClassName(), created->getName());
311          if (!created->isA(CL_ELEMENT_2D))
312            PRINTF(2)("Error the Created Entity is not an Element2D but an %s::%s\n", created->getClassName(), created->getName());
313        }
314        element = element->NextSiblingElement();
315      }
316      PRINTF(4)("Done loading Elements\n");
317    }
318  }
319
320  /* get the menu list */
321  const std::list<BaseObject*>* imageEntityList = ClassList::getList(CL_IMAGE_ENTITY);
322  std::list<BaseObject*>::const_iterator entity;
323  for (entity = imageEntityList->begin(); entity != imageEntityList->end(); entity++)
324  {
325
326    if( !strcmp("Selector_Menu", (*entity)->getName()))
327    {
328      this->menuSelector = dynamic_cast<ImageEntity*>(*entity);
329      this->menuSelector->setBindNode((const PNode*)NULL);
330    }
331  }
332
333  imageEntityList = ClassList::getList(CL_TEXT_ELEMENT);
334  for (entity = imageEntityList->begin(); entity != imageEntityList->end(); entity++)
335  {
336    if( !strcmp( "StartGame_Menu", (*entity)->getName()))
337    {
338      this->menuStartGame = dynamic_cast<TextElement*>(*entity);
339      this->menuStartGame->setBindNode((const PNode*)NULL);
340      this->menuStartGame->setRelCoor2D(State::getResX() / 2.0f,
341                                        State::getResY() / 2.0f - 60.0f);
342      this->menuLayers[0].menuList.push_back(dynamic_cast<TextElement*>(*entity));
343
344    }
345    else if( !strcmp( "Multiplayer_Menu", (*entity)->getName()))
346    {
347      this->menuStartMultiplayerGame = dynamic_cast<TextElement*>(*entity);
348      this->menuStartMultiplayerGame->setBindNode((const PNode*)NULL);
349      this->menuStartMultiplayerGame->setRelCoor2D(State::getResX() / 2.0f,
350          State::getResY() / 2.0f + ((this->menuLayers[0].menuList.size() -1 ) * 60.0f));
351      this->menuLayers[0].menuList.push_back(dynamic_cast<TextElement*>(*entity));
352    }
353    else if( !strcmp( "Quit_Menu", (*entity)->getName()))
354    {
355      this->menuQuitGame = dynamic_cast<TextElement*>(*entity);
356      this->menuQuitGame->setBindNode((const PNode*)NULL);
357      this->menuQuitGame->setRelCoor2D(State::getResX() / 2.0f,
358                                       State::getResY() / 2.0f + ((this->menuLayers[0].menuList.size() -1 )* 60.0f));
359      this->menuLayers[0].menuList.push_back(dynamic_cast<TextElement*>(*entity));
360    }
361  }
362  this->menuSelected->getNullElement()->update2D(0.1f);
363  this->menuSelectedIndex = 0;
364  this->menuSelected = this->menuLayers[0].menuList[this->menuSelectedIndex];
365  this->sliderTo(this->menuSelected, 0.0f);
366
367
368  // loading the storyentities submenu (singleplayer)
369  const std::list<BaseObject*>* storyEntities = ClassList::getList(CL_STORY_ENTITY);
370  std::list<BaseObject*>::const_iterator it;
371  for( it = storyEntities->begin(); it != storyEntities->end(); it++)
372  {
373    StoryEntity* se = dynamic_cast<StoryEntity*>(*it);
374    if( se->isContainedInMenu())
375    {
376      this->menuLayers[1].storyList.push_back(se);
377
378      // generating menu item
379      TextElement* te = new TextElement();
380      te->setVisibility(false);
381      te->setText(se->getName());
382      te->setRelCoor2D(State::getResX() / 2.0f - 200.0f, State::getResY() / 2.0f + ((this->menuLayers[1].menuList.size() - 2.0f) * 60.0f));
383      this->menuLayers[1].menuList.push_back(te);
384
385      // generating screenshoot item
386      ImageEntity* ie = new ImageEntity();
387      ie->setVisibility(false);
388      ie->setBindNode((const PNode*)NULL);
389      ie->setTexture(se->getMenuScreenshoot());
390      ie->setRelCoor2D(State::getResX() / 2.0f + 250.0f, State::getResY() / 2.0f);
391      ie->setSize2D(140.0f, 105.0f);
392      this->menuLayers[1].screenshootList.push_back(ie);
393    }
394  }
395}
396
397/**
398* @brief set the Sound to play when switching menu entry.
399* @param selectorSound the sound to load.
400*/
401void SimpleGameMenu::setSelectorSound(const std::string& selectorSound)
402{
403  this->selectorSource = OrxSound::SoundEngine::getInstance()->createSource(selectorSound, NULL);
404}
405
406ErrorMessage SimpleGameMenu::unloadData()
407{
408  this->unsubscribeEvents(ES_MENU);
409
410  std::vector<MenuLayer>::iterator mit;
411  for(mit = this->menuLayers.begin(); mit != this->menuLayers.end(); mit++)
412  {
413    while(!(*mit).menuList.empty())
414    {
415      delete (*mit).menuList.back();
416      (*mit).menuList.pop_back();
417    }
418
419    (*mit).menuList.clear();
420    (*mit).storyList.clear();
421    (*mit).screenshootList.clear();
422  }
423
424  // delete the SoundSource.
425  if (this->selectorSource != NULL)
426    delete this->selectorSource;
427  this->selectorSource = NULL;
428
429  GameWorld::unloadData();
430}
431
432
433/**
434* @brief start the menu
435*/
436bool SimpleGameMenu::start()
437{
438  EventHandler::getInstance()->pushState(ES_MENU);
439
440  /* now call the underlying*/
441  GameWorld::start();
442}
443
444
445
446/**
447* stop the menu
448*/
449bool SimpleGameMenu::stop()
450{
451  EventHandler::getInstance()->popState();
452
453  /* now call the underlying*/
454  GameWorld::stop();
455}
456
457
458/**
459*  override the standard tick for more functionality
460*/
461void SimpleGameMenu::tick()
462{
463  GameWorld::tick();
464
465  // Make the GLGui tick.
466  OrxGui::GLGuiHandler::getInstance()->tick(this->dtS);
467
468  this->animateScene(this->dtS);
469}
470
471
472/**
473* @brief no collision detection in the menu
474*/
475void SimpleGameMenu::collide()
476{
477  //   this->dataTank->localCamera->
478}
479
480
481/**
482* @brief animate the scene
483*/
484void SimpleGameMenu::animateScene(float dt)
485{
486  Quaternion q(/*0.00005*/ dt * .1, Vector(0.0, 1.0, 0.0));
487  this->cameraVector = q.apply(this->cameraVector);
488  this->dataTank->localCamera->setRelCoor(this->cameraVector);
489  this->dataTank->localCamera->getTarget()->setRelCoorSoft(0,0,0);
490}
491
492void SimpleGameMenu::quitMenu()
493{
494  this->setNextStoryID(WORLD_ID_GAMEEND);
495  this->stop();
496}
497
498
499/**
500* @brief event dispatcher funciton
501* @param event the incoming event
502*/
503void SimpleGameMenu::process(const Event &event)
504{
505  /* ----------------- LAYER 1 ---------------*/
506  if( this->layerIndex == 0)
507  {
508    if( event.type == SDLK_RETURN && event.bPressed == true)
509    {
510      if( this->menuSelected == this->menuQuitGame)
511      {
512        this->setNextStoryID(WORLD_ID_GAMEEND);
513        this->stop();
514      }
515      if( this->menuSelected == this->menuStartGame)
516      {
517        // switch to first submenu
518        if( this->menuLayers[1].menuList.size() == 0)
519        {
520          PRINTF(1)("Haven't got any StoryEntities to play!\n");
521          return;
522        }
523
524        this->switchMenuLayer(this->layerIndex, 1);
525      }
526    }
527    if( event.type == SDLK_ESCAPE && event.bPressed == true)
528    {
529      this->setNextStoryID(WORLD_ID_GAMEEND);
530      this->stop();
531    }
532  }  /* ----------------- LAYER 2 ---------------*/
533  else if( this->layerIndex == 1)
534  {
535    if( event.type == SDLK_RETURN && event.bPressed == true)
536    {
537      this->setNextStoryID( this->menuLayers[1].storyList[this->menuSelectedIndex]->getStoryID());
538      this->stop();
539    }
540    if( event.type == SDLK_ESCAPE && event.bPressed == true)
541    {
542      this->switchMenuLayer(this->layerIndex, 0);
543    }
544  }
545
546
547
548  // The menu selction cursor
549  if( event.type == SDLK_DOWN && event.bPressed == true)
550  {
551    if(this->menuSelectedIndex < (this->menuLayers[this->layerIndex].menuList.size() - 1))
552    {
553      this->menuSelected = this->menuLayers[this->layerIndex].menuList[++this->menuSelectedIndex];
554      this->sliderTo(this->menuSelected, 5.0f);
555      if (this->selectorSource != NULL)
556        this->selectorSource->play();
557
558      if( this->layerIndex == 1)
559      {
560        this->menuLayers[1].screenshootList[this->menuSelectedIndex]->setVisibility(true);
561        this->menuLayers[1].screenshootList[this->menuSelectedIndex-1]->setVisibility(false);
562      }
563    }
564  }
565  else if( event.type == SDLK_UP && event.bPressed == true)
566  {
567    if(this->menuSelectedIndex > 0)
568    {
569      this->menuSelected = this->menuLayers[this->layerIndex].menuList[--this->menuSelectedIndex];
570      this->sliderTo(this->menuSelected, 5.0f);
571      if (this->selectorSource != NULL)
572        this->selectorSource->play();
573
574      if( this->layerIndex == 1)
575      {
576        this->menuLayers[1].screenshootList[this->menuSelectedIndex]->setVisibility(true);
577        this->menuLayers[1].screenshootList[this->menuSelectedIndex+1]->setVisibility(false);
578      }
579    }
580  }
581}
582
583
584/**
585* @brief switches to from one meny layer to an other
586* @param layer1 from layer
587* @param layer2 to layer
588*/
589void SimpleGameMenu::switchMenuLayer(int layer1, int layer2)
590{
591  // wrong sizes
592  if(layer1 >= this->menuLayers.size() || layer2 >= this->menuLayers.size())
593    return;
594
595
596  PRINTF(0)("Removing layer %i\n", layer1);
597  std::vector<TextElement*>::iterator te;
598  // fade old menu
599  for( te = this->menuLayers[layer1].menuList.begin(); te != this->menuLayers[layer1].menuList.end(); te++)
600  {
601    (*te)->setVisibility(false);
602  }
603
604  std::vector<ImageEntity*>::iterator it;
605
606  //also fade the screenshots if in level choosement mode
607  for( it = this->menuLayers[layer1].screenshootList.begin(); it != this->menuLayers[layer1].screenshootList.end(); it++)
608  {
609    (*it)->setVisibility(false);
610  }
611
612
613  PRINTF(0)("Showing layer %i\n", layer1);
614  // beam here the new menu
615  for( te = this->menuLayers[layer2].menuList.begin(); te != this->menuLayers[layer2].menuList.end(); te++ )
616  {
617    (*te)->setVisibility(true);
618  }
619
620
621  this->layerIndex = layer2;
622  this->menuSelected = this->menuLayers[layer2].menuList[0];
623  this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D() + Vector2D(0, this->menuSelected->getSizeY2D() *.5));
624  this->menuSelector->setSize2D(this->menuSelected->getSizeX2D()*.7, this->menuSelected->getSizeY2D());
625  this->menuSelectedIndex = 0;
626
627  if( layer2 == 1)
628    this->menuLayers[layer2].screenshootList[0]->setVisibility(true);
629}
630
631void SimpleGameMenu::sliderTo(const Element2D* element, float bias)
632{
633  if (bias > 0.0)
634  {
635    this->menuSelector->setAbsCoorSoft2D(element->getAbsCoor2D() + Vector2D(0, element->getSizeY2D() *.5), bias);
636    this->menuSelector->setSizeSoft2D(element->getSizeX2D()*.7, element->getSizeY2D(), bias);
637  }
638  else
639  {
640    this->menuSelector->setAbsCoor2D(element->getAbsCoor2D() + Vector2D(0, element->getSizeY2D() *.5));
641    this->menuSelector->setSize2D(element->getSizeX2D()*.7, element->getSizeY2D());
642  }
643}
644
645
646
647/**********************************************************************************************
648SimpleGameMenuData
649**********************************************************************************************/
650
651
652/**
653* SimpleGameMenuData constructor
654*/
655SimpleGameMenuData::SimpleGameMenuData()
656{}
657
658/**
659* SimpleGameMenuData decontructor
660*/
661SimpleGameMenuData::~SimpleGameMenuData()
662{}
663
664
665/**
666*  initialize the GameWorldDataData
667*/
668ErrorMessage SimpleGameMenuData::init()
669{
670  /* call underlying function */
671  GameWorldData::init();
672}
673
674
675/**
676*  loads the GUI data
677* @param root reference to the xml root element
678*/
679ErrorMessage SimpleGameMenuData::loadGUI(const TiXmlElement* root)
680{
681  /* call underlying function */
682  GameWorldData::loadGUI(root);
683}
684
685
686/**
687*  unloads the GUI data
688*/
689ErrorMessage SimpleGameMenuData::unloadGUI()
690{
691  /* call underlying function */
692  GameWorldData::unloadGUI();
693}
694
695
696/**
697*  overloads the GameWorld::loadWorldEntities(...) class since the menu WorldEntity loading is different (less loading stuff)
698* @param root reference to the xml root parameter
699*/
700ErrorMessage SimpleGameMenuData::loadWorldEntities(const TiXmlElement* root)
701{
702  GameWorldData::loadWorldEntities(root);
703  /*
704  const TiXmlElement* element = root->FirstChildElement("WorldEntities");
705
706  if( element != NULL)
707  {
708  element = element->FirstChildElement();
709  PRINTF(4)("Loading WorldEntities\n");
710  while(element != NULL)
711  {
712  BaseObject* created = Factory::fabricate(element);
713  if( created != NULL )
714  printf("Created a %s: %s\n", created->getClassName(), created->getName());
715
716  if( element->Value() == "SkyBox")
717  this->sky = dynamic_cast<WorldEntity*>(created);
718  if( element->Value() == "Terrain")
719  this->terrain = dynamic_cast<Terrain*>(created);
720  element = element->NextSiblingElement();
721  }
722
723  PRINTF(4)("Done loading WorldEntities\n");
724  }
725
726  // init the pnode tree
727  PNode::getNullParent()->init();
728  */
729}
730
731
732/**
733*  unloads the world entities from the xml file
734*/
735ErrorMessage SimpleGameMenuData::unloadWorldEntities()
736{
737  /* call underlying function */
738  GameWorldData::unloadWorldEntities();
739}
740
741
742/**
743*  loads the scene data
744* @param root reference to the xml root element
745*/
746ErrorMessage SimpleGameMenuData::loadScene(const TiXmlElement* root)
747{
748  /* call underlying function */
749  GameWorldData::loadScene(root);
750}
751
752
753/**
754*  unloads the scene data
755*/
756ErrorMessage SimpleGameMenuData::unloadScene()
757{
758  /* call underlying function */
759  GameWorldData::unloadScene();
760}
761
762
763
Note: See TracBrowser for help on using the repository browser.