Changeset 4c00935 in network-game for client/Client/main.cpp
- Timestamp:
- Jul 19, 2014, 12:35:29 AM (10 years ago)
- Branches:
- master
- Children:
- 81c4e8a
- Parents:
- 53643ca
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
r53643ca r4c00935 142 142 Player* currentPlayer; 143 143 144 int honorPoints; 145 int numGames; 144 int honorPoints, wins, losses, numGames; 146 145 int** gameHistory; 147 146 … … 166 165 167 166 honorPoints = 0; 167 wins = 0; 168 losses = 0; 168 169 numGames = 0; 169 170 gameHistory = NULL; … … 450 451 oss.str(""); 451 452 453 oss << "Wins: " << wins << endl; 454 al_draw_text(font, al_map_rgb(0, 255, 0), 65, 105, ALLEGRO_ALIGN_LEFT, oss.str().c_str()); 455 oss.clear(); 456 oss.str(""); 457 458 oss << "Loses: " << losses << endl; 459 al_draw_text(font, al_map_rgb(0, 255, 0), 65, 120, ALLEGRO_ALIGN_LEFT, oss.str().c_str()); 460 oss.clear(); 461 oss.str(""); 462 452 463 // display records of the last 10 games 453 464 for (int i=0; i<numGames; i++) { … … 458 469 oss << "VICTORY" << endl; 459 470 460 al_draw_text(font, al_map_rgb(0, 255, 0), 142, 1 60+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str());471 al_draw_text(font, al_map_rgb(0, 255, 0), 142, 190+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str()); 461 472 oss.clear(); 462 473 oss.str(""); 463 474 464 475 oss << gameHistory[i][2] << endl; 465 al_draw_text(font, al_map_rgb(0, 255, 0), 302, 1 60+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str());476 al_draw_text(font, al_map_rgb(0, 255, 0), 302, 190+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str()); 466 477 oss.clear(); 467 478 oss.str(""); 468 479 469 480 oss << gameHistory[i][3] << endl; 470 al_draw_text(font, al_map_rgb(0, 255, 0), 462, 1 60+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str());481 al_draw_text(font, al_map_rgb(0, 255, 0), 462, 190+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str()); 471 482 oss.clear(); 472 483 oss.str(""); 473 484 474 485 oss << "6/11/2014, 5:12 PM" << endl; 475 al_draw_text(font, al_map_rgb(0, 255, 0), 622, 1 60+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str());486 al_draw_text(font, al_map_rgb(0, 255, 0), 622, 190+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str()); 476 487 oss.clear(); 477 488 oss.str(""); … … 758 769 wndProfile = new Window(0, 0, SCREEN_W, SCREEN_H); 759 770 vctComponents.push_back(wndProfile->addComponent(new TextLabel(450, 40, 124, 20, font, "Profile", ALLEGRO_ALIGN_CENTRE))); 760 vctComponents.push_back(wndProfile->addComponent(new TextLabel(160, 1 20, 124, 20, font, "Game History", ALLEGRO_ALIGN_CENTRE)));761 vctComponents.push_back(wndProfile->addComponent(new TextLabel(600, 1 60, 124, 20, font, "Time", ALLEGRO_ALIGN_CENTRE)));762 vctComponents.push_back(wndProfile->addComponent(new TextLabel(80, 1 60, 124, 20, font, "Result", ALLEGRO_ALIGN_CENTRE)));763 vctComponents.push_back(wndProfile->addComponent(new TextLabel(240, 1 60, 124, 20, font, "Blue Score", ALLEGRO_ALIGN_CENTRE)));764 vctComponents.push_back(wndProfile->addComponent(new TextLabel(400, 1 60, 124, 20, font, "Red Score", ALLEGRO_ALIGN_CENTRE)));765 vctComponents.push_back(wndProfile->addComponent(new TextLabel(560, 1 60, 124, 20, font, "Time", ALLEGRO_ALIGN_CENTRE)));771 vctComponents.push_back(wndProfile->addComponent(new TextLabel(160, 150, 124, 20, font, "Game History", ALLEGRO_ALIGN_CENTRE))); 772 vctComponents.push_back(wndProfile->addComponent(new TextLabel(600, 190, 124, 20, font, "Time", ALLEGRO_ALIGN_CENTRE))); 773 vctComponents.push_back(wndProfile->addComponent(new TextLabel(80, 190, 124, 20, font, "Result", ALLEGRO_ALIGN_CENTRE))); 774 vctComponents.push_back(wndProfile->addComponent(new TextLabel(240, 190, 124, 20, font, "Blue Score", ALLEGRO_ALIGN_CENTRE))); 775 vctComponents.push_back(wndProfile->addComponent(new TextLabel(400, 190, 124, 20, font, "Red Score", ALLEGRO_ALIGN_CENTRE))); 776 vctComponents.push_back(wndProfile->addComponent(new TextLabel(560, 190, 124, 20, font, "Time", ALLEGRO_ALIGN_CENTRE))); 766 777 vctComponents.push_back(wndProfile->addComponent(new Button(920, 738, 80, 20, font, "Back", goToLobbyScreen))); 767 778 … … 903 914 { 904 915 memcpy(&honorPoints, msg.buffer, 4); 905 memcpy(&numGames, msg.buffer+4, 4); 916 memcpy(&wins, msg.buffer+4, 4); 917 memcpy(&losses, msg.buffer+8, 4); 918 memcpy(&numGames, msg.buffer+12, 4); 906 919 907 920 cout << "Got records for " << numGames << " games." << endl; … … 911 924 cout << endl << "game record " << (i+1) << endl; 912 925 913 memcpy(&gameHistory[i][0], msg.buffer+ 8+i*16, 4);914 memcpy(&gameHistory[i][1], msg.buffer+ 12+i*16, 4);915 memcpy(&gameHistory[i][2], msg.buffer+ 16+i*16, 4);916 memcpy(&gameHistory[i][3], msg.buffer+2 0+i*16, 4);926 memcpy(&gameHistory[i][0], msg.buffer+16+i*16, 4); 927 memcpy(&gameHistory[i][1], msg.buffer+20+i*16, 4); 928 memcpy(&gameHistory[i][2], msg.buffer+24+i*16, 4); 929 memcpy(&gameHistory[i][3], msg.buffer+28+i*16, 4); 917 930 918 931 cout << "result: " << gameHistory[i][0] << endl; … … 1460 1473 msgTo.type = MSG_TYPE_PROFILE; 1461 1474 1475 unsigned int playerId = currentPlayer->getId(); 1476 memcpy(msgTo.buffer, &playerId, 4); 1462 1477 msgProcessor.sendMessage(&msgTo, &server); 1463 1478 }
Note:
See TracChangeset
for help on using the changeset viewer.