Finalize Multiplayer v2.0.0 with CMake ws2_32 fix
This commit is contained in:
parent
acf6d84d7c
commit
dea13eaf2c
|
|
@ -16,8 +16,11 @@ FetchContent_MakeAvailable(raylib)
|
||||||
# Create executable
|
# Create executable
|
||||||
add_executable(MorriCraft src/main.cpp)
|
add_executable(MorriCraft src/main.cpp)
|
||||||
|
|
||||||
# Link Raylib
|
# Link Raylib and Networking
|
||||||
target_link_libraries(MorriCraft PRIVATE raylib)
|
target_link_libraries(MorriCraft PRIVATE raylib)
|
||||||
|
if(WIN32)
|
||||||
|
target_link_libraries(MorriCraft PRIVATE ws2_32)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Copy assets to build directory
|
# Copy assets to build directory
|
||||||
add_custom_command(TARGET MorriCraft POST_BUILD
|
add_custom_command(TARGET MorriCraft POST_BUILD
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
v1.9.1
|
v2.0.0
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
v1.9.1
|
v2.0.0
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "network.h"
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
#include "raymath.h"
|
#include "raymath.h"
|
||||||
#include "rcamera.h"
|
#include "rcamera.h"
|
||||||
|
|
@ -11,7 +12,6 @@
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "rlgl.h"
|
#include "rlgl.h"
|
||||||
#include "network.h"
|
|
||||||
|
|
||||||
#define CHUNK_SIZE 32
|
#define CHUNK_SIZE 32
|
||||||
#ifndef PI
|
#ifndef PI
|
||||||
|
|
@ -703,7 +703,7 @@ int main(void)
|
||||||
// By default, windows have minimize, maximize, and close buttons on the top bar.
|
// By default, windows have minimize, maximize, and close buttons on the top bar.
|
||||||
SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_VSYNC_HINT);
|
SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_VSYNC_HINT);
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "MorriCraft v1.9.1");
|
InitWindow(screenWidth, screenHeight, "MorriCraft v2.0.0");
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
SetExitKey(KEY_NULL); // Prevent ESC from closing the window
|
SetExitKey(KEY_NULL); // Prevent ESC from closing the window
|
||||||
|
|
||||||
|
|
@ -771,6 +771,7 @@ int main(void)
|
||||||
std::vector<Socket> clientSockets;
|
std::vector<Socket> clientSockets;
|
||||||
|
|
||||||
InitNetworking();
|
InitNetworking();
|
||||||
|
InventorySlot mouseHeldItem(AIR, 0);
|
||||||
float gameTime = 75.0f; // Start at 6:00 AM
|
float gameTime = 75.0f; // Start at 6:00 AM
|
||||||
float breakProgress = 0.0f;
|
float breakProgress = 0.0f;
|
||||||
int lastHitX = -1, lastHitY = -1, lastHitZ = -1;
|
int lastHitX = -1, lastHitY = -1, lastHitZ = -1;
|
||||||
|
|
@ -1417,8 +1418,8 @@ int main(void)
|
||||||
DrawTexturePro(titleTexture, sourceRec, destRec, origin, 0.0f, WHITE);
|
DrawTexturePro(titleTexture, sourceRec, destRec, origin, 0.0f, WHITE);
|
||||||
EndMode2D();
|
EndMode2D();
|
||||||
|
|
||||||
// Show Version Number (v1.9.1) in Red
|
// Show Version Number (v2.0.0) in Red
|
||||||
DrawTextEx(customFont, "v1.9.1", (Vector2){ (float)currentWidth - 140, (float)currentHeight - 40 }, 22, 1.0f, RED);
|
DrawTextEx(customFont, "v2.0.0", (Vector2){ (float)currentWidth - 140, (float)currentHeight - 40 }, 22, 1.0f, RED);
|
||||||
|
|
||||||
// --- PLAYER NAME POPUP (IF MISSING) ---
|
// --- PLAYER NAME POPUP (IF MISSING) ---
|
||||||
if (playerName == "") {
|
if (playerName == "") {
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,34 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#ifndef NOGDI
|
||||||
|
#define NOGDI
|
||||||
|
#endif
|
||||||
|
#ifndef NOUSER
|
||||||
|
#define NOUSER
|
||||||
|
#endif
|
||||||
|
// Rename conflicting functions before including windows/winsock
|
||||||
|
#define CloseWindow CloseWindow_Win
|
||||||
|
#define ShowCursor ShowCursor_Win
|
||||||
|
#define DrawTextEx DrawTextEx_Win
|
||||||
|
#define PlaySound PlaySound_Win
|
||||||
|
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
|
#undef CloseWindow
|
||||||
|
#undef ShowCursor
|
||||||
|
#undef DrawTextEx
|
||||||
|
#undef PlaySound
|
||||||
|
#undef near
|
||||||
|
#undef far
|
||||||
|
|
||||||
#pragma comment(lib, "ws2_32.lib")
|
#pragma comment(lib, "ws2_32.lib")
|
||||||
typedef SOCKET Socket;
|
typedef SOCKET Socket;
|
||||||
#define INVALID_SOCKET_VAL INVALID_SOCKET
|
#define INVALID_SOCKET_VAL INVALID_SOCKET
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
v1.9.1
|
v2.0.0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue