init winsock

This commit is contained in:
NishiOwO 2025-03-29 22:36:35 +09:00
parent ba8da2bd18
commit a05c52835b
No known key found for this signature in database
GPG Key ID: 27EF69B208EB9343
4 changed files with 15 additions and 2 deletions

View File

@ -1,4 +1,6 @@
export
WINDOWS = NO
include mk/p_*.mk
AR = $(TARGET_PREFIX)ar
@ -6,7 +8,7 @@ CC = $(TARGET_PREFIX)gcc
OBJDUMP = $(TARGET_PREFIX)objdump
CFLAGS = -g -D_DEFAULT_SOURCE -DUSE_$(BACKEND) -I../engine $(ODE_CFLAGS) $(AMX_CFLAGS) $(PAWNC_CFLAGS) $(GL_CFLAGS)
LDFLAGS =
LIBS = $(ODE_LIBS) $(AMX_LIBS) $(PAWNC_LIBS) $(GL_LIBS)
LIBS = $(ODE_LIBS) $(AMX_LIBS) $(PAWNC_LIBS) $(GL_LIBS) $(SOCKET_LIBS)
.PHONY: all format clean ./engine ./src print-deps

View File

@ -2,6 +2,9 @@
/* External library */
#include <ode/ode.h>
#ifdef _WIN32
#include <winsock.h>
#endif
/* Interface */
#include "nb_core.h"
@ -17,9 +20,16 @@
void nb_engine_begin(void) {
nb_version_t ver;
#ifdef _WIN32
WSADATA wsa;
#endif
nb_get_version(&ver);
nb_function_log("NishBox engine %s", ver.full);
nb_function_log("OpenGL backend: %s", ver.opengl);
#ifdef _WIN32
WSAStartup(MAKEWORD(1, 1), &wsa);
nb_function_log("Winsock ready", "");
#endif
dInitODE();
}

View File

@ -7,6 +7,7 @@ PAWNC_CFLAGS = `pkg-config --cflags pawnc`
PAWNC_LIBS = `pkg-config --libs pawnc`
GL_CFLAGS = `pkg-config --cflags gl`
GL_LIBS = `pkg-config --libs gl`
SOCKET_LIBS =
BACKEND = GLX

View File

@ -1,4 +1,3 @@
WINDOWS = NO
ifeq ($(PLATFORM),win32)
TARGET_PREFIX = i686-w64-mingw32-
WINDOWS = YES
@ -18,6 +17,7 @@ PAWNC_CFLAGS = -I../deps/include
PAWNC_LIBS = -L../deps/lib -lpawnc
GL_CFLAGS =
GL_LIBS = -lopengl32 -lgdi32
SOCKET_LIBS = -lws2_32
BACKEND = WGL