Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8677 in orxonox.OLD for branches/gui/src/story_entities/game_menu.cc


Ignore:
Timestamp:
Jun 21, 2006, 4:49:06 PM (18 years ago)
Author:
bensch
Message:

new gui implementing work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/story_entities/game_menu.cc

    r8674 r8677  
    6868
    6969  State::setMenuID(this->getNextStoryID());
    70 }
    71 
    72 /// HACK only for testing.
    73 void GameMenu::enterGui()
    74 {
    7570}
    7671
     
    126121  GraphicsEngine::getInstance()->displayFPS(false);
    127122
     123  return ErrorMessage();
    128124}
    129125
     
    134130ErrorMessage GameMenu::loadData()
    135131{
    136   this->mainMenuBox = new OrxGui::GLGuiBox();
     132  this->mainMenuBox = NULL;
     133
     134  this->levelsBox = NULL;
     135  this->networkBox = NULL;
     136
     137  this->optionsBox = NULL;
     138  this->audioBox = NULL;
     139  this->videoBox = NULL;
     140  this->controlBox = NULL;
     141  this->levelsBox = NULL;
     142
     143  return GameWorld::loadData();
     144}
     145
     146
     147void GameMenu::showMainMenu()
     148{
     149  if (mainMenuBox == NULL)
    137150  {
    138     OrxGui::GLGuiButton* startButton = new OrxGui::GLGuiPushButton("Play");
    139     this->mainMenuBox->pack(startButton);
    140 
    141 
    142     OrxGui::GLGuiButton* quitButton = new OrxGui::GLGuiPushButton("Quit");
    143     this->mainMenuBox->pack(quitButton);
    144     quitButton->connect(SIGNAL(quitButton, released), this, SLOT(GameMenu, quitMenu));
    145 
    146 
     151    this->mainMenuBox = new OrxGui::GLGuiBox();
     152    {
     153      OrxGui::GLGuiButton* startButton = new OrxGui::GLGuiPushButton("Play");
     154      startButton->connect(SIGNAL(startButton, released), this, SLOT(GameMenu, showCampaigns));
     155      this->mainMenuBox->pack(startButton);
     156
     157      OrxGui::GLGuiButton* networkButton = new OrxGui::GLGuiPushButton("MultiPlayer");
     158      networkButton->connect(SIGNAL(networkButton, released), this, SLOT(GameMenu, showMultiPlayer));
     159      this->mainMenuBox->pack(networkButton);
     160
     161      OrxGui::GLGuiButton* optionsButton = new OrxGui::GLGuiPushButton("Options");
     162      optionsButton->connect(SIGNAL(optionsButton, released), this, SLOT(GameMenu, showOptionsMenu));
     163      this->mainMenuBox->pack(optionsButton);
     164
     165
     166      OrxGui::GLGuiButton* quitButton = new OrxGui::GLGuiPushButton("Quit");
     167      this->mainMenuBox->pack(quitButton);
     168      quitButton->connect(SIGNAL(quitButton, released), this, SLOT(GameMenu, quitMenu));
     169    }
    147170  }
    148 
    149 
    150   GameWorld::loadData();
    151 }
     171  this->mainMenuBox->showAll();
     172
     173  this->mainMenuBox->setRelCoor2D(200, 100);
     174}
     175
     176void GameMenu::showCampaigns()
     177{
     178
     179  if (this->levelsBox == NULL)
     180  {
     181    this->levelsBox = new OrxGui::GLGuiBox();
     182    {
     183      const std::list<BaseObject*>* storyEntities = ClassList::getList(CL_STORY_ENTITY);
     184      std::list<BaseObject*>::const_iterator it;
     185      for( it = storyEntities->begin(); it != storyEntities->end(); it++)
     186      {
     187        StoryEntity* se = dynamic_cast<StoryEntity*>(*it);
     188        if( se->isContainedInMenu())
     189        {
     190          OrxGui::GLGuiWidget* button = new OrxGui::GLGuiPushButton(se->getName());
     191          levelsBox->pack(button);
     192
     193          // generating screenshoot item
     194          /*
     195          ImageEntity* ie = new ImageEntity();
     196          ie->setVisibility(false);
     197          ie->setBindNode((const PNode*)NULL);
     198          ie->setTexture(se->getMenuScreenshoot());
     199          ie->setRelCoor2D(State::getResX() / 2.0f + 250.0f, State::getResY() / 2.0f);
     200          ie->setSize2D(140.0f, 105.0f);
     201          this->menuLayers[1].screenshootList.push_back(ie);
     202          */
     203        }
     204      }
     205    }
     206  }
     207
     208  this->levelsBox->showAll();
     209  this->levelsBox->setRelCoor2D(200, 100);
     210  this->mainMenuBox->setRelCoorSoft2D(50, 100, 5);
     211
     212}
     213
     214void GameMenu::showMultiPlayer()
     215{
     216
     217}
     218
     219void GameMenu::showOptionsMenu()
     220{
     221  if (this->optionsBox == NULL)
     222  {
     223    this->optionsBox = new OrxGui::GLGuiBox();
     224    {
     225      OrxGui::GLGuiButton* generalButton = new OrxGui::GLGuiPushButton("General");
     226      optionsBox->pack(generalButton);
     227
     228      OrxGui::GLGuiButton* audioButton = new OrxGui::GLGuiPushButton("Audio");
     229      optionsBox->pack(audioButton);
     230
     231      OrxGui::GLGuiButton* videoButton = new OrxGui::GLGuiPushButton("Video");
     232      optionsBox->pack(videoButton);
     233
     234      OrxGui::GLGuiButton* controlButton = new OrxGui::GLGuiPushButton("Control");
     235      optionsBox->pack(controlButton);
     236
     237
     238      //      for (unsigned int i = 0; i <
     239      //OrxGui::GLGuiButton*
     240
     241    }
     242  }
     243  this->optionsBox->showAll();
     244  this->optionsBox->setRelCoor2D(200, 100);
     245
     246  this->mainMenuBox->setRelCoorSoft2D(50, 100, 5);
     247
     248}
     249
     250
     251
     252
     253
     254
     255
     256
     257
    152258
    153259/**
     
    164270  this->unsubscribeEvents(ES_MENU);
    165271
    166   GameWorld::unloadData();
     272  return GameWorld::unloadData();
    167273}
    168274
     
    175281  EventHandler::getInstance()->pushState(ES_MENU);
    176282
    177   this->mainMenuBox->showAll();
     283  this->showMainMenu();
    178284
    179285  /* now call the underlying*/
    180   GameWorld::start();
     286  return GameWorld::start();
    181287}
    182288
     
    191297
    192298  /* now call the underlying*/
    193   GameWorld::stop();
     299  return GameWorld::stop();
    194300}
    195301
     
    276382{
    277383  /* call underlying function */
    278   GameWorldData::init();
     384  return GameWorldData::init();
    279385}
    280386
     
    287393{
    288394  /* call underlying function */
    289   GameWorldData::loadGUI(root);
     395  return GameWorldData::loadGUI(root);
    290396}
    291397
     
    297403{
    298404  /* call underlying function */
    299   GameWorldData::unloadGUI();
     405  return GameWorldData::unloadGUI();
    300406}
    301407
     
    307413ErrorMessage GameMenuData::loadWorldEntities(const TiXmlElement* root)
    308414{
    309   GameWorldData::loadWorldEntities(root);
     415  return GameWorldData::loadWorldEntities(root);
    310416}
    311417
     
    317423{
    318424  /* call underlying function */
    319   GameWorldData::unloadWorldEntities();
     425  return GameWorldData::unloadWorldEntities();
    320426}
    321427
     
    328434{
    329435  /* call underlying function */
    330   GameWorldData::loadScene(root);
     436  return GameWorldData::loadScene(root);
    331437}
    332438
     
    338444{
    339445  /* call underlying function */
    340   GameWorldData::unloadScene();
    341 }
    342 
    343 
    344 
     446  return GameWorldData::unloadScene();
     447}
     448
     449
     450
Note: See TracChangeset for help on using the changeset viewer.