Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8677 in orxonox.OLD


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

new gui implementing work

Location:
branches/gui/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/defs/error.h

    r5039 r8677  
    11
    22
    3 /* 
     3/*
    44   orxonox - the future of 3D-vertical-scrollers
    55
     
    1717
    1818
    19 /*! 
     19/*!
    2020 * @file error.h
    2121  *  A compendium of Error codes used in the program
    22 */ 
     22*/
    2323
    2424
     
    5454*/
    5555
    56 typedef struct
     56struct ErrorMessage
    5757{
     58  ErrorMessage(int code = 0, char* message = NULL, char* location = NULL)
     59    : code(code), message(message), location(location) {};
    5860  int code;
    5961  char* message;
    6062  char* location;
    61 } ErrorMessage;
     63};
    6264
    6365#endif /* _ERROR_H */
  • branches/gui/src/lib/data/data_tank.h

    r7370 r8677  
    2323
    2424    /** initializes the DataTank to be able to load the data */
    25     virtual ErrorMessage init() {}
     25    virtual ErrorMessage init() { return ErrorMessage(); }
    2626    /** loads the data into the DataTank @param root is the xml root parameter for for loadParams() connection */
    27     virtual ErrorMessage loadData(const TiXmlElement* root = NULL) {}
     27    virtual ErrorMessage loadData(const TiXmlElement* root = NULL) { return ErrorMessage(); }
    2828    /** unloads the data again from the DataTank */
    29     virtual ErrorMessage unloadData() {}
     29    virtual ErrorMessage unloadData() { return ErrorMessage(); }
    3030};
    3131
  • branches/gui/src/lib/util/loading/game_loader.cc

    r7868 r8677  
    7373  this->subscribeEvent(ES_GAME, KeyMapper::PEV_NEXT_WORLD);
    7474  this->subscribeEvent(ES_GAME, KeyMapper::PEV_PREVIOUS_WORLD);
     75
     76  return ErrorMessage();
    7577}
    7678
     
    9193    this->currentCampaign = this->fileToCampaign(campaignName);
    9294  }
     95
     96  return ErrorMessage();
    9397}
    9498
     
    109113    this->currentCampaign = this->fileToCampaign(campaignName);
    110114  }
     115
     116  return ErrorMessage();
    111117}
    112118
     
    147153      }
    148154  }
     155
     156  return ErrorMessage();
    149157}
    150158
     
    160168    this->currentCampaign->start();
    161169  }
     170
     171  return ErrorMessage();
    162172}
    163173
     
    191201  if(this->currentCampaign != NULL)
    192202    this->currentCampaign->pause();
     203
     204  return ErrorMessage();
    193205}
    194206
     
    205217  if(this->currentCampaign != NULL)
    206218    this->currentCampaign->resume();
     219
     220  return ErrorMessage();
    207221}
    208222
  • branches/gui/src/story_entities/campaign.cc

    r7283 r8677  
    8282  this->bReturnToMenu = false;
    8383  this->run();
     84
     85  return true;
    8486}
    8587
     
    9092bool Campaign::pause()
    9193{
    92   this->bPaused = true;
     94  return (this->bPaused = true);
    9395}
    9496
     
    100102{
    101103  PRINTF(4)("Resuming the current Campaign\n");
    102   this->bPaused = false;
     104  return (this->bPaused = false);
    103105}
    104106
     
    118120    this->currentEntity->stop();
    119121  }
     122
     123  return true;
    120124}
    121125
     
    127131{
    128132  ErrorMessage       errorCode;
    129   int                storyID = WORLD_ID_0;
     133//  int                storyID = WORLD_ID_0;
    130134
    131135  for( this->currentEntity = this->campaignData->getFirstLevel(), this->bRunning = true;
  • 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
  • branches/gui/src/story_entities/game_menu.h

    r8674 r8677  
    2727    virtual ~GameMenu();
    2828
    29     /// TODO TAKE THIS OUT
    30     void enterGui();
    31     void execURL() const;
    32     static int startURL(void* data);
    33 
    34     void setImage(int i);
    35     OrxGui::GLGuiImage* image;
    36     OrxGui::GLGuiInputLine* imageName;
    37     ///
    3829    virtual void loadParams(const TiXmlElement* root);
    3930
     
    4940
    5041    void startLevel(int level);
     42
     43    void showMainMenu();
     44    void showCampaigns();
     45    void showMultiPlayer();
     46    void showOptionsMenu();
     47
    5148    void quitMenu();
    5249
     
    6562  private:
    6663    OrxGui::GLGuiBox*                 mainMenuBox;
     64    OrxGui::GLGuiBox*                 levelsBox;
     65    OrxGui::GLGuiBox*                 networkBox;
     66
     67    OrxGui::GLGuiBox*                 optionsBox;
    6768    OrxGui::GLGuiBox*                 audioBox;
    6869    OrxGui::GLGuiBox*                 videoBox;
    6970    OrxGui::GLGuiBox*                 controlBox;
    70     OrxGui::GLGuiBox*                 levelsBox;
    7171
    7272    Vector                            cameraVector;
  • branches/gui/src/story_entities/game_world.cc

    r8490 r8677  
    140140  State::setScriptManager(&this->scriptManager);
    141141
     142  return ErrorMessage();
    142143}
    143144
     
    155156
    156157  PRINTF(3)("> Loading world: '%s'\n", getLoadFile().c_str());
    157   TiXmlElement* element;
    158   GameLoader* loader = GameLoader::getInstance();
     158//  TiXmlElement* element;
     159//  GameLoader* loader = GameLoader::getInstance();
    159160
    160161  if( getLoadFile().empty())
    161162  {
    162163    PRINTF(1)("GameWorld has no path specified for loading\n");
    163     return (ErrorMessage){213,"Path not specified","GameWorld::load()"};
     164    return (ErrorMessage(213,"Path not specified","GameWorld::load()"));
    164165  }
    165166
     
    170171    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getLoadFile().c_str(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
    171172    delete XMLDoc;
    172     return (ErrorMessage){213,"XML File parsing error","GameWorld::load()"};
     173    return ErrorMessage(213,"XML File parsing error","GameWorld::load()");
    173174  }
    174175  // check basic validity
     
    180181    PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
    181182    delete XMLDoc;
    182     return (ErrorMessage){213,"Path not a WorldDataFile","GameWorld::load()"};
     183    return ErrorMessage(213,"Path not a WorldDataFile","GameWorld::load()");
    183184  }
    184185  /* the whole loading process for the GameWorld */
     
    193194  Account *b = new Account(30);
    194195  b->setName("b");
    195  
    196  
     196
     197
    197198  LoadParamXML(root, "ScriptManager", &this->scriptManager, ScriptManager, loadParams);
    198199
    199200  delete XMLDoc;
    200201  this->releaseLoadScreen();
     202
     203  return ErrorMessage();
    201204}
    202205
     
    223226  if (this->dataXML)
    224227    delete this->dataXML;
     228
     229  return ErrorMessage();
    225230}
    226231
     
    235240  State::setScriptManager(&this->scriptManager); //make sure we have the right script manager
    236241  this->run();
     242
     243  return true;
    237244}
    238245
     
    245252  PRINTF(3)("GameWorld::stop() - got stop signal\n");
    246253  State::setScriptManager(NULL);
    247   this->bRunning = false;
     254  return (this->bRunning = false);
    248255}
    249256
     
    254261bool GameWorld::pause()
    255262{
    256   this->bPaused = true;
     263  return (this->bPaused = true);
    257264}
    258265
     
    263270bool GameWorld::resume()
    264271{
    265   this->bPaused = false;
     272  return(this->bPaused = false);
    266273}
    267274
     
    413420    if( likely(this->dataTank->gameRule != NULL))
    414421      this->dataTank->gameRule->tick(this->dtS);
    415      
     422
    416423  }
    417424}
  • branches/gui/src/story_entities/game_world_data.cc

    r8490 r8677  
    108108
    109109  GraphicsEngine::getInstance()->displayFPS(true);
     110
     111  return ErrorMessage();
    110112}
    111113
     
    131133  this->loadWorldEntities(root);
    132134  this->loadScene(root);
     135
     136  return ErrorMessage();
    133137}
    134138
     
    142146  this->unloadWorldEntities();
    143147  this->unloadScene();
     148
     149  return ErrorMessage();
    144150}
    145151
     
    166172  }
    167173  this->glmis->draw();
     174
     175  return ErrorMessage();
    168176}
    169177
     
    175183{
    176184  delete this->glmis;
     185
     186  return ErrorMessage();
    177187}
    178188
     
    250260  /* init the pnode tree */
    251261  PNode::getNullParent()->init();
     262
     263  return ErrorMessage();
    252264}
    253265
     
    312324
    313325  this->glmis = NULL;
     326
     327  return ErrorMessage();
    314328}
    315329
     
    337351    this->localCamera->addChild(this->sky);
    338352  OrxSound::SoundEngine::getInstance()->setListener(this->localCamera);
     353
     354  return ErrorMessage();
    339355}
    340356
     
    357373
    358374  State::setGameRules(NULL);
     375
     376  return ErrorMessage();
    359377}
    360378
  • branches/gui/src/story_entities/multi_player_world.cc

    r8228 r8677  
    123123/**
    124124 * cleanup
    125  * @return 
     125 * @return
    126126 */
    127127ErrorMessage MultiPlayerWorld::unloadData( )
    128128{
    129    
     129
    130130  GameWorld::unloadData();
    131  
     131
    132132  delete NetworkManager::getInstance();
    133133  delete NetworkGameManager::getInstance();
    134134
     135  return ErrorMessage();
    135136}
  • branches/gui/src/story_entities/multi_player_world_data.cc

    r8490 r8677  
    7878{
    7979  /* call underlying function */
    80   GameWorldData::init();
     80  return GameWorldData::init();
    8181}
    8282
     
    8989{
    9090  /* call underlying function */
    91   GameWorldData::loadGUI(root);
     91  return GameWorldData::loadGUI(root);
    9292}
    9393
     
    9999{
    100100  /* call underlying function */
    101   GameWorldData::unloadGUI();
     101  return GameWorldData::unloadGUI();
    102102}
    103103
     
    245245  this->drawLists.push_back(OM_GROUP_01);
    246246  this->drawLists.push_back(OM_GROUP_01_PROJ);
    247  
     247
    248248  State::setPlayer(this->localPlayer);
    249  
     249
     250  return ErrorMessage();
    250251}
    251252
     
    257258{
    258259  /* call underlying function */
    259   GameWorldData::unloadWorldEntities();
     260  return GameWorldData::unloadWorldEntities();
    260261}
    261262
     
    269270  /* call underlying function */
    270271  GameWorldData::loadScene(root);
    271  
     272
    272273  // create server playable
    273274  if ( NetworkManager::getInstance()->isGameServer() )
     
    276277    State::getPlayer()->setPlayable( PlayerStats::getStats( 0 )->getPlayable() );
    277278  }
     279
     280  return ErrorMessage();
    278281}
    279282
     
    285288{
    286289  /* call underlying function */
    287   GameWorldData::unloadScene();
     290  return GameWorldData::unloadScene();
    288291}
    289292
  • branches/gui/src/story_entities/single_player_world_data.cc

    r7370 r8677  
    4545{
    4646  /* call underlying function */
    47   GameWorldData::init();
     47  return GameWorldData::init();
    4848}
    4949
     
    5656{
    5757  /* call underlying function */
    58   GameWorldData::loadGUI(root);
     58  return GameWorldData::loadGUI(root);
    5959}
    6060
     
    6666{
    6767  /* call underlying function */
    68   GameWorldData::unloadGUI();
     68  return GameWorldData::unloadGUI();
    6969}
    7070
     
    7777{
    7878  /* call underlying function */
    79   GameWorldData::loadWorldEntities(root);
     79  return GameWorldData::loadWorldEntities(root);
    8080}
    8181
     
    8787{
    8888  /* call underlying function */
    89   GameWorldData::unloadWorldEntities();
     89  return GameWorldData::unloadWorldEntities();
    9090}
    9191
     
    9898{
    9999  /* call underlying function */
    100   GameWorldData::loadScene(root);
     100  return GameWorldData::loadScene(root);
    101101}
    102102
     
    108108{
    109109  /* call underlying function */
    110   GameWorldData::unloadScene();
     110  return GameWorldData::unloadScene();
    111111}
    112112
  • branches/gui/src/story_entities/story_entity.h

    r7283 r8677  
    3535  /* initialisation and loading */
    3636  /** initializes a Story Entity to the needed values */
    37   virtual ErrorMessage init() {};
     37  virtual ErrorMessage init() { return ErrorMessage(); };
    3838  /** called to load the data into the StoryEntity*/
    39   virtual ErrorMessage loadData() {};
     39  virtual ErrorMessage loadData() { return ErrorMessage(); };
    4040  /** function that unloads the data from the StoryEntity */
    41   virtual ErrorMessage unloadData() {};
     41  virtual ErrorMessage unloadData() { return ErrorMessage(); };
    4242
    4343  /* running, stopping and pausing */
Note: See TracChangeset for help on using the changeset viewer.