SQCSimulator2023/SQCSim-common/define.h
2023-10-28 14:41:23 -04:00

77 lines
1.6 KiB
C++

#ifndef DEFINE_H__
#define DEFINE_H__
#include <iostream>
#include <chrono>
#define SRV_PORT 10000
#define CLI_PORT 10001
#define BUFFER_LENGTH 150
#define CHUNK_SIZE_X 4
#define CHUNK_SIZE_Y 64
#define CHUNK_SIZE_Z 4
#define MAX_SELECTION_DISTANCE 5
#define SEED 0
#define COUNTDOWN 300
#define WORLD_SIZE_X 64
#define WORLD_SIZE_Y 64
#define FRAMES_RENDER_CHUNKS 1
#define FRAMES_UPDATE_CHUNKS 1
#define FRAMES_DELETE_CHUNKS 1
#define THREADS_GENERATE_CHUNKS 8
#define THREADS_UPDATE_CHUNKS 6
#define THREADS_DELETE_CHUNKS 3
#define VIEW_DISTANCE 512 // Si les chunks arrêtent de s'afficher pendant une game et qu'il y a un access violation quand tu quitte, il faut augmenter ce chiffre.
#define TEXTURE_SIZE 512
#define MAX_BULLETS 512
#define BULLET_TIME .1
typedef uint8_t BlockType;
enum BLOCK_TYPE { BTYPE_AIR, BTYPE_DIRT, BTYPE_GRASS, BTYPE_METAL, BTYPE_ICE, BTYPE_LAST };
typedef uint64_t Timestamp;
#ifdef _WIN32
#pragma comment(lib,"wsock32.lib") // Pour pouvoir faire fonctionner le linker sans le vcxproject
#pragma comment(lib,"ws2_32.lib")
#include <ws2tcpip.h>
#include <Windows.h>
#include <cstdio>
#include <ctime>
#define ioctl ioctlsocket
#define SOCK_NONBLOCK FIONBIO
#define strcpy strcpy_s
#define addrlen_t int
#define popen _popen
#define pclose _pclose
#else // Pas _WIN32
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <cstring>
#define addrlen_t unsigned int
#define SOCKET int
#define INVALID_SOCKET -1
#define closesocket close
#endif // _WIN32
#endif // DEFINE_H__