Changeset b4c5b6a in network-game for client/Client
- Timestamp:
- Dec 17, 2013, 12:44:38 AM (11 years ago)
- Branches:
- master
- Children:
- 3d6f78f
- Parents:
- 1a47469
- Location:
- client/Client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/GameRender.cpp
r1a47469 rb4c5b6a 63 63 ALLEGRO_COLOR color; 64 64 65 for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)65 for (it = mapPlayers.begin(); it != mapPlayers.end(); it++) 66 66 { 67 67 p = it->second; -
client/Client/main.cpp
r1a47469 rb4c5b6a 472 472 for (it = mapGames.begin(); it != mapGames.end(); it++) { 473 473 ossGame << it->first << " (" << it->second << " players)" << endl; 474 al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W*1/ 4-100, 120+i*15, ALLEGRO_ALIGN_LEFT, ossGame.str().c_str());474 al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W*1/2-100, 120+i*15, ALLEGRO_ALIGN_LEFT, ossGame.str().c_str()); 475 475 ossGame.clear(); 476 476 ossGame.str(""); … … 480 480 else if (wndCurrent == wndNewGame) 481 481 { 482 al_draw_text(font, al_map_rgb(0, 255, 0), 4, 4, ALLEGRO_ALIGN_LEFT, "Players"); 483 484 map<unsigned int, Player*>& gamePlayers = game->getPlayers(); 485 map<unsigned int, Player*>::iterator it; 486 487 int playerCount = 0; 488 for (it = gamePlayers.begin(); it != gamePlayers.end(); it++) 489 { 490 al_draw_text(font, al_map_rgb(0, 255, 0), 4, 19+(playerCount+1)*15, ALLEGRO_ALIGN_LEFT, it->second->name.c_str()); 491 playerCount++; 492 } 493 482 494 ostringstream ossScoreBlue, ossScoreRed; 483 495 … … 876 888 string gameName(msg.buffer); 877 889 game = new Game(gameName, "../../data/map.txt"); 890 game->addPlayer(mapPlayers[curPlayerId]); 878 891 cout << "Game name: " << gameName << endl; 879 892 … … 921 934 922 935 mapGames[gameName] = numPlayers; 936 937 break; 938 } 939 case MSG_TYPE_PLAYER: 940 { 941 cout << "Received MSG_TYPE_PLAYER" << endl; 942 943 Player* p = new Player("", ""); 944 p->deserialize(msg.buffer); 945 p->timeLastUpdated = getCurrentMillis(); 946 p->isChasing = false; 947 if (p->health <= 0) 948 p->isDead = true; 949 else 950 p->isDead = false; 951 952 if (mapPlayers.find(p->id) != mapPlayers.end()) 953 delete mapPlayers[p->id]; 954 mapPlayers[p->id] = p; 955 956 game->addPlayer(p); 923 957 924 958 break;
Note:
See TracChangeset
for help on using the changeset viewer.