Changeset 0693e25 in network-game for client/Client
- Timestamp:
- Sep 28, 2013, 2:11:19 AM (11 years ago)
- Branches:
- master
- Children:
- 6319311
- Parents:
- 3ef8cf4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
r3ef8cf4 r0693e25 54 54 void drawMap(WorldMap* gameMap); 55 55 void drawPlayers(map<unsigned int, Player>& mapPlayers, ALLEGRO_FONT* font, unsigned int curPlayerId); 56 POSITION screenToMap(POSITION pos);57 POSITION mapToScreen(POSITION pos);58 56 int getRefreshRate(int width, int height); 59 57 void drawMessageStatus(ALLEGRO_FONT* font); … … 483 481 al_draw_text(font, al_map_rgb(0, 255, 0), 330, 80, ALLEGRO_ALIGN_LEFT, ossScoreBlue.str().c_str()); 484 482 al_draw_text(font, al_map_rgb(0, 255, 0), 515, 80, ALLEGRO_ALIGN_LEFT, ossScoreRed.str().c_str()); 483 484 drawMap(game->getMap()); 485 game->drawPlayers(font, curPlayerId); 485 486 } 486 487 else if (wndCurrent == wndGame) … … 613 614 WSACleanup(); 614 615 #endif 615 }616 617 POSITION screenToMap(POSITION pos)618 {619 pos.x = pos.x-300;620 pos.y = pos.y-100;621 622 if (pos.x < 0 || pos.y < 0)623 {624 pos.x = -1;625 pos.y = -1;626 }627 628 return pos;629 }630 631 POSITION mapToScreen(POSITION pos)632 {633 pos.x = pos.x+300;634 pos.y = pos.y+100;635 636 return pos;637 }638 639 POSITION mapToScreen(FLOAT_POSITION pos)640 {641 POSITION p;642 p.x = pos.x+300;643 p.y = pos.y+100;644 645 return p;646 616 } 647 617 … … 1049 1019 continue; 1050 1020 1051 pos = mapToScreen(p->pos );1021 pos = mapToScreen(p->pos.toInt()); 1052 1022 1053 1023 if (p->id == curPlayerId) … … 1083 1053 // draw player health 1084 1054 al_draw_filled_rectangle(pos.x-12, pos.y-24, pos.x+12, pos.y-16, al_map_rgb(0, 0, 0)); 1085 if ( it->second.maxHealth != 0)1086 al_draw_filled_rectangle(pos.x-11, pos.y-23, pos.x-11+(22* it->second.health)/it->second.maxHealth, pos.y-17, al_map_rgb(255, 0, 0));1055 if (p->maxHealth != 0) 1056 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)); 1087 1057 1088 1058 if (p->hasBlueFlag)
Note:
See TracChangeset
for help on using the changeset viewer.