From 78a793e08fd1c1ce48f0dbdb5089dd2c4b5129fd Mon Sep 17 00:00:00 2001 From: vrld Date: Fri, 3 Sep 2010 14:28:57 +0200 Subject: [PATCH] Add default width/height to love.graphics.newFramebuffer --- src/modules/graphics/opengl/wrap_Graphics.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 7cba064a5..efe0bf78d 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -294,9 +294,13 @@ namespace opengl int w_newFramebuffer(lua_State * L) { - int width, height; - width = luaL_checkint(L, 1); - height = luaL_checkint(L, 2); + // check if width and height are given. else default to screen dimensions. + int width = instance->getWidth(); + 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 Framebuffer * framebuffer = instance->newFramebuffer(width, height);