Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9029 in orxonox.OLD


Ignore:
Timestamp:
Jul 3, 2006, 12:22:30 PM (18 years ago)
Author:
rennerc
Message:

implemented network game menu

Location:
branches/multi_player_map/src/story_entities/menu
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/multi_player_map/src/story_entities/menu/game_menu.cc

    r8742 r9029  
    3636#include "glgui.h"
    3737#include "menu/glgui_imagebutton.h"
     38
     39#include "glgui_text.h"
    3840
    3941//! This creates a Factory to fabricate a GameMenu
     
    122124  this->levelsBox = NULL;
    123125  this->networkBox = NULL;
     126 
     127  this->clientNetworkBox = NULL;
     128  this->serverNetworkBox = NULL;
    124129
    125130  this->optionsBox = NULL;
     
    224229      OrxGui::GLGuiButton* clientButton = new OrxGui::GLGuiPushButton("Client");
    225230      networkBox->pack(clientButton);
     231      clientButton->connect(SIGNAL(clientButton, released), this, SLOT(GameMenu, showClientMenu));
    226232
    227233      OrxGui::GLGuiButton* serverButton = new OrxGui::GLGuiPushButton("Server");
    228234      networkBox->pack(serverButton);
     235      serverButton->connect(SIGNAL(serverButton, released), this, SLOT(GameMenu, showServerMenu));
    229236
    230237
     
    481488}
    482489
    483 
    484 
     490/**
     491 * show controls to join network game
     492 */
     493void GameMenu::showClientMenu( )
     494{
     495  if ( this->serverNetworkBox )
     496  {
     497    delete this->serverNetworkBox;
     498    this->serverNetworkBox = NULL;
     499  }
     500 
     501  if ( !this->clientNetworkBox )
     502  {
     503    this->clientNetworkBox = new OrxGui::GLGuiBox();
     504    {
     505      OrxGui::GLGuiText * text = new OrxGui::GLGuiText();
     506      text->setText( "Host:" );
     507      this->clientNetworkBox->pack( text );
     508     
     509      this->ipInputLine = new OrxGui::GLGuiInputLine( );
     510      this->clientNetworkBox->pack( this->ipInputLine );
     511      this->ipInputLine->connect(SIGNAL(ipInputLine, enterPushed), this, SLOT(GameMenu, connectToServer));
     512      this->ipInputLine->select();
     513     
     514      OrxGui::GLGuiButton* connectButton = new OrxGui::GLGuiPushButton("connect to server");
     515      clientNetworkBox->pack(connectButton);
     516      connectButton->connect(SIGNAL(connectButton, released), this, SLOT(GameMenu, connectToServer));
     517    }
     518  }
     519 
     520  this->clientNetworkBox->showAll();
     521 
     522  this->clientNetworkBox->setAbsCoor2D( 300.0f, 100.0f );
     523}
     524
     525/**
     526 * show controls to create new network game
     527 */
     528void GameMenu::showServerMenu( )
     529{
     530  if ( this->clientNetworkBox )
     531  {
     532    delete this->clientNetworkBox;
     533    this->clientNetworkBox = NULL;
     534  }
     535 
     536  if ( !this->serverNetworkBox )
     537  {
     538    this->serverNetworkBox = new OrxGui::GLGuiBox();
     539    {
     540      OrxGui::GLGuiText * text = new OrxGui::GLGuiText();
     541      text->setText( "Map:" );
     542      this->serverNetworkBox->pack( text );
     543     
     544      OrxGui::GLGuiText * text2 = new OrxGui::GLGuiText();
     545      text2->setText( "Multiplayer TeamDeathMatch Arena" );
     546      this->serverNetworkBox->pack( text2 );
     547     
     548      OrxGui::GLGuiButton* createButton = new OrxGui::GLGuiPushButton("create server");
     549      serverNetworkBox->pack(createButton);
     550      createButton->connect(SIGNAL(createButton, released), this, SLOT(GameMenu, createServer));
     551    }
     552  }
     553 
     554  this->serverNetworkBox->showAll();
     555 
     556  this->serverNetworkBox->setAbsCoor2D( 300.0f, 100.0f );
     557}
     558
     559/**
     560 * connect to host
     561 */
     562void GameMenu::connectToServer( )
     563{
     564  PRINTF(0)("Connecting to %s\n", this->ipInputLine->_getText().c_str() );
     565 
     566  //TODO connect :D
     567}
     568
     569void GameMenu::createServer( )
     570{
     571  PRINTF(0)("Create server\n" );
     572 
     573  //TODO create server :D
     574}
     575
     576
     577
  • branches/multi_player_map/src/story_entities/menu/game_menu.h

    r8717 r9029  
    4545    void showMultiPlayer();
    4646    void showOptionsMenu();
     47   
     48    void showClientMenu();
     49    void connectToServer();
     50   
     51    void showServerMenu();
     52    void createServer();
    4753
    4854
     
    6369    void setSelectorSound(const std::string& selectorSound);
    6470
     71   
     72
    6573
    6674  private:
     
    6876    OrxGui::GLGuiBox*                 levelsBox;
    6977    OrxGui::GLGuiBox*                 networkBox;
     78   
     79    OrxGui::GLGuiBox*                 clientNetworkBox;
     80    OrxGui::GLGuiInputLine*           ipInputLine;
     81   
     82    OrxGui::GLGuiBox*                 serverNetworkBox;
    7083
    7184    OrxGui::GLGuiBox*                 optionsBox;
Note: See TracChangeset for help on using the changeset viewer.