netpanzer-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [netPanzer-Devel] Status of the network code and next plans


From: Raphael Bosshard
Subject: Re: [netPanzer-Devel] Status of the network code and next plans
Date: Sat, 06 Sep 2003 14:26:38 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5b) Gecko/20030903 Mozilla Thunderbird/0.2a

Here is little patch that cares about a XXX-entry in GameManager.cpp. Keypresses are now handled with libSDL.

Raphael

Matze Braun wrote:

*snipp*

could eventually help getting started with the code. If you search for stuff that needs fixing the look at the TODO text or simply search the sourcecode for XXX (I added XXX to places where we need smaller fixes).




--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp  2003-09-06 
12:34:29.000000000 +0200
+++ netpanzer.mod/src/NetPanzer/Interfaces/GameManager.cpp      2003-09-06 
14:13:07.526006280 +0200
@@ -672,8 +672,7 @@
                        }
                } 
 
-       if( (KeyboardInterface::getKeyState( SDLK_LCTRL) ||
-                       KeyboardInterface::getKeyState( SDLK_RCTRL) )   )
+       if( (KeyboardInterface::getKeyState( SDLK_LCRTL) || 
KeyboardInterface::getKeyState( SDLK_RCRTL) )   )
         {
          
                  // DEBUG VIEW 
@@ -2012,75 +2011,51 @@
 
 // ******************************************************************
 void GameManager::dedicatedInputLoop()
- {
-  KeyboardInterface::sampleKeyboard();
-
-  // XXX we need SDL code here
-#ifdef WIN32
-  if( kbhit() )
-   {
-    int key;
-    key = getch();
-    if ( key == 0 )
-     {
-      key = getch();
-     }
-    else
-     {
-      switch( key )
-       {
-        case 27 :
-         {
-          exitNetPanzer();
-         } break;
-
-        case 'Q' :
-        case 'q' :
-         {
-          exitNetPanzer();
-         } break;         
-        
-        case 'M' :
-        case 'm' :
-         {
-          GameControlRulesDaemon::forceMapCycle();
-         } break;
-         
-        case 'I' :
-        case 'i' :
-         {
-          ConsoleInterface::postMessage( "Map: %s", 
GameConfig::getGameMapName() );
-          ConsoleInterface::postMessage( "Players: %d/%d", 
PlayerInterface::getActivePlayerCount(),
-                                                           
GameConfig::GetNumberPlayers() );
-         
-          ConsoleInterface::postMessage( "Units: %d/%d", 
UnitInterface::getTotalUnitCount(),
-                                                         
GameConfig::GetNumberUnits() );
-         } break;
-       
-        case '1' :
-         {
-          ChatInterface::setMessageScopeServer();
-          ChatInterface::sendCurrentMessage( "Server will restart in 5 
minutes" );
-         } break;
-
-        case '2' :
-         {
-          ChatInterface::setMessageScopeServer();
-          ChatInterface::sendCurrentMessage( "Server is restarting" );
-         } break;
-
-        case '3' :
-         {
-          ChatInterface::setMessageScopeServer();
-          ChatInterface::sendCurrentMessage( "Server is rotating map" );
-         } break;
+{
+       KeyboardInterface::sampleKeyboard();
+       
+       // XXX we need SDL code here
+       // DONE  
 
-       } // ** switch
-     }
-   }
-#endif
- 
- }
+       if( SDL_PollEvent( &event ) )
+       {
+               switch( event.key.keysym.sym )
+               {
+                       case SDLK_ESCAPE :
+                               exitNetPanzer();
+                               break;
+
+                       case SDLK_q :
+                               exitNetPanzer();
+                               break;         
+
+                       case SDLK_m :
+                               GameControlRulesDaemon::forceMapCycle();
+                               break;
+
+                       case SDLK_i :
+                               ConsoleInterface::postMessage( "Map: %s", 
GameConfig::getGameMapName() );
+                               ConsoleInterface::postMessage( "Players: 
%d/%d",        PlayerInterface::getActivePlayerCount(), 
GameConfig::GetNumberPlayers() );
+                               ConsoleInterface::postMessage( "Units: %d/%d",  
UnitInterface::getTotalUnitCount(), GameConfig::GetNumberUnits() );
+                               break;
+                       
+                       case SDLK_1 :
+                                       ChatInterface::setMessageScopeServer();
+                                       ChatInterface::sendCurrentMessage( 
"Server will restart in 5 minutes" );
+                                       break;
+
+                       case SDLK_2 :
+                                       ChatInterface::setMessageScopeServer();
+                                       ChatInterface::sendCurrentMessage( 
"Server is restarting" );
+                                       break;
+                               
+                       case SDLK_3 :
+                                       ChatInterface::setMessageScopeServer();
+                                       ChatInterface::sendCurrentMessage( 
"Server is rotating map" );
+                                       break;
+               } //switch
+       }//if
+}
 
 void   GameManager::startGameTimer()
  {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]