Login.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "Login.h"
  2. #include "Initialisierung.h"
  3. #include "Globals.h"
  4. LoginMenu::LoginMenu( Bildschirm* zScreen )
  5. : Menu( zScreen )
  6. {
  7. elements.add( initTextFeld( 10, 10, 90, 20, TextFeld::Style::Text, "Name: " ) );
  8. elements.add( initTextFeld( 10, 35, 90, 20, TextFeld::Style::Text, "Passwort: " ) );
  9. name = initTextFeld( 100, 10, 200, 20, TextFeld::Style::TextFeld, "Kolja" );
  10. password = initTextFeld( 100, 35, 200, 20, TextFeld::Style::TextFeld, "1rg3ndw13" );
  11. password->setSchowChar( '*' );
  12. elements.add( name );
  13. elements.add( password );
  14. Knopf* login = initKnopf( 200, 60, 100, 20, Knopf::Style::Normal, "Login" );
  15. login->setMausEreignis( [this, login]( void* p, void* o, MausEreignis me ) {
  16. if( me.id == ME_RLinks )
  17. {
  18. login->removeStyle( Knopf::Style::Erlaubt );
  19. name->removeStyle( TextFeld::Style::Erlaubt );
  20. password->removeStyle( TextFeld::Style::Erlaubt );
  21. if( network->login( name->zText()->getText(), password->zText()->getText() ) )
  22. {
  23. hide();
  24. menuRegister->get( "directConnect" )->show();
  25. }
  26. name->addStyle( TextFeld::Style::Erlaubt );
  27. password->addStyle( TextFeld::Style::Erlaubt );
  28. login->addStyle( Knopf::Style::Erlaubt );
  29. }
  30. return 1;
  31. } );
  32. elements.add( login );
  33. }
  34. void LoginMenu::onLoadingFinished()
  35. {}