Changeset 7efed11 in network-game


Ignore:
Timestamp:
May 18, 2013, 6:42:59 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
c987d79
Parents:
d436ac4
Message:

Removed the draw method from the Player class to avoid an allegro dependency on the server

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    rd436ac4 r7efed11  
    564564      pos = mapToScreen(p->pos);
    565565
    566       p->draw(pos, p->id == curPlayerId);
     566      if (p->id == curPlayerId)
     567         al_draw_filled_circle(pos.x, pos.y, 12, al_map_rgb(255, 0, 0));
     568      else
     569         al_draw_filled_circle(pos.x, pos.y, 12, al_map_rgb(191, 0, 0));
     570
     571      if (o->hasBlueFlag)
     572         al_draw_filled_rectangle(pos.x+4, pos.y-18, pos.x+18, pos.y-4, al_map_rgb(0, 0, 255));
     573      else if(o->hasRedFlag)
     574         al_draw_filled_rectangle(pos.x+4, pos.y-18, pos.x+18, pos.y-4, al_map_rgb(255, 0, 0));
    567575   }
    568576}
  • common/Player.cpp

    rd436ac4 r7efed11  
    9191}
    9292
    93 void Player::draw(POSITION pos, bool curPlayer) {
    94    if (curPlayer)
    95       al_draw_filled_circle(pos.x, pos.y, 12, al_map_rgb(255, 0, 0));
    96    else
    97       al_draw_filled_circle(pos.x, pos.y, 12, al_map_rgb(191, 0, 0));
    98 
    99    if (this->hasBlueFlag)
    100       al_draw_filled_rectangle(pos.x+4, pos.y-18, pos.x+18, pos.y-4, al_map_rgb(0, 0, 255));
    101    else if(this->hasRedFlag)
    102       al_draw_filled_rectangle(pos.x+4, pos.y-18, pos.x+18, pos.y-4, al_map_rgb(255, 0, 0));
    103 }
    104 
    10593bool Player::move(WorldMap *map) {
    10694   int speed = 100; // pixels per second
  • common/Player.h

    rd436ac4 r7efed11  
    3232   void setAddr(sockaddr_in addr);
    3333
    34    void draw(POSITION pos, bool curPlayer);
    3534   bool move(WorldMap *map);
    3635
Note: See TracChangeset for help on using the changeset viewer.