Game.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "Game.h"
  2. #include "Initialisierung.h"
  3. #include "Globals.h"
  4. Game::Game( Bildschirm* zScreen )
  5. : Menu( zScreen )
  6. {
  7. logout = initKnopf( 10, 10, 200, 20, Knopf::Style::Normal, "Verlassen" );
  8. logout->setMausEreignis( [this]( void* p, void* o, MausEreignis me ) {
  9. if( me.id == ME_RLinks )
  10. {
  11. logout->removeStyle( Knopf::Style::Erlaubt );
  12. if( network->leaveGame() )
  13. {
  14. currentGame->release();
  15. currentGame = 0;
  16. hide();
  17. menuRegister->get( "directConnect" )->show();
  18. }
  19. logout->addStyle( Knopf::Style::Erlaubt );
  20. }
  21. return 1;
  22. } );
  23. elements.add( logout );
  24. debug = initTextFeld( 10, 40, 500, 20, TextFeld::Style::Text, "" );
  25. elements.add( debug );
  26. }
  27. void Game::updatePositionAndFace( Vec3<float> position, Vec2<float> face )
  28. {
  29. Text txt = "Position: (";
  30. txt.setPrecision( 2 );
  31. txt += position.x;
  32. txt += ", ";
  33. txt += position.y;
  34. txt += ", ";
  35. txt += position.z;
  36. txt += ") Face: (";
  37. txt += face.x;
  38. txt += ", ";
  39. txt += face.y;
  40. txt += ")";
  41. debug->setText( txt );
  42. }