diff --git a/.gitignore b/.gitignore index c22f379..d536cfb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /bin +/build /obj /lib /output 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/d3d/rwd3d.h b/src/d3d/rwd3d.h index 36e94f3..2e4996c 100644 --- a/src/d3d/rwd3d.h +++ b/src/d3d/rwd3d.h @@ -1,5 +1,5 @@ #ifdef RW_D3D9 -#define NOMINMAX +#define NOMINMAX 1 #include #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/ras_test.cpp b/tools/clumpview/ras_test.cpp index 03621dc..853e10e 100644 --- a/tools/clumpview/ras_test.cpp +++ b/tools/clumpview/ras_test.cpp @@ -465,11 +465,11 @@ texfunc(Color t, Color f) a = srTexUseAlpha ? t.a : f.a; break; } - r = clamp(r); - g = clamp(g); - b = clamp(b); - a = clamp(a); - Color v = { r, g, b, a }; + Color v; + v.r = clamp(r); + v.g = clamp(g); + v.b = clamp(b); + v.a = clamp(a); return v; } 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); diff --git a/tools/imguitest/main.cpp b/tools/imguitest/main.cpp index 9f5b348..5051b54 100644 --- a/tools/imguitest/main.cpp +++ b/tools/imguitest/main.cpp @@ -74,7 +74,7 @@ Draw(float timeDelta) static bool show_another_window = false; static ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); - rw::RGBA clearcol = { clear_color.x*255, clear_color.y*255, clear_color.z*255, clear_color.w*255 }; + rw::RGBA clearcol = rw::makeRGBA(clear_color.x*255, clear_color.y*255, clear_color.z*255, clear_color.w*255); Scene.camera->clear(&clearcol, rw::Camera::CLEARIMAGE|rw::Camera::CLEARZ); Scene.camera->beginUpdate();