Changeset 0693e25 in network-game for common/Common.cpp
- Timestamp:
- Sep 28, 2013, 2:11:19 AM (11 years ago)
- Branches:
- master
- Children:
- 6319311
- Parents:
- 3ef8cf4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Common.cpp
r3ef8cf4 r0693e25 11 11 12 12 using namespace std; 13 14 FLOAT_POSITION POSITION::toFloat() { 15 FLOAT_POSITION floatPosition; 16 floatPosition.x = x; 17 floatPosition.y = y; 18 19 return floatPosition; 20 } 21 22 POSITION FLOAT_POSITION::toInt() { 23 POSITION position; 24 position.x = x; 25 position.y = y; 26 27 return position; 28 } 13 29 14 30 void set_nonblock(int sock) … … 58 74 return sqrt( pow(xDiff,2) + pow(yDiff,2) ); 59 75 } 76 77 POSITION screenToMap(POSITION pos) 78 { 79 pos.x = pos.x-300; 80 pos.y = pos.y-100; 81 82 if (pos.x < 0 || pos.y < 0) 83 { 84 pos.x = -1; 85 pos.y = -1; 86 } 87 88 return pos; 89 } 90 91 POSITION mapToScreen(POSITION pos) 92 { 93 pos.x = pos.x+300; 94 pos.y = pos.y+100; 95 96 return pos; 97 }
Note:
See TracChangeset
for help on using the changeset viewer.