|
|
@@ -32,10 +32,11 @@ void luaRegister_FrameBuffer()
|
|
|
{
|
|
|
{"bindDefault", lua_FrameBuffer_static_bindDefault},
|
|
|
{"create", lua_FrameBuffer_static_create},
|
|
|
+ {"createScreenshot", lua_FrameBuffer_static_createScreenshot},
|
|
|
{"getCurrent", lua_FrameBuffer_static_getCurrent},
|
|
|
- {"getCurrentScreenshot", lua_FrameBuffer_static_getCurrentScreenshot},
|
|
|
{"getFrameBuffer", lua_FrameBuffer_static_getFrameBuffer},
|
|
|
{"getMaxRenderTargets", lua_FrameBuffer_static_getMaxRenderTargets},
|
|
|
+ {"getScreenshot", lua_FrameBuffer_static_getScreenshot},
|
|
|
{NULL, NULL}
|
|
|
};
|
|
|
std::vector<std::string> scopePath;
|
|
|
@@ -761,7 +762,7 @@ int lua_FrameBuffer_static_create(lua_State* state)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-int lua_FrameBuffer_static_getCurrent(lua_State* state)
|
|
|
+int lua_FrameBuffer_static_createScreenshot(lua_State* state)
|
|
|
{
|
|
|
// Get the number of parameters.
|
|
|
int paramCount = lua_gettop(state);
|
|
|
@@ -771,13 +772,13 @@ int lua_FrameBuffer_static_getCurrent(lua_State* state)
|
|
|
{
|
|
|
case 0:
|
|
|
{
|
|
|
- void* returnPtr = (void*)FrameBuffer::getCurrent();
|
|
|
+ void* returnPtr = (void*)FrameBuffer::createScreenshot();
|
|
|
if (returnPtr)
|
|
|
{
|
|
|
gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
|
|
|
object->instance = returnPtr;
|
|
|
object->owns = false;
|
|
|
- luaL_getmetatable(state, "FrameBuffer");
|
|
|
+ luaL_getmetatable(state, "Image");
|
|
|
lua_setmetatable(state, -2);
|
|
|
}
|
|
|
else
|
|
|
@@ -798,7 +799,7 @@ int lua_FrameBuffer_static_getCurrent(lua_State* state)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-int lua_FrameBuffer_static_getCurrentScreenshot(lua_State* state)
|
|
|
+int lua_FrameBuffer_static_getCurrent(lua_State* state)
|
|
|
{
|
|
|
// Get the number of parameters.
|
|
|
int paramCount = lua_gettop(state);
|
|
|
@@ -808,13 +809,13 @@ int lua_FrameBuffer_static_getCurrentScreenshot(lua_State* state)
|
|
|
{
|
|
|
case 0:
|
|
|
{
|
|
|
- void* returnPtr = (void*)FrameBuffer::getCurrentScreenshot();
|
|
|
+ void* returnPtr = (void*)FrameBuffer::getCurrent();
|
|
|
if (returnPtr)
|
|
|
{
|
|
|
gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
|
|
|
object->instance = returnPtr;
|
|
|
object->owns = false;
|
|
|
- luaL_getmetatable(state, "Image");
|
|
|
+ luaL_getmetatable(state, "FrameBuffer");
|
|
|
lua_setmetatable(state, -2);
|
|
|
}
|
|
|
else
|
|
|
@@ -909,4 +910,44 @@ int lua_FrameBuffer_static_getMaxRenderTargets(lua_State* state)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int lua_FrameBuffer_static_getScreenshot(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 1:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Image> param1 = gameplay::ScriptUtil::getObjectPointer<Image>(1, "Image", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Image'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ FrameBuffer::getScreenshot(param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_FrameBuffer_static_getScreenshot - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 1).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
}
|