From 5ba40369ccb5d2d0c72cec48feb0a7c623f14e71 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Mon, 26 May 2014 16:54:54 +0200 Subject: [PATCH 1/3] Don't unnecessarily expose internal constant --- src/input.cpp | 8 ++++---- src/input.h | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index 6758dc6..85a6d1f 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -31,7 +31,7 @@ #include #include -const int Input::buttonCodeSize = 24; +#define BUTTON_CODE_COUNT 24 struct ButtonState { @@ -285,7 +285,7 @@ struct InputPrivate /* Collective binding array */ std::vector bindings; - ButtonState stateArray[Input::buttonCodeSize*2]; + ButtonState stateArray[BUTTON_CODE_COUNT*2]; ButtonState *states; ButtonState *statesOld; @@ -312,7 +312,7 @@ struct InputPrivate initMsBindings(); states = stateArray; - statesOld = stateArray + Input::buttonCodeSize; + statesOld = stateArray + BUTTON_CODE_COUNT; /* Clear buffers */ clearBuffer(); @@ -359,7 +359,7 @@ struct InputPrivate void clearBuffer() { - const size_t size = sizeof(ButtonState) * Input::buttonCodeSize; + const size_t size = sizeof(ButtonState) * BUTTON_CODE_COUNT; memset(states, 0, size); } diff --git a/src/input.h b/src/input.h index 7d4c2c9..2a4e501 100644 --- a/src/input.h +++ b/src/input.h @@ -45,8 +45,6 @@ public: MouseLeft = 38, MouseMiddle = 39, MouseRight = 40 }; - static const int buttonCodeSize; - void update(); bool isPressed(int button); From 7b1f599dd60456eb84684105569a9290d9af3638 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Tue, 27 May 2014 07:35:06 +0200 Subject: [PATCH 2/3] mkxp.pro: Add 'BOOST_LIB_SUFFIX' Boost being boost. --- README.md | 2 +- mkxp.pro | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3904257..7a3db06 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ mkxp employs Qt's qmake build system, so you'll need to install that beforehand. qmake will use pkg-config to locate the respective include/library paths. If you installed any dependencies into non-standard prefixes, make sure to adjust your `PKG_CONFIG_PATH` variable accordingly. -The exception is boost, which is weird in that it still hasn't managed to pull off pkg-config support (seriously?). *If you installed boost in a non-standard prefix*, you will need to pass its include path via `BOOST_I` and library path via `BOOST_L`, either as direct arguments to qmake (`qmake BOOST_I="/usr/include" ...`) or via environment variables. +The exception is boost, which is weird in that it still hasn't managed to pull off pkg-config support (seriously?). *If you installed boost in a non-standard prefix*, you will need to pass its include path via `BOOST_I` and library path via `BOOST_L`, either as direct arguments to qmake (`qmake BOOST_I="/usr/include" ...`) or via environment variables. You can specify a library suffix (eg. "-mt") via `BOOST_LIB_SUFFIX` if needed. **MRI-Binding**: pkg-config will look for `ruby-2.1.pc`, but you can modify mkxp.pro to use 2.0 instead. This is the default binding, so no arguments to qmake needed (`BINDING=MRI` to be explicit). diff --git a/mkxp.pro b/mkxp.pro index 824c9c5..f994e47 100644 --- a/mkxp.pro +++ b/mkxp.pro @@ -74,7 +74,11 @@ unix { LIBS += -L$$BOOST_L } - LIBS += -lboost_program_options + isEmpty(BOOST_LIB_SUFFIX) { + BOOST_LIB_SUFFIX = $$(BOOST_LIB_SUFFIX) + } + + LIBS += -lboost_program_options$$BOOST_LIB_SUFFIX } # Input From 2cc2ebca3196c275b3efb8ac54be75d62bae8408 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Fri, 30 May 2014 23:03:19 +0200 Subject: [PATCH 3/3] GLState: Get rid of GL_TEXTURE_2D enable/disable This bit was deprecated/removed in core GL. There was only one place where this was used (flash tiles in Tilemap), and since the full shader rewrite, it was effectively a no-op anyway (flash shader doesn't sample texture). --- src/glstate.cpp | 6 ------ src/glstate.h | 6 ------ src/tilemap.cpp | 2 -- 3 files changed, 14 deletions(-) diff --git a/src/glstate.cpp b/src/glstate.cpp index 2f1c7fe..b02537b 100644 --- a/src/glstate.cpp +++ b/src/glstate.cpp @@ -56,11 +56,6 @@ void GLScissorTest::apply(const bool &value) value ? glEnable(GL_SCISSOR_TEST) : glDisable(GL_SCISSOR_TEST); } -void GLTexture2D::apply(const bool &value) -{ - value ? glEnable(GL_TEXTURE_2D) : glDisable(GL_TEXTURE_2D); -} - void GLBlendMode::apply(const BlendType &value) { switch (value) @@ -115,6 +110,5 @@ GLState::GLState() blendMode.init(BlendNormal); scissorTest.init(false); scissorBox.init(IntRect(0, 0, 640, 480)); - texture2D.init(true); program.init(0); } diff --git a/src/glstate.h b/src/glstate.h index 613c555..a78d592 100644 --- a/src/glstate.h +++ b/src/glstate.h @@ -84,11 +84,6 @@ class GLScissorTest : public GLProperty void apply(const bool &value); }; -class GLTexture2D : public GLProperty -{ - void apply(const bool &value); -}; - class GLBlendMode : public GLProperty { void apply(const BlendType &value); @@ -111,7 +106,6 @@ public: GLClearColor clearColor; GLScissorBox scissorBox; GLScissorTest scissorTest; - GLTexture2D texture2D; GLBlendMode blendMode; GLViewport viewport; GLProgram program; diff --git a/src/tilemap.cpp b/src/tilemap.cpp index 2cdf6ba..9cd8432 100644 --- a/src/tilemap.cpp +++ b/src/tilemap.cpp @@ -1136,7 +1136,6 @@ void GroundLayer::draw() { VAO::bind(p->flash.vao); glState.blendMode.pushSet(BlendAddition); - glState.texture2D.pushSet(false); FlashMapShader &shader = shState->shaders().flashMap; shader.bind(); @@ -1155,7 +1154,6 @@ void GroundLayer::draw() drawFlashInt(); } - glState.texture2D.pop(); glState.blendMode.pop(); }