Socket côté client!

This commit is contained in:
MarcEricMartel
2023-09-25 17:17:17 -04:00
parent 3ff2634e51
commit 8bc74624c3
14 changed files with 74 additions and 313 deletions

View File

@@ -1,11 +1,12 @@
#ifndef DEFINE_H__
#define DEFINE_H__
#ifndef CLI_DEFINE_H__
#define CLI_DEFINE_H__
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>
#include <chrono>
#include <iomanip>
#include "../SQCSim-common/define.h"
#ifdef _WIN32
#include <windows.h>
@@ -14,21 +15,11 @@
#include <gl/GLU.h>
#endif
#define NETWORK_TEST false
#define NETWORK_TEST true
#define SRV_ADDR "127.0.0.1"
#define SRV_PORT 1025
#define CLI_PORT 1026
#define CHUNK_SIZE_X 4
#define CHUNK_SIZE_Y 64
#define CHUNK_SIZE_Z 4
#define MAX_SELECTION_DISTANCE 5
#define BASE_WIDTH 640
#define BASE_HEIGHT 480
#define SEED 12345
#define WORLD_SIZE_X 64
#define WORLD_SIZE_Y 64
#define COUNTDOWN 300
#define FRAMES_RENDER_CHUNKS 1
#define FRAMES_UPDATE_CHUNKS 1
@@ -38,39 +29,8 @@
#define THREADS_UPDATE_CHUNKS 3
#define THREADS_DELETE_CHUNKS 3
#define VIEW_DISTANCE 512
#define TEXTURE_SIZE 512
#define MAX_BULLETS 512
#ifdef _WIN32
#pragma comment(lib,"wsock32.lib") // Pour pouvoir faire fonctionner le linker sans le vcxproject
#include <Windows.h>
#include <cstdio>
#include <ctime>
#define popen _popen
#define pclose _pclose
#else // Pas _WIN32
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#define SOCKET int
#define INVALID_SOCKET -1
#define closesocket close
#endif // _WIN32
typedef uint8_t BlockType;
enum BLOCK_TYPE { BTYPE_AIR, BTYPE_DIRT, BTYPE_GRASS, BTYPE_METAL, BTYPE_ICE, BTYPE_LAST };
typedef std::chrono::system_clock::time_point Timestamp;
#define BASE_WIDTH 640
#define BASE_HEIGHT 480
#define TEXTURE_PATH "./media/textures/"
#define SHADER_PATH "./media/shaders/"