Updated the Lua wrapper code for modules to account for cases where the module's instance is removed from memory completely and recreated during the program's lifetime.

This commit is contained in:
Alex Szpakowski
2014-07-21 14:52:01 -03:00
parent e87fbdcaaf
commit 014b9a46e5
45 changed files with 432 additions and 316 deletions
+2 -2
View File
@@ -118,7 +118,7 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI;
#endif
graphics::Graphics *gfx = (graphics::Graphics *) Module::findInstance("love.graphics.");
graphics::Graphics *gfx = Module::getInstance<graphics::Graphics>(Module::M_GRAPHICS);
if (gfx != nullptr)
gfx->unSetMode();
@@ -431,7 +431,7 @@ bool Window::setFullscreen(bool fullscreen, Window::FullscreenType fstype)
updateSettings(newsettings);
// Update the viewport size now instead of waiting for event polling.
graphics::Graphics *gfx = (graphics::Graphics *) Module::findInstance("love.graphics.");
graphics::Graphics *gfx = Module::getInstance<graphics::Graphics>(Module::M_GRAPHICS);
if (gfx != nullptr)
{
int width = curMode.width;