Changeset 3107
- Timestamp:
- May 28, 2009, 11:47:22 PM (16 years ago)
- Location:
- code/branches/ggz
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ggz/bin/ggz/module.dsc
r3000 r3107 8 8 ProtocolVersion = 0 9 9 Version = 0 10 IconPath = /home/adi/development/orxonox/media/materials/textures/orxonox_logo.svg10 #IconPath = /home/adi/development/orxonox/media/materials/textures/orxonox_logo.svg -
code/branches/ggz/src/orxonox/GGZClient.cc
r3000 r3107 8 8 GGZClient* GGZClient::singletonRef_s = 0; 9 9 10 GGZClient::GGZClient( )10 GGZClient::GGZClient(GSClient * c) 11 11 : ggzSocket(io), gameSocket(io) 12 12 { … … 14 14 singletonRef_s = this; 15 15 16 client = c; 16 17 initGGZ(); 17 18 } … … 38 39 void GGZClient::tick(const float /*dt*/) 39 40 { 41 COUT(3) << "Tick\n"; 40 42 boost::system::error_code ec; 41 43 io.poll(ec); 42 if (ec) { 44 if (ec) 45 { 43 46 /* TODO: Error */ 44 47 } … … 47 50 void GGZClient::initGGZ() 48 51 { 52 COUT(3) << "Initializing GGZ\n"; 49 53 ggzmod = ggzmod_new(GGZMOD_GAME); 50 54 ggzmod_set_handler(ggzmod, GGZMOD_EVENT_SERVER, 51 55 &orxonox::GGZClient::handleGGZModServer); 52 if (ggzmod_connect(ggzmod) < 0) { 56 if (ggzmod_connect(ggzmod) < 0) 57 { 53 58 /* TODO: Error */ 54 59 } 55 60 int fd = ggzmod_get_fd(ggzmod); 56 if (fd < 0) { 61 if (fd < 0) 62 { 57 63 /* TODO: Error */ 58 64 } … … 84 90 const void *data) 85 91 { 92 COUT(3) << "GGZ Initialized\n"; 86 93 ggzmod_set_state(ggzmod, GGZMOD_STATE_PLAYING); 87 94 getInstance().gameSocket.assign(boost::asio::local::stream_protocol(), *(int*)data); -
code/branches/ggz/src/orxonox/GGZClient.h
r3000 r3107 4 4 #include "OrxonoxPrereqs.h" 5 5 #include "objects/Tickable.h" 6 #include "gamestates/GSClient.h" 6 7 7 8 #include <ggzmod.h> … … 13 14 { 14 15 public: 15 GGZClient( );16 GGZClient(GSClient * client); 16 17 ~GGZClient(); 17 18 … … 23 24 static GGZClient* singletonRef_s; 24 25 26 GSClient * client; 25 27 GGZMod * ggzmod; 26 28 boost::asio::io_service io; -
code/branches/ggz/src/orxonox/OrxonoxPrereqs.h
r2710 r3107 235 235 class Scoreboard; 236 236 237 // gui237 // gui 238 238 class GUIManager; 239 239 … … 248 248 class GSClient; 249 249 class GSGUI; 250 251 // GGZ 252 class GGZClient; 250 253 } 251 254 -
code/branches/ggz/src/orxonox/gamestates/GSClient.cc
r3106 r3107 30 30 #include "OrxonoxStableHeaders.h" 31 31 #include "GSClient.h" 32 #include "SpecialConfig.h" 32 33 33 34 #include "core/input/InputManager.h" … … 44 45 45 46 GSClient::GSClient() 46 : GameState<GSGraphics>("client") 47 , client_(0) 47 : GameState<GSGraphics>("client"), 48 client_(0), 49 ggzClient(0) 48 50 { 49 51 } … … 58 60 59 61 #ifdef GGZMOD_FOUND 60 ggzClient = NULL;61 if (GGZClient::isActive()){62 COUT(3) << "Initializing GGZ\n";63 ggzClient = new GGZClient;62 if (GGZClient::isActive()) 63 { 64 this->ggzClient = new GGZClient(this); 65 return; 64 66 } 65 else {66 COUT(3) << "Not using GGZ\n";67 }68 #else /* GGZMOD_FOUND */69 COUT(3) << "GGZ support disabled\n";70 67 #endif /* GGZMOD_FOUND */ 71 68 72 this->client_ = new Client(CommandLine::getValue("ip").getString(), CommandLine::getValue("port")); 69 this->connect(CommandLine::getValue("ip").getString(), CommandLine::getValue("port")); 70 } 71 72 void GSClient::connect(const std::string& address, int port) 73 { 74 this->client_ = new Client(address, port); 73 75 74 76 if(!client_->establishConnection()) … … 86 88 client_->closeConnection(); 87 89 88 #ifdef GGZMOD_FOUND89 90 if (ggzClient) 90 91 { 91 92 delete ggzClient; 92 93 } 93 #endif /* GGZMOD_FOUND */94 94 95 95 // destroy client -
code/branches/ggz/src/orxonox/gamestates/GSClient.h
r3106 r3107 30 30 #define _GSClient_H__ 31 31 32 #include "SpecialConfig.h"33 32 #include "OrxonoxPrereqs.h" 34 33 #include "network/NetworkPrereqs.h" … … 38 37 namespace orxonox 39 38 { 40 #ifdef GGZMOD_FOUND41 class _OrxonoxExport GGZClient;42 #endif /* GGZMOD_FOUND */43 44 39 class _OrxonoxExport GSClient : public GameState<GSGraphics>, public GSLevel 45 40 { … … 47 42 GSClient(); 48 43 ~GSClient(); 44 void connect(const std::string& address, int port); 49 45 50 46 private: … … 54 50 55 51 Client* client_; 56 #ifdef GGZMOD_FOUND57 52 GGZClient* ggzClient; 58 #endif /* GGZMOD_FOUND */59 53 }; 60 54 }
Note: See TracChangeset
for help on using the changeset viewer.