diff --git a/premake5.lua b/premake5.lua index b50d6ab..7569e27 100644 --- a/premake5.lua +++ b/premake5.lua @@ -93,6 +93,11 @@ workspace "librw" filter "action:vs*" buildoptions { "/wd4996", "/wd4244" } + filter { "platforms:win*gl3", "action:not vs*" } + if _OPTIONS["gfxlib"] == "sdl2" then + includedirs { "/mingw/include/SDL2" } -- TODO: Detect this properly + end + filter {} Libdir = "lib/%{cfg.platform}/%{cfg.buildcfg}" @@ -122,8 +127,11 @@ function findlibs() else links { "SDL2" } end - filter { "platforms:win*gl3" } + filter { "platforms:win*gl3", "action:vs*" } defines { "GLEW_STATIC" } + links { "glew32s" } + filter { "platforms:win*gl3", "action:not vs*" } + links { "glew32" } filter { "platforms:win-amd64-gl3" } libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/x64") } libdirs { path.join(_OPTIONS["glfwdir"], "lib-vc2015") } @@ -132,14 +140,16 @@ function findlibs() libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") } libdirs { path.join(_OPTIONS["sdl2dir"], "lib/x86") } filter { "platforms:win*gl3" } - links { "glew32s", "opengl32" } + links { "opengl32" } if _OPTIONS["gfxlib"] == "glfw" then links { "glfw3" } else links { "SDL2" } end filter { "platforms:*d3d9" } - links { "d3d9", "Xinput9_1_0" } + links { "gdi32", "d3d9" } + filter { "platforms:*d3d9", "action:vs*" } + links { "Xinput9_1_0" } filter {} end diff --git a/rw.h b/rw.h index a000c55..bdfc62a 100644 --- a/rw.h +++ b/rw.h @@ -1,4 +1,5 @@ #include +#include #include #include "src/rwbase.h" diff --git a/skeleton/win.cpp b/skeleton/win.cpp index ee5d67a..ba8f30e 100644 --- a/skeleton/win.cpp +++ b/skeleton/win.cpp @@ -8,6 +8,10 @@ using namespace rw; #ifdef RW_D3D9 +#ifndef VK_OEM_NEC_EQUAL +#define VK_OEM_NEC_EQUAL 0x92 +#endif + static int keymap[256]; static void initkeymap(void) @@ -65,6 +69,7 @@ WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { static int resizing = 0; static int buttons = 0; + POINTS p; MouseState ms; switch(msg){ @@ -108,7 +113,7 @@ WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_MOUSEMOVE: - POINTS p = MAKEPOINTS(lParam); + p = MAKEPOINTS(lParam); ms.posx = p.x; ms.posy = p.y; EventHandler(MOUSEMOVE, &ms); @@ -231,8 +236,14 @@ WinMain(HINSTANCE instance, HINSTANCE, if(!QueryPerformanceCounter((LARGE_INTEGER*)&ticks)) return 0; +#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) + args.argc = _argc; + args.argv = _argv; +#else args.argc = __argc; args.argv = __argv; +#endif + if(EventHandler(INITIALIZE, nil) == EVENTERROR) return 0; @@ -294,7 +305,11 @@ WinMain(HINSTANCE instance, HINSTANCE, freopen("CONOUT$", "w", stderr); */ +#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) + return main(_argc, _argv); +#else return main(__argc, __argv); +#endif } #endif #endif diff --git a/src/gl/gl3immed.cpp b/src/gl/gl3immed.cpp index bc31582..93ba26c 100644 --- a/src/gl/gl3immed.cpp +++ b/src/gl/gl3immed.cpp @@ -17,7 +17,7 @@ namespace rw { namespace gl3 { -static uint32 im2DVbo, im2DIbo; +uint32 im2DVbo, im2DIbo; static int32 u_xform; #define STARTINDICES 10000 diff --git a/tools/clumpview/tl_tests.cpp b/tools/clumpview/tl_tests.cpp index cbcf83b..dfee700 100644 --- a/tools/clumpview/tl_tests.cpp +++ b/tools/clumpview/tl_tests.cpp @@ -6,6 +6,8 @@ extern bool dosoftras; using namespace rw; using namespace RWDEVICE; +void rastest_renderTriangles(RWDEVICE::Im2DVertex *scrverts, int32 verts, uint16 *indices, int32 numTris); + // // This is a test to implement T&L in software and render with Im2D // @@ -494,7 +496,6 @@ clipTriangles(MeshState *mstate, CamSpace3DVertex *camverts, Im2DVertex *scrvert static void submitTriangles(RWDEVICE::Im2DVertex *scrverts, int32 numVerts, uint16 *indices, int32 numTris) { -void rastest_renderTriangles(RWDEVICE::Im2DVertex *scrverts, int32 verts, uint16 *indices, int32 numTris); rw::SetRenderStatePtr(rw::TEXTURERASTER, nil); if(dosoftras) rastest_renderTriangles(scrverts, numVerts, indices, numTris);