Changeset 3ff2bd7 in network-game for client/Client
- Timestamp:
- Dec 27, 2013, 8:58:51 PM (11 years ago)
- Branches:
- master
- Children:
- 360c0f1
- Parents:
- 9bfc1cb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
r9bfc1cb r3ff2bd7 95 95 Window* wndLobby; 96 96 Window* wndLobbyDebug; 97 Window* wnd NewGame;97 Window* wndGame; 98 98 Window* wndGameSummary; 99 99 Window* wndCurrent; … … 287 287 cout << "Created debug lobby screen" << endl; 288 288 289 wnd NewGame = new Window(0, 0, SCREEN_W, SCREEN_H);290 vctComponents.push_back(wnd NewGame->addComponent(new Button(880, 10, 120, 20, font, "Leave Game", leaveGame)));289 wndGame = new Window(0, 0, SCREEN_W, SCREEN_H); 290 vctComponents.push_back(wndGame->addComponent(new Button(880, 10, 120, 20, font, "Leave Game", leaveGame))); 291 291 292 292 cout << "Created new game screen" << endl; … … 398 398 } 399 399 else if(ev.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) { 400 if(wndCurrent == wnd NewGame) {400 if(wndCurrent == wndGame) { 401 401 if (ev.mouse.button == 1) { // left click 402 402 msgTo.type = MSG_TYPE_PLAYER_MOVE; … … 439 439 cout << "Found valid target" << endl; 440 440 441 msgTo.type = MSG_TYPE_ START_ATTACK;441 msgTo.type = MSG_TYPE_ATTACK; 442 442 memcpy(msgTo.buffer, &curPlayerId, 4); 443 443 memcpy(msgTo.buffer+4, &target->id, 4); … … 479 479 } 480 480 } 481 else if (wndCurrent == wnd NewGame)481 else if (wndCurrent == wndGame) 482 482 { 483 483 al_draw_text(font, al_map_rgb(0, 255, 0), 4, 4, ALLEGRO_ALIGN_LEFT, "Players"); … … 486 486 map<unsigned int, Player*>::iterator it; 487 487 488 int playerCount = 0; 489 for (it = gamePlayers.begin(); it != gamePlayers.end(); it++) 490 { 491 al_draw_text(font, al_map_rgb(0, 255, 0), 4, 19+(playerCount+1)*15, ALLEGRO_ALIGN_LEFT, it->second->name.c_str()); 492 playerCount++; 488 if (!debugging) { 489 int playerCount = 0; 490 for (it = gamePlayers.begin(); it != gamePlayers.end(); it++) 491 { 492 al_draw_text(font, al_map_rgb(0, 255, 0), 4, 19+(playerCount+1)*15, ALLEGRO_ALIGN_LEFT, it->second->name.c_str()); 493 playerCount++; 494 } 493 495 } 494 496 … … 589 591 delete wndLobby; 590 592 delete wndLobbyDebug; 591 delete wnd NewGame;593 delete wndGame; 592 594 delete wndGameSummary; 593 595 … … 807 809 case MSG_TYPE_ATTACK: 808 810 { 809 cout << "Received ATTACK message" << endl;810 811 break;812 }813 case MSG_TYPE_START_ATTACK:814 {815 811 cout << "Received START_ATTACK message" << endl; 816 812 … … 889 885 890 886 state = STATE_GAME; 891 wndCurrent = wnd NewGame;887 wndCurrent = wndGame; 892 888 893 889 msgTo.type = MSG_TYPE_JOIN_GAME_ACK; … … 1086 1082 case MSG_TYPE_ATTACK: 1087 1083 { 1088 cout << "Received ATTACK message" << endl;1089 1090 break;1091 }1092 case MSG_TYPE_START_ATTACK:1093 {1094 1084 cout << "Received START_ATTACK message" << endl; 1095 1085 … … 1185 1175 al_draw_text(font, al_map_rgb(0, 255, 255), 240+clientMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "Acked?"); 1186 1176 1187 al_draw_text(font, al_map_rgb(0, 255, 255), serverMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "ID");1177 //al_draw_text(font, al_map_rgb(0, 255, 255), serverMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "ID"); 1188 1178 1189 1179 map<unsigned int, map<unsigned long, MessageContainer> >& sentMessages = msgProcessor.getSentMessages();
Note:
See TracChangeset
for help on using the changeset viewer.