mirror of
https://github.com/aap/librw.git
synced 2024-11-25 05:05:42 +00:00
Merge branch 'master' of github.com:aap/librw
This commit is contained in:
commit
0c8398c7e4
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
/bin
|
||||
/build
|
||||
/obj
|
||||
/lib
|
||||
/output
|
||||
|
16
premake5.lua
16
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
|
||||
|
||||
|
1
rw.h
1
rw.h
@ -1,4 +1,5 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
|
||||
#include "src/rwbase.h"
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef RW_D3D9
|
||||
#define NOMINMAX
|
||||
#define NOMINMAX 1
|
||||
#include <d3d9.h>
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
namespace rw {
|
||||
namespace gl3 {
|
||||
|
||||
static uint32 im2DVbo, im2DIbo;
|
||||
uint32 im2DVbo, im2DIbo;
|
||||
static int32 u_xform;
|
||||
|
||||
#define STARTINDICES 10000
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user