Changeset 0693e25 in network-game for common/Common.cpp


Ignore:
Timestamp:
Sep 28, 2013, 2:11:19 AM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
6319311
Parents:
3ef8cf4
Message:

The client draws the map and players in individual games

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/Common.cpp

    r3ef8cf4 r0693e25  
    1111
    1212using namespace std;
     13
     14FLOAT_POSITION POSITION::toFloat() {
     15   FLOAT_POSITION floatPosition;
     16   floatPosition.x = x;
     17   floatPosition.y = y;
     18
     19   return floatPosition;
     20}
     21
     22POSITION FLOAT_POSITION::toInt() {
     23   POSITION position;
     24   position.x = x;
     25   position.y = y;
     26
     27   return position;
     28}
    1329
    1430void set_nonblock(int sock)
     
    5874   return sqrt( pow(xDiff,2) + pow(yDiff,2) );   
    5975}
     76
     77POSITION 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
     91POSITION 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.