Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: nacltoons/data/res/util.lua

Issue 17743003: [nacltoons] Roll cocos2dx + two bug fixes (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « nacltoons/data/res/drawing.lua ('k') | nacltoons/proj.linux/Makefile » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: nacltoons/data/res/util.lua
diff --git a/nacltoons/data/res/util.lua b/nacltoons/data/res/util.lua
index 31efc690a275ce1a576e46fd271e08eeb0809423..8470e0f4418aad7afb079d603cfc88d644417680 100644
--- a/nacltoons/data/res/util.lua
+++ b/nacltoons/data/res/util.lua
@@ -19,15 +19,23 @@ function util.ScreenToWorld(value)
return value / util.PTM_RATIO
end
+function util.WorldToScreen(value)
+ return value * util.PTM_RATIO
+end
+
--- Log messages to console
-function util.Log(...)
- print('LUA: ' .. string.format(...))
+function util.Log(arg)
+ print('LUA: ' .. tostring(arg))
end
function util.PointToString(point)
return string.format('%dx%d', point.x, point.y)
end
+function util.VecToString(v)
+ return string.format('%dx%d', util.WorldToScreen(v.x), util.WorldToScreen(v.y))
+end
+
--- Create CCPoint from a lua table containing 2 elements.
-- This is used to convert point data from .def files into
-- the cocos2dx coordinate space.
@@ -35,7 +43,7 @@ function util.PointFromLua(point, absolute)
if absolute == nil then
absolute = true
end
- if abolute then
+ if absolute then
return ccp(point[1] + game_obj.origin.x, point[2] + game_obj.origin.y)
else
return ccp(point[1], point[2])
« no previous file with comments | « nacltoons/data/res/drawing.lua ('k') | nacltoons/proj.linux/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698