Changeset 0693e25 in network-game for client/Client


Ignore:
Timestamp:
Sep 28, 2013, 2:11:19 AM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
6319311
Parents:
3ef8cf4
Message:

The client draws the map and players in individual games

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    r3ef8cf4 r0693e25  
    5454void drawMap(WorldMap* gameMap);
    5555void drawPlayers(map<unsigned int, Player>& mapPlayers, ALLEGRO_FONT* font, unsigned int curPlayerId);
    56 POSITION screenToMap(POSITION pos);
    57 POSITION mapToScreen(POSITION pos);
    5856int getRefreshRate(int width, int height);
    5957void drawMessageStatus(ALLEGRO_FONT* font);
     
    483481            al_draw_text(font, al_map_rgb(0, 255, 0), 330, 80, ALLEGRO_ALIGN_LEFT, ossScoreBlue.str().c_str());
    484482            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);
    485486         }
    486487         else if (wndCurrent == wndGame)
     
    613614   WSACleanup();
    614615#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;
    646616}
    647617
     
    10491019         continue;
    10501020
    1051       pos = mapToScreen(p->pos);
     1021      pos = mapToScreen(p->pos.toInt());
    10521022
    10531023      if (p->id == curPlayerId)
     
    10831053      // draw player health
    10841054      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));
    10871057
    10881058      if (p->hasBlueFlag)
Note: See TracChangeset for help on using the changeset viewer.