Changeset 9059 in orxonox.OLD for trunk/src/story_entities/menu
- Timestamp:
- Jul 3, 2006, 6:30:42 PM (18 years ago)
- Location:
- trunk/src/story_entities/menu
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/menu/game_menu.cc
r9015 r9059 36 36 #include "glgui.h" 37 37 #include "menu/glgui_imagebutton.h" 38 39 #include "glgui_text.h" 40 41 #include "network_manager.h" 38 42 39 43 //! This creates a Factory to fabricate a GameMenu … … 122 126 this->levelsBox = NULL; 123 127 this->networkBox = NULL; 128 129 this->clientNetworkBox = NULL; 130 this->serverNetworkBox = NULL; 124 131 125 132 this->optionsBox = NULL; … … 233 240 OrxGui::GLGuiButton* clientButton = new OrxGui::GLGuiPushButton("Client"); 234 241 networkBox->pack(clientButton); 242 clientButton->connect(SIGNAL(clientButton, released), this, SLOT(GameMenu, showClientMenu)); 235 243 236 244 OrxGui::GLGuiButton* serverButton = new OrxGui::GLGuiPushButton("Server"); 237 245 networkBox->pack(serverButton); 246 serverButton->connect(SIGNAL(serverButton, released), this, SLOT(GameMenu, showServerMenu)); 238 247 239 248 … … 495 504 } 496 505 497 498 506 /** 507 * show controls to join network game 508 */ 509 void GameMenu::showClientMenu( ) 510 { 511 if ( this->serverNetworkBox ) 512 { 513 delete this->serverNetworkBox; 514 this->serverNetworkBox = NULL; 515 } 516 517 if ( !this->clientNetworkBox ) 518 { 519 this->clientNetworkBox = new OrxGui::GLGuiBox(); 520 { 521 OrxGui::GLGuiText * text = new OrxGui::GLGuiText(); 522 text->setText( "Host:" ); 523 this->clientNetworkBox->pack( text ); 524 525 this->ipInputLine = new OrxGui::GLGuiInputLine( ); 526 this->ipInputLine->setText( "tardis-d08" ); 527 this->clientNetworkBox->pack( this->ipInputLine ); 528 this->ipInputLine->connect(SIGNAL(ipInputLine, enterPushed), this, SLOT(GameMenu, connectToServer)); 529 this->ipInputLine->select(); 530 531 OrxGui::GLGuiButton* connectButton = new OrxGui::GLGuiPushButton("Connect"); 532 clientNetworkBox->pack(connectButton); 533 connectButton->connect(SIGNAL(connectButton, released), this, SLOT(GameMenu, connectToServer)); 534 } 535 } 536 537 this->clientNetworkBox->showAll(); 538 539 this->clientNetworkBox->setAbsCoor2D( 300.0f, 100.0f ); 540 } 541 542 /** 543 * show controls to create new network game 544 */ 545 void GameMenu::showServerMenu( ) 546 { 547 if ( this->clientNetworkBox ) 548 { 549 delete this->clientNetworkBox; 550 this->clientNetworkBox = NULL; 551 } 552 553 if ( !this->serverNetworkBox ) 554 { 555 this->serverNetworkBox = new OrxGui::GLGuiBox(); 556 { 557 OrxGui::GLGuiText * text = new OrxGui::GLGuiText(); 558 text->setText( "Map:" ); 559 this->serverNetworkBox->pack( text ); 560 561 OrxGui::GLGuiText * text2 = new OrxGui::GLGuiText(); 562 text2->setText( "Multiplayer TeamDeathMatch Arena" ); 563 this->serverNetworkBox->pack( text2 ); 564 565 OrxGui::GLGuiButton* createButton = new OrxGui::GLGuiPushButton("Create Server"); 566 serverNetworkBox->pack(createButton); 567 createButton->connect(SIGNAL(createButton, released), this, SLOT(GameMenu, createServer)); 568 } 569 } 570 571 this->serverNetworkBox->showAll(); 572 573 this->serverNetworkBox->setAbsCoor2D( 300.0f, 100.0f ); 574 } 575 576 /** 577 * connect to host 578 */ 579 void GameMenu::connectToServer( ) 580 { 581 PRINTF(0)("Connecting to %s\n", this->ipInputLine->_getText().c_str() ); 582 583 State::setOnline(true); 584 NetworkManager::getInstance()->establishConnection( this->ipInputLine->_getText(), 9999 ); 585 586 this->startLevel( 5 ); 587 } 588 589 void GameMenu::createServer( ) 590 { 591 PRINTF(0)("Create server\n" ); 592 593 State::setOnline(true); 594 NetworkManager::getInstance()->createServer( 9999 ); 595 596 this->startLevel( 5 ); 597 } 598 599 600 -
trunk/src/story_entities/menu/game_menu.h
r8717 r9059 45 45 void showMultiPlayer(); 46 46 void showOptionsMenu(); 47 48 void showClientMenu(); 49 void connectToServer(); 50 51 void showServerMenu(); 52 void createServer(); 47 53 48 54 … … 63 69 void setSelectorSound(const std::string& selectorSound); 64 70 71 72 65 73 66 74 private: … … 68 76 OrxGui::GLGuiBox* levelsBox; 69 77 OrxGui::GLGuiBox* networkBox; 78 79 OrxGui::GLGuiBox* clientNetworkBox; 80 OrxGui::GLGuiInputLine* ipInputLine; 81 82 OrxGui::GLGuiBox* serverNetworkBox; 70 83 71 84 OrxGui::GLGuiBox* optionsBox;
Note: See TracChangeset
for help on using the changeset viewer.