Changeset 34bd549 in network-game
- Timestamp:
- Jun 19, 2014, 1:34:15 AM (11 years ago)
- Branches:
- master
- Children:
- 3ea1839
- Parents:
- 883bb5d
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
r883bb5d r34bd549 11 11 #include <netdb.h> 12 12 #include <cstring> 13 #elif defined MAC 14 #include <netdb.h> 13 15 #endif 14 16 … … 171 173 font = al_load_ttf_font("../pirulen.ttf", 12, 0); 172 174 #elif defined LINUX 175 font = al_load_ttf_font("pirulen.ttf", 12, 0); 176 #elif defined MAC 173 177 font = al_load_ttf_font("pirulen.ttf", 12, 0); 174 178 #endif … … 782 786 #elif defined LINUX 783 787 game = new Game(gameName, "../data/map.txt", &msgProcessor); 788 #elif defined MAC 789 game = new Game(gameName, "../data/map.txt", &msgProcessor); 784 790 #endif 785 791 … … 1303 1309 1304 1310 msgProcessor.sendMessage(&msgTo, &server); 1311 cout << "Sent CREATE_GAME message" << endl; 1305 1312 } 1306 1313 -
client/makefile
r883bb5d r34bd549 1 1 CC = g++ 2 LIB_FLAGS = `pkg-config --cflags --libs --static allegro-static-5.0 allegro_ttf-static-5.0 allegro_primitives-static-5.0` 2 #LIB_FLAGS = `pkg-config --cflags --libs --static allegro-static-5.0 allegro_main-static-5.0 allegro_ttf-static-5.0 allegro_primitives-static-5.0` 3 # osx needs to link against some extra libraries 4 LIB_FLAGS = `pkg-config --cflags --libs --static allegro-static-5.0 allegro_main-static-5.0 allegro_ttf-static-5.0 allegro_primitives-static-5.0` -framework AppKit -framework IOKit -framework OpenGL -framework AGL -framework OpenAL 3 5 FLAGS = -Wall -g 4 6 COMMON_PATH = ../common -
common/Common.cpp
r883bb5d r34bd549 8 8 #include <fcntl.h> 9 9 #include <assert.h> 10 #elif defined MAC 11 #include <fcntl.h> 12 #include <assert.h> 13 #include <mach/clock.h> 14 #include <mach/mach.h> 10 15 #endif 11 16 … … 50 55 assert(flags != -1); 51 56 fcntl(sock, F_SETFL, flags | O_NONBLOCK); 57 #elif defined MAC 58 int flags = fcntl(sock, F_GETFL,0); 59 assert(flags != -1); 60 fcntl(sock, F_SETFL, flags | O_NONBLOCK); 52 61 #endif 53 62 } … … 62 71 timespec curTime; 63 72 clock_gettime(CLOCK_REALTIME, &curTime); 73 74 numMilliseconds = curTime.tv_sec*(unsigned long long)1000+curTime.tv_nsec/(unsigned long long)1000000; 75 # elif defined MAC 76 timespec curTime; 77 78 clock_serv_t cclock; 79 mach_timespec_t mts; 80 host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); 81 clock_get_time(cclock, &mts); 82 mach_port_deallocate(mach_task_self(), cclock); 83 curTime.tv_sec = mts.tv_sec; 84 curTime.tv_nsec = mts.tv_nsec; 64 85 65 86 numMilliseconds = curTime.tv_sec*(unsigned long long)1000+curTime.tv_nsec/(unsigned long long)1000000; -
common/Compiler.h
r883bb5d r34bd549 9 9 #elif defined __posix 10 10 #define LINUX 11 #elif defined __APPLE__ 12 #define MAC 11 13 #endif -
common/MessageContainer.h
r883bb5d r34bd549 9 9 #include <winsock2.h> 10 10 #elif defined LINUX 11 #include <netinet/in.h> 12 #elif defined MAC 11 13 #include <netinet/in.h> 12 14 #endif -
common/MessageProcessor.cpp
r883bb5d r34bd549 50 50 51 51 // assume we don't care about the value of socklen 52 cout << "Waiting for message from server" << endl; 52 53 int ret = recvfrom(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)source, &socklen); 54 cout << "Returned from wait" << endl; 53 55 54 56 if (ret == -1) -
common/Player.h
r883bb5d r34bd549 10 10 #include <winsock2.h> 11 11 #elif defined LINUX 12 #include <netinet/in.h> 13 #elif defined MAC 12 14 #include <netinet/in.h> 13 15 #endif
Note:
See TracChangeset
for help on using the changeset viewer.