love.graphics.getScissor now has a proper C++ module method

This commit is contained in:
Alex Szpakowski
2014-01-09 22:49:00 -04:00
parent c64b3d2527
commit fda005c5ff
9 changed files with 25 additions and 16 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ Module::~Module()
void Module::registerInstance(Module *instance)
{
if (instance == nullptr)
throw Exception("Module instance is NULL");
throw Exception("Module instance is null");
std::string name(instance->getName());
-1
View File
@@ -22,7 +22,6 @@
#define LOVE_MODULE_H
// LOVE
#include "runtime.h"
#include "Exception.h"
#include "Object.h"
@@ -31,6 +31,7 @@
#include "common/Module.h"
#include "common/config.h"
#include "common/int.h"
#include "common/runtime.h"
#include "filesystem/FileData.h"
#include "File.h"
+6 -9
View File
@@ -273,19 +273,16 @@ void Graphics::setScissor()
glDisable(GL_SCISSOR_TEST);
}
int Graphics::getScissor(lua_State *L) const
bool Graphics::getScissor(int &x, int &y, int &width, int &height) const
{
if (glIsEnabled(GL_SCISSOR_TEST) == GL_FALSE)
return 0;
OpenGL::Viewport scissor = gl.getScissor();
lua_pushinteger(L, scissor.x);
lua_pushinteger(L, scissor.y);
lua_pushinteger(L, scissor.w);
lua_pushinteger(L, scissor.h);
x = scissor.x;
y = scissor.y;
width = scissor.w;
height = scissor.h;
return 4;
return glIsEnabled(GL_SCISSOR_TEST) == GL_TRUE;
}
void Graphics::defineStencil()
+4 -4
View File
@@ -163,10 +163,10 @@ public:
void setScissor();
/**
* This native Lua function gets the current scissor box in the order of:
* x, y, width, height
**/
int getScissor(lua_State *L) const;
* Gets the current scissor box.
* @return Whether the scissor is enabled.
*/
bool getScissor(int &x, int &y, int &width, int &height) const;
/**
* Enables the stencil buffer and set stencil function to fill it
+10 -1
View File
@@ -104,7 +104,16 @@ int w_setScissor(lua_State *L)
int w_getScissor(lua_State *L)
{
return instance->getScissor(L);
int x, y, w, h;
if (!instance->getScissor(x, y, w, h))
return 0;
lua_pushinteger(L, x);
lua_pushinteger(L, y);
lua_pushinteger(L, w);
lua_pushinteger(L, h);
return 4;
}
static int setStencil(lua_State *L, bool invert)
@@ -23,6 +23,7 @@
// LOVE
#include "common/config.h"
#include "common/runtime.h"
#include "JoystickModule.h"
namespace love
+1
View File
@@ -22,6 +22,7 @@
#define LOVE_KEYBOARD_WRAP_KEYBOARD_H
// LOVE
#include "common/runtime.h"
#include "Keyboard.h"
namespace love
+1
View File
@@ -22,6 +22,7 @@
#define LOVE_TIMER_WRAP_TIMER_H
// LOVE
#include "common/runtime.h"
#include "Timer.h"
namespace love