Advertisement
Benjamin_Loison

void sendPosition()

Jul 2nd, 2018
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. void sendPosition()
  2. {
  3.     User* user = getUser(USERNAME);
  4.     Position posTmp(1, 1, 1);
  5.     ViewAngle viewAngleTmp(0, 0);
  6.     while(connected)
  7.     {
  8.         View* view = user->getView();
  9.         Position pos = view->getPosition();
  10.         ViewAngle viewAngle = view->getViewAngle();
  11.         if(pos.getX() != posTmp.getX() && pos.getY() != posTmp.getY())
  12.         {
  13.             ostringstream oss;
  14.             oss << "MAJ User Pos " << USERNAME<< " " << pos.getX() << " " << pos.getY() << " " << pos.getZ();
  15.             sendStr(oss.str());
  16.             posTmp.updatePosition(pos);
  17.         }
  18.         if(viewAngle.getPhi() != viewAngleTmp.getPhi() && viewAngle.getTheta() != viewAngleTmp.getTheta())
  19.         {
  20.             ostringstream oss;
  21.             oss << "MAJ User ViewAngle " << USERNAME<< " " << viewAngle.getPhi() << " " << viewAngle.getTheta();
  22.             sendStr(oss.str());
  23.             viewAngle.updateViewAngle(viewAngleTmp);
  24.         }
  25.         SDL_Delay(17); // ~ 60 fps
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement