quick-cocos2dx cocos2dx.lua

来源:互联网 发布:创维电视有线连接网络 编辑:程序博客网 时间:2024/04/29 22:18
cocos2dx.lua 重命名cocos2dx中的常用struct, 函数; 重定义一些常用宏;以及新定义了一些c++ to lua 的转换函数。如:
1、重命名struct
ccp = CCPointccsize = CCSizeccrect = CCRectcc.p = CCPointcc.size = CCSizecc.rect = CCRect

2、重命名函数
cc.c3 = ccc3cc.c4 = ccc4cc.c4f = ccc4f

3、冲定义宏
cc.TOUCH_IGNORE               = 0cc.TOUCH_BEGAN                = 1cc.TOUCH_BEGAN_SWALLOWS       = cc.TOUCH_BEGANcc.TOUCH_BEGAN_NO_SWALLOWS    = 2cc.TOUCH_MOVED                = 1cc.TOUCH_MOVED_SWALLOWS       = cc.TOUCH_MOVEDcc.TOUCH_MOVED_NO_SWALLOWS    = 0cc.TOUCH_MOVED_RELEASE_OTHERS = 2cc.MULTI_TOUCHES_ON           = truecc.MULTI_TOUCHES_OFF          = false

4、转换函数
cc.size2t = function(size)-- CCSize to table    return {width = size.width, height = size.height}endcc.point2t = function(point)-- CCPoint to table    return {x = point.x, y = point.y}endcc.rect2t = function(rect)-- CCRect to table    return {origin = cc.point2t(rect.origin), size = cc.size2t(rect.size)}endcc.t2size = function(t)-- table to CCSize    return CCSize(t.width, t.height)endcc.t2point = function(t)-- table to CCPoint    return CCPoint(t.x, t.y)endcc.t2rect = function(t)-- table to Rect    return CCRect(t.origin.x, t.origin.y, t.size.width, t.size.height)end


0 0
原创粉丝点击