Changeset 1f1eb58 in network-game
- Timestamp:
- Jul 14, 2013, 4:11:25 PM (12 years ago)
- Branches:
- master
- Children:
- 5a64bea
- Parents:
- 1a3c42d
- Location:
- client
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
client/.gitignore
r1a3c42d r1f1eb58 1 1 Debug/ 2 Release/ 2 3 ipch/ 3 4 Client.suo -
client/Client/Client.vcxproj
r1a3c42d r1f1eb58 56 56 <FunctionLevelLinking>true</FunctionLevelLinking> 57 57 <IntrinsicFunctions>true</IntrinsicFunctions> 58 <AdditionalIncludeDirectories>c:\allegro\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 58 59 </ClCompile> 59 60 <Link> … … 61 62 <EnableCOMDATFolding>true</EnableCOMDATFolding> 62 63 <OptimizeReferences>true</OptimizeReferences> 64 <AdditionalLibraryDirectories>c:\allegro\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> 65 <AdditionalDependencies>allegro-5.0.8-monolith-md.lib;%(AdditionalDependencies)</AdditionalDependencies> 63 66 </Link> 64 67 </ItemDefinitionGroup> -
client/Client/Client.vcxproj.user
r1a3c42d r1f1eb58 6 6 <LocalDebuggerEnvironment>PATH=c:\allegro\bin;%PATH%</LocalDebuggerEnvironment> 7 7 </PropertyGroup> 8 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 9 <LocalDebuggerCommandArguments>medievaltech.com 10000</LocalDebuggerCommandArguments> 10 </PropertyGroup> 11 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 12 <LocalDebuggerEnvironment>PATH=c:\allegro\bin;%PATH% 13 $(LocalDebuggerEnvironment)</LocalDebuggerEnvironment> 14 <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> 15 </PropertyGroup> 8 16 </Project> -
client/Client/main.cpp
r1a3c42d r1f1eb58 52 52 POSITION screenToMap(POSITION pos); 53 53 POSITION mapToScreen(POSITION pos); 54 int getRefreshRate(int width, int height); 54 55 55 56 // callbacks … … 100 101 string username; 101 102 chat chatConsole; 102 103 103 104 int main(int argc, char **argv) 104 105 { … … 113 114 unsigned int curPlayerId = -1; 114 115 int scoreBlue, scoreRed; 116 bool fullscreen = false; 115 117 116 118 scoreBlue = 0; … … 160 162 } 161 163 162 display = al_create_display(SCREEN_W, SCREEN_H); 164 int refreshRate = getRefreshRate(SCREEN_W, SCREEN_H); 165 // if the computer doesn't support this resolution, just use windowed mode 166 if (refreshRate > 0 && fullscreen) { 167 al_set_new_display_flags(ALLEGRO_FULLSCREEN); 168 al_set_new_display_refresh_rate(refreshRate); 169 } 170 display = al_create_display(SCREEN_W, SCREEN_H); 163 171 if(!display) { 164 172 fprintf(stderr, "failed to create display!\n"); … … 446 454 return 0; 447 455 } 456 457 448 458 449 459 // need to make a function like this that works on windows … … 550 560 551 561 cout << "Got a valid login response with the player" << endl; 552 cout << "Player id: " << curPlayerId << endl; 562 cout << "Player id: " << curPlayerId << endl; 563 cout << "Player health: " << p.health << endl; 553 564 cout << "map size: " << mapPlayers.size() << endl; 554 565 } … … 611 622 case MSG_TYPE_PLAYER: 612 623 { 624 cout << "Received MSG_TYPE_PLAYER" << endl; 625 613 626 Player p("", ""); 614 627 p.deserialize(msg.buffer); … … 620 633 p.isDead = false; 621 634 635 cout << mapPlayers[p.id].pos.x << ", " << mapPlayers[p.id].pos.y << endl; 636 cout << "health:" << mapPlayers[p.id].health << endl; 637 cout << "is dead?:" << mapPlayers[p.id].isDead << endl; 622 638 mapPlayers[p.id] = p; 639 cout << mapPlayers[p.id].pos.x << ", " << mapPlayers[p.id].pos.y << endl; 640 cout << "health:" << mapPlayers[p.id].health << endl; 641 cout << "is dead?:" << mapPlayers[p.id].isDead << endl; 623 642 624 643 break; … … 956 975 sendMessage(&msgTo, sock, &server); 957 976 } 977 978 int getRefreshRate(int width, int height) { 979 int numRefreshRates = al_get_num_display_modes(); 980 ALLEGRO_DISPLAY_MODE displayMode; 981 982 for(int i=0; i<numRefreshRates; i++) { 983 al_get_display_mode(i, &displayMode); 984 985 if (displayMode.width == width && displayMode.height == height) 986 return displayMode.refresh_rate; 987 } 988 989 return 0; 990 }
Note:
See TracChangeset
for help on using the changeset viewer.