mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Add default width/height to love.graphics.newFramebuffer
This commit is contained in:
@@ -294,9 +294,13 @@ namespace opengl
|
|||||||
|
|
||||||
int w_newFramebuffer(lua_State * L)
|
int w_newFramebuffer(lua_State * L)
|
||||||
{
|
{
|
||||||
int width, height;
|
// check if width and height are given. else default to screen dimensions.
|
||||||
width = luaL_checkint(L, 1);
|
int width = instance->getWidth();
|
||||||
height = luaL_checkint(L, 2);
|
int height = instance->getHeight();
|
||||||
|
if (lua_gettop(L) >= 2) {
|
||||||
|
width = luaL_optint(L, 1, instance->getWidth());
|
||||||
|
height = luaL_optint(L, 2, instance->getHeight());
|
||||||
|
}
|
||||||
glGetError(); // clear opengl error flag
|
glGetError(); // clear opengl error flag
|
||||||
Framebuffer * framebuffer = instance->newFramebuffer(width, height);
|
Framebuffer * framebuffer = instance->newFramebuffer(width, height);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user