source: network-game/common/Common.h@ d05086b

Last change on this file since d05086b was d05086b, checked in by dportnoy <dmp1488@…>, 11 years ago

Support for logging to a textfile

  • Property mode set to 100644
File size: 680 bytes
RevLine 
[3b1efcc]1#ifndef _COMMON_H
2#define _COMMON_H
3
[4c202e0]4#include "Compiler.h"
5
6#if defined WINDOWS
7 #include <winsock2.h>
8 #include <WS2tcpip.h>
9#elif defined LINUX
10 #include <fcntl.h>
11 #include <assert.h>
12#endif
[edfd1d0]13
[d05086b]14#include <string>
15
16using namespace std;
17
[b07eeac]18typedef struct
19{
20 float x;
21 float y;
22} FLOAT_POSITION;
[edfd1d0]23
24typedef struct
[3b1efcc]25{
[edfd1d0]26 int x;
27 int y;
[b07eeac]28 FLOAT_POSITION toFloat() {
29 FLOAT_POSITION floatPosition;
30 floatPosition.x = x;
31 floatPosition.y = y;
32
33 return floatPosition;
34 }
[62ee2ce]35} POSITION;
[3b1efcc]36
[b07eeac]37void set_nonblock(int sock);
38unsigned long long getCurrentMillis();
[d05086b]39string getCurrentDateTimeString();
[b07eeac]40float posDistance(FLOAT_POSITION pos1, FLOAT_POSITION pos2);
[60017fc]41
[3b1efcc]42#endif
Note: See TracBrowser for help on using the repository browser.