Changeset e6c26b8 in network-game for client/Client/GameRender.cpp
- Timestamp:
- Oct 1, 2013, 8:08:24 PM (12 years ago)
- Branches:
- master
- Children:
- 95ffe57
- Parents:
- 373089e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/GameRender.cpp
r373089e re6c26b8 52 52 } 53 53 } 54 }55 }56 57 void GameRender::drawPlayers(map<unsigned int, Player>& mapPlayers, ALLEGRO_FONT* font, unsigned int curPlayerId)58 {59 map<unsigned int, Player>::iterator it;60 61 Player* p;62 POSITION pos;63 ALLEGRO_COLOR color;64 65 for(it = mapPlayers.begin(); it != mapPlayers.end(); it++)66 {67 p = &it->second;68 69 if (p->isDead)70 continue;71 72 pos = mapToScreen(p->pos.toInt());73 74 if (p->id == curPlayerId)75 al_draw_filled_circle(pos.x, pos.y, 14, al_map_rgb(0, 0, 0));76 77 if (p->team == 0)78 color = al_map_rgb(0, 0, 255);79 else if (p->team == 1)80 color = al_map_rgb(255, 0, 0);81 82 al_draw_filled_circle(pos.x, pos.y, 12, color);83 84 // draw player class85 int fontHeight = al_get_font_line_height(font);86 87 string strClass;88 switch (p->playerClass) {89 case Player::CLASS_WARRIOR:90 strClass = "W";91 break;92 case Player::CLASS_RANGER:93 strClass = "R";94 break;95 case Player::CLASS_NONE:96 strClass = "";97 break;98 default:99 strClass = "";100 break;101 }102 al_draw_text(font, al_map_rgb(0, 0, 0), pos.x, pos.y-fontHeight/2, ALLEGRO_ALIGN_CENTRE, strClass.c_str());103 104 // draw player health105 al_draw_filled_rectangle(pos.x-12, pos.y-24, pos.x+12, pos.y-16, al_map_rgb(0, 0, 0));106 if (p->maxHealth != 0)107 al_draw_filled_rectangle(pos.x-11, pos.y-23, pos.x-11+(22*p->health)/p->maxHealth, pos.y-17, al_map_rgb(255, 0, 0));108 109 if (p->hasBlueFlag)110 al_draw_filled_rectangle(pos.x+4, pos.y-18, pos.x+18, pos.y-4, al_map_rgb(0, 0, 255));111 else if (p->hasRedFlag)112 al_draw_filled_rectangle(pos.x+4, pos.y-18, pos.x+18, pos.y-4, al_map_rgb(255, 0, 0));113 54 } 114 55 }
Note:
See TracChangeset
for help on using the changeset viewer.