Added love.graphics.origin(): resets the coordinate system (replaces the current transformation matrix with the identity)

--HG--
branch : love.graphics.origin
This commit is contained in:
Alex Szpakowski
2013-02-24 14:07:03 -04:00
parent 6282cad960
commit 083218742a
6 changed files with 26 additions and 1 deletions
+5 -1
View File
@@ -207,7 +207,6 @@ void Graphics::reset()
void Graphics::clear()
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
}
void Graphics::present()
@@ -1117,6 +1116,11 @@ void Graphics::shear(float kx, float ky)
glMultMatrixf((const GLfloat *)t.getElements());
}
void Graphics::origin()
{
glLoadIdentity();
}
bool Graphics::hasFocus() const
{
return currentWindow->hasFocus();
+1
View File
@@ -510,6 +510,7 @@ public:
void scale(float x, float y = 1.0f);
void translate(float x, float y);
void shear(float kx, float ky);
void origin();
bool hasFocus() const;
private:
@@ -1250,6 +1250,12 @@ int w_shear(lua_State *L)
return 0;
}
int w_origin(lua_State *L)
{
instance->origin();
return 0;
}
int w_hasFocus(lua_State *L)
{
luax_pushboolean(L, instance->hasFocus());
@@ -1352,6 +1358,7 @@ static const luaL_Reg functions[] =
{ "scale", w_scale },
{ "translate", w_translate },
{ "shear", w_shear },
{ "origin", w_origin },
{ "hasFocus", w_hasFocus },
@@ -110,6 +110,7 @@ int w_rotate(lua_State *L);
int w_scale(lua_State *L);
int w_translate(lua_State *L);
int w_shear(lua_State *L);
int w_origin(lua_State *L);
int w_hasFocus(lua_State *L);
extern "C" LOVE_EXPORT int luaopen_love_graphics(lua_State *L);