Commits

Alex Szpakowski committed b424e5f

Added love.window.minimize (resolves issue #904).

  • Participants
  • Parent commits 750edc9

Comments (0)

Files changed (6)

   * Added Joint:setUserData and Joint:getUserData.
   * Added Body:getWorld.
   * Added love.window.getDisplayName.
+  * Added love.window.minimize.
 
   * Deprecated SpriteBatch:bind and SpriteBatch:unbind.
   * Deprecated all uses of the name 'FSAA' in favor of 'MSAA'.

src/modules/window/Window.h

 	virtual bool setIcon(love::image::ImageData *imgd) = 0;
 	virtual love::image::ImageData *getIcon() = 0;
 
+	virtual void minimize() = 0;
+
 	// default no-op implementation
 	virtual void swapBuffers();
 

src/modules/window/sdl/Window.cpp

 	return curMode.icon;
 }
 
+void Window::minimize()
+{
+	if (window != nullptr)
+		SDL_MinimizeWindow(window);
+}
+
 void Window::swapBuffers()
 {
 	SDL_GL_SwapWindow(window);

src/modules/window/sdl/Window.h

 	bool setIcon(love::image::ImageData *imgd);
 	love::image::ImageData *getIcon();
 
+	void minimize();
+
 	void swapBuffers();
 
 	bool hasFocus() const;

src/modules/window/wrap_Window.cpp

 	return 1;
 }
 
+int w_minimize(lua_State* /*L*/)
+{
+	instance->minimize();
+	return 0;
+}
+
 static const luaL_Reg functions[] =
 {
 	{ "getDisplayCount", w_getDisplayCount },
 	{ "hasMouseFocus", w_hasMouseFocus },
 	{ "isVisible", w_isVisible },
 	{ "getPixelScale", w_getPixelScale },
+	{ "minimize", w_minimize },
 	{ 0, 0 }
 };
 

src/modules/window/wrap_Window.h

 int w_hasMouseFocus(lua_State *L);
 int w_isVisible(lua_State *L);
 int w_getPixelScale(lua_State *L);
+int w_minimize(lua_State *L);
 extern "C" LOVE_EXPORT int luaopen_love_window(lua_State *L);
 
 } // window