Changeset d09fe76 in network-game for client/Client
- Timestamp:
- May 26, 2013, 8:20:49 PM (12 years ago)
- Branches:
- master
- Children:
- 46fa35a
- Parents:
- 07c73fa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
r07c73fa rd09fe76 49 49 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player>& mapPlayers, unsigned int& curPlayerId, int &scoreBlue, int &scoreRed); 50 50 void drawMap(WorldMap* gameMap); 51 void drawPlayers(map<unsigned int, Player>& mapPlayers, unsigned int curPlayerId);51 void drawPlayers(map<unsigned int, Player>& mapPlayers, ALLEGRO_FONT* font, unsigned int curPlayerId); 52 52 POSITION screenToMap(POSITION pos); 53 53 POSITION mapToScreen(POSITION pos); … … 333 333 334 334 drawMap(gameMap); 335 drawPlayers(mapPlayers, curPlayerId);335 drawPlayers(mapPlayers, font, curPlayerId); 336 336 } 337 337 … … 664 664 } 665 665 666 void drawPlayers(map<unsigned int, Player>& mapPlayers, unsigned int curPlayerId)666 void drawPlayers(map<unsigned int, Player>& mapPlayers, ALLEGRO_FONT* font, unsigned int curPlayerId) 667 667 { 668 668 map<unsigned int, Player>::iterator it; … … 670 670 Player* p; 671 671 POSITION pos; 672 ALLEGRO_COLOR color; 672 673 673 674 for(it = mapPlayers.begin(); it != mapPlayers.end(); it++) … … 680 681 681 682 if (p->team == 0) 682 al_draw_filled_circle(pos.x, pos.y, 12, al_map_rgb(0, 0, 255));683 color = al_map_rgb(0, 0, 255); 683 684 else if (p->team == 1) 684 al_draw_filled_circle(pos.x, pos.y, 12, al_map_rgb(255, 0, 0)); 685 color = al_map_rgb(255, 0, 0); 686 687 al_draw_filled_circle(pos.x, pos.y, 12, color); 688 689 // draw player class 690 int fontHeight = al_get_font_line_height(font); 691 692 string strClass; 693 switch (p->playerClass) { 694 case Player::CLASS_WARRIOR: 695 strClass = "W"; 696 break; 697 case Player::CLASS_RANGER: 698 strClass = "R"; 699 break; 700 case Player::CLASS_NONE: 701 strClass = ""; 702 break; 703 default: 704 strClass = ""; 705 break; 706 } 707 al_draw_text(font, al_map_rgb(0, 0, 0), pos.x, pos.y-fontHeight/2, ALLEGRO_ALIGN_CENTRE, strClass.c_str()); 708 709 // draw player health 710 al_draw_filled_rectangle(pos.x-12, pos.y-24, pos.x+12, pos.y-16, al_map_rgb(0, 0, 0)); 711 if (it->second.maxHealth != 0) 712 al_draw_filled_rectangle(pos.x-11, pos.y-19, pos.x-11+(22*it->second.health)/it->second.maxHealth, pos.y-15, al_map_rgb(255, 0, 0)); 685 713 686 714 if (p->hasBlueFlag)
Note:
See TracChangeset
for help on using the changeset viewer.