Changeset 1f1eb58 in network-game for client/Client


Ignore:
Timestamp:
Jul 14, 2013, 4:11:25 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
5a64bea
Parents:
1a3c42d
Message:

Added a client release build that uses the release version of allegro

Location:
client/Client
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • client/Client/Client.vcxproj

    r1a3c42d r1f1eb58  
    5656      <FunctionLevelLinking>true</FunctionLevelLinking>
    5757      <IntrinsicFunctions>true</IntrinsicFunctions>
     58      <AdditionalIncludeDirectories>c:\allegro\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    5859    </ClCompile>
    5960    <Link>
     
    6162      <EnableCOMDATFolding>true</EnableCOMDATFolding>
    6263      <OptimizeReferences>true</OptimizeReferences>
     64      <AdditionalLibraryDirectories>c:\allegro\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     65      <AdditionalDependencies>allegro-5.0.8-monolith-md.lib;%(AdditionalDependencies)</AdditionalDependencies>
    6366    </Link>
    6467  </ItemDefinitionGroup>
  • client/Client/Client.vcxproj.user

    r1a3c42d r1f1eb58  
    66    <LocalDebuggerEnvironment>PATH=c:\allegro\bin;%PATH%</LocalDebuggerEnvironment>
    77  </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>
    816</Project>
  • client/Client/main.cpp

    r1a3c42d r1f1eb58  
    5252POSITION screenToMap(POSITION pos);
    5353POSITION mapToScreen(POSITION pos);
     54int getRefreshRate(int width, int height);
    5455
    5556// callbacks
     
    100101string username;
    101102chat chatConsole;
    102  
     103
    103104int main(int argc, char **argv)
    104105{
     
    113114   unsigned int curPlayerId = -1;
    114115   int scoreBlue, scoreRed;
     116   bool fullscreen = false;
    115117
    116118   scoreBlue = 0;
     
    160162   }
    161163 
    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);
    163171   if(!display) {
    164172      fprintf(stderr, "failed to create display!\n");
     
    446454   return 0;
    447455}
     456
     457
    448458
    449459// need to make a function like this that works on windows
     
    550560
    551561                  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;
    553564                  cout << "map size: " << mapPlayers.size() << endl;
    554565               }
     
    611622            case MSG_TYPE_PLAYER:
    612623            {
     624               cout << "Received MSG_TYPE_PLAYER" << endl;
     625
    613626               Player p("", "");
    614627               p.deserialize(msg.buffer);
     
    620633                  p.isDead = false;
    621634
     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;
    622638               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;
    623642
    624643               break;
     
    956975   sendMessage(&msgTo, sock, &server);
    957976}
     977
     978int 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.