1234567891011121314151617181920212223242526272829303132333435 |
- #include "DirectConnect.h"
- #include "Initialisierung.h"
- #include "Globals.h"
- DirectConnect::DirectConnect( Bildschirm* zScreen )
- : Menu( zScreen )
- {
- elements.add( initTextFeld( 10, 10, 90, 20, TextFeld::Style::Text, "Adresse: " ) );
- elements.add( initTextFeld( 10, 35, 90, 20, TextFeld::Style::Text, "Port: " ) );
- address = initTextFeld( 100, 10, 200, 20, TextFeld::Style::TextFeld, "koljastrohm-games.com" );
- port = initTextFeld( 100, 35, 200, 20, TextFeld::Style::TextFeld, "5425" );
- port->setTastaturEreignis( _nurNummernTE );
- elements.add( address );
- elements.add( port );
- Knopf* login = initKnopf( 200, 60, 100, 20, Knopf::Style::Normal, "Beitreten" );
- login->setMausEreignis( [this, login, zScreen]( void* p, void* o, MausEreignis me ) {
- if( me.id == ME_RLinks )
- {
- login->removeStyle( Knopf::Style::Erlaubt );
- address->removeStyle( TextFeld::Style::Erlaubt );
- port->removeStyle( TextFeld::Style::Erlaubt );
- if( network->connect( address->zText()->getText(), (short)(int)*port->zText() ) )
- {
- currentGame = new World( dynamic_cast<Bildschirm3D*>(zScreen) );
- hide();
- menuRegister->get( "game" )->show();
- }
- address->addStyle( TextFeld::Style::Erlaubt );
- port->addStyle( TextFeld::Style::Erlaubt );
- login->addStyle( Knopf::Style::Erlaubt );
- }
- return 1;
- } );
- elements.add( login );
- }
|