Changeset e5697b1 in network-game for client/Client/GameRender.cpp
- Timestamp:
- Jan 19, 2014, 8:02:22 PM (11 years ago)
- Branches:
- master
- Children:
- 1f6233e
- Parents:
- d05c484
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/GameRender.cpp
rd05c484 re5697b1 2 2 3 3 #include <allegro5/allegro_primitives.h> 4 5 #include "../../common/Common.h" 4 6 5 7 void GameRender::drawMap(WorldMap* gameMap) … … 113 115 } 114 116 } 117 118 void GameRender::drawProjectiles(map<unsigned int, Projectile>& mapProjectiles, map<unsigned int, Player*>& mapPlayers) 119 { 120 map<unsigned int, Projectile>::iterator it; 121 for (it = mapProjectiles.begin(); it != mapProjectiles.end(); it++) 122 { 123 Projectile proj = it->second; 124 125 FLOAT_POSITION target = mapPlayers[proj.target]->pos; 126 float angle = atan2(target.y-proj.pos.toFloat().y, target.x-proj.pos.toFloat().x); 127 128 POSITION start, end; 129 start.x = cos(angle)*15+proj.pos.x; 130 start.y = sin(angle)*15+proj.pos.y; 131 end.x = proj.pos.x; 132 end.y = proj.pos.y; 133 134 start = mapToScreen(start); 135 end = mapToScreen(end); 136 137 al_draw_line(start.x, start.y, end.x, end.y, al_map_rgb(0, 0, 0), 4); 138 } 139 }
Note:
See TracChangeset
for help on using the changeset viewer.