DirectConnect.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #include "DirectConnect.h"
  2. #include "Initialisierung.h"
  3. #include "Globals.h"
  4. DirectConnect::DirectConnect( Bildschirm* zScreen )
  5. : Menu( zScreen )
  6. {
  7. elements.add( initTextFeld( 10, 10, 90, 20, TextFeld::Style::Text, "Adresse: " ) );
  8. elements.add( initTextFeld( 10, 35, 90, 20, TextFeld::Style::Text, "Port: " ) );
  9. address = initTextFeld( 100, 10, 200, 20, TextFeld::Style::TextFeld, "koljastrohm-games.com" );
  10. port = initTextFeld( 100, 35, 200, 20, TextFeld::Style::TextFeld, "5425" );
  11. port->setTastaturEreignis( _nurNummernTE );
  12. elements.add( address );
  13. elements.add( port );
  14. Knopf* login = initKnopf( 200, 60, 100, 20, Knopf::Style::Normal, "Beitreten" );
  15. login->setMausEreignis( [this, login, zScreen]( void* p, void* o, MausEreignis me ) {
  16. if( me.id == ME_RLinks )
  17. {
  18. login->removeStyle( Knopf::Style::Erlaubt );
  19. address->removeStyle( TextFeld::Style::Erlaubt );
  20. port->removeStyle( TextFeld::Style::Erlaubt );
  21. if( network->connect( address->zText()->getText(), (short)(int)*port->zText() ) )
  22. {
  23. currentGame = new World( dynamic_cast<Bildschirm3D*>(zScreen) );
  24. hide();
  25. menuRegister->get( "game" )->show();
  26. }
  27. address->addStyle( TextFeld::Style::Erlaubt );
  28. port->addStyle( TextFeld::Style::Erlaubt );
  29. login->addStyle( Knopf::Style::Erlaubt );
  30. }
  31. return 1;
  32. } );
  33. elements.add( login );
  34. }