Changeset fef7c69 in network-game for client/Client
- Timestamp:
- Dec 19, 2013, 3:34:50 AM (11 years ago)
- Branches:
- master
- Children:
- 402cf86
- Parents:
- 0129700
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
r0129700 rfef7c69 399 399 wndCurrent = wndGame; 400 400 } 401 }else if(wndCurrent == wndGame ) {401 }else if(wndCurrent == wndGame || wndCurrent == wndNewGame) { 402 402 if (ev.mouse.button == 1) { // left click 403 403 msgTo.type = MSG_TYPE_PLAYER_MOVE; … … 500 500 al_draw_text(font, al_map_rgb(0, 255, 0), 515, 80, ALLEGRO_ALIGN_LEFT, ossScoreRed.str().c_str()); 501 501 502 // update players 503 for (it = game->getPlayers().begin(); it != game->getPlayers().end(); it++) 504 { 505 it->second->updateTarget(game->getPlayers()); 506 } 507 508 for (it = game->getPlayers().begin(); it != game->getPlayers().end(); it++) 509 { 510 it->second->move(game->getMap()); // ignore return value 511 } 512 502 513 GameRender::drawMap(game->getMap()); 503 514 GameRender::drawPlayers(game->getPlayers(), font, curPlayerId); … … 982 993 983 994 game->addPlayer(mapPlayers[p.id]); 995 996 break; 997 } 998 case MSG_TYPE_PLAYER_MOVE: 999 { 1000 cout << "Received PLAYER_MOVE message" << endl; 1001 1002 unsigned int id; 1003 int x, y; 1004 1005 memcpy(&id, msg.buffer, 4); 1006 memcpy(&x, msg.buffer+4, 4); 1007 memcpy(&y, msg.buffer+8, 4); 1008 1009 cout << "id: " << id << endl; 1010 1011 mapPlayers[id]->target.x = x; 1012 mapPlayers[id]->target.y = y; 984 1013 985 1014 break;
Note:
See TracChangeset
for help on using the changeset viewer.