mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Add hasFocus (issue #117)
This commit is contained in:
@@ -1164,6 +1164,10 @@ namespace opengl
|
|||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Graphics::hasFocus()
|
||||||
|
{
|
||||||
|
return SDL_GetAppState() & SDL_APPINPUTFOCUS;
|
||||||
|
}
|
||||||
} // opengl
|
} // opengl
|
||||||
} // graphics
|
} // graphics
|
||||||
} // love
|
} // love
|
||||||
|
|||||||
@@ -528,6 +528,8 @@ namespace opengl
|
|||||||
|
|
||||||
void drawTest(Image * image, float x, float y, float a, float sx, float sy, float ox, float oy);
|
void drawTest(Image * image, float x, float y, float a, float sx, float sy, float ox, float oy);
|
||||||
|
|
||||||
|
bool hasFocus();
|
||||||
|
|
||||||
}; // Graphics
|
}; // Graphics
|
||||||
|
|
||||||
} // opengl
|
} // opengl
|
||||||
|
|||||||
@@ -922,6 +922,12 @@ namespace opengl
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int w_hasFocus(lua_State * L)
|
||||||
|
{
|
||||||
|
luax_pushboolean(L, instance->hasFocus());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// List of functions to wrap.
|
// List of functions to wrap.
|
||||||
static const luaL_Reg functions[] = {
|
static const luaL_Reg functions[] = {
|
||||||
@@ -1007,6 +1013,8 @@ namespace opengl
|
|||||||
|
|
||||||
{ "translate", w_translate },
|
{ "translate", w_translate },
|
||||||
|
|
||||||
|
{ "hasFocus", w_hasFocus },
|
||||||
|
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ namespace opengl
|
|||||||
int w_rotate(lua_State * L);
|
int w_rotate(lua_State * L);
|
||||||
int w_scale(lua_State * L);
|
int w_scale(lua_State * L);
|
||||||
int w_translate(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);
|
extern "C" LOVE_EXPORT int luaopen_love_graphics(lua_State * L);
|
||||||
|
|
||||||
} // opengl
|
} // opengl
|
||||||
|
|||||||
Reference in New Issue
Block a user