Cleaned up the love.graphics code that deals with love.window to be more consistent with the rest of the codebase.

This commit is contained in:
Alex Szpakowski
2015-07-24 21:40:55 -03:00
parent 354f83c1cb
commit f5abedaeeb
7 changed files with 22 additions and 40 deletions
+5 -2
View File
@@ -529,8 +529,11 @@ static const luaL_Reg functions[] =
extern "C" int luaopen_love_window(lua_State *L)
{
Window *instance = nullptr;
luax_catchexcept(L, [&](){ instance = sdl::Window::createSingleton(); });
Window *instance = instance();
if (instance == nullptr)
luax_catchexcept(L, [&](){ instance = new love::window::sdl::Window(); });
else
instance->retain();
WrappedModule w;
w.module = instance;