Merged love.graphics.origin into default (issue #124)

This commit is contained in:
Alex Szpakowski
2013-04-11 17:59:32 -03:00
6 changed files with 26 additions and 1 deletions
+5 -1
View File
@@ -231,7 +231,6 @@ void Graphics::reset()
void Graphics::clear()
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
}
void Graphics::present()
@@ -1318,6 +1317,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
@@ -531,6 +531,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:
@@ -1539,6 +1539,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());
@@ -1647,6 +1653,7 @@ static const luaL_Reg functions[] =
{ "scale", w_scale },
{ "translate", w_translate },
{ "shear", w_shear },
{ "origin", w_origin },
{ "hasFocus", w_hasFocus },
@@ -114,6 +114,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);
+4
View File
@@ -396,6 +396,7 @@ function love.init()
love.event.pump()
love.graphics.setBackgroundColor(89, 157, 220)
love.graphics.clear()
love.graphics.origin()
love.graphics.print(msg, 70, 70)
love.graphics.present()
love.graphics.setBackgroundColor(0, 0, 0)
@@ -443,6 +444,7 @@ function love.run()
if love.update then love.update(dt) end -- will pass 0 if love.timer is disabled
if love.graphics then
love.graphics.clear()
love.graphics.origin()
if love.draw then love.draw() end
end
@@ -736,6 +738,7 @@ function love.errhand(msg)
local trace = debug.traceback()
love.graphics.clear()
love.graphics.origin()
local err = {}
@@ -799,6 +802,7 @@ function love.releaseerrhand(msg)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.clear()
love.graphics.origin()
local err = {}
+8
View File
@@ -696,6 +696,8 @@ const unsigned char boot_lua[] =
0x09, 0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e,
0x63, 0x6c, 0x65, 0x61, 0x72, 0x28, 0x29, 0x0a,
0x09, 0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e,
0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x28, 0x29, 0x0a,
0x09, 0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e,
0x70, 0x72, 0x69, 0x6e, 0x74, 0x28, 0x6d, 0x73, 0x67, 0x2c, 0x20, 0x37, 0x30, 0x2c, 0x20, 0x37, 0x30, 0x29, 0x0a,
0x09, 0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e,
0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x28, 0x29, 0x0a,
@@ -768,6 +770,8 @@ const unsigned char boot_lua[] =
0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x63,
0x6c, 0x65, 0x61, 0x72, 0x28, 0x29, 0x0a,
0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6f,
0x72, 0x69, 0x67, 0x69, 0x6e, 0x28, 0x29, 0x0a,
0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x64, 0x72, 0x61, 0x77, 0x20, 0x74, 0x68,
0x65, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x64, 0x72, 0x61, 0x77, 0x28, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a,
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
@@ -1767,6 +1771,8 @@ const unsigned char boot_lua[] =
0x75, 0x67, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x62, 0x61, 0x63, 0x6b, 0x28, 0x29, 0x0a,
0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x63, 0x6c, 0x65,
0x61, 0x72, 0x28, 0x29, 0x0a,
0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6f, 0x72, 0x69,
0x67, 0x69, 0x6e, 0x28, 0x29, 0x0a,
0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x65, 0x72, 0x72, 0x20, 0x3d, 0x20, 0x7b, 0x7d, 0x0a,
0x09, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x28, 0x65, 0x72, 0x72, 0x2c,
0x20, 0x22, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x5c, 0x6e, 0x22, 0x29, 0x0a,
@@ -1857,6 +1863,8 @@ const unsigned char boot_lua[] =
0x35, 0x2c, 0x20, 0x32, 0x35, 0x35, 0x29, 0x0a,
0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x63, 0x6c, 0x65,
0x61, 0x72, 0x28, 0x29, 0x0a,
0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6f, 0x72, 0x69,
0x67, 0x69, 0x6e, 0x28, 0x29, 0x0a,
0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x65, 0x72, 0x72, 0x20, 0x3d, 0x20, 0x7b, 0x7d, 0x0a,
0x09, 0x70, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74,
0x28, 0x22, 0x41, 0x6e, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x68, 0x61, 0x73, 0x20, 0x6f, 0x63, 0x63,