| 1 |
// { dg-do compile } |
| 2 |
|
| 3 |
extern "C"{ |
| 4 |
float sqrtf(float); |
| 5 |
} |
| 6 |
|
| 7 |
inline float squareroot(const float f) |
| 8 |
{ |
| 9 |
return sqrtf(f); |
| 10 |
} |
| 11 |
|
| 12 |
inline int squareroot(const int f) |
| 13 |
{ |
| 14 |
return static_cast<int>(sqrtf(static_cast<float>(f))); |
| 15 |
} |
| 16 |
|
| 17 |
template <class T> |
| 18 |
class vector2d |
| 19 |
{ |
| 20 |
public: |
| 21 |
vector2d(T nx, T ny) : X(nx), Y(ny) {} |
| 22 |
T getLength() const { return squareroot( X*X + Y*Y ); } |
| 23 |
T X; |
| 24 |
T Y; |
| 25 |
}; |
| 26 |
|
| 27 |
vector2d<int> getMousePos(); |
| 28 |
|
| 29 |
class Client |
| 30 |
{ |
| 31 |
public: |
| 32 |
Client(); |
| 33 |
~Client(); |
| 34 |
}; |
| 35 |
|
| 36 |
void the_game(float turn_amount) |
| 37 |
{ |
| 38 |
Client client; |
| 39 |
bool first = true; |
| 40 |
|
| 41 |
while (1) { |
| 42 |
if (first) { |
| 43 |
first = false; |
| 44 |
} else { |
| 45 |
int dx = getMousePos().X; |
| 46 |
int dy = getMousePos().Y; |
| 47 |
|
| 48 |
turn_amount = vector2d<float>(dx, dy).getLength(); |
| 49 |
} |
| 50 |
} |
| 51 |
} |