Commits

Bart van Strien  committed 90522cb

Add hasFocus (issue #117)

  • Participants
  • Parent commits b494e4f

Comments (0)

Files changed (4)

File src/modules/graphics/opengl/Graphics.cpp

 		glDisableClientState(GL_VERTEX_ARRAY);
 	}
 
+	bool Graphics::hasFocus()
+	{
+		return SDL_GetAppState() & SDL_APPINPUTFOCUS;
+	}
 } // opengl
 } // graphics
 } // love

File src/modules/graphics/opengl/Graphics.h

 
 		void drawTest(Image * image, float x, float y, float a, float sx, float sy, float ox, float oy);
 
+		bool hasFocus();
+
 	}; // Graphics
 
 } // opengl

File src/modules/graphics/opengl/wrap_Graphics.cpp

 		return 0;
 	}
 
+	int w_hasFocus(lua_State * L)
+	{
+		luax_pushboolean(L, instance->hasFocus());
+		return 1;
+	}
+
 
 	// List of functions to wrap.
 	static const luaL_Reg functions[] = {
 
 		{ "translate", w_translate },
 
+		{ "hasFocus", w_hasFocus },
+
 		{ 0, 0 }
 	};
 

File src/modules/graphics/opengl/wrap_Graphics.h

 	int w_rotate(lua_State * L);
 	int w_scale(lua_State * L);
 	int w_translate(lua_State * L);
+	int w_hasFocus(lua_State * L);
 	extern "C" LOVE_EXPORT int luaopen_love_graphics(lua_State * L);
 
 } // opengl