Commits

Alex Szpakowski committed f22a7ac Merge

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

Comments (1)

Files changed (6)

src/modules/graphics/opengl/Graphics.cpp

 void Graphics::clear()
 {
 	glClear(GL_COLOR_BUFFER_BIT);
-	glLoadIdentity();
 }
 
 void Graphics::present()
 	glMultMatrixf((const GLfloat *)t.getElements());
 }
 
+void Graphics::origin()
+{
+	glLoadIdentity();
+}
+
 bool Graphics::hasFocus() const
 {
 	return currentWindow->hasFocus();

src/modules/graphics/opengl/Graphics.h

 	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:

src/modules/graphics/opengl/wrap_Graphics.cpp

 	return 0;
 }
 
+int w_origin(lua_State *L)
+{
+	instance->origin();
+	return 0;
+}
+
 int w_hasFocus(lua_State *L)
 {
 	luax_pushboolean(L, instance->hasFocus());
 	{ "scale", w_scale },
 	{ "translate", w_translate },
 	{ "shear", w_shear },
+	{ "origin", w_origin },
 
 	{ "hasFocus", w_hasFocus },
 

src/modules/graphics/opengl/wrap_Graphics.h

 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);
 

src/scripts/boot.lua

 				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)
 		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
 
 	local trace = debug.traceback()
 
 	love.graphics.clear()
+	love.graphics.origin()
 
 	local err = {}
 
 	love.graphics.setColor(255, 255, 255, 255)
 
 	love.graphics.clear()
+	love.graphics.origin()
 
 	local err = {}
 

src/scripts/boot.lua.h

 	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,
 	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,
 	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,
 	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,