Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/terrain.old/src/story_entities/simple_game_menu.cc @ 9168

Last change on this file since 9168 was 8697, checked in by patrick, 18 years ago

merged the terrain with the new trunk (MARK TERRAIN)

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