Changeset 459
- Timestamp:
- Dec 12, 2007, 12:35:52 AM (17 years ago)
- Location:
- code/branches/FICN/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/network/Client.cc
r448 r459 151 151 * Performs a GameState update 152 152 */ 153 void Client:: update(){153 void Client::tick(float time){ 154 154 ENetPacket *packet; 155 155 // stop if the packet queue is empty -
code/branches/FICN/src/network/Client.h
r438 r459 20 20 #include "GameStateClient.h" 21 21 #include "orxonox/core/IdentifierIncludes.h" 22 //#include "NetworkFrameListener.h" 22 23 23 24 24 25 namespace network{ 25 26 27 28 26 29 /** 30 network::Client *client; 27 31 * The network/Client class 28 32 * This class implements all necessary function for the network communication … … 48 52 bool sendPackets(); 49 53 50 void update();54 void tick(float time); 51 55 52 56 private: … … 62 66 }; 63 67 68 64 69 } 65 70 -
code/branches/FICN/src/network/Server.cc
r444 r459 95 95 * Run this function once every tick 96 96 * calls processQueue and updateGamestate 97 * @param time time since last tick 97 98 */ 98 void Server::tick( ){99 void Server::tick(float time){ 99 100 processQueue(); 100 101 updateGamestate(); -
code/branches/FICN/src/network/Server.h
r440 r459 21 21 #include "enet/enet.h" 22 22 #include "ClientInformation.h" 23 //#include "NetworkFrameListener.h" 24 23 25 24 26 namespace network{ 25 27 28 26 29 /** 27 30 * This class is the root class of the network module for a server. … … 37 40 bool sendMSG(std::string msg); 38 41 bool sendMSG(const char *msg); 39 void tick( );42 void tick(float time); 40 43 protected: 41 44 void processQueue(); … … 49 52 ClientInformation *clients; 50 53 }; 51 52 54 53 55 54 56 -
code/branches/FICN/src/network/Synchronisable.h
r346 r459 17 17 18 18 #include "orxonox/core/IdentifierIncludes.h" 19 #include "orxonox/core/OrxonoxClass.h" 19 20 20 21 namespace network { … … 39 40 * @author Oliver Scheuss 40 41 */ 41 class Synchronisable {42 class Synchronisable : public orxonox::OrxonoxClass{ 42 43 public: 43 44 Synchronisable(); -
code/branches/FICN/src/network/dummyclient3.cc
r448 r459 23 23 24 24 while (true) { 25 client. update();25 client.tick(0); 26 26 std::cout << "your message: "; 27 27 std::getline( std::cin, str ); … … 50 50 51 51 while (true) { 52 client. update();52 client.tick(0); 53 53 usleep(100); 54 54 } -
code/branches/FICN/src/orxonox/orxonox.cc
r458 r459 57 57 58 58 audio::AudioManager* auMan; 59 60 //network stuff 61 //#include "network/Server.h" 62 //#include "network/Client.h" 63 #include "network/NetworkFrameListener.h" 59 64 60 65 // some tests to see if enet works without includsion … … 194 199 void go() 195 200 { 201 if(function==0) 202 standalone(); 203 else if(function==1) 204 server(); 205 else 206 client(); 207 } 208 209 OrxApplication(int func){ 210 function = func; 211 } 212 OrxApplication(){ 213 function = 0; 214 } 215 216 ~OrxApplication() 217 { 218 mInputManager->destroyInputObject(mKeyboard); 219 OIS::InputManager::destroyInputSystem(mInputManager); 220 221 // delete mRenderer; 222 // delete mSystem; 223 224 // delete mListener; 225 // delete mRoot; 226 } 227 228 private: 229 Ogre::Root *mRoot; 230 OIS::Keyboard *mKeyboard; 231 OIS::Mouse *mMouse; 232 OIS::InputManager *mInputManager; 233 //CEGUI::OgreCEGUIRenderer *mRenderer; 234 //CEGUI::System *mSystem; 235 OrxExitListener *mListener; 236 int function; // 0 for standalone, 1 for server, 2 for client 237 238 void client() 239 { 240 client_g = new network::Client(); // address here 241 mRoot->addFrameListener(new network::ClientFrameListener()); 196 242 createRoot(); 197 243 defineResources(); … … 202 248 setupScene(); 203 249 setupInputSystem(); 204 // 250 // setupCEGUI(); 205 251 createFrameListener(); 206 252 startRenderLoop(); 207 253 } 208 209 ~OrxApplication() 210 { 211 mInputManager->destroyInputObject(mKeyboard); 212 OIS::InputManager::destroyInputSystem(mInputManager); 213 214 // delete mRenderer; 215 // delete mSystem; 216 217 // delete mListener; 218 // delete mRoot; 219 } 220 221 private: 222 Ogre::Root *mRoot; 223 OIS::Keyboard *mKeyboard; 224 OIS::Mouse *mMouse; 225 OIS::InputManager *mInputManager; 226 //CEGUI::OgreCEGUIRenderer *mRenderer; 227 //CEGUI::System *mSystem; 228 OrxExitListener *mListener; 229 254 void server() 255 { 256 server_g = new network::Server(); // add some settings if wanted 257 mRoot->addFrameListener(new network::ServerFrameListener()); 258 createRoot(); 259 defineResources(); 260 setupRenderSystem(); 261 createRenderWindow(); 262 initializeResourceGroups(); 263 createScene(); 264 setupScene(); 265 //setupInputSystem(); 266 //setupCEGUI(); 267 //createFrameListener(); 268 //startRenderLoop(); 269 } 270 void standalone() 271 { 272 createRoot(); 273 defineResources(); 274 setupRenderSystem(); 275 createRenderWindow(); 276 initializeResourceGroups(); 277 createScene(); 278 setupScene(); 279 setupInputSystem(); 280 setupCEGUI(); 281 createFrameListener(); 282 startRenderLoop(); 283 } 284 230 285 void createRoot() 231 286 { … … 377 432 mRoot->addFrameListener(mListener); 378 433 } 379 380 381 382 434 void startRenderLoop() 435 { 436 mRoot->startRendering(); 437 } 383 438 }; 384 439 } … … 397 452 try 398 453 { 399 orxonox::OrxApplication orxonox; 400 orxonox.go(); 454 if(argc >=2 && strcmp(argv[1], "server")==0){ 455 orxonox::OrxApplication orxonox(1); 456 orxonox.go(); 457 } 458 else if(argc >=2 && strcmp(argv[1], "client")==0){ 459 orxonox::OrxApplication orxonox(2); 460 orxonox.go(); 461 } 462 else{ 463 orxonox::OrxApplication orxonox(0); 464 orxonox.go(); 465 } 401 466 } 402 467 catch(Exception& e)
Note: See TracChangeset
for help on using the changeset viewer.