Changeset 03ba5e3 in network-game
- Timestamp:
- Sep 27, 2013, 7:31:17 PM (11 years ago)
- Branches:
- master
- Children:
- ab8fd40
- Parents:
- a6fe73d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
ra6fe73d r03ba5e3 70 70 void joinGame(); 71 71 void createGame(); 72 void leaveGame(); 72 73 73 74 void error(const char *); … … 92 93 Window* wndLobby; 93 94 Window* wndGame; 95 Window* wndNewGame; 94 96 Window* wndGameDebug; 95 97 Window* wndCurrent; … … 280 282 cout << "Created game screen" << endl; 281 283 284 wndNewGame = new Window(0, 0, SCREEN_W, SCREEN_H); 285 wndNewGame->addComponent(new Button(880, 10, 120, 20, font, "Leave Game", leaveGame)); 286 287 cout << "Created new game screen" << endl; 288 282 289 goToLoginScreen(); 283 290 … … 467 474 } 468 475 } 476 else if (wndCurrent == wndNewGame) 477 { 478 ostringstream ossScoreBlue, ossScoreRed; 479 480 ossScoreBlue << "Blue: " << game->getBlueScore() << endl; 481 ossScoreRed << "Red: " << game->getRedScore() << endl; 482 483 al_draw_text(font, al_map_rgb(0, 255, 0), 330, 80, ALLEGRO_ALIGN_LEFT, ossScoreBlue.str().c_str()); 484 al_draw_text(font, al_map_rgb(0, 255, 0), 515, 80, ALLEGRO_ALIGN_LEFT, ossScoreRed.str().c_str()); 485 } 469 486 else if (wndCurrent == wndGame) 470 487 { … … 852 869 cout << "Received a JOIN_GAME_SUCCESS message" << endl; 853 870 854 string gameName(msg.buffer); 855 871 string gameName(msg.buffer); 872 game = new Game(gameName, "../../data/map.txt"); 856 873 cout << "Game name: " << gameName << endl; 857 858 game = new Game(gameName, "../../data/map.txt"); 859 860 /* 874 861 875 state = STATE_NEW_GAME; 876 wndCurrent = wndNewGame; 862 877 863 878 msgTo.type = MSG_TYPE_JOIN_GAME_ACK; … … 865 880 866 881 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog); 867 */868 882 869 883 break; … … 1299 1313 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog); 1300 1314 } 1315 1316 void leaveGame() 1317 { 1318 cout << "Leaving game" << endl; 1319 1320 game = NULL; 1321 1322 state = STATE_LOBBY; 1323 wndCurrent = wndLobby; 1324 1325 msgTo.type = MSG_TYPE_LEAVE_GAME; 1326 1327 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog); 1328 }
Note:
See TracChangeset
for help on using the changeset viewer.