Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/gui/src/story_entities/simple_game_menu.cc @ 7985

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

EVENTS WORK :)

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