Changeset b07eeac in network-game for common/Common.cpp
- Timestamp:
- May 25, 2013, 1:45:54 AM (12 years ago)
- Branches:
- master
- Children:
- 2df63d6
- Parents:
- b81cea1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Common.cpp
rb81cea1 rb07eeac 2 2 3 3 #include <iostream> 4 using namespace std; 4 #include <cmath> 5 5 6 6 #if defined WINDOWS … … 9 9 #include <time.h> 10 10 #endif 11 12 using namespace std; 13 14 /* 15 FLOAT_POSITION POSITION::toFloat() { 16 FLOAT_POSITION floatPosition; 17 floatPosition.x = x; 18 floatPosition.y = y; 19 20 return floatPosition; 21 } 22 */ 11 23 12 24 void set_nonblock(int sock) … … 38 50 return numMilliseconds; 39 51 } 52 53 float posDistance(FLOAT_POSITION pos1, FLOAT_POSITION pos2) { 54 float xDiff = pos2.x - pos1.x; 55 float yDiff = pos2.y - pos1.y; 56 57 return sqrt( pow(xDiff,2) + pow(yDiff,2) ); 58 }
Note:
See TracChangeset
for help on using the changeset viewer.