From e9b4f88a5c2f536c1a80465accaa8a7e8a636ebd Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Sun, 1 Feb 2026 22:34:10 +0900 Subject: [PATCH] winsock --- client/main.c | 8 +------- engine/CMakeLists.txt | 4 ++-- engine/src/core.c | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/client/main.c b/client/main.c index a705092..fecfdd6 100644 --- a/client/main.c +++ b/client/main.c @@ -51,7 +51,6 @@ static void render(GSEngine self){ {20, -1, -20}, {20, -1, 20} }; - GSVector3 pos = {0, 0, 0}; GSVector3 n = {0, 1, 0}; for(i = 0; i < sizeof(obj) / sizeof(obj[0]); i++){ @@ -64,15 +63,10 @@ static void render(GSEngine self){ GSGLPushMatrix(gl); GSGLSetPosition(gl, rv); GSGLSetRotation3x3(gl, rm); - //GSGLTetrakis(gl, 0.5, col1, col2); + GSGLTetrakis(gl, 0.5, col1, col2); GSGLPopMatrix(gl); } - GSGLPushMatrix(gl); - GSGLSetPosition(gl, pos); - GSGLTetrakis(gl, 0.5, col1, col2); - GSGLPopMatrix(gl); - GSGLSetColor(gl, col2); GSGLPolygon(gl, 4, v, NULL, n); } diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 836af8f..74ed82b 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -30,9 +30,9 @@ target_compile_definitions(GearSrc PRIVATE _GEARSRC) target_link_libraries(GearSrc PRIVATE ode lz4) if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") target_link_options(GearSrc PRIVATE -static-libgcc -static-libstdc++) + target_link_libraries(GearSrc PRIVATE ws2_32) else() - target_link_libraries(GearSrc PRIVATE stdc++) - target_link_libraries(GearSrc PRIVATE m pthread) + target_link_libraries(GearSrc PRIVATE stdc++ m pthread) endif() if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") target_link_libraries(GearSrc PRIVATE dl) diff --git a/engine/src/core.c b/engine/src/core.c index 72dddf0..e9e57bd 100644 --- a/engine/src/core.c +++ b/engine/src/core.c @@ -9,11 +9,27 @@ #include #include +#ifdef _WIN32 +#include +#endif + #include +#ifdef _WIN32 +static void init_winsock(void){ + WSADATA wsa; + + WSAStartup(MAKEWORD(1, 1), &wsa); +} +#endif + void GSInit(void) { GSVersion version; +#ifdef _WIN32 + init_winsock(); +#endif + GSVersionGet(&version); GSLog(NULL, GSLogInfo, "GearSrc Engine %s", version.string);