|
@ -67,6 +67,8 @@ BOOST_FUSION_ADAPT_STRUCT( |
|
|
std::vector<User*> people_online; |
|
|
std::vector<User*> people_online; |
|
|
|
|
|
|
|
|
inline void update_positions(){ |
|
|
inline void update_positions(){ |
|
|
|
|
|
const float speed = 0.4; |
|
|
|
|
|
|
|
|
typedef std::chrono::duration<double, std::ratio<1,1>> fseconds; |
|
|
typedef std::chrono::duration<double, std::ratio<1,1>> fseconds; |
|
|
static auto start = std::chrono::steady_clock::now(); |
|
|
static auto start = std::chrono::steady_clock::now(); |
|
|
auto end = std::chrono::steady_clock::now(); |
|
|
auto end = std::chrono::steady_clock::now(); |
|
@ -76,11 +78,11 @@ inline void update_positions(){ |
|
|
auto n = people_online.size(); |
|
|
auto n = people_online.size(); |
|
|
for(int i = 0; i < n; ++i){ |
|
|
for(int i = 0; i < n; ++i){ |
|
|
User& user = *people_online[i]; |
|
|
User& user = *people_online[i]; |
|
|
double x = cos(0.1 * time + 2*M_PI*i/double(n)); |
|
|
double x = cos(speed * time + 2*M_PI*i/double(n)); |
|
|
double y = sin(0.1 * time + 2*M_PI*i/double(n)); |
|
|
double y = sin(speed * time + 2*M_PI*i/double(n)); |
|
|
|
|
|
|
|
|
user.position.x = 200 + 180*x; |
|
|
user.position.x = 200 + 200*x; |
|
|
user.position.y = 200 + 180*y; |
|
|
user.position.y = 200 + 200*y; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|