Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

gui: introducing a Box

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