123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include "Game.h"
- #include "Initialisierung.h"
- #include "Globals.h"
- #include <AsynchronCall.h>
- #include <Bildschirm.h>
- Game::Game( Bildschirm* zScreen )
- : Menu( zScreen )
- {
- logout = initKnopf( 10, 10, 200, 20, Knopf::Style::Normal, "Verlassen" );
- logout->setMausEreignis( [this, zScreen]( void* p, void* o, MausEreignis me ) {
- if( me.id == ME_RLinks )
- {
- logout->removeStyle( Knopf::Style::Erlaubt );
- new AsynchronCall( [this, zScreen]() {
- if( network->leaveGame() )
- {
- currentGame->release();
- currentGame = 0;
- zScreen->lock();
- hide();
- menuRegister->get( "directConnect" )->show();
- zScreen->unlock();
- }
- logout->addStyle( Knopf::Style::Erlaubt );
- } );
- }
- return 1;
- } );
- elements.add( logout );
- debug = initTextFeld( 10, 40, 500, 40, TextFeld::Style::Text | TextFeld::Style::Mehrzeilig, "" );
- elements.add( debug );
- }
- void Game::updatePosition( Vec3<float> position, bool target, Vec3<int> targetPos )
- {
- Text txt = "Position: (";
- txt.setPrecision( 2 );
- txt += position.x;
- txt += ", ";
- txt += position.y;
- txt += ", ";
- txt += position.z;
- txt += ")";
- if( target )
- {
- txt += "\nTarget: (";
- txt += targetPos.x;
- txt += ", ";
- txt += targetPos.y;
- txt += ", ";
- txt += targetPos.z;
- txt += ")";
- }
- debug->setText( txt );
- }
|