Advertisement
igromanru

Draw Player To Radar

Jul 7th, 2013
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. float focusX = ((pPlayer1->o.x - pPlayer1->o.x) / 2) * -1 + (RADAR_SIZE / 2);
  2. float focusY = ((pPlayer1->o.y - pPlayer1->o.y) / 2) + (RADAR_SIZE / 2);
  3.  
  4. float tmpX = ((pPlayer1->o.x - pPlayer->o.x) / 5) + (RADAR_SIZE / 2);
  5. float tmpY = ((pPlayer1->o.y - pPlayer->o.y) / 5) * -1 + (RADAR_SIZE / 2);
  6.            
  7. tmpX -= focusX;
  8. tmpY -= focusY;
  9.  
  10. float cosY = (float)cos((double)RadianToDegree((double)pPlayer1->yaw));
  11. float sinY = (float)sin((double)RadianToDegree((double)pPlayer1->yaw));
  12.  
  13. float x = (tmpY * cosY - tmpX * sinY) * -1 + (RADAR_SIZE / 2);
  14. float y = tmpX * cosY + tmpY * sinY + (RADAR_SIZE / 2);
  15.  
  16. renderer->Fill(position.X + x, position.Y + y, 5, 5 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement