diff --git a/res/HelloWorld.png b/res/HelloWorld.png new file mode 100644 index 0000000..21d4326 Binary files /dev/null and b/res/HelloWorld.png differ diff --git a/src/app/MyApp.lua b/src/app/MyApp.lua new file mode 100644 index 0000000..e8d1a9f --- /dev/null +++ b/src/app/MyApp.lua @@ -0,0 +1,8 @@ + +local MyApp = class("MyApp", cc.load("mvc").AppBase) + +function MyApp:onCreate() + math.randomseed(os.time()) +end + +return MyApp diff --git a/src/app/views/MainScene.lua b/src/app/views/MainScene.lua new file mode 100644 index 0000000..83dc298 --- /dev/null +++ b/src/app/views/MainScene.lua @@ -0,0 +1,17 @@ + +local MainScene = class("MainScene", cc.load("mvc").ViewBase) + +function MainScene:onCreate() + -- add background image + display.newSprite("HelloWorld.png") + :move(display.center) + :addTo(self) + + -- add HelloWorld label + cc.Label:createWithSystemFont("Hello World", "Arial", 40) + :move(display.cx, display.cy + 200) + :addTo(self) + +end + +return MainScene diff --git a/src/cocos/3d/3dConstants.lua b/src/cocos/3d/3dConstants.lua new file mode 100644 index 0000000..cd0d602 --- /dev/null +++ b/src/cocos/3d/3dConstants.lua @@ -0,0 +1,16 @@ +if nil == cc.Terrain then + return +end + +cc.Terrain.CrackFixedType = +{ + SKIRT = 0, + INCREASE_LOWER = 1, +} + +cc.Animate3DQuality = +{ + QUALITY_NONE = 0, + QUALITY_LOW = 1, + QUALITY_HIGH = 2, +} diff --git a/src/cocos/cocos2d/Cocos2d.lua b/src/cocos/cocos2d/Cocos2d.lua new file mode 100644 index 0000000..6b451c3 --- /dev/null +++ b/src/cocos/cocos2d/Cocos2d.lua @@ -0,0 +1,580 @@ + +cc = cc or {} + +function cc.clampf(value, min_inclusive, max_inclusive) + -- body + local temp = 0 + if min_inclusive > max_inclusive then + temp = min_inclusive + min_inclusive = max_inclusive + max_inclusive = temp + end + + if value < min_inclusive then + return min_inclusive + elseif value < max_inclusive then + return value + else + return max_inclusive + end +end + +--Point +function cc.p(_x,_y) + if nil == _y then + return { x = _x.x, y = _x.y } + else + return { x = _x, y = _y } + end +end + +function cc.pAdd(pt1,pt2) + return {x = pt1.x + pt2.x , y = pt1.y + pt2.y } +end + +function cc.pSub(pt1,pt2) + return {x = pt1.x - pt2.x , y = pt1.y - pt2.y } +end + +function cc.pMul(pt1,factor) + return { x = pt1.x * factor , y = pt1.y * factor } +end + +function cc.pMidpoint(pt1,pt2) + return { x = (pt1.x + pt2.x) / 2.0 , y = ( pt1.y + pt2.y) / 2.0 } +end + +function cc.pForAngle(a) + return { x = math.cos(a), y = math.sin(a) } +end + +function cc.pGetLength(pt) + return math.sqrt( pt.x * pt.x + pt.y * pt.y ) +end + +function cc.pNormalize(pt) + local length = cc.pGetLength(pt) + if 0 == length then + return { x = 1.0,y = 0.0 } + end + + return { x = pt.x / length, y = pt.y / length } +end + +function cc.pCross(self,other) + return self.x * other.y - self.y * other.x +end + +function cc.pDot(self,other) + return self.x * other.x + self.y * other.y +end + +function cc.pToAngleSelf(self) + return math.atan2(self.y, self.x) +end + +function cc.pGetAngle(self,other) + local a2 = cc.pNormalize(self) + local b2 = cc.pNormalize(other) + local angle = math.atan2(cc.pCross(a2, b2), cc.pDot(a2, b2) ) + if math.abs(angle) < 1.192092896e-7 then + return 0.0 + end + + return angle +end + +function cc.pGetDistance(startP,endP) + return cc.pGetLength(cc.pSub(startP,endP)) +end + +function cc.pIsLineIntersect(A, B, C, D, s, t) + if ((A.x == B.x) and (A.y == B.y)) or ((C.x == D.x) and (C.y == D.y))then + return false, s, t + end + + local BAx = B.x - A.x + local BAy = B.y - A.y + local DCx = D.x - C.x + local DCy = D.y - C.y + local ACx = A.x - C.x + local ACy = A.y - C.y + + local denom = DCy * BAx - DCx * BAy + s = DCx * ACy - DCy * ACx + t = BAx * ACy - BAy * ACx + + if (denom == 0) then + if (s == 0 or t == 0) then + return true, s , t + end + + return false, s, t + end + + s = s / denom + t = t / denom + + return true,s,t +end + +function cc.pPerp(pt) + return { x = -pt.y, y = pt.x } +end + +function cc.RPerp(pt) + return { x = pt.y, y = -pt.x } +end + +function cc.pProject(pt1, pt2) + return { x = pt2.x * (cc.pDot(pt1,pt2) / cc.pDot(pt2,pt2)) , y = pt2.y * (cc.pDot(pt1,pt2) / cc.pDot(pt2,pt2)) } +end + +function cc.pRotate(pt1, pt2) + return { x = pt1.x * pt2.x - pt1.y * pt2.y, y = pt1.x * pt2.y + pt1.y * pt2.x } +end + +function cc.pUnrotate(pt1, pt2) + return { x = pt1.x * pt2.x + pt1.y * pt2.y, pt1.y * pt2.x - pt1.x * pt2.y } +end +--Calculates the square length of pt +function cc.pLengthSQ(pt) + return cc.pDot(pt,pt) +end +--Calculates the square distance between pt1 and pt2 +function cc.pDistanceSQ(pt1,pt2) + return cc.pLengthSQ(cc.pSub(pt1,pt2)) +end + +function cc.pGetClampPoint(pt1,pt2,pt3) + return { x = cc.clampf(pt1.x, pt2.x, pt3.x), y = cc.clampf(pt1.y, pt2.y, pt3.y) } +end + +function cc.pFromSize(sz) + return { x = sz.width, y = sz.height } +end + +function cc.pLerp(pt1,pt2,alpha) + return cc.pAdd(cc.pMul(pt1, 1.0 - alpha), cc.pMul(pt2,alpha) ) +end + +function cc.pFuzzyEqual(pt1,pt2,variance) + if (pt1.x - variance <= pt2.x) and (pt2.x <= pt1.x + variance) and (pt1.y - variance <= pt2.y) and (pt2.y <= pt1.y + variance) then + return true + else + return false + end +end + +function cc.pRotateByAngle(pt1, pt2, angle) + return cc.pAdd(pt2, cc.pRotate( cc.pSub(pt1, pt2),cc.pForAngle(angle))) +end + +function cc.pIsSegmentIntersect(pt1,pt2,pt3,pt4) + local s,t,ret = 0,0,false + ret,s,t =cc.pIsLineIntersect(pt1, pt2, pt3, pt4,s,t) + + if ret and s >= 0.0 and s <= 1.0 and t >= 0.0 and t <= 1.0 then + return true + end + + return false +end + +function cc.pGetIntersectPoint(pt1,pt2,pt3,pt4) + local s,t, ret = 0,0,false + ret,s,t = cc.pIsLineIntersect(pt1,pt2,pt3,pt4,s,t) + if ret then + return cc.p(pt1.x + s * (pt2.x - pt1.x), pt1.y + s * (pt2.y - pt1.y)) + else + return cc.p(0,0) + end +end +--Size +function cc.size( _width,_height ) + return { width = _width, height = _height } +end + +--Rect +function cc.rect(_x,_y,_width,_height) + return { x = _x, y = _y, width = _width, height = _height } +end + +function cc.rectEqualToRect(rect1,rect2) + if ((rect1.x >= rect2.x) or (rect1.y >= rect2.y) or + ( rect1.x + rect1.width <= rect2.x + rect2.width) or + ( rect1.y + rect1.height <= rect2.y + rect2.height)) then + return false + end + + return true +end + +function cc.rectGetMaxX(rect) + return rect.x + rect.width +end + +function cc.rectGetMidX(rect) + return rect.x + rect.width / 2.0 +end + +function cc.rectGetMinX(rect) + return rect.x +end + +function cc.rectGetMaxY(rect) + return rect.y + rect.height +end + +function cc.rectGetMidY(rect) + return rect.y + rect.height / 2.0 +end + +function cc.rectGetMinY(rect) + return rect.y +end + +function cc.rectContainsPoint( rect, point ) + local ret = false + + if (point.x >= rect.x) and (point.x <= rect.x + rect.width) and + (point.y >= rect.y) and (point.y <= rect.y + rect.height) then + ret = true + end + + return ret +end + +function cc.rectIntersectsRect( rect1, rect2 ) + local intersect = not ( rect1.x > rect2.x + rect2.width or + rect1.x + rect1.width < rect2.x or + rect1.y > rect2.y + rect2.height or + rect1.y + rect1.height < rect2.y ) + + return intersect +end + +function cc.rectUnion( rect1, rect2 ) + local rect = cc.rect(0, 0, 0, 0) + rect.x = math.min(rect1.x, rect2.x) + rect.y = math.min(rect1.y, rect2.y) + rect.width = math.max(rect1.x + rect1.width, rect2.x + rect2.width) - rect.x + rect.height = math.max(rect1.y + rect1.height, rect2.y + rect2.height) - rect.y + return rect +end + +function cc.rectIntersection( rect1, rect2 ) + local intersection = cc.rect( + math.max(rect1.x, rect2.x), + math.max(rect1.y, rect2.y), + 0, 0) + + intersection.width = math.min(rect1.x + rect1.width, rect2.x + rect2.width) - intersection.x + intersection.height = math.min(rect1.y + rect1.height, rect2.y + rect2.height) - intersection.y + return intersection +end + +--Color3B +function cc.c3b( _r,_g,_b ) + return { r = _r, g = _g, b = _b } +end + +--Color4B +function cc.c4b( _r,_g,_b,_a ) + return { r = _r, g = _g, b = _b, a = _a } +end + +--Color4F +function cc.c4f( _r,_g,_b,_a ) + return { r = _r, g = _g, b = _b, a = _a } +end + +local function isFloatColor(c) + return (c.r <= 1 and c.g <= 1 and c.b <= 1) and (math.ceil(c.r) ~= c.r or math.ceil(c.g) ~= c.g or math.ceil(c.b) ~= c.b) +end + +function cc.convertColor(input, typ) + assert(type(input) == "table" and input.r and input.g and input.b, "cc.convertColor() - invalid input color") + local ret + if typ == "3b" then + if isFloatColor(input) then + ret = {r = math.ceil(input.r * 255), g = math.ceil(input.g * 255), b = math.ceil(input.b * 255)} + else + ret = {r = input.r, g = input.g, b = input.b} + end + elseif typ == "4b" then + if isFloatColor(input) then + ret = {r = math.ceil(input.r * 255), g = math.ceil(input.g * 255), b = math.ceil(input.b * 255)} + else + ret = {r = input.r, g = input.g, b = input.b} + end + if input.a then + if math.ceil(input.a) ~= input.a or input.a >= 1 then + ret.a = input.a * 255 + else + ret.a = input.a + end + else + ret.a = 255 + end + elseif typ == "4f" then + if isFloatColor(input) then + ret = {r = input.r, g = input.g, b = input.b} + else + ret = {r = input.r / 255, g = input.g / 255, b = input.b / 255} + end + if input.a then + if math.ceil(input.a) ~= input.a or input.a >= 1 then + ret.a = input.a + else + ret.a = input.a / 255 + end + else + ret.a = 255 + end + else + error(string.format("cc.convertColor() - invalid type %s", typ), 0) + end + return ret +end + +--Vertex2F +function cc.vertex2F(_x,_y) + return { x = _x, y = _y } +end + +--Vertex3F +function cc.Vertex3F(_x,_y,_z) + return { x = _x, y = _y, z = _z } +end + +--Tex2F +function cc.tex2F(_u,_v) + return { u = _u, v = _v } +end + +--PointSprite +function cc.PointSprite(_pos,_color,_size) + return { pos = _pos, color = _color, size = _size } +end + +--Quad2 +function cc.Quad2(_tl,_tr,_bl,_br) + return { tl = _tl, tr = _tr, bl = _bl, br = _br } +end + +--Quad3 +function cc.Quad3(_tl, _tr, _bl, _br) + return { tl = _tl, tr = _tr, bl = _bl, br = _br } +end + +--V2F_C4B_T2F +function cc.V2F_C4B_T2F(_vertices, _colors, _texCoords) + return { vertices = _vertices, colors = _colors, texCoords = _texCoords } +end + +--V2F_C4F_T2F +function cc.V2F_C4F_T2F(_vertices, _colors, _texCoords) + return { vertices = _vertices, colors = _colors, texCoords = _texCoords } +end + +--V3F_C4B_T2F +function cc.V3F_C4B_T2F(_vertices, _colors, _texCoords) + return { vertices = _vertices, colors = _colors, texCoords = _texCoords } +end + +--V2F_C4B_T2F_Quad +function cc.V2F_C4B_T2F_Quad(_bl, _br, _tl, _tr) + return { bl = _bl, br = _br, tl = _tl, tr = _tr } +end + +--V3F_C4B_T2F_Quad +function cc.V3F_C4B_T2F_Quad(_tl, _bl, _tr, _br) + return { tl = _tl, bl = _bl, tr = _tr, br = _br } +end + +--V2F_C4F_T2F_Quad +function cc.V2F_C4F_T2F_Quad(_bl, _br, _tl, _tr) + return { bl = _bl, br = _br, tl = _tl, tr = _tr } +end + +--T2F_Quad +function cc.T2F_Quad(_bl, _br, _tl, _tr) + return { bl = _bl, br = _br, tl = _tl, tr = _tr } +end + +--AnimationFrameData +function cc.AnimationFrameData( _texCoords, _delay, _size) + return { texCoords = _texCoords, delay = _delay, size = _size } +end + +--PhysicsMaterial +function cc.PhysicsMaterial(_density, _restitution, _friction) + return { density = _density, restitution = _restitution, friction = _friction } +end + +function cc.vec3(_x, _y, _z) + return { x = _x, y = _y, z = _z } +end + +function cc.vec4(_x, _y, _z, _w) + return { x = _x, y = _y, z = _z, w = _w } +end + +function cc.vec3normalize(vec3) + local n = vec3.x * vec3.x + vec3.y * vec3.y + vec3.z * vec3.z + if n == 1.0 then + return vec3 + end + + n = math.sqrt(n) + + if n < 2e-37 then + return vec3 + end + + n = 1.0 / n + return {x = vec3.x * n, y = vec3.y * n, z = vec3.z * n} +end + +function cc.quaternion(_x, _y ,_z,_w) + return { x = _x, y = _y, z = _z, w = _w } +end + +function cc.quaternion_createFromAxisAngle(axis, angle) + + local halfAngle = angle * 0.5 + local sinHalfAngle = math.sin(halfAngle) + + local normal = cc.vec3(axis.x, axis.y, axis.z) + normal = cc.vec3normalize(normal) + local dst = cc.vec3(0.0, 0.0, 0.0) + dst.x = normal.x * sinHalfAngle + dst.y = normal.y * sinHalfAngle + dst.z = normal.z * sinHalfAngle + dst.w = math.cos(halfAngle) + + return dst +end + +function cc.blendFunc(_src, _dst) + return {src = _src, dst = _dst} +end + +cc.mat4 = cc.mat4 or {} + +function cc.mat4.new(...) + local params = {...} + local size = #params + local obj = {} + + if 1 == size then + assert(type(params[1]) == "table" , "type of input params are wrong to new a mat4 when num of params is 1") + for i= 1, 16 do + if params[1][i] ~= nil then + obj[i] = params[1][i] + else + obj[i] = 0 + end + end + elseif 16 == size then + for i= 1, 16 do + obj[i] = params[i] + end + end + + setmetatable(obj, {__index = cc.mat4}) + + return obj +end + +function cc.mat4.getInversed(self) + return mat4_getInversed(self) +end + +function cc.mat4.transformVector(self, vector, dst) + return mat4_transformVector(self, vector, dst) +end + +function cc.mat4.multiply(self, mat) + return mat4_multiply(self, mat) +end + +function cc.mat4.decompose(self, scale, rotation, translation) + return mat4_decompose(self, scale ,rotation, translation) +end + +function cc.mat4.createIdentity() + return cc.mat4.new(1.0 ,0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0) +end + +function cc.mat4.createTranslation(translation, dst) + assert(type(translation) == "table" and type(dst) == "table", "The type of input parameters should be table") + dst = cc.mat4.createIdentity() + dst[13] = translation.x + dst[14] = translation.y + dst[15] = translation.z + return dst +end + +function cc.mat4.createRotation(q, dst) + assert(type(q) == "table" and type(dst) == "table", "The type of input parameters should be table") + local x2 = q.x + q.x + local y2 = q.y + q.y + local z2 = q.z + q.z + + local xx2 = q.x * x2 + local yy2 = q.y * y2 + local zz2 = q.z * z2 + local xy2 = q.x * y2 + local xz2 = q.x * z2 + local yz2 = q.y * z2 + local wx2 = q.w * x2 + local wy2 = q.w * y2 + local wz2 = q.w * z2 + + dst[1] = 1.0 - yy2 - zz2 + dst[2] = xy2 + wz2 + dst[3] = xz2 - wy2 + dst[4] = 0.0 + + dst[5] = xy2 - wz2 + dst[6] = 1.0 - xx2 - zz2 + dst[7] = yz2 + wx2 + dst[8] = 0.0 + + dst[9] = xz2 + wy2 + dst[10] = yz2 - wx2 + dst[11] = 1.0 - xx2 - yy2 + dst[12] = 0.0 + + dst[13] = 0.0 + dst[14] = 0.0 + dst[15] = 0.0 + dst[16] = 1.0 + + return dst +end + +function cc.mat4.translate(self,vec3) + return mat4_translate(self,vec3) +end + +function cc.mat4.createRotationZ(self,angle) + return mat4_createRotationZ(self,angle) +end + +function cc.mat4.setIdentity(self) + return mat4_setIdentity(self) +end + +function cc.mat4.createTranslation(...) + return mat4_createTranslation(...) +end + +function cc.mat4.createRotation(...) + return mat4_createRotation(...) +end \ No newline at end of file diff --git a/src/cocos/cocos2d/Cocos2dConstants.lua b/src/cocos/cocos2d/Cocos2dConstants.lua new file mode 100644 index 0000000..ff51b72 --- /dev/null +++ b/src/cocos/cocos2d/Cocos2dConstants.lua @@ -0,0 +1,647 @@ + +cc = cc or {} + +cc.SPRITE_INDEX_NOT_INITIALIZED = 0xffffffff +cc.TMX_ORIENTATION_HEX = 0x1 +cc.TMX_ORIENTATION_ISO = 0x2 +cc.TMX_ORIENTATION_ORTHO = 0x0 +cc.Z_COMPRESSION_BZIP2 = 0x1 +cc.Z_COMPRESSION_GZIP = 0x2 +cc.Z_COMPRESSION_NONE = 0x3 +cc.Z_COMPRESSION_ZLIB = 0x0 +cc.BLEND_DST = 0x303 +cc.BLEND_SRC = 0x1 +cc.DIRECTOR_IOS_USE_BACKGROUND_THREAD = 0x0 +cc.DIRECTOR_MAC_THREAD = 0x0 +cc.DIRECTOR_STATS_INTERVAL = 0.1 +cc.ENABLE_BOX2_D_INTEGRATION = 0x0 +cc.ENABLE_DEPRECATED = 0x1 +cc.ENABLE_GL_STATE_CACHE = 0x1 +cc.ENABLE_PROFILERS = 0x0 +cc.ENABLE_STACKABLE_ACTIONS = 0x1 +cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0x0 +cc.GL_ALL = 0x0 +cc.LABELATLAS_DEBUG_DRAW = 0x0 +cc.LABELBMFONT_DEBUG_DRAW = 0x0 +cc.MAC_USE_DISPLAY_LINK_THREAD = 0x0 +cc.MAC_USE_MAIN_THREAD = 0x2 +cc.MAC_USE_OWN_THREAD = 0x1 +cc.NODE_RENDER_SUBPIXEL = 0x1 +cc.PVRMIPMAP_MAX = 0x10 +cc.SPRITEBATCHNODE_RENDER_SUBPIXEL = 0x1 +cc.SPRITE_DEBUG_DRAW = 0x0 +cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP = 0x0 +cc.TEXTURE_ATLAS_USE_VAO = 0x1 +cc.USE_L_A88_LABELS = 0x1 +cc.ACTION_TAG_INVALID = -1 +cc.DEVICE_MAC = 0x6 +cc.DEVICE_MAC_RETINA_DISPLAY = 0x7 +cc.DEVICEI_PAD = 0x4 +cc.DEVICEI_PAD_RETINA_DISPLAY = 0x5 +cc.DEVICEI_PHONE = 0x0 +cc.DEVICEI_PHONE5 = 0x2 +cc.DEVICEI_PHONE5_RETINA_DISPLAY = 0x3 +cc.DEVICEI_PHONE_RETINA_DISPLAY = 0x1 +cc.DIRECTOR_PROJECTION2_D = 0x0 +cc.DIRECTOR_PROJECTION3_D = 0x1 +cc.DIRECTOR_PROJECTION_CUSTOM = 0x2 +cc.DIRECTOR_PROJECTION_DEFAULT = 0x1 +cc.FILE_UTILS_SEARCH_DIRECTORY_MODE = 0x1 +cc.FILE_UTILS_SEARCH_SUFFIX_MODE = 0x0 +cc.FLIPED_ALL = 0xe0000000 +cc.FLIPPED_MASK = 0x1fffffff +cc.IMAGE_FORMAT_JPEG = 0x0 +cc.IMAGE_FORMAT_PNG = 0x1 +cc.ITEM_SIZE = 0x20 +cc.LABEL_AUTOMATIC_WIDTH = -1 +cc.LINE_BREAK_MODE_CHARACTER_WRAP = 0x1 +cc.LINE_BREAK_MODE_CLIP = 0x2 +cc.LINE_BREAK_MODE_HEAD_TRUNCATION = 0x3 +cc.LINE_BREAK_MODE_MIDDLE_TRUNCATION = 0x5 +cc.LINE_BREAK_MODE_TAIL_TRUNCATION = 0x4 +cc.LINE_BREAK_MODE_WORD_WRAP = 0x0 +cc.MAC_VERSION_10_6 = 0xa060000 +cc.MAC_VERSION_10_7 = 0xa070000 +cc.MAC_VERSION_10_8 = 0xa080000 +cc.MENU_HANDLER_PRIORITY = -128 +cc.MENU_STATE_TRACKING_TOUCH = 0x1 +cc.MENU_STATE_WAITING = 0x0 +cc.NODE_TAG_INVALID = -1 +cc.PARTICLE_DURATION_INFINITY = -1 +cc.PARTICLE_MODE_GRAVITY = 0x0 +cc.PARTICLE_MODE_RADIUS = 0x1 +cc.PARTICLE_START_RADIUS_EQUAL_TO_END_RADIUS = -1 +cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE = -1 +cc.POSITION_TYPE_FREE = 0x0 +cc.POSITION_TYPE_GROUPED = 0x2 +cc.POSITION_TYPE_RELATIVE = 0x1 +cc.PRIORITY_NON_SYSTEM_MIN = -2147483647 +cc.PRIORITY_SYSTEM = -2147483648 +cc.PROGRESS_TIMER_TYPE_BAR = 0x1 +cc.PROGRESS_TIMER_TYPE_RADIAL = 0x0 +cc.REPEAT_FOREVER = 0xfffffffe +cc.RESOLUTION_MAC = 0x1 +cc.RESOLUTION_MAC_RETINA_DISPLAY = 0x2 +cc.RESOLUTION_UNKNOWN = 0x0 +cc.TMX_TILE_DIAGONAL_FLAG = 0x20000000 +cc.TMX_TILE_HORIZONTAL_FLAG = 0x80000000 +cc.TMX_TILE_VERTICAL_FLAG = 0x40000000 +cc.TEXT_ALIGNMENT_CENTER = 0x1 +cc.TEXT_ALIGNMENT_LEFT = 0x0 +cc.TEXT_ALIGNMENT_RIGHT = 0x2 + +cc.TEXTURE2_D_PIXEL_FORMAT_AUTO = 0x0 +cc.TEXTURE2_D_PIXEL_FORMAT_BGR_A8888 = 0x1 +cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888 = 0x2 +cc.TEXTURE2_D_PIXEL_FORMAT_RG_B888 = 0x3 +cc.TEXTURE2_D_PIXEL_FORMAT_RG_B565 = 0x4 +cc.TEXTURE2_D_PIXEL_FORMAT_A8 = 0x5 +cc.TEXTURE2_D_PIXEL_FORMAT_I8 = 0x6 +cc.TEXTURE2_D_PIXEL_FORMAT_A_I88 = 0x7 +cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444 = 0x8 +cc.TEXTURE2_D_PIXEL_FORMAT_RGB5_A1 = 0x9 +cc.TEXTURE2_D_PIXEL_FORMAT_PVRTC4 = 0xa +cc.TEXTURE2_D_PIXEL_FORMAT_PVRTC4A = 0xb +cc.TEXTURE2_D_PIXEL_FORMAT_PVRTC2 = 0xc +cc.TEXTURE2_D_PIXEL_FORMAT_PVRTC2A = 0xd +cc.TEXTURE2_D_PIXEL_FORMAT_ETC = 0xe +cc.TEXTURE2_D_PIXEL_FORMAT_S3TC_DXT1 = 0xf +cc.TEXTURE2_D_PIXEL_FORMAT_S3TC_DXT3 = 0x10 +cc.TEXTURE2_D_PIXEL_FORMAT_S3TC_DXT5 = 0x11 +cc.TEXTURE2_D_PIXEL_FORMAT_DEFAULT = 0x0 +cc.TOUCHES_ALL_AT_ONCE = 0x0 +cc.TOUCHES_ONE_BY_ONE = 0x1 +cc.TRANSITION_ORIENTATION_DOWN_OVER = 0x1 +cc.TRANSITION_ORIENTATION_LEFT_OVER = 0x0 +cc.TRANSITION_ORIENTATION_RIGHT_OVER = 0x1 +cc.TRANSITION_ORIENTATION_UP_OVER = 0x0 +cc.UNIFORM_COS_TIME = 0x5 +cc.UNIFORM_MV_MATRIX = 0x1 +cc.UNIFORM_MVP_MATRIX = 0x2 +cc.UNIFORM_P_MATRIX = 0x0 +cc.UNIFORM_RANDOM01 = 0x6 +cc.UNIFORM_SAMPLER = 0x7 +cc.UNIFORM_SIN_TIME = 0x4 +cc.UNIFORM_TIME = 0x3 +cc.UNIFORM_MAX = 0x8 +cc.VERTEX_ATTRIB_FLAG_COLOR = 0x2 +cc.VERTEX_ATTRIB_FLAG_NONE = 0x0 +cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX = 0x7 +cc.VERTEX_ATTRIB_FLAG_POSITION = 0x1 +cc.VERTEX_ATTRIB_FLAG_TEX_COORDS = 0x4 +cc.VERTEX_ATTRIB_COLOR = 0x1 +cc.VERTEX_ATTRIB_MAX = 0x3 +cc.VERTEX_ATTRIB_POSITION = 0x0 +cc.VERTEX_ATTRIB_TEX_COORD = 0x2 + +cc.VERTEX_ATTRIB_TEX_COORDS = 0x2 +cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM = 0x2 +cc.VERTICAL_TEXT_ALIGNMENT_CENTER = 0x1 +cc.VERTICAL_TEXT_ALIGNMENT_TOP = 0x0 +cc.OS_VERSION_4_0 = 0x4000000 +cc.OS_VERSION_4_0_1 = 0x4000100 +cc.OS_VERSION_4_1 = 0x4010000 +cc.OS_VERSION_4_2 = 0x4020000 +cc.OS_VERSION_4_2_1 = 0x4020100 +cc.OS_VERSION_4_3 = 0x4030000 +cc.OS_VERSION_4_3_1 = 0x4030100 +cc.OS_VERSION_4_3_2 = 0x4030200 +cc.OS_VERSION_4_3_3 = 0x4030300 +cc.OS_VERSION_4_3_4 = 0x4030400 +cc.OS_VERSION_4_3_5 = 0x4030500 +cc.OS_VERSION_5_0 = 0x5000000 +cc.OS_VERSION_5_0_1 = 0x5000100 +cc.OS_VERSION_5_1_0 = 0x5010000 +cc.OS_VERSION_6_0_0 = 0x6000000 +cc.ANIMATION_FRAME_DISPLAYED_NOTIFICATION = 'CCAnimationFrameDisplayedNotification' +cc.CHIPMUNK_IMPORT = 'chipmunk.h' +cc.ATTRIBUTE_NAME_COLOR = 'a_color' +cc.ATTRIBUTE_NAME_POSITION = 'a_position' +cc.ATTRIBUTE_NAME_TEX_COORD = 'a_texCoord' +cc.SHADER_POSITION_COLOR = 'ShaderPositionColor' +cc.SHADER_POSITION_LENGTH_TEXURE_COLOR = 'ShaderPositionLengthTextureColor' +cc.SHADER_POSITION_TEXTURE = 'ShaderPositionTexture' +cc.SHADER_POSITION_TEXTURE_A8_COLOR = 'ShaderPositionTextureA8Color' +cc.SHADER_POSITION_TEXTURE_COLOR = 'ShaderPositionTextureColor' +cc.SHADER_POSITION_TEXTURE_COLOR_ALPHA_TEST = 'ShaderPositionTextureColorAlphaTest' +cc.SHADER_POSITION_TEXTURE_U_COLOR = 'ShaderPositionTexture_uColor' +cc.SHADER_POSITION_U_COLOR = 'ShaderPosition_uColor' +cc.UNIFORM_ALPHA_TEST_VALUE_S = 'CC_AlphaValue' +cc.UNIFORM_COS_TIME_S = 'CC_CosTime' +cc.UNIFORM_MV_MATRIX_S = 'CC_MVMatrix' +cc.UNIFORM_MVP_MATRIX_S = 'CC_MVPMatrix' +cc.UNIFORM_P_MATRIX_S = 'CC_PMatrix' +cc.UNIFORM_RANDOM01_S = 'CC_Random01' +cc.UNIFORM_SAMPLER_S = 'CC_Texture0' +cc.UNIFORM_SIN_TIME_S = 'CC_SinTime' +cc.UNIFORM_TIME_S = 'CC_Time' + +cc.PLATFORM_OS_WINDOWS = 0 +cc.PLATFORM_OS_LINUX = 1 +cc.PLATFORM_OS_MAC = 2 +cc.PLATFORM_OS_ANDROID = 3 +cc.PLATFORM_OS_IPHONE = 4 +cc.PLATFORM_OS_IPAD = 5 +cc.PLATFORM_OS_BLACKBERRY = 6 +cc.PLATFORM_OS_NACL = 7 +cc.PLATFORM_OS_EMSCRIPTEN = 8 +cc.PLATFORM_OS_TIZEN = 9 +cc.PLATFORM_OS_WINRT = 10 +cc.PLATFORM_OS_WP8 = 11 + +cc.LANGUAGE_ENGLISH = 0 +cc.LANGUAGE_CHINESE = 1 +cc.LANGUAGE_FRENCH = 2 +cc.LANGUAGE_ITALIAN = 3 +cc.LANGUAGE_GERMAN = 4 +cc.LANGUAGE_SPANISH = 5 +cc.LANGUAGE_RUSSIAN = 6 +cc.LANGUAGE_KOREAN = 7 +cc.LANGUAGE_JAPANESE = 8 +cc.LANGUAGE_HUNGARIAN = 9 +cc.LANGUAGE_PORTUGUESE = 10 +cc.LANGUAGE_ARABIC = 11 + +cc.NODE_ON_ENTER = 0 +cc.NODE_ON_EXIT = 1 +cc.NODE_ON_ENTER_TRANSITION_DID_FINISH = 2 +cc.NODE_ON_EXIT_TRANSITION_DID_START = 3 +cc.NODE_ON_CLEAN_UP = 4 + +cc.Handler = cc.Handler or {} +cc.Handler.NODE = 0 +cc.Handler.MENU_CLICKED = 1 +cc.Handler.CALLFUNC = 2 +cc.Handler.SCHEDULE = 3 +cc.Handler.TOUCHES = 4 +cc.Handler.KEYPAD = 5 +cc.Handler.ACCELEROMETER = 6 +cc.Handler.CONTROL_TOUCH_DOWN = 7 +cc.Handler.CONTROL_TOUCH_DRAG_INSIDE = 8 +cc.Handler.CONTROL_TOUCH_DRAG_OUTSIDE = 9 +cc.Handler.CONTROL_TOUCH_DRAG_ENTER = 10 +cc.Handler.CONTROL_TOUCH_DRAG_EXIT = 11 +cc.Handler.CONTROL_TOUCH_UP_INSIDE = 12 +cc.Handler.CONTROL_TOUCH_UP_OUTSIDE = 13 +cc.Handler.CONTROL_TOUCH_UP_CANCEL = 14 +cc.Handler.CONTROL_VALUE_CHANGED = 15 +cc.Handler.WEBSOCKET_OPEN = 16 +cc.Handler.WEBSOCKET_MESSAGE = 17 +cc.Handler.WEBSOCKET_CLOSE = 18 +cc.Handler.WEBSOCKET_ERROR = 19 +cc.Handler.GL_NODE_DRAW = 20 +cc.Handler.SCROLLVIEW_SCROLL = 21 +cc.Handler.SCROLLVIEW_ZOOM = 22 +cc.Handler.TABLECELL_TOUCHED = 23 +cc.Handler.TABLECELL_HIGHLIGHT = 24 +cc.Handler.TABLECELL_UNHIGHLIGHT = 25 +cc.Handler.TABLECELL_WILL_RECYCLE = 26 +cc.Handler.TABLECELL_SIZE_FOR_INDEX = 27 +cc.Handler.TABLECELL_AT_INDEX = 28 +cc.Handler.TABLEVIEW_NUMS_OF_CELLS = 29 +cc.Handler.HTTPREQUEST_STATE_CHANGE = 30 +cc.Handler.ASSETSMANAGER_PROGRESS = 31 +cc.Handler.ASSETSMANAGER_SUCCESS = 32 +cc.Handler.ASSETSMANAGER_ERROR = 33 +cc.Handler.STUDIO_EVENT_LISTENER = 34 +cc.Handler.ARMATURE_EVENT = 35 +cc.Handler.EVENT_ACC = 36 +cc.Handler.EVENT_CUSTIOM = 37 +cc.Handler.EVENT_KEYBOARD_PRESSED = 38 +cc.Handler.EVENT_KEYBOARD_RELEASED = 39 +cc.Handler.EVENT_TOUCH_BEGAN = 40 +cc.Handler.EVENT_TOUCH_MOVED = 41 +cc.Handler.EVENT_TOUCH_ENDED = 42 +cc.Handler.EVENT_TOUCH_CANCELLED = 43 +cc.Handler.EVENT_TOUCHES_BEGAN = 44 +cc.Handler.EVENT_TOUCHES_MOVED = 45 +cc.Handler.EVENT_TOUCHES_ENDED = 46 +cc.Handler.EVENT_TOUCHES_CANCELLED = 47 +cc.Handler.EVENT_MOUSE_DOWN = 48 +cc.Handler.EVENT_MOUSE_UP = 49 +cc.Handler.EVENT_MOUSE_MOVE = 50 +cc.Handler.EVENT_MOUSE_SCROLL = 51 +cc.Handler.EVENT_SPINE = 52 +cc.Handler.EVENT_PHYSICS_CONTACT_BEGIN = 53 +cc.Handler.EVENT_PHYSICS_CONTACT_PRESOLVE = 54 +cc.Handler.EVENT_PHYSICS_CONTACT_POSTSOLVE = 55 +cc.Handler.EVENT_PHYSICS_CONTACT_SEPARATE = 56 +cc.Handler.EVENT_FOCUS = 57 +cc.Handler.EVENT_CONTROLLER_CONNECTED = 58 +cc.Handler.EVENT_CONTROLLER_DISCONNECTED = 59 +cc.Handler.EVENT_CONTROLLER_KEYDOWN = 60 +cc.Handler.EVENT_CONTROLLER_KEYUP = 61 +cc.Handler.EVENT_CONTROLLER_KEYREPEAT = 62 +cc.Handler.EVENT_CONTROLLER_AXIS = 63 +cc.Handler.EVENT_SPINE_ANIMATION_START = 64 +cc.Handler.EVENT_SPINE_ANIMATION_END = 65 +cc.Handler.EVENT_SPINE_ANIMATION_COMPLETE = 66 +cc.Handler.EVENT_SPINE_ANIMATION_EVENT = 67 + + +cc.EVENT_UNKNOWN = 0 +cc.EVENT_TOUCH_ONE_BY_ONE = 1 +cc.EVENT_TOUCH_ALL_AT_ONCE = 2 +cc.EVENT_KEYBOARD = 3 +cc.EVENT_MOUSE = 4 +cc.EVENT_ACCELERATION = 5 +cc.EVENT_CUSTOM = 6 + +cc.PHYSICSSHAPE_MATERIAL_DEFAULT = {density = 0.0, restitution = 0.5, friction = 0.5} +cc.PHYSICSBODY_MATERIAL_DEFAULT = {density = 0.1, restitution = 0.5, friction = 0.5} +cc.GLYPHCOLLECTION_DYNAMIC = 0 +cc.GLYPHCOLLECTION_NEHE = 1 +cc.GLYPHCOLLECTION_ASCII = 2 +cc.GLYPHCOLLECTION_CUSTOM = 3 + +cc.ResolutionPolicy = +{ + EXACT_FIT = 0, + NO_BORDER = 1, + SHOW_ALL = 2, + FIXED_HEIGHT = 3, + FIXED_WIDTH = 4, + UNKNOWN = 5, +} + +cc.LabelEffect = +{ + NORMAL = 0, + OUTLINE = 1, + SHADOW = 2, + GLOW = 3, +} + +cc.LabelOverflow = +{ + NONE = 0, + CLAMP = 1, + SHRINK = 2, + RESIZE_HEIGHT = 3 +}; + +cc.KeyCodeKey = +{ + "KEY_NONE", + "KEY_PAUSE", + "KEY_SCROLL_LOCK", + "KEY_PRINT", + "KEY_SYSREQ", + "KEY_BREAK", + "KEY_ESCAPE", + "KEY_BACKSPACE", + "KEY_TAB", + "KEY_BACK_TAB", + "KEY_RETURN", + "KEY_CAPS_LOCK", + "KEY_SHIFT", + "KEY_RIGHT_SHIFT", + "KEY_CTRL", + "KEY_RIGHT_CTRL", + "KEY_ALT", + "KEY_RIGHT_ALT", + "KEY_MENU", + "KEY_HYPER", + "KEY_INSERT", + "KEY_HOME", + "KEY_PG_UP", + "KEY_DELETE", + "KEY_END", + "KEY_PG_DOWN", + "KEY_LEFT_ARROW", + "KEY_RIGHT_ARROW", + "KEY_UP_ARROW", + "KEY_DOWN_ARROW", + "KEY_NUM_LOCK", + "KEY_KP_PLUS", + "KEY_KP_MINUS", + "KEY_KP_MULTIPLY", + "KEY_KP_DIVIDE", + "KEY_KP_ENTER", + "KEY_KP_HOME", + "KEY_KP_UP", + "KEY_KP_PG_UP", + "KEY_KP_LEFT", + "KEY_KP_FIVE", + "KEY_KP_RIGHT", + "KEY_KP_END", + "KEY_KP_DOWN", + "KEY_KP_PG_DOWN", + "KEY_KP_INSERT", + "KEY_KP_DELETE", + "KEY_F1", + "KEY_F2", + "KEY_F3", + "KEY_F4", + "KEY_F5", + "KEY_F6", + "KEY_F7", + "KEY_F8", + "KEY_F9", + "KEY_F10", + "KEY_F11", + "KEY_F12", + "KEY_SPACE", + "KEY_EXCLAM", + "KEY_QUOTE", + "KEY_NUMBER", + "KEY_DOLLAR", + "KEY_PERCENT", + "KEY_CIRCUMFLEX", + "KEY_AMPERSAND", + "KEY_APOSTROPHE", + "KEY_LEFT_PARENTHESIS", + "KEY_RIGHT_PARENTHESIS", + "KEY_ASTERISK", + "KEY_PLUS", + "KEY_COMMA", + "KEY_MINUS", + "KEY_PERIOD", + "KEY_SLASH", + "KEY_0", + "KEY_1", + "KEY_2", + "KEY_3", + "KEY_4", + "KEY_5", + "KEY_6", + "KEY_7", + "KEY_8", + "KEY_9", + "KEY_COLON", + "KEY_SEMICOLON", + "KEY_LESS_THAN", + "KEY_EQUAL", + "KEY_GREATER_THAN", + "KEY_QUESTION", + "KEY_AT", + "KEY_CAPITAL_A", + "KEY_CAPITAL_B", + "KEY_CAPITAL_C", + "KEY_CAPITAL_D", + "KEY_CAPITAL_E", + "KEY_CAPITAL_F", + "KEY_CAPITAL_G", + "KEY_CAPITAL_H", + "KEY_CAPITAL_I", + "KEY_CAPITAL_J", + "KEY_CAPITAL_K", + "KEY_CAPITAL_L", + "KEY_CAPITAL_M", + "KEY_CAPITAL_N", + "KEY_CAPITAL_O", + "KEY_CAPITAL_P", + "KEY_CAPITAL_Q", + "KEY_CAPITAL_R", + "KEY_CAPITAL_S", + "KEY_CAPITAL_T", + "KEY_CAPITAL_U", + "KEY_CAPITAL_V", + "KEY_CAPITAL_W", + "KEY_CAPITAL_X", + "KEY_CAPITAL_Y", + "KEY_CAPITAL_Z", + "KEY_LEFT_BRACKET", + "KEY_BACK_SLASH", + "KEY_RIGHT_BRACKET", + "KEY_UNDERSCORE", + "KEY_GRAVE", + "KEY_A", + "KEY_B", + "KEY_C", + "KEY_D", + "KEY_E", + "KEY_F", + "KEY_G", + "KEY_H", + "KEY_I", + "KEY_J", + "KEY_K", + "KEY_L", + "KEY_M", + "KEY_N", + "KEY_O", + "KEY_P", + "KEY_Q", + "KEY_R", + "KEY_S", + "KEY_T", + "KEY_U", + "KEY_V", + "KEY_W", + "KEY_X", + "KEY_Y", + "KEY_Z", + "KEY_LEFT_BRACE", + "KEY_BAR", + "KEY_RIGHT_BRACE", + "KEY_TILDE", + "KEY_EURO", + "KEY_POUND", + "KEY_YEN", + "KEY_MIDDLE_DOT", + "KEY_SEARCH", + "KEY_DPAD_LEFT", + "KEY_DPAD_RIGHT", + "KEY_DPAD_UP", + "KEY_DPAD_DOWN", + "KEY_DPAD_CENTER", + "KEY_ENTER", + "KEY_PLAY", +} + +cc.KeyCode = +{ +} + +for k,v in ipairs(cc.KeyCodeKey) do + cc.KeyCode[v] = k - 1 +end + +cc.KeyCode.KEY_BACK = cc.KeyCode.KEY_ESCAPE +cc.KeyCode.KEY_LEFT_SHIFT = cc.KeyCode.KEY_SHIFT +cc.KeyCode.KEY_LEFT_CTRL = cc.KeyCode.KEY_CTRL +cc.KeyCode.KEY_LEFT_ALT = cc.KeyCode.KEY_ALT + +cc.EventAssetsManagerEx = +{ + EventCode = + { + ERROR_NO_LOCAL_MANIFEST = 0, + ERROR_DOWNLOAD_MANIFEST = 1, + ERROR_PARSE_MANIFEST = 2, + NEW_VERSION_FOUND = 3, + ALREADY_UP_TO_DATE = 4, + UPDATE_PROGRESSION = 5, + ASSET_UPDATED = 6, + ERROR_UPDATING = 7, + UPDATE_FINISHED = 8, + UPDATE_FAILED = 9, + ERROR_DECOMPRESS = 10 + }, +} + +cc.AssetsManagerExStatic = +{ + VERSION_ID = "@version", + MANIFEST_ID = "@manifest", +} + +cc.EventCode = +{ + BEGAN = 0, + MOVED = 1, + ENDED = 2, + CANCELLED = 3, +} + +cc.DIRECTOR_PROJECTION_2D = 0 +cc.DIRECTOR_PROJECTION_3D = 1 + +cc.ConfigType = +{ + NONE = 0, + COCOSTUDIO = 1, +} + +cc.AUDIO_INVAILD_ID = -1 +cc.AUDIO_TIME_UNKNOWN = -1.0 + +cc.CameraFlag = +{ + DEFAULT = 1, + USER1 = 2, + USER2 = 4, + USER3 = 8, + USER4 = 16, + USER5 = 32, + USER6 = 64, + USER7 = 128, + USER8 = 256, +} + +cc.CameraBackgroundBrush.BrushType = +{ + NONE = 0, + DEPTH = 1, + COLOR = 2, + SKYBOX = 3, +} + +cc.BillBoard_Mode = +{ + VIEW_POINT_ORIENTED = 0, + VIEW_PLANE_ORIENTED = 1, +} + +cc.GLProgram_VERTEX_ATTRIB = +{ + POSITION = 0, + COLOR = 1, + TEX_COORD = 2, + TEX_COORD1 = 3, + TEX_COORD2 = 4, + TEX_COORD3 = 5, + TEX_COORD4 = 6, + TEX_COORD5 = 7, + TEX_COORD6 = 8, + TEX_COORD7 = 9, + NORMAL = 10, + BLEND_WEIGHT = 11, + BLEND_INDEX =12, + MAX = 13, + --backward compatibility + TEX_COORDS = 2, +} + +cc.MATRIX_STACK_TYPE = +{ + MODELVIEW = 0, + PROJECTION = 1, + TEXTURE = 2, +} + +cc.LightType = +{ + DIRECTIONAL = 0, + POINT = 1, + SPOT = 2, + AMBIENT = 3, +} + +cc.LightFlag = +{ + LIGHT0 = math.pow(2,0), + LIGHT1 = math.pow(2,1), + LIGHT2 = math.pow(2,2), + LIGHT3 = math.pow(2,3), + LIGHT4 = math.pow(2,4), + LIGHT5 = math.pow(2,5), + LIGHT6 = math.pow(2,6), + LIGHT7 = math.pow(2,7), + LIGHT8 = math.pow(2,8), + LIGHT9 = math.pow(2,9), + LIGHT10 = math.pow(2,10), + LIGHT11 = math.pow(2,11), + LIGHT12 = math.pow(2,12), + LIGHT13 = math.pow(2,13), + LIGHT14 = math.pow(2,14), + LIGHT15 = math.pow(2,15), +} + +cc.AsyncTaskPool.TaskType = +{ + TASK_IO = 0, + TASK_NETWORK = 1, + TASK_OTHER = 2, + TASK_MAX_TYPE = 3, +} + + +cc.RED = cc.c3b(255,0,0) +cc.GREEN = cc.c3b(0,255,0) +cc.BLUE = cc.c3b(0,0,255) +cc.BLACK = cc.c3b(0,0,0) +cc.WHITE = cc.c3b(255,255,255) +cc.YELLOW = cc.c3b(255,255,0) + diff --git a/src/cocos/cocos2d/DeprecatedCocos2dClass.lua b/src/cocos/cocos2d/DeprecatedCocos2dClass.lua new file mode 100644 index 0000000..3228789 --- /dev/null +++ b/src/cocos/cocos2d/DeprecatedCocos2dClass.lua @@ -0,0 +1,1767 @@ +-- This is the DeprecatedClass + +DeprecatedClass = {} or DeprecatedClass + +--tip +local function deprecatedTip(old_name,new_name) + print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") +end + +--CCProgressTo class will be Deprecated,begin +function DeprecatedClass.CCProgressTo() + deprecatedTip("CCProgressTo","cc.ProgressTo") + return cc.ProgressTo +end +_G["CCProgressTo"] = DeprecatedClass.CCProgressTo() +--CCProgressTo class will be Deprecated,end + +--CCHide class will be Deprecated,begin +function DeprecatedClass.CCHide() + deprecatedTip("CCHide","cc.Hide") + return cc.Hide +end +_G["CCHide"] = DeprecatedClass.CCHide() +--CCHide class will be Deprecated,end + +--CCTransitionMoveInB class will be Deprecated,begin +function DeprecatedClass.CCTransitionMoveInB() + deprecatedTip("CCTransitionMoveInB","cc.TransitionMoveInB") + return cc.TransitionMoveInB +end +_G["CCTransitionMoveInB"] = DeprecatedClass.CCTransitionMoveInB() +--CCTransitionMoveInB class will be Deprecated,end + +--CCEaseSineIn class will be Deprecated,begin +function DeprecatedClass.CCEaseSineIn() + deprecatedTip("CCEaseSineIn","cc.EaseSineIn") + return cc.EaseSineIn +end +_G["CCEaseSineIn"] = DeprecatedClass.CCEaseSineIn() +--CCEaseSineIn class will be Deprecated,end + +--CCTransitionMoveInL class will be Deprecated,begin +function DeprecatedClass.CCTransitionMoveInL() + deprecatedTip("CCTransitionMoveInL","cc.TransitionMoveInL") + return cc.TransitionMoveInL +end +_G["CCTransitionMoveInL"] = DeprecatedClass.CCTransitionMoveInL() +--CCTransitionMoveInL class will be Deprecated,end + +--CCEaseInOut class will be Deprecated,begin +function DeprecatedClass.CCEaseInOut() + deprecatedTip("CCEaseInOut","cc.EaseInOut") + return cc.EaseInOut +end +_G["CCEaseInOut"] = DeprecatedClass.CCEaseInOut() +--CCEaseInOut class will be Deprecated,end + +--CCTransitionMoveInT class will be Deprecated,begin +function DeprecatedClass.CCTransitionMoveInT() + deprecatedTip("CCTransitionMoveInT","cc.TransitionMoveInT") + return cc.TransitionMoveInT +end +_G["CCTransitionMoveInT"] = DeprecatedClass.CCTransitionMoveInT() +--CCTransitionMoveInT class will be Deprecated,end + +--CCTransitionMoveInR class will be Deprecated,begin +function DeprecatedClass.CCTransitionMoveInR() + deprecatedTip("CCTransitionMoveInR","cc.TransitionMoveInR") + return cc.TransitionMoveInR +end +_G["CCTransitionMoveInR"] = DeprecatedClass.CCTransitionMoveInR() +--CCTransitionMoveInR class will be Deprecated,end + +--CCParticleSnow class will be Deprecated,begin +function DeprecatedClass.CCParticleSnow() + deprecatedTip("CCParticleSnow","cc.ParticleSnow") + return cc.ParticleSnow +end +_G["CCParticleSnow"] = DeprecatedClass.CCParticleSnow() +--CCParticleSnow class will be Deprecated,end + +--CCActionCamera class will be Deprecated,begin +function DeprecatedClass.CCActionCamera() + deprecatedTip("CCActionCamera","cc.ActionCamera") + return cc.ActionCamera +end +_G["CCActionCamera"] = DeprecatedClass.CCActionCamera() +--CCActionCamera class will be Deprecated,end + +--CCProgressFromTo class will be Deprecated,begin +function DeprecatedClass.CCProgressFromTo() + deprecatedTip("CCProgressFromTo","cc.ProgressFromTo") + return cc.ProgressFromTo +end +_G["CCProgressFromTo"] = DeprecatedClass.CCProgressFromTo() +--CCProgressFromTo class will be Deprecated,end + +--CCMoveTo class will be Deprecated,begin +function DeprecatedClass.CCMoveTo() + deprecatedTip("CCMoveTo","cc.MoveTo") + return cc.MoveTo +end +_G["CCMoveTo"] = DeprecatedClass.CCMoveTo() +--CCMoveTo class will be Deprecated,end + +--CCJumpBy class will be Deprecated,begin +function DeprecatedClass.CCJumpBy() + deprecatedTip("CCJumpBy","cc.JumpBy") + return cc.JumpBy +end +_G["CCJumpBy"] = DeprecatedClass.CCJumpBy() +--CCJumpBy class will be Deprecated,end + +--CCObject class will be Deprecated,begin +function DeprecatedClass.CCObject() + deprecatedTip("CCObject","cc.Object") + return cc.Object +end +_G["CCObject"] = DeprecatedClass.CCObject() +--CCObject class will be Deprecated,end + +--CCTransitionRotoZoom class will be Deprecated,begin +function DeprecatedClass.CCTransitionRotoZoom() + deprecatedTip("CCTransitionRotoZoom","cc.TransitionRotoZoom") + return cc.TransitionRotoZoom +end +_G["CCTransitionRotoZoom"] = DeprecatedClass.CCTransitionRotoZoom() +--CCTransitionRotoZoom class will be Deprecated,end + +--CCDirector class will be Deprecated,begin +function DeprecatedClass.CCDirector() + deprecatedTip("CCDirector","cc.Director") + return cc.Director +end +_G["CCDirector"] = DeprecatedClass.CCDirector() +--CCDirector class will be Deprecated,end + +--CCScheduler class will be Deprecated,begin +function DeprecatedClass.CCScheduler() + deprecatedTip("CCScheduler","cc.Scheduler") + return cc.Scheduler +end +_G["CCScheduler"] = DeprecatedClass.CCScheduler() +--CCScheduler class will be Deprecated,end + +--CCEaseElasticOut class will be Deprecated,begin +function DeprecatedClass.CCEaseElasticOut() + deprecatedTip("CCEaseElasticOut","cc.EaseElasticOut") + return cc.EaseElasticOut +end +_G["CCEaseElasticOut"] = DeprecatedClass.CCEaseElasticOut() +--CCEaseElasticOut class will be Deprecated,end + +--CCTableViewCell class will be Deprecated,begin +function DeprecatedClass.CCTableViewCell() + deprecatedTip("CCTableViewCell","cc.TableViewCell") + return cc.TableViewCell +end +_G["CCTableViewCell"] = DeprecatedClass.CCTableViewCell() +--CCTableViewCell class will be Deprecated,end + + +--CCEaseBackOut class will be Deprecated,begin +function DeprecatedClass.CCEaseBackOut() + deprecatedTip("CCEaseBackOut","cc.EaseBackOut") + return cc.EaseBackOut +end +_G["CCEaseBackOut"] = DeprecatedClass.CCEaseBackOut() +--CCEaseBackOut class will be Deprecated,end + +--CCParticleSystemQuad class will be Deprecated,begin +function DeprecatedClass.CCParticleSystemQuad() + deprecatedTip("CCParticleSystemQuad","cc.ParticleSystemQuad") + return cc.ParticleSystemQuad +end +_G["CCParticleSystemQuad"] = DeprecatedClass.CCParticleSystemQuad() +--CCParticleSystemQuad class will be Deprecated,end + +--CCMenuItemToggle class will be Deprecated,begin +function DeprecatedClass.CCMenuItemToggle() + deprecatedTip("CCMenuItemToggle","cc.MenuItemToggle") + return cc.MenuItemToggle +end +_G["CCMenuItemToggle"] = DeprecatedClass.CCMenuItemToggle() +--CCMenuItemToggle class will be Deprecated,end + +--CCStopGrid class will be Deprecated,begin +function DeprecatedClass.CCStopGrid() + deprecatedTip("CCStopGrid","cc.StopGrid") + return cc.StopGrid +end +_G["CCStopGrid"] = DeprecatedClass.CCStopGrid() +--CCStopGrid class will be Deprecated,end + +--CCTransitionScene class will be Deprecated,begin +function DeprecatedClass.CCTransitionScene() + deprecatedTip("CCTransitionScene","cc.TransitionScene") + return cc.TransitionScene +end +_G["CCTransitionScene"] = DeprecatedClass.CCTransitionScene() +--CCTransitionScene class will be Deprecated,end + +--CCSkewBy class will be Deprecated,begin +function DeprecatedClass.CCSkewBy() + deprecatedTip("CCSkewBy","cc.SkewBy") + return cc.SkewBy +end +_G["CCSkewBy"] = DeprecatedClass.CCSkewBy() +--CCSkewBy class will be Deprecated,end + +--CCLayer class will be Deprecated,begin +function DeprecatedClass.CCLayer() + deprecatedTip("CCLayer","cc.Layer") + return cc.Layer +end +_G["CCLayer"] = DeprecatedClass.CCLayer() +--CCLayer class will be Deprecated,end + +--CCEaseElastic class will be Deprecated,begin +function DeprecatedClass.CCEaseElastic() + deprecatedTip("CCEaseElastic","cc.EaseElastic") + return cc.EaseElastic +end +_G["CCEaseElastic"] = DeprecatedClass.CCEaseElastic() +--CCEaseElastic class will be Deprecated,end + +--CCTMXTiledMap class will be Deprecated,begin +function DeprecatedClass.CCTMXTiledMap() + deprecatedTip("CCTMXTiledMap","cc.TMXTiledMap") + return cc.TMXTiledMap +end +_G["CCTMXTiledMap"] = DeprecatedClass.CCTMXTiledMap() +--CCTMXTiledMap class will be Deprecated,end + +--CCGrid3DAction class will be Deprecated,begin +function DeprecatedClass.CCGrid3DAction() + deprecatedTip("CCGrid3DAction","cc.Grid3DAction") + return cc.Grid3DAction +end +_G["CCGrid3DAction"] = DeprecatedClass.CCGrid3DAction() +--CCGrid3DAction class will be Deprecated,end + +--CCFadeIn class will be Deprecated,begin +function DeprecatedClass.CCFadeIn() + deprecatedTip("CCFadeIn","cc.FadeIn") + return cc.FadeIn +end +_G["CCFadeIn"] = DeprecatedClass.CCFadeIn() +--CCFadeIn class will be Deprecated,end + +--CCNodeRGBA class will be Deprecated,begin +function DeprecatedClass.CCNodeRGBA() + deprecatedTip("CCNodeRGBA","cc.Node") + return cc.Node +end +_G["CCNodeRGBA"] = DeprecatedClass.CCNodeRGBA() +--CCNodeRGBA class will be Deprecated,end + +--NodeRGBA class will be Deprecated,begin +function DeprecatedClass.NodeRGBA() + deprecatedTip("cc.NodeRGBA","cc.Node") + return cc.Node +end +_G["cc"]["NodeRGBA"] = DeprecatedClass.NodeRGBA() +--NodeRGBA class will be Deprecated,end + +--CCAnimationCache class will be Deprecated,begin +function DeprecatedClass.CCAnimationCache() + deprecatedTip("CCAnimationCache","cc.AnimationCache") + return cc.AnimationCache +end +_G["CCAnimationCache"] = DeprecatedClass.CCAnimationCache() +--CCAnimationCache class will be Deprecated,end + +--CCFlipY3D class will be Deprecated,begin +function DeprecatedClass.CCFlipY3D() + deprecatedTip("CCFlipY3D","cc.FlipY3D") + return cc.FlipY3D +end +_G["CCFlipY3D"] = DeprecatedClass.CCFlipY3D() +--CCFlipY3D class will be Deprecated,end + +--CCEaseSineInOut class will be Deprecated,begin +function DeprecatedClass.CCEaseSineInOut() + deprecatedTip("CCEaseSineInOut","cc.EaseSineInOut") + return cc.EaseSineInOut +end +_G["CCEaseSineInOut"] = DeprecatedClass.CCEaseSineInOut() +--CCEaseSineInOut class will be Deprecated,end + +--CCTransitionFlipAngular class will be Deprecated,begin +function DeprecatedClass.CCTransitionFlipAngular() + deprecatedTip("CCTransitionFlipAngular","cc.TransitionFlipAngular") + return cc.TransitionFlipAngular +end +_G["CCTransitionFlipAngular"] = DeprecatedClass.CCTransitionFlipAngular() +--CCTransitionFlipAngular class will be Deprecated,end + +--CCEaseElasticInOut class will be Deprecated,begin +function DeprecatedClass.CCEaseElasticInOut() + deprecatedTip("CCEaseElasticInOut","cc.EaseElasticInOut") + return cc.EaseElasticInOut +end +_G["CCEaseElasticInOut"] = DeprecatedClass.CCEaseElasticInOut() +--CCEaseElasticInOut class will be Deprecated,end + +--CCEaseBounce class will be Deprecated,begin +function DeprecatedClass.CCEaseBounce() + deprecatedTip("CCEaseBounce","cc.EaseBounce") + return cc.EaseBounce +end +_G["CCEaseBounce"] = DeprecatedClass.CCEaseBounce() +--CCEaseBounce class will be Deprecated,end + +--CCShow class will be Deprecated,begin +function DeprecatedClass.CCShow() + deprecatedTip("CCShow","cc.Show") + return cc.Show +end +_G["CCShow"] = DeprecatedClass.CCShow() +--CCShow class will be Deprecated,end + +--CCFadeOut class will be Deprecated,begin +function DeprecatedClass.CCFadeOut() + deprecatedTip("CCFadeOut","cc.FadeOut") + return cc.FadeOut +end +_G["CCFadeOut"] = DeprecatedClass.CCFadeOut() +--CCFadeOut class will be Deprecated,end + +--CCCallFunc class will be Deprecated,begin +function DeprecatedClass.CCCallFunc() + deprecatedTip("CCCallFunc","cc.CallFunc") + return cc.CallFunc +end +_G["CCCallFunc"] = DeprecatedClass.CCCallFunc() +--CCCallFunc class will be Deprecated,end + +--CCWaves3D class will be Deprecated,begin +function DeprecatedClass.CCWaves3D() + deprecatedTip("CCWaves3D","cc.Waves3D") + return cc.Waves3D +end +_G["CCWaves3D"] = DeprecatedClass.CCWaves3D() +--CCWaves3D class will be Deprecated,end + +--CCFlipX3D class will be Deprecated,begin +function DeprecatedClass.CCFlipX3D() + deprecatedTip("CCFlipX3D","cc.FlipX3D") + return cc.FlipX3D +end +_G["CCFlipX3D"] = DeprecatedClass.CCFlipX3D() +--CCFlipX3D class will be Deprecated,end + +--CCParticleFireworks class will be Deprecated,begin +function DeprecatedClass.CCParticleFireworks() + deprecatedTip("CCParticleFireworks","cc.ParticleFireworks") + return cc.ParticleFireworks +end +_G["CCParticleFireworks"] = DeprecatedClass.CCParticleFireworks() +--CCParticleFireworks class will be Deprecated,end + +--CCMenuItemImage class will be Deprecated,begin +function DeprecatedClass.CCMenuItemImage() + deprecatedTip("CCMenuItemImage","cc.MenuItemImage") + return cc.MenuItemImage +end +_G["CCMenuItemImage"] = DeprecatedClass.CCMenuItemImage() +--CCMenuItemImage class will be Deprecated,end + +--CCParticleFire class will be Deprecated,begin +function DeprecatedClass.CCParticleFire() + deprecatedTip("CCParticleFire","cc.ParticleFire") + return cc.ParticleFire +end +_G["CCParticleFire"] = DeprecatedClass.CCParticleFire() +--CCParticleFire class will be Deprecated,end + +--CCMenuItem class will be Deprecated,begin +function DeprecatedClass.CCMenuItem() + deprecatedTip("CCMenuItem","cc.MenuItem") + return cc.MenuItem +end +_G["CCMenuItem"] = DeprecatedClass.CCMenuItem() +--CCMenuItem class will be Deprecated,end + +--CCActionEase class will be Deprecated,begin +function DeprecatedClass.CCActionEase() + deprecatedTip("CCActionEase","cc.ActionEase") + return cc.ActionEase +end +_G["CCActionEase"] = DeprecatedClass.CCActionEase() +--CCActionEase class will be Deprecated,end + +--CCTransitionSceneOriented class will be Deprecated,begin +function DeprecatedClass.CCTransitionSceneOriented() + deprecatedTip("CCTransitionSceneOriented","cc.TransitionSceneOriented") + return cc.TransitionSceneOriented +end +_G["CCTransitionSceneOriented"] = DeprecatedClass.CCTransitionSceneOriented() +--CCTransitionSceneOriented class will be Deprecated,end + +--CCTransitionZoomFlipAngular class will be Deprecated,begin +function DeprecatedClass.CCTransitionZoomFlipAngular() + deprecatedTip("CCTransitionZoomFlipAngular","cc.TransitionZoomFlipAngular") + return cc.TransitionZoomFlipAngular +end +_G["CCTransitionZoomFlipAngular"] = DeprecatedClass.CCTransitionZoomFlipAngular() +--CCTransitionZoomFlipAngular class will be Deprecated,end + +--CCEaseIn class will be Deprecated,begin +function DeprecatedClass.CCEaseIn() + deprecatedTip("CCEaseIn","cc.EaseIn") + return cc.EaseIn +end +_G["CCEaseIn"] = DeprecatedClass.CCEaseIn() +--CCEaseIn class will be Deprecated,end + +--CCEaseExponentialInOut class will be Deprecated,begin +function DeprecatedClass.CCEaseExponentialInOut() + deprecatedTip("CCEaseExponentialInOut","cc.EaseExponentialInOut") + return cc.EaseExponentialInOut +end +_G["CCEaseExponentialInOut"] = DeprecatedClass.CCEaseExponentialInOut() +--CCEaseExponentialInOut class will be Deprecated,end + +--CCTransitionFlipX class will be Deprecated,begin +function DeprecatedClass.CCTransitionFlipX() + deprecatedTip("CCTransitionFlipX","cc.TransitionFlipX") + return cc.TransitionFlipX +end +_G["CCTransitionFlipX"] = DeprecatedClass.CCTransitionFlipX() +--CCTransitionFlipX class will be Deprecated,end + +--CCEaseExponentialOut class will be Deprecated,begin +function DeprecatedClass.CCEaseExponentialOut() + deprecatedTip("CCEaseExponentialOut","cc.EaseExponentialOut") + return cc.EaseExponentialOut +end +_G["CCEaseExponentialOut"] = DeprecatedClass.CCEaseExponentialOut() +--CCEaseExponentialOut class will be Deprecated,end + +--CCLabel class will be Deprecated,begin +function DeprecatedClass.CCLabel() + deprecatedTip("CCLabel","cc.Label") + return cc.Label +end +_G["CCLabel"] = DeprecatedClass.CCLabel() +--CCLabel class will be Deprecated,end + +--CCApplication class will be Deprecated,begin +function DeprecatedClass.CCApplication() + deprecatedTip("CCApplication","cc.Application") + return cc.Application +end +_G["CCApplication"] = DeprecatedClass.CCApplication() +--CCApplication class will be Deprecated,end + +--CCDelayTime class will be Deprecated,begin +function DeprecatedClass.CCDelayTime() + deprecatedTip("CCDelayTime","cc.DelayTime") + return cc.DelayTime +end +_G["CCDelayTime"] = DeprecatedClass.CCDelayTime() +--CCDelayTime class will be Deprecated,end + +--CCLabelAtlas class will be Deprecated,begin +function DeprecatedClass.CCLabelAtlas() + deprecatedTip("CCLabelAtlas","cc.LabelAtlas") + return cc.LabelAtlas +end +_G["CCLabelAtlas"] = DeprecatedClass.CCLabelAtlas() +--CCLabelAtlas class will be Deprecated,end + +--CCLabelBMFont class will be Deprecated,begin +function DeprecatedClass.CCLabelBMFont() + deprecatedTip("CCLabelBMFont","cc.LabelBMFont") + return cc.LabelBMFont +end +_G["CCLabelBMFont"] = DeprecatedClass.CCLabelBMFont() +--CCLabelBMFont class will be Deprecated,end + +--CCFadeOutTRTiles class will be Deprecated,begin +function DeprecatedClass.CCFadeOutTRTiles() + deprecatedTip("CCFadeOutTRTiles","cc.FadeOutTRTiles") + return cc.FadeOutTRTiles +end +_G["CCFadeOutTRTiles"] = DeprecatedClass.CCFadeOutTRTiles() +--CCFadeOutTRTiles class will be Deprecated,end + +--CCEaseElasticIn class will be Deprecated,begin +function DeprecatedClass.CCEaseElasticIn() + deprecatedTip("CCEaseElasticIn","cc.EaseElasticIn") + return cc.EaseElasticIn +end +_G["CCEaseElasticIn"] = DeprecatedClass.CCEaseElasticIn() +--CCEaseElasticIn class will be Deprecated,end + +--CCParticleSpiral class will be Deprecated,begin +function DeprecatedClass.CCParticleSpiral() + deprecatedTip("CCParticleSpiral","cc.ParticleSpiral") + return cc.ParticleSpiral +end +_G["CCParticleSpiral"] = DeprecatedClass.CCParticleSpiral() +--CCParticleSpiral class will be Deprecated,end + +--CCFiniteTimeAction class will be Deprecated,begin +function DeprecatedClass.CCFiniteTimeAction() + deprecatedTip("CCFiniteTimeAction","cc.FiniteTimeAction") + return cc.FiniteTimeAction +end +_G["CCFiniteTimeAction"] = DeprecatedClass.CCFiniteTimeAction() +--CCFiniteTimeAction class will be Deprecated,end + +--CCFadeOutDownTiles class will be Deprecated,begin +function DeprecatedClass.CCFadeOutDownTiles() + deprecatedTip("CCFadeOutDownTiles","cc.FadeOutDownTiles") + return cc.FadeOutDownTiles +end +_G["CCFadeOutDownTiles"] = DeprecatedClass.CCFadeOutDownTiles() +--CCFadeOutDownTiles class will be Deprecated,end + +--CCJumpTiles3D class will be Deprecated,begin +function DeprecatedClass.CCJumpTiles3D() + deprecatedTip("CCJumpTiles3D","cc.JumpTiles3D") + return cc.JumpTiles3D +end +_G["CCJumpTiles3D"] = DeprecatedClass.CCJumpTiles3D() +--CCJumpTiles3D class will be Deprecated,end + +--CCEaseBackIn class will be Deprecated,begin +function DeprecatedClass.CCEaseBackIn() + deprecatedTip("CCEaseBackIn","cc.EaseBackIn") + return cc.EaseBackIn +end +_G["CCEaseBackIn"] = DeprecatedClass.CCEaseBackIn() +--CCEaseBackIn class will be Deprecated,end + +--CCSpriteBatchNode class will be Deprecated,begin +function DeprecatedClass.CCSpriteBatchNode() + deprecatedTip("CCSpriteBatchNode","cc.SpriteBatchNode") + return cc.SpriteBatchNode +end +_G["CCSpriteBatchNode"] = DeprecatedClass.CCSpriteBatchNode() +--CCSpriteBatchNode class will be Deprecated,end + +--CCParticleSystem class will be Deprecated,begin +function DeprecatedClass.CCParticleSystem() + deprecatedTip("CCParticleSystem","cc.ParticleSystem") + return cc.ParticleSystem +end +_G["CCParticleSystem"] = DeprecatedClass.CCParticleSystem() +--CCParticleSystem class will be Deprecated,end + +--CCActionTween class will be Deprecated,begin +function DeprecatedClass.CCActionTween() + deprecatedTip("CCActionTween","cc.ActionTween") + return cc.ActionTween +end +_G["CCActionTween"] = DeprecatedClass.CCActionTween() +--CCActionTween class will be Deprecated,end + +--CCTransitionFadeDown class will be Deprecated,begin +function DeprecatedClass.CCTransitionFadeDown() + deprecatedTip("CCTransitionFadeDown","cc.TransitionFadeDown") + return cc.TransitionFadeDown +end +_G["CCTransitionFadeDown"] = DeprecatedClass.CCTransitionFadeDown() +--CCTransitionFadeDown class will be Deprecated,end + +--CCParticleSun class will be Deprecated,begin +function DeprecatedClass.CCParticleSun() + deprecatedTip("CCParticleSun","cc.ParticleSun") + return cc.ParticleSun +end +_G["CCParticleSun"] = DeprecatedClass.CCParticleSun() +--CCParticleSun class will be Deprecated,end + +--CCTransitionProgressHorizontal class will be Deprecated,begin +function DeprecatedClass.CCTransitionProgressHorizontal() + deprecatedTip("CCTransitionProgressHorizontal","cc.TransitionProgressHorizontal") + return cc.TransitionProgressHorizontal +end +_G["CCTransitionProgressHorizontal"] = DeprecatedClass.CCTransitionProgressHorizontal() +--CCTransitionProgressHorizontal class will be Deprecated,end + +--CCRipple3D class will be Deprecated,begin +function DeprecatedClass.CCRipple3D() + deprecatedTip("CCRipple3D","cc.Ripple3D") + return cc.Ripple3D +end +_G["CCRipple3D"] = DeprecatedClass.CCRipple3D() +--CCRipple3D class will be Deprecated,end + +--CCTMXLayer class will be Deprecated,begin +function DeprecatedClass.CCTMXLayer() + deprecatedTip("CCTMXLayer","cc.TMXLayer") + return cc.TMXLayer +end +_G["CCTMXLayer"] = DeprecatedClass.CCTMXLayer() +--CCTMXLayer class will be Deprecated,end + +--CCFlipX class will be Deprecated,begin +function DeprecatedClass.CCFlipX() + deprecatedTip("CCFlipX","cc.FlipX") + return cc.FlipX +end +_G["CCFlipX"] = DeprecatedClass.CCFlipX() +--CCFlipX class will be Deprecated,end + +--CCFlipY class will be Deprecated,begin +function DeprecatedClass.CCFlipY() + deprecatedTip("CCFlipY","cc.FlipY") + return cc.FlipY +end +_G["CCFlipY"] = DeprecatedClass.CCFlipY() +--CCFlipY class will be Deprecated,end + +--CCTransitionSplitCols class will be Deprecated,begin +function DeprecatedClass.CCTransitionSplitCols() + deprecatedTip("CCTransitionSplitCols","cc.TransitionSplitCols") + return cc.TransitionSplitCols +end +_G["CCTransitionSplitCols"] = DeprecatedClass.CCTransitionSplitCols() +--CCTransitionSplitCols class will be Deprecated,end + +--CCTimer class will be Deprecated,begin +function DeprecatedClass.CCTimer() + deprecatedTip("CCTimer","cc.Timer") + return cc.Timer +end +_G["CCTimer"] = DeprecatedClass.CCTimer() +--CCTimer class will be Deprecated,end + +--CCFadeTo class will be Deprecated,begin +function DeprecatedClass.CCFadeTo() + deprecatedTip("CCFadeTo","cc.FadeTo") + return cc.FadeTo +end +_G["CCFadeTo"] = DeprecatedClass.CCFadeTo() +--CCFadeTo class will be Deprecated,end + +--CCRepeatForever class will be Deprecated,begin +function DeprecatedClass.CCRepeatForever() + deprecatedTip("CCRepeatForever","cc.RepeatForever") + return cc.RepeatForever +end +_G["CCRepeatForever"] = DeprecatedClass.CCRepeatForever() +--CCRepeatForever class will be Deprecated,end + +--CCPlace class will be Deprecated,begin +function DeprecatedClass.CCPlace() + deprecatedTip("CCPlace","cc.Place") + return cc.Place +end +_G["CCPlace"] = DeprecatedClass.CCPlace() +--CCPlace class will be Deprecated,end + + +--CCGLProgram class will be Deprecated,begin +function DeprecatedClass.CCGLProgram() + deprecatedTip("CCGLProgram","cc.GLProgram") + return cc.GLProgram +end +_G["CCGLProgram"] = DeprecatedClass.CCGLProgram() +--CCGLProgram class will be Deprecated,end + +--CCEaseBounceOut class will be Deprecated,begin +function DeprecatedClass.CCEaseBounceOut() + deprecatedTip("CCEaseBounceOut","cc.EaseBounceOut") + return cc.EaseBounceOut +end +_G["CCEaseBounceOut"] = DeprecatedClass.CCEaseBounceOut() +--CCEaseBounceOut class will be Deprecated,end + +--CCCardinalSplineBy class will be Deprecated,begin +function DeprecatedClass.CCCardinalSplineBy() + deprecatedTip("CCCardinalSplineBy","cc.CardinalSplineBy") + return cc.CardinalSplineBy +end +_G["CCCardinalSplineBy"] = DeprecatedClass.CCCardinalSplineBy() +--CCCardinalSplineBy class will be Deprecated,end + +--CCSpriteFrameCache class will be Deprecated,begin +function DeprecatedClass.CCSpriteFrameCache() + deprecatedTip("CCSpriteFrameCache","cc.SpriteFrameCache") + return cc.SpriteFrameCache +end +_G["CCSpriteFrameCache"] = DeprecatedClass.CCSpriteFrameCache() +--CCSpriteFrameCache class will be Deprecated,end + +--CCTransitionShrinkGrow class will be Deprecated,begin +function DeprecatedClass.CCTransitionShrinkGrow() + deprecatedTip("CCTransitionShrinkGrow","cc.TransitionShrinkGrow") + return cc.TransitionShrinkGrow +end +_G["CCTransitionShrinkGrow"] = DeprecatedClass.CCTransitionShrinkGrow() +--CCTransitionShrinkGrow class will be Deprecated,end + +--CCSplitCols class will be Deprecated,begin +function DeprecatedClass.CCSplitCols() + deprecatedTip("CCSplitCols","cc.SplitCols") + return cc.SplitCols +end +_G["CCSplitCols"] = DeprecatedClass.CCSplitCols() +--CCSplitCols class will be Deprecated,end + +--CCClippingNode class will be Deprecated,begin +function DeprecatedClass.CCClippingNode() + deprecatedTip("CCClippingNode","cc.ClippingNode") + return cc.ClippingNode +end +_G["CCClippingNode"] = DeprecatedClass.CCClippingNode() +--CCClippingNode class will be Deprecated,end + +--CCEaseBounceInOut class will be Deprecated,begin +function DeprecatedClass.CCEaseBounceInOut() + deprecatedTip("CCEaseBounceInOut","cc.EaseBounceInOut") + return cc.EaseBounceInOut +end +_G["CCEaseBounceInOut"] = DeprecatedClass.CCEaseBounceInOut() +--CCEaseBounceInOut class will be Deprecated,end + +--CCLiquid class will be Deprecated,begin +function DeprecatedClass.CCLiquid() + deprecatedTip("CCLiquid","cc.Liquid") + return cc.Liquid +end +_G["CCLiquid"] = DeprecatedClass.CCLiquid() +--CCLiquid class will be Deprecated,end + +--CCParticleFlower class will be Deprecated,begin +function DeprecatedClass.CCParticleFlower() + deprecatedTip("CCParticleFlower","cc.ParticleFlower") + return cc.ParticleFlower +end +_G["CCParticleFlower"] = DeprecatedClass.CCParticleFlower() +--CCParticleFlower class will be Deprecated,end + +--CCParticleSmoke class will be Deprecated,begin +function DeprecatedClass.CCParticleSmoke() + deprecatedTip("CCParticleSmoke","cc.ParticleSmoke") + return cc.ParticleSmoke +end +_G["CCParticleSmoke"] = DeprecatedClass.CCParticleSmoke() +--CCParticleSmoke class will be Deprecated,end + +--CCImage class will be Deprecated,begin +function DeprecatedClass.CCImage() + deprecatedTip("CCImage","cc.Image") + return cc.Image +end +_G["CCImage"] = DeprecatedClass.CCImage() +--CCImage class will be Deprecated,end + +--CCTurnOffTiles class will be Deprecated,begin +function DeprecatedClass.CCTurnOffTiles() + deprecatedTip("CCTurnOffTiles","cc.TurnOffTiles") + return cc.TurnOffTiles +end +_G["CCTurnOffTiles"] = DeprecatedClass.CCTurnOffTiles() +--CCTurnOffTiles class will be Deprecated,end + +--CCBlink class will be Deprecated,begin +function DeprecatedClass.CCBlink() + deprecatedTip("CCBlink","cc.Blink") + return cc.Blink +end +_G["CCBlink"] = DeprecatedClass.CCBlink() +--CCBlink class will be Deprecated,end + +--CCShaderCache class will be Deprecated,begin +function DeprecatedClass.CCShaderCache() + deprecatedTip("CCShaderCache","cc.ShaderCache") + return cc.ShaderCache +end +_G["CCShaderCache"] = DeprecatedClass.CCShaderCache() +--CCShaderCache class will be Deprecated,end + +--CCJumpTo class will be Deprecated,begin +function DeprecatedClass.CCJumpTo() + deprecatedTip("CCJumpTo","cc.JumpTo") + return cc.JumpTo +end +_G["CCJumpTo"] = DeprecatedClass.CCJumpTo() +--CCJumpTo class will be Deprecated,end + +--CCAtlasNode class will be Deprecated,begin +function DeprecatedClass.CCAtlasNode() + deprecatedTip("CCAtlasNode","cc.AtlasNode") + return cc.AtlasNode +end +_G["CCAtlasNode"] = DeprecatedClass.CCAtlasNode() +--CCAtlasNode class will be Deprecated,end + +--CCTransitionJumpZoom class will be Deprecated,begin +function DeprecatedClass.CCTransitionJumpZoom() + deprecatedTip("CCTransitionJumpZoom","cc.TransitionJumpZoom") + return cc.TransitionJumpZoom +end +_G["CCTransitionJumpZoom"] = DeprecatedClass.CCTransitionJumpZoom() +--CCTransitionJumpZoom class will be Deprecated,end + +--CCTransitionProgressVertical class will be Deprecated,begin +function DeprecatedClass.CCTransitionProgressVertical() + deprecatedTip("CCTransitionProgressVertical","cc.TransitionProgressVertical") + return cc.TransitionProgressVertical +end +_G["CCTransitionProgressVertical"] = DeprecatedClass.CCTransitionProgressVertical() +--CCTransitionProgressVertical class will be Deprecated,end + +--CCAnimationFrame class will be Deprecated,begin +function DeprecatedClass.CCAnimationFrame() + deprecatedTip("CCAnimationFrame","cc.AnimationFrame") + return cc.AnimationFrame +end +_G["CCAnimationFrame"] = DeprecatedClass.CCAnimationFrame() +--CCAnimationFrame class will be Deprecated,end + +--CCTintTo class will be Deprecated,begin +function DeprecatedClass.CCTintTo() + deprecatedTip("CCTintTo","cc.TintTo") + return cc.TintTo +end +_G["CCTintTo"] = DeprecatedClass.CCTintTo() +--CCTintTo class will be Deprecated,end + +--CCTiledGrid3DAction class will be Deprecated,begin +function DeprecatedClass.CCTiledGrid3DAction() + deprecatedTip("CCTiledGrid3DAction","cc.TiledGrid3DAction") + return cc.TiledGrid3DAction +end +_G["CCTiledGrid3DAction"] = DeprecatedClass.CCTiledGrid3DAction() +--CCTiledGrid3DAction class will be Deprecated,end + +--CCTMXTilesetInfo class will be Deprecated,begin +function DeprecatedClass.CCTMXTilesetInfo() + deprecatedTip("CCTMXTilesetInfo","cc.TMXTilesetInfo") + return cc.TMXTilesetInfo +end +_G["CCTMXTilesetInfo"] = DeprecatedClass.CCTMXTilesetInfo() +--CCTMXTilesetInfo class will be Deprecated,end + +--CCTMXObjectGroup class will be Deprecated,begin +function DeprecatedClass.CCTMXObjectGroup() + deprecatedTip("CCTMXObjectGroup","cc.TMXObjectGroup") + return cc.TMXObjectGroup +end +_G["CCTMXObjectGroup"] = DeprecatedClass.CCTMXObjectGroup() +--CCTMXObjectGroup class will be Deprecated,end + +--CCParticleGalaxy class will be Deprecated,begin +function DeprecatedClass.CCParticleGalaxy() + deprecatedTip("CCParticleGalaxy","cc.ParticleGalaxy") + return cc.ParticleGalaxy +end +_G["CCParticleGalaxy"] = DeprecatedClass.CCParticleGalaxy() +--CCParticleGalaxy class will be Deprecated,end + +--CCTwirl class will be Deprecated,begin +function DeprecatedClass.CCTwirl() + deprecatedTip("CCTwirl","cc.Twirl") + return cc.Twirl +end +_G["CCTwirl"] = DeprecatedClass.CCTwirl() +--CCTwirl class will be Deprecated,end + +--CCMenuItemLabel class will be Deprecated,begin +function DeprecatedClass.CCMenuItemLabel() + deprecatedTip("CCMenuItemLabel","cc.MenuItemLabel") + return cc.MenuItemLabel +end +_G["CCMenuItemLabel"] = DeprecatedClass.CCMenuItemLabel() +--CCMenuItemLabel class will be Deprecated,end + +--CCLayerColor class will be Deprecated,begin +function DeprecatedClass.CCLayerColor() + deprecatedTip("CCLayerColor","cc.LayerColor") + return cc.LayerColor +end +_G["CCLayerColor"] = DeprecatedClass.CCLayerColor() +--CCLayerColor class will be Deprecated,end + +--CCFadeOutBLTiles class will be Deprecated,begin +function DeprecatedClass.CCFadeOutBLTiles() + deprecatedTip("CCFadeOutBLTiles","cc.FadeOutBLTiles") + return cc.FadeOutBLTiles +end +_G["CCFadeOutBLTiles"] = DeprecatedClass.CCFadeOutBLTiles() +--CCFadeOutBLTiles class will be Deprecated,end + +--CCTransitionProgress class will be Deprecated,begin +function DeprecatedClass.CCTransitionProgress() + deprecatedTip("CCTransitionProgress","cc.TransitionProgress") + return cc.TransitionProgress +end +_G["CCTransitionProgress"] = DeprecatedClass.CCTransitionProgress() +--CCTransitionProgress class will be Deprecated,end + +--CCEaseRateAction class will be Deprecated,begin +function DeprecatedClass.CCEaseRateAction() + deprecatedTip("CCEaseRateAction","cc.EaseRateAction") + return cc.EaseRateAction +end +_G["CCEaseRateAction"] = DeprecatedClass.CCEaseRateAction() +--CCEaseRateAction class will be Deprecated,end + +--CCLayerGradient class will be Deprecated,begin +function DeprecatedClass.CCLayerGradient() + deprecatedTip("CCLayerGradient","cc.LayerGradient") + return cc.LayerGradient +end +_G["CCLayerGradient"] = DeprecatedClass.CCLayerGradient() +--CCLayerGradient class will be Deprecated,end + +--CCMenuItemSprite class will be Deprecated,begin +function DeprecatedClass.CCMenuItemSprite() + deprecatedTip("CCMenuItemSprite","cc.MenuItemSprite") + return cc.MenuItemSprite +end +_G["CCMenuItemSprite"] = DeprecatedClass.CCMenuItemSprite() +--CCMenuItemSprite class will be Deprecated,end + +--CCNode class will be Deprecated,begin +function DeprecatedClass.CCNode() + deprecatedTip("CCNode","cc.Node") + return cc.Node +end +_G["CCNode"] = DeprecatedClass.CCNode() +--CCNode class will be Deprecated,end + +--CCToggleVisibility class will be Deprecated,begin +function DeprecatedClass.CCToggleVisibility() + deprecatedTip("CCToggleVisibility","cc.ToggleVisibility") + return cc.ToggleVisibility +end +_G["CCToggleVisibility"] = DeprecatedClass.CCToggleVisibility() +--CCToggleVisibility class will be Deprecated,end + +--CCRepeat class will be Deprecated,begin +function DeprecatedClass.CCRepeat() + deprecatedTip("CCRepeat","cc.Repeat") + return cc.Repeat +end +_G["CCRepeat"] = DeprecatedClass.CCRepeat() +--CCRepeat class will be Deprecated,end + +--CCRenderTexture class will be Deprecated,begin +function DeprecatedClass.CCRenderTexture() + deprecatedTip("CCRenderTexture","cc.RenderTexture") + return cc.RenderTexture +end +_G["CCRenderTexture"] = DeprecatedClass.CCRenderTexture() +--CCRenderTexture class will be Deprecated,end + +--CCTransitionFlipY class will be Deprecated,begin +function DeprecatedClass.CCTransitionFlipY() + deprecatedTip("CCTransitionFlipY","cc.TransitionFlipY") + return cc.TransitionFlipY +end +_G["CCTransitionFlipY"] = DeprecatedClass.CCTransitionFlipY() +--CCTransitionFlipY class will be Deprecated,end + +--CCLayerMultiplex class will be Deprecated,begin +function DeprecatedClass.CCLayerMultiplex() + deprecatedTip("CCLayerMultiplex","cc.LayerMultiplex") + return cc.LayerMultiplex +end +_G["CCLayerMultiplex"] = DeprecatedClass.CCLayerMultiplex() +--CCLayerMultiplex class will be Deprecated,end + +--CCTMXLayerInfo class will be Deprecated,begin +function DeprecatedClass.CCTMXLayerInfo() + deprecatedTip("CCTMXLayerInfo","cc.TMXLayerInfo") + return cc.TMXLayerInfo +end +_G["CCTMXLayerInfo"] = DeprecatedClass.CCTMXLayerInfo() +--CCTMXLayerInfo class will be Deprecated,end + +--CCEaseBackInOut class will be Deprecated,begin +function DeprecatedClass.CCEaseBackInOut() + deprecatedTip("CCEaseBackInOut","cc.EaseBackInOut") + return cc.EaseBackInOut +end +_G["CCEaseBackInOut"] = DeprecatedClass.CCEaseBackInOut() +--CCEaseBackInOut class will be Deprecated,end + +--CCActionInstant class will be Deprecated,begin +function DeprecatedClass.CCActionInstant() + deprecatedTip("CCActionInstant","cc.ActionInstant") + return cc.ActionInstant +end +_G["CCActionInstant"] = DeprecatedClass.CCActionInstant() +--CCActionInstant class will be Deprecated,end + +--CCTargetedAction class will be Deprecated,begin +function DeprecatedClass.CCTargetedAction() + deprecatedTip("CCTargetedAction","cc.TargetedAction") + return cc.TargetedAction +end +_G["CCTargetedAction"] = DeprecatedClass.CCTargetedAction() +--CCTargetedAction class will be Deprecated,end + +--CCDrawNode class will be Deprecated,begin +function DeprecatedClass.CCDrawNode() + deprecatedTip("CCDrawNode","cc.DrawNode") + return cc.DrawNode +end +_G["CCDrawNode"] = DeprecatedClass.CCDrawNode() +--CCDrawNode class will be Deprecated,end + +--CCTransitionTurnOffTiles class will be Deprecated,begin +function DeprecatedClass.CCTransitionTurnOffTiles() + deprecatedTip("CCTransitionTurnOffTiles","cc.TransitionTurnOffTiles") + return cc.TransitionTurnOffTiles +end +_G["CCTransitionTurnOffTiles"] = DeprecatedClass.CCTransitionTurnOffTiles() +--CCTransitionTurnOffTiles class will be Deprecated,end + +--CCRotateTo class will be Deprecated,begin +function DeprecatedClass.CCRotateTo() + deprecatedTip("CCRotateTo","cc.RotateTo") + return cc.RotateTo +end +_G["CCRotateTo"] = DeprecatedClass.CCRotateTo() +--CCRotateTo class will be Deprecated,end + +--CCTransitionSplitRows class will be Deprecated,begin +function DeprecatedClass.CCTransitionSplitRows() + deprecatedTip("CCTransitionSplitRows","cc.TransitionSplitRows") + return cc.TransitionSplitRows +end +_G["CCTransitionSplitRows"] = DeprecatedClass.CCTransitionSplitRows() +--CCTransitionSplitRows class will be Deprecated,end + +--CCTransitionProgressRadialCCW class will be Deprecated,begin +function DeprecatedClass.CCTransitionProgressRadialCCW() + deprecatedTip("CCTransitionProgressRadialCCW","cc.TransitionProgressRadialCCW") + return cc.TransitionProgressRadialCCW +end +_G["CCTransitionProgressRadialCCW"] = DeprecatedClass.CCTransitionProgressRadialCCW() +--CCTransitionProgressRadialCCW class will be Deprecated,end + +--CCScaleTo class will be Deprecated,begin +function DeprecatedClass.CCScaleTo() + deprecatedTip("CCScaleTo","cc.ScaleTo") + return cc.ScaleTo +end +_G["CCScaleTo"] = DeprecatedClass.CCScaleTo() +--CCScaleTo class will be Deprecated,end + +--CCTransitionPageTurn class will be Deprecated,begin +function DeprecatedClass.CCTransitionPageTurn() + deprecatedTip("CCTransitionPageTurn","cc.TransitionPageTurn") + return cc.TransitionPageTurn +end +_G["CCTransitionPageTurn"] = DeprecatedClass.CCTransitionPageTurn() +--CCTransitionPageTurn class will be Deprecated,end + +--CCParticleExplosion class will be Deprecated,begin +function DeprecatedClass.CCParticleExplosion() + deprecatedTip("CCParticleExplosion","cc.ParticleExplosion") + return cc.ParticleExplosion +end +_G["CCParticleExplosion"] = DeprecatedClass.CCParticleExplosion() +--CCParticleExplosion class will be Deprecated,end + +--CCMenu class will be Deprecated,begin +function DeprecatedClass.CCMenu() + deprecatedTip("CCMenu","cc.Menu") + return cc.Menu +end +_G["CCMenu"] = DeprecatedClass.CCMenu() +--CCMenu class will be Deprecated,end + +--CCTexture2D class will be Deprecated,begin +function DeprecatedClass.CCTexture2D() + deprecatedTip("CCTexture2D","cc.Texture2D") + return cc.Texture2D +end +_G["CCTexture2D"] = DeprecatedClass.CCTexture2D() +--CCTexture2D class will be Deprecated,end + +--CCActionManager class will be Deprecated,begin +function DeprecatedClass.CCActionManager() + deprecatedTip("CCActionManager","cc.ActionManager") + return cc.ActionManager +end +_G["CCActionManager"] = DeprecatedClass.CCActionManager() +--CCActionManager class will be Deprecated,end + +--CCParticleBatchNode class will be Deprecated,begin +function DeprecatedClass.CCParticleBatchNode() + deprecatedTip("CCParticleBatchNode","cc.ParticleBatchNode") + return cc.ParticleBatchNode +end +_G["CCParticleBatchNode"] = DeprecatedClass.CCParticleBatchNode() +--CCParticleBatchNode class will be Deprecated,end + +--CCTransitionZoomFlipX class will be Deprecated,begin +function DeprecatedClass.CCTransitionZoomFlipX() + deprecatedTip("CCTransitionZoomFlipX","cc.TransitionZoomFlipX") + return cc.TransitionZoomFlipX +end +_G["CCTransitionZoomFlipX"] = DeprecatedClass.CCTransitionZoomFlipX() +--CCTransitionZoomFlipX class will be Deprecated,end + +--CCScaleBy class will be Deprecated,begin +function DeprecatedClass.CCScaleBy() + deprecatedTip("CCScaleBy","cc.ScaleBy") + return cc.ScaleBy +end +_G["CCScaleBy"] = DeprecatedClass.CCScaleBy() +--CCScaleBy class will be Deprecated,end + +--CCTileMapAtlas class will be Deprecated,begin +function DeprecatedClass.CCTileMapAtlas() + deprecatedTip("CCTileMapAtlas","cc.TileMapAtlas") + return cc.TileMapAtlas +end +_G["CCTileMapAtlas"] = DeprecatedClass.CCTileMapAtlas() +--CCTileMapAtlas class will be Deprecated,end + +--CCAction class will be Deprecated,begin +function DeprecatedClass.CCAction() + deprecatedTip("CCAction","cc.Action") + return cc.Action +end +_G["CCAction"] = DeprecatedClass.CCAction() +--CCAction class will be Deprecated,end + +--CCLens3D class will be Deprecated,begin +function DeprecatedClass.CCLens3D() + deprecatedTip("CCLens3D","cc.Lens3D") + return cc.Lens3D +end +_G["CCLens3D"] = DeprecatedClass.CCLens3D() +--CCLens3D class will be Deprecated,end + +--CCAnimation class will be Deprecated,begin +function DeprecatedClass.CCAnimation() + deprecatedTip("CCAnimation","cc.Animation") + return cc.Animation +end +_G["CCAnimation"] = DeprecatedClass.CCAnimation() +--CCAnimation class will be Deprecated,end + +--CCTransitionSlideInT class will be Deprecated,begin +function DeprecatedClass.CCTransitionSlideInT() + deprecatedTip("CCTransitionSlideInT","cc.TransitionSlideInT") + return cc.TransitionSlideInT +end +_G["CCTransitionSlideInT"] = DeprecatedClass.CCTransitionSlideInT() +--CCTransitionSlideInT class will be Deprecated,end + +--CCSpawn class will be Deprecated,begin +function DeprecatedClass.CCSpawn() + deprecatedTip("CCSpawn","cc.Spawn") + return cc.Spawn +end +_G["CCSpawn"] = DeprecatedClass.CCSpawn() +--CCSpawn class will be Deprecated,end + +--CCSet class will be Deprecated,begin +function DeprecatedClass.CCSet() + deprecatedTip("CCSet","cc.Set") + return cc.Set +end +_G["CCSet"] = DeprecatedClass.CCSet() +--CCSet class will be Deprecated,end + +--CCShakyTiles3D class will be Deprecated,begin +function DeprecatedClass.CCShakyTiles3D() + deprecatedTip("CCShakyTiles3D","cc.ShakyTiles3D") + return cc.ShakyTiles3D +end +_G["CCShakyTiles3D"] = DeprecatedClass.CCShakyTiles3D() +--CCShakyTiles3D class will be Deprecated,end + +--CCPageTurn3D class will be Deprecated,begin +function DeprecatedClass.CCPageTurn3D() + deprecatedTip("CCPageTurn3D","cc.PageTurn3D") + return cc.PageTurn3D +end +_G["CCPageTurn3D"] = DeprecatedClass.CCPageTurn3D() +--CCPageTurn3D class will be Deprecated,end + +--CCGrid3D class will be Deprecated,begin +function DeprecatedClass.CCGrid3D() + deprecatedTip("CCGrid3D","cc.Grid3D") + return cc.Grid3D +end +_G["CCGrid3D"] = DeprecatedClass.CCGrid3D() +--CCGrid3D class will be Deprecated,end + +--CCTransitionProgressInOut class will be Deprecated,begin +function DeprecatedClass.CCTransitionProgressInOut() + deprecatedTip("CCTransitionProgressInOut","cc.TransitionProgressInOut") + return cc.TransitionProgressInOut +end +_G["CCTransitionProgressInOut"] = DeprecatedClass.CCTransitionProgressInOut() +--CCTransitionProgressInOut class will be Deprecated,end + +--CCTransitionFadeBL class will be Deprecated,begin +function DeprecatedClass.CCTransitionFadeBL() + deprecatedTip("CCTransitionFadeBL","cc.TransitionFadeBL") + return cc.TransitionFadeBL +end +_G["CCTransitionFadeBL"] = DeprecatedClass.CCTransitionFadeBL() +--CCTransitionFadeBL class will be Deprecated,end + +--CCCamera class will be Deprecated,begin +function DeprecatedClass.CCCamera() + deprecatedTip("CCCamera","cc.Camera") + return cc.Camera +end +_G["CCCamera"] = DeprecatedClass.CCCamera() +--CCCamera class will be Deprecated,end + +--CCLayerRGBA class will be Deprecated,begin +function DeprecatedClass.CCLayerRGBA() + deprecatedTip("CCLayerRGBA","cc.Layer") + return cc.Layer +end +_G["CCLayerRGBA"] = DeprecatedClass.CCLayerRGBA() +--CCLayerRGBA class will be Deprecated,end + +--LayerRGBA class will be Deprecated,begin +function DeprecatedClass.LayerRGBA() + deprecatedTip("cc.LayerRGBA","cc.Layer") + return cc.Layer +end +_G["cc"]["LayerRGBA"] = DeprecatedClass.LayerRGBA() +--LayerRGBA class will be Deprecated,end + +--CCBezierTo class will be Deprecated,begin +function DeprecatedClass.CCBezierTo() + deprecatedTip("CCBezierTo","cc.BezierTo") + return cc.BezierTo +end +_G["CCBezierTo"] = DeprecatedClass.CCBezierTo() +--CCBezierTo class will be Deprecated,end + +--CCFollow class will be Deprecated,begin +function DeprecatedClass.CCFollow() + deprecatedTip("CCFollow","cc.Follow") + return cc.Follow +end +_G["CCFollow"] = DeprecatedClass.CCFollow() +--CCFollow class will be Deprecated,end + +--CCTintBy class will be Deprecated,begin +function DeprecatedClass.CCTintBy() + deprecatedTip("CCTintBy","cc.TintBy") + return cc.TintBy +end +_G["CCTintBy"] = DeprecatedClass.CCTintBy() +--CCTintBy class will be Deprecated,end + +--CCActionInterval class will be Deprecated,begin +function DeprecatedClass.CCActionInterval() + deprecatedTip("CCActionInterval","cc.ActionInterval") + return cc.ActionInterval +end +_G["CCActionInterval"] = DeprecatedClass.CCActionInterval() +--CCActionInterval class will be Deprecated,end + +--CCAnimate class will be Deprecated,begin +function DeprecatedClass.CCAnimate() + deprecatedTip("CCAnimate","cc.Animate") + return cc.Animate +end +_G["CCAnimate"] = DeprecatedClass.CCAnimate() +--CCAnimate class will be Deprecated,end + +--CCProgressTimer class will be Deprecated,begin +function DeprecatedClass.CCProgressTimer() + deprecatedTip("CCProgressTimer","cc.ProgressTimer") + return cc.ProgressTimer +end +_G["CCProgressTimer"] = DeprecatedClass.CCProgressTimer() +--CCProgressTimer class will be Deprecated,end + +--CCParticleMeteor class will be Deprecated,begin +function DeprecatedClass.CCParticleMeteor() + deprecatedTip("CCParticleMeteor","cc.ParticleMeteor") + return cc.ParticleMeteor +end +_G["CCParticleMeteor"] = DeprecatedClass.CCParticleMeteor() +--CCParticleMeteor class will be Deprecated,end + +--CCTransitionFadeTR class will be Deprecated,begin +function DeprecatedClass.CCTransitionFadeTR() + deprecatedTip("CCTransitionFadeTR","cc.TransitionFadeTR") + return cc.TransitionFadeTR +end +_G["CCTransitionFadeTR"] = DeprecatedClass.CCTransitionFadeTR() +--CCTransitionFadeTR class will be Deprecated,end + +--CCCatmullRomTo class will be Deprecated,begin +function DeprecatedClass.CCCatmullRomTo() + deprecatedTip("CCCatmullRomTo","cc.CatmullRomTo") + return cc.CatmullRomTo +end +_G["CCCatmullRomTo"] = DeprecatedClass.CCCatmullRomTo() +--CCCatmullRomTo class will be Deprecated,end + +--CCTransitionZoomFlipY class will be Deprecated,begin +function DeprecatedClass.CCTransitionZoomFlipY() + deprecatedTip("CCTransitionZoomFlipY","cc.TransitionZoomFlipY") + return cc.TransitionZoomFlipY +end +_G["CCTransitionZoomFlipY"] = DeprecatedClass.CCTransitionZoomFlipY() +--CCTransitionZoomFlipY class will be Deprecated,end + +--CCTransitionCrossFade class will be Deprecated,begin +function DeprecatedClass.CCTransitionCrossFade() + deprecatedTip("CCTransitionCrossFade","cc.TransitionCrossFade") + return cc.TransitionCrossFade +end +_G["CCTransitionCrossFade"] = DeprecatedClass.CCTransitionCrossFade() +--CCTransitionCrossFade class will be Deprecated,end + +--CCGridBase class will be Deprecated,begin +function DeprecatedClass.CCGridBase() + deprecatedTip("CCGridBase","cc.GridBase") + return cc.GridBase +end +_G["CCGridBase"] = DeprecatedClass.CCGridBase() +--CCGridBase class will be Deprecated,end + +--CCSkewTo class will be Deprecated,begin +function DeprecatedClass.CCSkewTo() + deprecatedTip("CCSkewTo","cc.SkewTo") + return cc.SkewTo +end +_G["CCSkewTo"] = DeprecatedClass.CCSkewTo() +--CCSkewTo class will be Deprecated,end + +--CCCardinalSplineTo class will be Deprecated,begin +function DeprecatedClass.CCCardinalSplineTo() + deprecatedTip("CCCardinalSplineTo","cc.CardinalSplineTo") + return cc.CardinalSplineTo +end +_G["CCCardinalSplineTo"] = DeprecatedClass.CCCardinalSplineTo() +--CCCardinalSplineTo class will be Deprecated,end + +--CCTMXMapInfo class will be Deprecated,begin +function DeprecatedClass.CCTMXMapInfo() + deprecatedTip("CCTMXMapInfo","cc.TMXMapInfo") + return cc.TMXMapInfo +end +_G["CCTMXMapInfo"] = DeprecatedClass.CCTMXMapInfo() +--CCTMXMapInfo class will be Deprecated,end + +--CCEaseExponentialIn class will be Deprecated,begin +function DeprecatedClass.CCEaseExponentialIn() + deprecatedTip("CCEaseExponentialIn","cc.EaseExponentialIn") + return cc.EaseExponentialIn +end +_G["CCEaseExponentialIn"] = DeprecatedClass.CCEaseExponentialIn() +--CCEaseExponentialIn class will be Deprecated,end + +--CCReuseGrid class will be Deprecated,begin +function DeprecatedClass.CCReuseGrid() + deprecatedTip("CCReuseGrid","cc.ReuseGrid") + return cc.ReuseGrid +end +_G["CCReuseGrid"] = DeprecatedClass.CCReuseGrid() +--CCReuseGrid class will be Deprecated,end + +--CCMenuItemAtlasFont class will be Deprecated,begin +function DeprecatedClass.CCMenuItemAtlasFont() + deprecatedTip("CCMenuItemAtlasFont","cc.MenuItemAtlasFont") + return cc.MenuItemAtlasFont +end +_G["CCMenuItemAtlasFont"] = DeprecatedClass.CCMenuItemAtlasFont() +--CCMenuItemAtlasFont class will be Deprecated,end + +--CCSpriteFrame class will be Deprecated,begin +function DeprecatedClass.CCSpriteFrame() + deprecatedTip("CCSpriteFrame","cc.SpriteFrame") + return cc.SpriteFrame +end +_G["CCSpriteFrame"] = DeprecatedClass.CCSpriteFrame() +--CCSpriteFrame class will be Deprecated,end + +--CCSplitRows class will be Deprecated,begin +function DeprecatedClass.CCSplitRows() + deprecatedTip("CCSplitRows","cc.SplitRows") + return cc.SplitRows +end +_G["CCSplitRows"] = DeprecatedClass.CCSplitRows() +--CCSplitRows class will be Deprecated,end + +--CCSprite class will be Deprecated,begin +function DeprecatedClass.CCSprite() + deprecatedTip("CCSprite","cc.Sprite") + return cc.Sprite +end +_G["CCSprite"] = DeprecatedClass.CCSprite() +--CCSprite class will be Deprecated,end + +--CCOrbitCamera class will be Deprecated,begin +function DeprecatedClass.CCOrbitCamera() + deprecatedTip("CCOrbitCamera","cc.OrbitCamera") + return cc.OrbitCamera +end +_G["CCOrbitCamera"] = DeprecatedClass.CCOrbitCamera() +--CCOrbitCamera class will be Deprecated,end + +--CCUserDefault class will be Deprecated,begin +function DeprecatedClass.CCUserDefault() + deprecatedTip("CCUserDefault","cc.UserDefault") + return cc.UserDefault +end +_G["CCUserDefault"] = DeprecatedClass.CCUserDefault() +--CCUserDefault class will be Deprecated,end + +--CCFadeOutUpTiles class will be Deprecated,begin +function DeprecatedClass.CCFadeOutUpTiles() + deprecatedTip("CCFadeOutUpTiles","cc.FadeOutUpTiles") + return cc.FadeOutUpTiles +end +_G["CCFadeOutUpTiles"] = DeprecatedClass.CCFadeOutUpTiles() +--CCFadeOutUpTiles class will be Deprecated,end + +--CCParticleRain class will be Deprecated,begin +function DeprecatedClass.CCParticleRain() + deprecatedTip("CCParticleRain","cc.ParticleRain") + return cc.ParticleRain +end +_G["CCParticleRain"] = DeprecatedClass.CCParticleRain() +--CCParticleRain class will be Deprecated,end + +--CCWaves class will be Deprecated,begin +function DeprecatedClass.CCWaves() + deprecatedTip("CCWaves","cc.Waves") + return cc.Waves +end +_G["CCWaves"] = DeprecatedClass.CCWaves() +--CCWaves class will be Deprecated,end + +--CCEaseOut class will be Deprecated,begin +function DeprecatedClass.CCEaseOut() + deprecatedTip("CCEaseOut","cc.EaseOut") + return cc.EaseOut +end +_G["CCEaseOut"] = DeprecatedClass.CCEaseOut() +--CCEaseOut class will be Deprecated,end + +--CCEaseBounceIn class will be Deprecated,begin +function DeprecatedClass.CCEaseBounceIn() + deprecatedTip("CCEaseBounceIn","cc.EaseBounceIn") + return cc.EaseBounceIn +end +_G["CCEaseBounceIn"] = DeprecatedClass.CCEaseBounceIn() +--CCEaseBounceIn class will be Deprecated,end + +--CCMenuItemFont class will be Deprecated,begin +function DeprecatedClass.CCMenuItemFont() + deprecatedTip("CCMenuItemFont","cc.MenuItemFont") + return cc.MenuItemFont +end +_G["CCMenuItemFont"] = DeprecatedClass.CCMenuItemFont() +--CCMenuItemFont class will be Deprecated,end + +--CCEaseSineOut class will be Deprecated,begin +function DeprecatedClass.CCEaseSineOut() + deprecatedTip("CCEaseSineOut","cc.EaseSineOut") + return cc.EaseSineOut +end +_G["CCEaseSineOut"] = DeprecatedClass.CCEaseSineOut() +--CCEaseSineOut class will be Deprecated,end + +--CCTextureCache class will be Deprecated,begin +function DeprecatedClass.CCTextureCache() + deprecatedTip("CCTextureCache","cc.TextureCache") + return cc.TextureCache +end +_G["CCTextureCache"] = DeprecatedClass.CCTextureCache() +--CCTextureCache class will be Deprecated,end + +--CCTiledGrid3D class will be Deprecated,begin +function DeprecatedClass.CCTiledGrid3D() + deprecatedTip("CCTiledGrid3D","cc.TiledGrid3D") + return cc.TiledGrid3D +end +_G["CCTiledGrid3D"] = DeprecatedClass.CCTiledGrid3D() +--CCTiledGrid3D class will be Deprecated,end + +--CCRemoveSelf class will be Deprecated,begin +function DeprecatedClass.CCRemoveSelf() + deprecatedTip("CCRemoveSelf","cc.RemoveSelf") + return cc.RemoveSelf +end +_G["CCRemoveSelf"] = DeprecatedClass.CCRemoveSelf() +--CCRemoveSelf class will be Deprecated,end + +--CCLabelTTF class will be Deprecated,begin +function DeprecatedClass.CCLabelTTF() + deprecatedTip("CCLabelTTF","cc.LabelTTF") + return cc.LabelTTF +end +_G["CCLabelTTF"] = DeprecatedClass.CCLabelTTF() +--CCLabelTTF class will be Deprecated,end + +--CCTouch class will be Deprecated,begin +function DeprecatedClass.CCTouch() + deprecatedTip("CCTouch","cc.Touch") + return cc.Touch +end +_G["CCTouch"] = DeprecatedClass.CCTouch() +--CCTouch class will be Deprecated,end + +--CCMoveBy class will be Deprecated,begin +function DeprecatedClass.CCMoveBy() + deprecatedTip("CCMoveBy","cc.MoveBy") + return cc.MoveBy +end +_G["CCMoveBy"] = DeprecatedClass.CCMoveBy() +--CCMoveBy class will be Deprecated,end + +--CCMotionStreak class will be Deprecated,begin +function DeprecatedClass.CCMotionStreak() + deprecatedTip("CCMotionStreak","cc.MotionStreak") + return cc.MotionStreak +end +_G["CCMotionStreak"] = DeprecatedClass.CCMotionStreak() +--CCMotionStreak class will be Deprecated,end + +--CCRotateBy class will be Deprecated,begin +function DeprecatedClass.CCRotateBy() + deprecatedTip("CCRotateBy","cc.RotateBy") + return cc.RotateBy +end +_G["CCRotateBy"] = DeprecatedClass.CCRotateBy() +--CCRotateBy class will be Deprecated,end + +--CCFileUtils class will be Deprecated,begin +function DeprecatedClass.CCFileUtils() + deprecatedTip("CCFileUtils","cc.FileUtils") + return cc.FileUtils +end +_G["CCFileUtils"] = DeprecatedClass.CCFileUtils() +--CCFileUtils class will be Deprecated,end + +--CCBezierBy class will be Deprecated,begin +function DeprecatedClass.CCBezierBy() + deprecatedTip("CCBezierBy","cc.BezierBy") + return cc.BezierBy +end +_G["CCBezierBy"] = DeprecatedClass.CCBezierBy() +--CCBezierBy class will be Deprecated,end + +--CCTransitionFade class will be Deprecated,begin +function DeprecatedClass.CCTransitionFade() + deprecatedTip("CCTransitionFade","cc.TransitionFade") + return cc.TransitionFade +end +_G["CCTransitionFade"] = DeprecatedClass.CCTransitionFade() +--CCTransitionFade class will be Deprecated,end + +--CCTransitionProgressOutIn class will be Deprecated,begin +function DeprecatedClass.CCTransitionProgressOutIn() + deprecatedTip("CCTransitionProgressOutIn","cc.TransitionProgressOutIn") + return cc.TransitionProgressOutIn +end +_G["CCTransitionProgressOutIn"] = DeprecatedClass.CCTransitionProgressOutIn() +--CCTransitionProgressOutIn class will be Deprecated,end + +--CCCatmullRomBy class will be Deprecated,begin +function DeprecatedClass.CCCatmullRomBy() + deprecatedTip("CCCatmullRomBy","cc.CatmullRomBy") + return cc.CatmullRomBy +end +_G["CCCatmullRomBy"] = DeprecatedClass.CCCatmullRomBy() +--CCCatmullRomBy class will be Deprecated,end + +--CCGridAction class will be Deprecated,begin +function DeprecatedClass.CCGridAction() + deprecatedTip("CCGridAction","cc.GridAction") + return cc.GridAction +end +_G["CCGridAction"] = DeprecatedClass.CCGridAction() +--CCGridAction class will be Deprecated,end + +--CCShaky3D class will be Deprecated,begin +function DeprecatedClass.CCShaky3D() + deprecatedTip("CCShaky3D","cc.Shaky3D") + return cc.Shaky3D +end +_G["CCShaky3D"] = DeprecatedClass.CCShaky3D() +--CCShaky3D class will be Deprecated,end + +--CCTransitionEaseScene class will be Deprecated,begin +function DeprecatedClass.CCTransitionEaseScene() + deprecatedTip("CCTransitionEaseScene","cc.TransitionEaseScene") + return cc.TransitionEaseScene +end +_G["CCTransitionEaseScene"] = DeprecatedClass.CCTransitionEaseScene() +--CCTransitionEaseScene class will be Deprecated,end + +--CCSequence class will be Deprecated,begin +function DeprecatedClass.CCSequence() + deprecatedTip("CCSequence","cc.Sequence") + return cc.Sequence +end +_G["CCSequence"] = DeprecatedClass.CCSequence() +--CCSequence class will be Deprecated,end + +--CCTransitionFadeUp class will be Deprecated,begin +function DeprecatedClass.CCTransitionFadeUp() + deprecatedTip("CCTransitionFadeUp","cc.TransitionFadeUp") + return cc.TransitionFadeUp +end +_G["CCTransitionFadeUp"] = DeprecatedClass.CCTransitionFadeUp() +--CCTransitionFadeUp class will be Deprecated,end + +--CCTransitionProgressRadialCW class will be Deprecated,begin +function DeprecatedClass.CCTransitionProgressRadialCW() + deprecatedTip("CCTransitionProgressRadialCW","cc.TransitionProgressRadialCW") + return cc.TransitionProgressRadialCW +end +_G["CCTransitionProgressRadialCW"] = DeprecatedClass.CCTransitionProgressRadialCW() +--CCTransitionProgressRadialCW class will be Deprecated,end + +--CCShuffleTiles class will be Deprecated,begin +function DeprecatedClass.CCShuffleTiles() + deprecatedTip("CCShuffleTiles","cc.ShuffleTiles") + return cc.ShuffleTiles +end +_G["CCShuffleTiles"] = DeprecatedClass.CCShuffleTiles() +--CCShuffleTiles class will be Deprecated,end + +--CCTransitionSlideInR class will be Deprecated,begin +function DeprecatedClass.CCTransitionSlideInR() + deprecatedTip("CCTransitionSlideInR","cc.TransitionSlideInR") + return cc.TransitionSlideInR +end +_G["CCTransitionSlideInR"] = DeprecatedClass.CCTransitionSlideInR() +--CCTransitionSlideInR class will be Deprecated,end + +--CCScene class will be Deprecated,begin +function DeprecatedClass.CCScene() + deprecatedTip("CCScene","cc.Scene") + return cc.Scene +end +_G["CCScene"] = DeprecatedClass.CCScene() +--CCScene class will be Deprecated,end + +--CCParallaxNode class will be Deprecated,begin +function DeprecatedClass.CCParallaxNode() + deprecatedTip("CCParallaxNode","cc.ParallaxNode") + return cc.ParallaxNode +end +_G["CCParallaxNode"] = DeprecatedClass.CCParallaxNode() +--CCParallaxNode class will be Deprecated,end + +--CCTransitionSlideInL class will be Deprecated,begin +function DeprecatedClass.CCTransitionSlideInL() + deprecatedTip("CCTransitionSlideInL","cc.TransitionSlideInL") + return cc.TransitionSlideInL +end +_G["CCTransitionSlideInL"] = DeprecatedClass.CCTransitionSlideInL() +--CCTransitionSlideInL class will be Deprecated,end + +--CCWavesTiles3D class will be Deprecated,begin +function DeprecatedClass.CCWavesTiles3D() + deprecatedTip("CCWavesTiles3D","cc.WavesTiles3D") + return cc.WavesTiles3D +end +_G["CCWavesTiles3D"] = DeprecatedClass.CCWavesTiles3D() +--CCWavesTiles3D class will be Deprecated,end + +--CCTransitionSlideInB class will be Deprecated,begin +function DeprecatedClass.CCTransitionSlideInB() + deprecatedTip("CCTransitionSlideInB","cc.TransitionSlideInB") + return cc.TransitionSlideInB +end +_G["CCTransitionSlideInB"] = DeprecatedClass.CCTransitionSlideInB() +--CCTransitionSlideInB class will be Deprecated,end + +--CCSpeed class will be Deprecated,begin +function DeprecatedClass.CCSpeed() + deprecatedTip("CCSpeed","cc.Speed") + return cc.Speed +end +_G["CCSpeed"] = DeprecatedClass.CCSpeed() +--CCSpeed class will be Deprecated,end + +--CCShatteredTiles3D class will be Deprecated,begin +function DeprecatedClass.CCShatteredTiles3D() + deprecatedTip("CCShatteredTiles3D","cc.ShatteredTiles3D") + return cc.ShatteredTiles3D +end +_G["CCShatteredTiles3D"] = DeprecatedClass.CCShatteredTiles3D() +--CCShatteredTiles3D class will be Deprecated,end + +--CCCallFuncN class will be Deprecated,begin +function DeprecatedClass.CCCallFuncN() + deprecatedTip("CCCallFuncN","cc.CallFunc") + return cc.CallFunc +end +_G["CCCallFuncN"] = DeprecatedClass.CCCallFuncN() +--CCCallFuncN class will be Deprecated,end + +--CCEGLViewProtocol class will be Deprecated,begin +function DeprecatedClass.CCEGLViewProtocol() + deprecatedTip("CCEGLViewProtocol","cc.GLViewProtocol") + return cc.GLViewProtocol +end +_G["CCEGLViewProtocol"] = DeprecatedClass.CCEGLViewProtocol() +--CCEGLViewProtocol class will be Deprecated,end + +--CCEGLView class will be Deprecated,begin +function DeprecatedClass.CCEGLView() + deprecatedTip("CCEGLView","cc.GLView") + return cc.GLView +end + +_G["CCEGLView"] = DeprecatedClass.CCEGLView() +--CCEGLView class will be Deprecated,end + +--XMLHttpRequest class will be Deprecated,begin +function DeprecatedClass.XMLHttpRequest() + deprecatedTip("XMLHttpRequest","cc.XMLHttpRequest") + return cc.XMLHttpRequest +end +_G["XMLHttpRequest"] = DeprecatedClass.XMLHttpRequest() +--XMLHttpRequest class will be Deprecated,end + +--EGLViewProtocol class will be Deprecated,begin +function DeprecatedClass.EGLViewProtocol() + deprecatedTip("cc.EGLViewProtocol","cc.GLViewProtocol") + return cc.GLViewProtocol +end +_G["cc.EGLViewProtocol"] = DeprecatedClass.EGLViewProtocol() +--EGLViewProtocol class will be Deprecated,end + +--EGLView class will be Deprecated,begin +function DeprecatedClass.EGLView() + deprecatedTip("cc.EGLView","cc.GLView") + return cc.GLView +end +_G["cc.EGLView"] = DeprecatedClass.EGLView() +--EGLView class will be Deprecated,end + +--EGLView class will be Deprecated,begin +function DeprecatedClass.EGLView() + deprecatedTip("cc.EGLView","cc.GLView") + print(cc.GLView) + return cc.GLView +end +_G["cc.EGLView"] = DeprecatedClass.EGLView() +--EGLView class will be Deprecated,end + +--ShaderCache class will be Deprecated,begin +function DeprecatedClass.ShaderCache() + deprecatedTip("cc.ShaderCache","cc.GLProgramCache") + return cc.GLProgramCache +end +cc.ShaderCache = DeprecatedClass.ShaderCache() +--ShaderCache class will be Deprecated,end + + + diff --git a/src/cocos/cocos2d/DeprecatedCocos2dEnum.lua b/src/cocos/cocos2d/DeprecatedCocos2dEnum.lua new file mode 100644 index 0000000..e28ae3e --- /dev/null +++ b/src/cocos/cocos2d/DeprecatedCocos2dEnum.lua @@ -0,0 +1,371 @@ + +--Enums will be deprecated,begin +_G.kCCTextAlignmentLeft = cc.TEXT_ALIGNMENT_LEFT +_G.kCCTextAlignmentRight = cc.TEXT_ALIGNMENT_RIGHT +_G.kCCTextAlignmentCenter = cc.TEXT_ALIGNMENT_CENTER +_G.kCCVerticalTextAlignmentTop = cc.VERTICAL_TEXT_ALIGNMENT_TOP +_G.kCCVerticalTextAlignmentCenter = cc.VERTICAL_TEXT_ALIGNMENT_CENTER +_G.kCCVerticalTextAlignmentBottom = cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM +_G.kCCDirectorProjection3D = cc.DIRECTOR_PROJECTION3_D +_G.kCCDirectorProjection2D = cc.DIRECTOR_PROJECTION2_D +_G.kCCDirectorProjectionCustom = cc.DIRECTOR_PROJECTION_CUSTOM +_G.kCCDirectorProjectionDefault = cc.DIRECTOR_PROJECTION_DEFAULT +_G.kCCNodeTagInvalid = cc.NODE_TAG_INVALID +_G.kCCNodeOnEnter = cc.NODE_ON_ENTER +_G.kCCNodeOnExit = cc.NODE_ON_EXIT +_G.kCCTexture2DPixelFormat_RGBA8888 = cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888 +_G.kCCTexture2DPixelFormat_RGB888 = cc.TEXTURE2_D_PIXEL_FORMAT_RG_B888 +_G.kCCTexture2DPixelFormat_RGB565 = cc.TEXTURE2_D_PIXEL_FORMAT_RG_B565 +_G.kCCTexture2DPixelFormat_A8 = cc.TEXTURE2_D_PIXEL_FORMAT_A8 +_G.kCCTexture2DPixelFormat_I8 = cc.TEXTURE2_D_PIXEL_FORMAT_I8 +_G.kCCTexture2DPixelFormat_AI88 = cc.TEXTURE2_D_PIXEL_FORMAT_A_I88 +_G.kCCTexture2DPixelFormat_RGBA4444 = cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444 +_G.kCCTexture2DPixelFormat_RGB5A1 = cc.TEXTURE2_D_PIXEL_FORMAT_RGB5_A1 +_G.kCCTexture2DPixelFormat_PVRTC4 = cc.TEXTURE2_D_PIXEL_FORMAT_PVRTC4 +_G.kCCTexture2DPixelFormat_PVRTC2 = cc.TEXTURE2_D_PIXEL_FORMAT_PVRTC2 +_G.kCCTexture2DPixelFormat_Default = cc.TEXTURE2_D_PIXEL_FORMAT_DEFAULT +_G.kCCImageFormatPNG = cc.IMAGE_FORMAT_PNG +_G.kCCImageFormatJPEG = cc.IMAGE_FORMAT_JPEG +_G.kCCTouchesOneByOne = cc.TOUCHES_ONE_BY_ONE +_G.kCCTouchesAllAtOnce = cc.TOUCHES_ALL_AT_ONCE +_G.kCCTransitionOrientationLeftOver = cc.TRANSITION_ORIENTATION_LEFT_OVER +_G.kCCTransitionOrientationRightOver = cc.TRANSITION_ORIENTATION_RIGHT_OVER +_G.kCCTransitionOrientationUpOver = cc.TRANSITION_ORIENTATION_UP_OVER +_G.kCCTransitionOrientationDownOver = cc.TRANSITION_ORIENTATION_DOWN_OVER +_G.kCCActionTagInvalid = cc.ACTION_TAG_INVALID +_G.kCCLabelAutomaticWidth = cc.LABEL_AUTOMATIC_WIDTH +_G.kCCMenuStateWaiting = cc.MENU_STATE_WAITING +_G.kCCMenuStateTrackingTouch = cc.MENU_STATE_TRACKING_TOUCH +_G.kCCMenuHandlerPriority = cc.MENU_HANDLER_PRIORITY +_G.kCCParticleDurationInfinity = cc.PARTICLE_DURATION_INFINITY +_G.kCCParticleStartSizeEqualToEndSize = cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE +_G.kCCParticleStartRadiusEqualToEndRadius = cc.PARTICLE_START_RADIUS_EQUAL_TO_END_RADIUS +_G.kCCParticleModeGravity = cc.PARTICLE_MODE_GRAVITY +_G.kCCParticleModeRadius = cc.PARTICLE_MODE_RADIUS +_G.kCCPositionTypeFree = cc.POSITION_TYPE_FREE +_G.kCCPositionTypeRelative = cc.POSITION_TYPE_RELATIVE +_G.kCCPositionTypeGrouped = cc.POSITION_TYPE_GROUPED +_G.kCCProgressTimerTypeRadial = cc.PROGRESS_TIMER_TYPE_RADIAL +_G.kCCProgressTimerTypeBar = cc.PROGRESS_TIMER_TYPE_BAR +_G.kCCTMXTileHorizontalFlag = cc.TMX_TILE_HORIZONTAL_FLAG +_G.kCCTMXTileVerticalFlag = cc.TMX_TILE_VERTICAL_FLAG +_G.kCCTMXTileDiagonalFlag = cc.TMX_TILE_DIAGONAL_FLAG +_G.kCCFlipedAll = cc.FLIPED_ALL +_G.kCCFlippedMask = cc.FLIPPED_MASK + +_G.kLanguageEnglish = cc.LANGUAGE_ENGLISH +_G.kLanguageChinese = cc.LANGUAGE_CHINESE +_G.kLanguageFrench = cc.LANGUAGE_FRENCH +_G.kLanguageItalian = cc.LANGUAGE_ITALIAN +_G.kLanguageGerman = cc.LANGUAGE_GERMAN +_G.kLanguageSpanish = cc.LANGUAGE_SPANISH +_G.kLanguageRussian = cc.LANGUAGE_RUSSIAN +_G.kLanguageKorean = cc.LANGUAGE_KOREAN +_G.kLanguageJapanese = cc.LANGUAGE_JAPANESE +_G.kLanguageHungarian = cc.LANGUAGE_HUNGARIAN +_G.kLanguagePortuguese = cc.LANGUAGE_PORTUGUESE +_G.kLanguageArabic = cc.LANGUAGE_ARABIC +_G.kTargetWindows = cc.PLATFORM_OS_WINDOWS +_G.kTargetLinux = cc.PLATFORM_OS_LINUX +_G.kTargetMacOS = cc.PLATFORM_OS_MAC +_G.kTargetAndroid = cc.PLATFORM_OS_ANDROID +_G.kTargetIphone = cc.PLATFORM_OS_IPHONE +_G.kTargetIpad = cc.PLATFORM_OS_IPAD +_G.kTargetBlackBerry = cc.PLATFORM_OS_BLACKBERRY + +_G.GL_ZERO = gl.ZERO +_G.GL_ONE = gl.ONE +_G.GL_SRC_COLOR = gl.SRC_COLOR +_G.GL_ONE_MINUS_SRC_COLOR = gl.ONE_MINUS_SRC_COLOR +_G.GL_SRC_ALPHA = gl.SRC_ALPHA +_G.GL_ONE_MINUS_SRC_ALPHA = gl.ONE_MINUS_SRC_ALPHA +_G.GL_DST_ALPHA = gl.DST_ALPHA +_G.GL_ONE_MINUS_DST_ALPHA = gl.ONE_MINUS_DST_ALPHA +_G.GL_DST_COLOR = gl.DST_COLOR +_G.GL_ONE_MINUS_DST_COLOR = gl.ONE_MINUS_DST_COLOR +_G.GL_RENDERBUFFER_INTERNAL_FORMAT = gl.RENDERBUFFER_INTERNAL_FORMAT +_G.GL_LINE_WIDTH = gl.LINE_WIDTH +_G.GL_CONSTANT_ALPHA = gl.CONSTANT_ALPHA +_G.GL_BLEND_SRC_ALPHA = gl.BLEND_SRC_ALPHA +_G.GL_GREEN_BITS = gl.GREEN_BITS +_G.GL_STENCIL_REF = gl.STENCIL_REF +_G.GL_ONE_MINUS_SRC_ALPHA = gl.ONE_MINUS_SRC_ALPHA +_G.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE +_G.GL_CCW = gl.CCW +_G.GL_MAX_TEXTURE_IMAGE_UNITS = gl.MAX_TEXTURE_IMAGE_UNITS +_G.GL_BACK = gl.BACK +_G.GL_ACTIVE_ATTRIBUTES = gl.ACTIVE_ATTRIBUTES +_G.GL_TEXTURE_CUBE_MAP_POSITIVE_X = gl.TEXTURE_CUBE_MAP_POSITIVE_X +_G.GL_STENCIL_BACK_VALUE_MASK = gl.STENCIL_BACK_VALUE_MASK +_G.GL_TEXTURE_CUBE_MAP_POSITIVE_Z = gl.TEXTURE_CUBE_MAP_POSITIVE_Z +_G.GL_ONE = gl.ONE +_G.GL_TRUE = gl.TRUE +_G.GL_TEXTURE12 = gl.TEXTURE12 +_G.GL_LINK_STATUS = gl.LINK_STATUS +_G.GL_BLEND = gl.BLEND +_G.GL_LESS = gl.LESS +_G.GL_TEXTURE16 = gl.TEXTURE16 +_G.GL_BOOL_VEC2 = gl.BOOL_VEC2 +_G.GL_KEEP = gl.KEEP +_G.GL_DST_COLOR = gl.DST_COLOR +_G.GL_VERTEX_ATTRIB_ARRAY_ENABLED = gl.VERTEX_ATTRIB_ARRAY_ENABLED +_G.GL_EXTENSIONS = gl.EXTENSIONS +_G.GL_FRONT = gl.FRONT +_G.GL_DST_ALPHA = gl.DST_ALPHA +_G.GL_ATTACHED_SHADERS = gl.ATTACHED_SHADERS +_G.GL_STENCIL_BACK_FUNC = gl.STENCIL_BACK_FUNC +_G.GL_ONE_MINUS_DST_COLOR = gl.ONE_MINUS_DST_COLOR +_G.GL_BLEND_EQUATION = gl.BLEND_EQUATION +_G.GL_RENDERBUFFER_DEPTH_SIZE = gl.RENDERBUFFER_DEPTH_SIZE +_G.GL_PACK_ALIGNMENT = gl.PACK_ALIGNMENT +_G.GL_VENDOR = gl.VENDOR +_G.GL_NEAREST_MIPMAP_LINEAR = gl.NEAREST_MIPMAP_LINEAR +_G.GL_TEXTURE_CUBE_MAP_POSITIVE_Y = gl.TEXTURE_CUBE_MAP_POSITIVE_Y +_G.GL_NEAREST = gl.NEAREST +_G.GL_RENDERBUFFER_WIDTH = gl.RENDERBUFFER_WIDTH +_G.GL_ARRAY_BUFFER_BINDING = gl.ARRAY_BUFFER_BINDING +_G.GL_ARRAY_BUFFER = gl.ARRAY_BUFFER +_G.GL_LEQUAL = gl.LEQUAL +_G.GL_VERSION = gl.VERSION +_G.GL_COLOR_CLEAR_VALUE = gl.COLOR_CLEAR_VALUE +_G.GL_RENDERER = gl.RENDERER +_G.GL_STENCIL_BACK_PASS_DEPTH_PASS = gl.STENCIL_BACK_PASS_DEPTH_PASS +_G.GL_STENCIL_BACK_PASS_DEPTH_FAIL = gl.STENCIL_BACK_PASS_DEPTH_FAIL +_G.GL_STENCIL_BACK_WRITEMASK = gl.STENCIL_BACK_WRITEMASK +_G.GL_BOOL = gl.BOOL +_G.GL_VIEWPORT = gl.VIEWPORT +_G.GL_FRAGMENT_SHADER = gl.FRAGMENT_SHADER +_G.GL_LUMINANCE = gl.LUMINANCE +_G.GL_DECR_WRAP = gl.DECR_WRAP +_G.GL_FUNC_ADD = gl.FUNC_ADD +_G.GL_ONE_MINUS_DST_ALPHA = gl.ONE_MINUS_DST_ALPHA +_G.GL_OUT_OF_MEMORY = gl.OUT_OF_MEMORY +_G.GL_BOOL_VEC4 = gl.BOOL_VEC4 +_G.GL_POLYGON_OFFSET_FACTOR = gl.POLYGON_OFFSET_FACTOR +_G.GL_STATIC_DRAW = gl.STATIC_DRAW +_G.GL_DITHER = gl.DITHER +_G.GL_TEXTURE31 = gl.TEXTURE31 +_G.GL_TEXTURE30 = gl.TEXTURE30 +_G.GL_UNSIGNED_BYTE = gl.UNSIGNED_BYTE +_G.GL_DEPTH_COMPONENT16 = gl.DEPTH_COMPONENT16 +_G.GL_TEXTURE23 = gl.TEXTURE23 +_G.GL_DEPTH_TEST = gl.DEPTH_TEST +_G.GL_STENCIL_PASS_DEPTH_FAIL = gl.STENCIL_PASS_DEPTH_FAIL +_G.GL_BOOL_VEC3 = gl.BOOL_VEC3 +_G.GL_POLYGON_OFFSET_UNITS = gl.POLYGON_OFFSET_UNITS +_G.GL_TEXTURE_BINDING_2D = gl.TEXTURE_BINDING_2D +_G.GL_TEXTURE21 = gl.TEXTURE21 +_G.GL_UNPACK_ALIGNMENT = gl.UNPACK_ALIGNMENT +_G.GL_DONT_CARE = gl.DONT_CARE +_G.GL_BUFFER_SIZE = gl.BUFFER_SIZE +_G.GL_FLOAT_MAT3 = gl.FLOAT_MAT3 +_G.GL_UNSIGNED_SHORT_5_6_5 = gl.UNSIGNED_SHORT_5_6_5 +_G.GL_INT_VEC2 = gl.INT_VEC2 +_G.GL_UNSIGNED_SHORT_4_4_4_4 = gl.UNSIGNED_SHORT_4_4_4_4 +_G.GL_NONE = gl.NONE +_G.GL_BLEND_DST_ALPHA = gl.BLEND_DST_ALPHA +_G.GL_VERTEX_ATTRIB_ARRAY_SIZE = gl.VERTEX_ATTRIB_ARRAY_SIZE +_G.GL_SRC_COLOR = gl.SRC_COLOR +_G.GL_COMPRESSED_TEXTURE_FORMATS = gl.COMPRESSED_TEXTURE_FORMATS +_G.GL_STENCIL_ATTACHMENT = gl.STENCIL_ATTACHMENT +_G.GL_MAX_VERTEX_ATTRIBS = gl.MAX_VERTEX_ATTRIBS +_G.GL_NUM_COMPRESSED_TEXTURE_FORMATS = gl.NUM_COMPRESSED_TEXTURE_FORMATS +_G.GL_BLEND_EQUATION_RGB = gl.BLEND_EQUATION_RGB +_G.GL_TEXTURE = gl.TEXTURE +_G.GL_LINEAR_MIPMAP_LINEAR = gl.LINEAR_MIPMAP_LINEAR +_G.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING +_G.GL_CURRENT_PROGRAM = gl.CURRENT_PROGRAM +_G.GL_COLOR_BUFFER_BIT = gl.COLOR_BUFFER_BIT +_G.GL_TEXTURE20 = gl.TEXTURE20 +_G.GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = gl.ACTIVE_ATTRIBUTE_MAX_LENGTH +_G.GL_TEXTURE28 = gl.TEXTURE28 +_G.GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE +_G.GL_TEXTURE22 = gl.TEXTURE22 +_G.GL_ELEMENT_ARRAY_BUFFER_BINDING = gl.ELEMENT_ARRAY_BUFFER_BINDING +_G.GL_STREAM_DRAW = gl.STREAM_DRAW +_G.GL_SCISSOR_BOX = gl.SCISSOR_BOX +_G.GL_TEXTURE26 = gl.TEXTURE26 +_G.GL_TEXTURE27 = gl.TEXTURE27 +_G.GL_TEXTURE24 = gl.TEXTURE24 +_G.GL_TEXTURE25 = gl.TEXTURE25 +_G.GL_NO_ERROR = gl.NO_ERROR +_G.GL_TEXTURE29 = gl.TEXTURE29 +_G.GL_FLOAT_MAT4 = gl.FLOAT_MAT4 +_G.GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = gl.VERTEX_ATTRIB_ARRAY_NORMALIZED +_G.GL_SAMPLE_COVERAGE_INVERT = gl.SAMPLE_COVERAGE_INVERT +_G.GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL +_G.GL_FLOAT_VEC3 = gl.FLOAT_VEC3 +_G.GL_STENCIL_CLEAR_VALUE = gl.STENCIL_CLEAR_VALUE +_G.GL_UNSIGNED_SHORT_5_5_5_1 = gl.UNSIGNED_SHORT_5_5_5_1 +_G.GL_ACTIVE_UNIFORMS = gl.ACTIVE_UNIFORMS +_G.GL_INVALID_OPERATION = gl.INVALID_OPERATION +_G.GL_DEPTH_ATTACHMENT = gl.DEPTH_ATTACHMENT +_G.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS +_G.GL_FRAMEBUFFER_COMPLETE = gl.FRAMEBUFFER_COMPLETE +_G.GL_ONE_MINUS_CONSTANT_COLOR = gl.ONE_MINUS_CONSTANT_COLOR +_G.GL_TEXTURE2 = gl.TEXTURE2 +_G.GL_TEXTURE1 = gl.TEXTURE1 +_G.GL_GEQUAL = gl.GEQUAL +_G.GL_TEXTURE7 = gl.TEXTURE7 +_G.GL_TEXTURE6 = gl.TEXTURE6 +_G.GL_TEXTURE5 = gl.TEXTURE5 +_G.GL_TEXTURE4 = gl.TEXTURE4 +_G.GL_GENERATE_MIPMAP_HINT = gl.GENERATE_MIPMAP_HINT +_G.GL_ONE_MINUS_SRC_COLOR = gl.ONE_MINUS_SRC_COLOR +_G.GL_TEXTURE9 = gl.TEXTURE9 +_G.GL_STENCIL_TEST = gl.STENCIL_TEST +_G.GL_COLOR_WRITEMASK = gl.COLOR_WRITEMASK +_G.GL_DEPTH_COMPONENT = gl.DEPTH_COMPONENT +_G.GL_STENCIL_INDEX8 = gl.STENCIL_INDEX8 +_G.GL_VERTEX_ATTRIB_ARRAY_TYPE = gl.VERTEX_ATTRIB_ARRAY_TYPE +_G.GL_FLOAT_VEC2 = gl.FLOAT_VEC2 +_G.GL_BLUE_BITS = gl.BLUE_BITS +_G.GL_VERTEX_SHADER = gl.VERTEX_SHADER +_G.GL_SUBPIXEL_BITS = gl.SUBPIXEL_BITS +_G.GL_STENCIL_WRITEMASK = gl.STENCIL_WRITEMASK +_G.GL_FLOAT_VEC4 = gl.FLOAT_VEC4 +_G.GL_TEXTURE17 = gl.TEXTURE17 +_G.GL_ONE_MINUS_CONSTANT_ALPHA = gl.ONE_MINUS_CONSTANT_ALPHA +_G.GL_TEXTURE15 = gl.TEXTURE15 +_G.GL_TEXTURE14 = gl.TEXTURE14 +_G.GL_TEXTURE13 = gl.TEXTURE13 +_G.GL_SAMPLES = gl.SAMPLES +_G.GL_TEXTURE11 = gl.TEXTURE11 +_G.GL_TEXTURE10 = gl.TEXTURE10 +_G.GL_FUNC_SUBTRACT = gl.FUNC_SUBTRACT +_G.GL_STENCIL_BUFFER_BIT = gl.STENCIL_BUFFER_BIT +_G.GL_TEXTURE19 = gl.TEXTURE19 +_G.GL_TEXTURE18 = gl.TEXTURE18 +_G.GL_NEAREST_MIPMAP_NEAREST = gl.NEAREST_MIPMAP_NEAREST +_G.GL_SHORT = gl.SHORT +_G.GL_RENDERBUFFER_BINDING = gl.RENDERBUFFER_BINDING +_G.GL_REPEAT = gl.REPEAT +_G.GL_TEXTURE_MIN_FILTER = gl.TEXTURE_MIN_FILTER +_G.GL_RED_BITS = gl.RED_BITS +_G.GL_FRONT_FACE = gl.FRONT_FACE +_G.GL_BLEND_COLOR = gl.BLEND_COLOR +_G.GL_MIRRORED_REPEAT = gl.MIRRORED_REPEAT +_G.GL_INT_VEC4 = gl.INT_VEC4 +_G.GL_MAX_CUBE_MAP_TEXTURE_SIZE = gl.MAX_CUBE_MAP_TEXTURE_SIZE +_G.GL_RENDERBUFFER_BLUE_SIZE = gl.RENDERBUFFER_BLUE_SIZE +_G.GL_SAMPLE_COVERAGE = gl.SAMPLE_COVERAGE +_G.GL_SRC_ALPHA = gl.SRC_ALPHA +_G.GL_FUNC_REVERSE_SUBTRACT = gl.FUNC_REVERSE_SUBTRACT +_G.GL_DEPTH_WRITEMASK = gl.DEPTH_WRITEMASK +_G.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT +_G.GL_POLYGON_OFFSET_FILL = gl.POLYGON_OFFSET_FILL +_G.GL_STENCIL_FUNC = gl.STENCIL_FUNC +_G.GL_REPLACE = gl.REPLACE +_G.GL_LUMINANCE_ALPHA = gl.LUMINANCE_ALPHA +_G.GL_DEPTH_RANGE = gl.DEPTH_RANGE +_G.GL_FASTEST = gl.FASTEST +_G.GL_STENCIL_FAIL = gl.STENCIL_FAIL +_G.GL_UNSIGNED_SHORT = gl.UNSIGNED_SHORT +_G.GL_RENDERBUFFER_HEIGHT = gl.RENDERBUFFER_HEIGHT +_G.GL_STENCIL_BACK_FAIL = gl.STENCIL_BACK_FAIL +_G.GL_BLEND_SRC_RGB = gl.BLEND_SRC_RGB +_G.GL_TEXTURE3 = gl.TEXTURE3 +_G.GL_RENDERBUFFER = gl.RENDERBUFFER +_G.GL_RGB5_A1 = gl.RGB5_A1 +_G.GL_RENDERBUFFER_ALPHA_SIZE = gl.RENDERBUFFER_ALPHA_SIZE +_G.GL_RENDERBUFFER_STENCIL_SIZE = gl.RENDERBUFFER_STENCIL_SIZE +_G.GL_NOTEQUAL = gl.NOTEQUAL +_G.GL_BLEND_DST_RGB = gl.BLEND_DST_RGB +_G.GL_FRONT_AND_BACK = gl.FRONT_AND_BACK +_G.GL_TEXTURE_BINDING_CUBE_MAP = gl.TEXTURE_BINDING_CUBE_MAP +_G.GL_MAX_RENDERBUFFER_SIZE = gl.MAX_RENDERBUFFER_SIZE +_G.GL_ZERO = gl.ZERO +_G.GL_TEXTURE0 = gl.TEXTURE0 +_G.GL_SAMPLE_ALPHA_TO_COVERAGE = gl.SAMPLE_ALPHA_TO_COVERAGE +_G.GL_BUFFER_USAGE = gl.BUFFER_USAGE +_G.GL_ACTIVE_TEXTURE = gl.ACTIVE_TEXTURE +_G.GL_BYTE = gl.BYTE +_G.GL_CW = gl.CW +_G.GL_DYNAMIC_DRAW = gl.DYNAMIC_DRAW +_G.GL_RENDERBUFFER_RED_SIZE = gl.RENDERBUFFER_RED_SIZE +_G.GL_FALSE = gl.FALSE +_G.GL_GREATER = gl.GREATER +_G.GL_RGBA4 = gl.RGBA4 +_G.GL_VALIDATE_STATUS = gl.VALIDATE_STATUS +_G.GL_STENCIL_BITS = gl.STENCIL_BITS +_G.GL_RGB = gl.RGB +_G.GL_INT = gl.INT +_G.GL_DEPTH_FUNC = gl.DEPTH_FUNC +_G.GL_SAMPLER_2D = gl.SAMPLER_2D +_G.GL_NICEST = gl.NICEST +_G.GL_MAX_VIEWPORT_DIMS = gl.MAX_VIEWPORT_DIMS +_G.GL_CULL_FACE = gl.CULL_FACE +_G.GL_INT_VEC3 = gl.INT_VEC3 +_G.GL_ALIASED_POINT_SIZE_RANGE = gl.ALIASED_POINT_SIZE_RANGE +_G.GL_INVALID_ENUM = gl.INVALID_ENUM +_G.GL_INVERT = gl.INVERT +_G.GL_CULL_FACE_MODE = gl.CULL_FACE_MODE +_G.GL_TEXTURE8 = gl.TEXTURE8 +_G.GL_VERTEX_ATTRIB_ARRAY_POINTER = gl.VERTEX_ATTRIB_ARRAY_POINTER +_G.GL_TEXTURE_WRAP_S = gl.TEXTURE_WRAP_S +_G.GL_VERTEX_ATTRIB_ARRAY_STRIDE = gl.VERTEX_ATTRIB_ARRAY_STRIDE +_G.GL_LINES = gl.LINES +_G.GL_EQUAL = gl.EQUAL +_G.GL_LINE_LOOP = gl.LINE_LOOP +_G.GL_TEXTURE_WRAP_T = gl.TEXTURE_WRAP_T +_G.GL_DEPTH_BUFFER_BIT = gl.DEPTH_BUFFER_BIT +_G.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS +_G.GL_SHADER_TYPE = gl.SHADER_TYPE +_G.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME +_G.GL_TEXTURE_CUBE_MAP_NEGATIVE_X = gl.TEXTURE_CUBE_MAP_NEGATIVE_X +_G.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = gl.TEXTURE_CUBE_MAP_NEGATIVE_Y +_G.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = gl.TEXTURE_CUBE_MAP_NEGATIVE_Z +_G.GL_DECR = gl.DECR +_G.GL_DELETE_STATUS = gl.DELETE_STATUS +_G.GL_DEPTH_BITS = gl.DEPTH_BITS +_G.GL_INCR = gl.INCR +_G.GL_SAMPLE_COVERAGE_VALUE = gl.SAMPLE_COVERAGE_VALUE +_G.GL_ALPHA_BITS = gl.ALPHA_BITS +_G.GL_FLOAT_MAT2 = gl.FLOAT_MAT2 +_G.GL_LINE_STRIP = gl.LINE_STRIP +_G.GL_SHADER_SOURCE_LENGTH = gl.SHADER_SOURCE_LENGTH +_G.GL_INVALID_VALUE = gl.INVALID_VALUE +_G.GL_NEVER = gl.NEVER +_G.GL_INCR_WRAP = gl.INCR_WRAP +_G.GL_BLEND_EQUATION_ALPHA = gl.BLEND_EQUATION_ALPHA +_G.GL_TEXTURE_MAG_FILTER = gl.TEXTURE_MAG_FILTER +_G.GL_POINTS = gl.POINTS +_G.GL_COLOR_ATTACHMENT0 = gl.COLOR_ATTACHMENT0 +_G.GL_RGBA = gl.RGBA +_G.GL_SRC_ALPHA_SATURATE = gl.SRC_ALPHA_SATURATE +_G.GL_SAMPLER_CUBE = gl.SAMPLER_CUBE +_G.GL_FRAMEBUFFER = gl.FRAMEBUFFER +_G.GL_TEXTURE_CUBE_MAP = gl.TEXTURE_CUBE_MAP +_G.GL_SAMPLE_BUFFERS = gl.SAMPLE_BUFFERS +_G.GL_LINEAR = gl.LINEAR +_G.GL_LINEAR_MIPMAP_NEAREST = gl.LINEAR_MIPMAP_NEAREST +_G.GL_ACTIVE_UNIFORM_MAX_LENGTH = gl.ACTIVE_UNIFORM_MAX_LENGTH +_G.GL_STENCIL_BACK_REF = gl.STENCIL_BACK_REF +_G.GL_ELEMENT_ARRAY_BUFFER = gl.ELEMENT_ARRAY_BUFFER +_G.GL_CLAMP_TO_EDGE = gl.CLAMP_TO_EDGE +_G.GL_TRIANGLE_STRIP = gl.TRIANGLE_STRIP +_G.GL_CONSTANT_COLOR = gl.CONSTANT_COLOR +_G.GL_COMPILE_STATUS = gl.COMPILE_STATUS +_G.GL_RENDERBUFFER_GREEN_SIZE = gl.RENDERBUFFER_GREEN_SIZE +_G.GL_UNSIGNED_INT = gl.UNSIGNED_INT +_G.GL_DEPTH_CLEAR_VALUE = gl.DEPTH_CLEAR_VALUE +_G.GL_ALIASED_LINE_WIDTH_RANGE = gl.ALIASED_LINE_WIDTH_RANGE +_G.GL_SHADING_LANGUAGE_VERSION = gl.SHADING_LANGUAGE_VERSION +_G.GL_FRAMEBUFFER_UNSUPPORTED = gl.FRAMEBUFFER_UNSUPPORTED +_G.GL_INFO_LOG_LENGTH = gl.INFO_LOG_LENGTH +_G.GL_STENCIL_PASS_DEPTH_PASS = gl.STENCIL_PASS_DEPTH_PASS +_G.GL_STENCIL_VALUE_MASK = gl.STENCIL_VALUE_MASK +_G.GL_ALWAYS = gl.ALWAYS +_G.GL_MAX_TEXTURE_SIZE = gl.MAX_TEXTURE_SIZE +_G.GL_FLOAT = gl.FLOAT +_G.GL_FRAMEBUFFER_BINDING = gl.FRAMEBUFFER_BINDING +_G.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT +_G.GL_TRIANGLE_FAN = gl.TRIANGLE_FAN +_G.GL_INVALID_FRAMEBUFFER_OPERATION = gl.INVALID_FRAMEBUFFER_OPERATION +_G.GL_TEXTURE_2D = gl.TEXTURE_2D +_G.GL_ALPHA = gl.ALPHA +_G.GL_CURRENT_VERTEX_ATTRIB = gl.CURRENT_VERTEX_ATTRIB +_G.GL_SCISSOR_TEST = gl.SCISSOR_TEST +_G.GL_TRIANGLES = gl.TRIANGLES + +cc.TEXTURE_PIXELFORMAT_DEFAULT = cc.TEXTURE2_D_PIXEL_FORMAT_DEFAULT diff --git a/src/cocos/cocos2d/DeprecatedCocos2dFunc.lua b/src/cocos/cocos2d/DeprecatedCocos2dFunc.lua new file mode 100644 index 0000000..2c83429 --- /dev/null +++ b/src/cocos/cocos2d/DeprecatedCocos2dFunc.lua @@ -0,0 +1,1014 @@ + +--tip +local function deprecatedTip(old_name,new_name) + print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") +end + +--functions of CCDirector will be deprecated,begin +local CCDirectorDeprecated = { } +function CCDirectorDeprecated.sharedDirector() + deprecatedTip("CCDirector:sharedDirector","cc.Director:getInstance") + return cc.Director:getInstance() +end +CCDirector.sharedDirector = CCDirectorDeprecated.sharedDirector +--functions of CCDirector will be deprecated,end + + +--functions of CCTextureCache will be deprecated begin +local TextureCacheDeprecated = {} +function TextureCacheDeprecated.getInstance(self) + deprecatedTip("cc.TextureCache:getInstance","cc.Director:getInstance():getTextureCache") + return cc.Director:getInstance():getTextureCache() +end +cc.TextureCache.getInstance = TextureCacheDeprecated.getInstance + +function TextureCacheDeprecated.destroyInstance(self) + deprecatedTip("cc.TextureCache:destroyInstance","cc.Director:getInstance():destroyTextureCache") + return cc.Director:getInstance():destroyTextureCache() +end +cc.TextureCache.destroyInstance = TextureCacheDeprecated.destroyInstance + +function TextureCacheDeprecated.dumpCachedTextureInfo(self) + deprecatedTip("self:dumpCachedTextureInfo","self:getCachedTextureInfo") + return print(self:getCachedTextureInfo()) +end +cc.TextureCache.dumpCachedTextureInfo = TextureCacheDeprecated.dumpCachedTextureInfo + +local CCTextureCacheDeprecated = { } +function CCTextureCacheDeprecated.sharedTextureCache() + deprecatedTip("CCTextureCache:sharedTextureCache","CCTextureCache:getInstance") + return cc.TextureCache:getInstance() +end +rawset(CCTextureCache,"sharedTextureCache",CCTextureCacheDeprecated.sharedTextureCache) + +function CCTextureCacheDeprecated.purgeSharedTextureCache() + deprecatedTip("CCTextureCache:purgeSharedTextureCache","CCTextureCache:destroyInstance") + return cc.TextureCache:destroyInstance() +end +rawset(CCTextureCache,"purgeSharedTextureCache",CCTextureCacheDeprecated.purgeSharedTextureCache) + +function CCTextureCacheDeprecated.addUIImage(self, image, key) + deprecatedTip("CCTextureCache:addUIImage","CCTextureCache:addImage") + return self:addImage(image,key) +end +CCTextureCache.addUIImage = CCTextureCacheDeprecated.addUIImage +--functions of CCTextureCache will be deprecated end + +--functions of CCAnimation will be deprecated begin +local CCAnimationDeprecated = {} +function CCAnimationDeprecated.addSpriteFrameWithFileName(self,...) + deprecatedTip("CCAnimationDeprecated:addSpriteFrameWithFileName","cc.Animation:addSpriteFrameWithFile") + return self:addSpriteFrameWithFile(...) +end +CCAnimation.addSpriteFrameWithFileName = CCAnimationDeprecated.addSpriteFrameWithFileName +--functions of CCAnimation will be deprecated end + + +--functions of CCAnimationCache will be deprecated begin +local CCAnimationCacheDeprecated = { } +function CCAnimationCacheDeprecated.sharedAnimationCache() + deprecatedTip("CCAnimationCache:sharedAnimationCache","CCAnimationCache:getInstance") + return CCAnimationCache:getInstance() +end +CCAnimationCache.sharedAnimationCache = CCAnimationCacheDeprecated.sharedAnimationCache + +function CCAnimationCacheDeprecated.purgeSharedAnimationCache() + deprecatedTip("CCAnimationCache:purgeSharedAnimationCache","CCAnimationCache:destroyInstance") + return CCAnimationCache:destroyInstance() +end +CCAnimationCache.purgeSharedAnimationCache = CCAnimationCacheDeprecated.purgeSharedAnimationCache + +function CCAnimationCacheDeprecated.addAnimationsWithFile(self,...) + deprecatedTip("CCAnimationCache:addAnimationsWithFile","cc.AnimationCache:addAnimations") + return self:addAnimations(...) +end +CCAnimationCache.addAnimationsWithFile = CCAnimationCacheDeprecated.addAnimationsWithFile + +function CCAnimationCacheDeprecated.animationByName(self,...) + deprecatedTip("CCAnimationCache:animationByName","cc.AnimationCache:getAnimation") + return self:getAnimation(...) +end +CCAnimationCache.animationByName = CCAnimationCacheDeprecated.animationByName + +function CCAnimationCacheDeprecated.removeAnimationByName(self) + deprecatedTip("CCAnimationCache:removeAnimationByName","cc.AnimationCache:removeAnimation") + return self:removeAnimation() +end +CCAnimationCache.removeAnimationByName = CCAnimationCacheDeprecated.removeAnimationByName +--functions of CCAnimationCache will be deprecated end + +--functions of CCFileUtils will be deprecated end +local CCFileUtilsDeprecated = { } +function CCFileUtilsDeprecated.sharedFileUtils() + deprecatedTip("CCFileUtils:sharedFileUtils","CCFileUtils:getInstance") + return cc.FileUtils:getInstance() +end +CCFileUtils.sharedFileUtils = CCFileUtilsDeprecated.sharedFileUtils + +function CCFileUtilsDeprecated.purgeFileUtils() + deprecatedTip("CCFileUtils:purgeFileUtils","CCFileUtils:destroyInstance") + return cc.FileUtils:destroyInstance() +end +CCFileUtils.purgeFileUtils = CCFileUtilsDeprecated.purgeFileUtils +--functions of CCFileUtils will be deprecated end + +--functions of CCMenu will be deprecated begin +local CCMenuDeprecated = { } +function CCMenuDeprecated.createWithItem(self,...) + deprecatedTip("CCMenuDeprecated:createWithItem","cc.Menu:createWithItem") + return self:create(...) +end +CCMenu.createWithItem = CCMenuDeprecated.createWithItem + +function CCMenuDeprecated.setHandlerPriority(self) + print("\n********** \n".."setHandlerPriority was deprecated in 3.0. \n**********") +end +CCMenu.setHandlerPriority = CCMenuDeprecated.setHandlerPriority +--functions of CCMenu will be deprecated end + +--functions of CCNode will be deprecated begin +local CCNodeDeprecated = { } + +function CCNodeDeprecated.boundingBox(self) + deprecatedTip("CCNode:boundingBox","cc.Node:getBoundingBox") + return self:getBoundingBox() +end +CCNode.boundingBox = CCNodeDeprecated.boundingBox + + +function CCNodeDeprecated.numberOfRunningActions(self) + deprecatedTip("CCNode:numberOfRunningActions","cc.Node:getNumberOfRunningActions") + return self:getNumberOfRunningActions() +end +CCNode.numberOfRunningActions = CCNodeDeprecated.numberOfRunningActions + + +function CCNodeDeprecated.removeFromParentAndCleanup(self,...) + deprecatedTip("CCNode:removeFromParentAndCleanup","cc.Node:removeFromParent") + return self:removeFromParent(...) +end +CCNode.removeFromParentAndCleanup = CCNodeDeprecated.removeFromParentAndCleanup +--functions of CCNode will be deprecated end + +--CCDrawPrimitives will be deprecated begin +local function CCDrawPrimitivesClassDeprecated() + deprecatedTip("CCDrawPrimitives","cc.DrawPrimitives") + return cc.DrawPrimitives +end +_G.CCDrawPrimitives = CCDrawPrimitivesClassDeprecated() +--functions of CCDrawPrimitives will be deprecated begin +local CCDrawPrimitivesDeprecated = { } +function CCDrawPrimitivesDeprecated.ccDrawPoint(pt) + deprecatedTip("ccDrawPoint","cc.DrawPrimitives.drawPoint") + return cc.DrawPrimitives.drawPoint(pt) +end +_G.ccDrawPoint = CCDrawPrimitivesDeprecated.ccDrawPoint + +function CCDrawPrimitivesDeprecated.ccDrawLine(origin,destination) + deprecatedTip("ccDrawLine","cc.DrawPrimitives.drawLine") + return cc.DrawPrimitives.drawLine(origin,destination) +end +_G.ccDrawLine = CCDrawPrimitivesDeprecated.ccDrawLine + +function CCDrawPrimitivesDeprecated.ccDrawRect(origin,destination) + deprecatedTip("ccDrawRect","cc.DrawPrimitives.drawRect") + return cc.DrawPrimitives.drawRect(origin,destination) +end +_G.ccDrawRect = CCDrawPrimitivesDeprecated.ccDrawRect + +function CCDrawPrimitivesDeprecated.ccDrawSolidRect(origin,destination,color) + deprecatedTip("ccDrawSolidRect","cc.DrawPrimitives.drawSolidRect") + return cc.DrawPrimitives.drawSolidRect(origin,destination,color) +end +_G.ccDrawSolidRect = CCDrawPrimitivesDeprecated.ccDrawSolidRect + +-- params:... may represent two param(xScale,yScale) or nil +function CCDrawPrimitivesDeprecated.ccDrawCircle(center,radius,angle,segments,drawLineToCenter,...) + deprecatedTip("ccDrawCircle","cc.DrawPrimitives.drawCircle") + return cc.DrawPrimitives.drawCircle(center,radius,angle,segments,drawLineToCenter,...) +end +_G.ccDrawCircle = CCDrawPrimitivesDeprecated.ccDrawCircle + +-- params:... may represent two param(xScale,yScale) or nil +function CCDrawPrimitivesDeprecated.ccDrawSolidCircle(center,radius,angle,segments,...) + deprecatedTip("ccDrawSolidCircle","cc.DrawPrimitives.drawSolidCircle") + return cc.DrawPrimitives.drawSolidCircle(center,radius,angle,segments,...) +end +_G.ccDrawSolidCircle = CCDrawPrimitivesDeprecated.ccDrawSolidCircle + +function CCDrawPrimitivesDeprecated.ccDrawQuadBezier(origin,control,destination,segments) + deprecatedTip("ccDrawQuadBezier","cc.DrawPrimitives.drawQuadBezier") + return cc.DrawPrimitives.drawQuadBezier(origin,control,destination,segments) +end +_G.ccDrawQuadBezier = CCDrawPrimitivesDeprecated.ccDrawQuadBezier + +function CCDrawPrimitivesDeprecated.ccDrawCubicBezier(origin,control1,control2,destination,segments) + deprecatedTip("ccDrawCubicBezier","cc.DrawPrimitives.drawCubicBezier") + return cc.DrawPrimitives.drawCubicBezier(origin,control1,control2,destination,segments) +end +_G.ccDrawCubicBezier = CCDrawPrimitivesDeprecated.ccDrawCubicBezier + +function CCDrawPrimitivesDeprecated.ccDrawCatmullRom(arrayOfControlPoints,segments) + deprecatedTip("ccDrawCatmullRom","cc.DrawPrimitives.drawCatmullRom") + return cc.DrawPrimitives.drawCatmullRom(arrayOfControlPoints,segments) +end +_G.ccDrawCatmullRom = CCDrawPrimitivesDeprecated.ccDrawCatmullRom + +function CCDrawPrimitivesDeprecated.ccDrawCardinalSpline(config,tension,segments) + deprecatedTip("ccDrawCardinalSpline","cc.DrawPrimitives.drawCardinalSpline") + return cc.DrawPrimitives.drawCardinalSpline(config,tension,segments) +end +_G.ccDrawCardinalSpline = CCDrawPrimitivesDeprecated.ccDrawCardinalSpline + +function CCDrawPrimitivesDeprecated.ccDrawColor4B(r,g,b,a) + deprecatedTip("ccDrawColor4B","cc.DrawPrimitives.drawColor4B") + return cc.DrawPrimitives.drawColor4B(r,g,b,a) +end +_G.ccDrawColor4B = CCDrawPrimitivesDeprecated.ccDrawColor4B + +function CCDrawPrimitivesDeprecated.ccDrawColor4F(r,g,b,a) + deprecatedTip("ccDrawColor4F","cc.DrawPrimitives.drawColor4F") + return cc.DrawPrimitives.drawColor4F(r,g,b,a) +end +_G.ccDrawColor4F = CCDrawPrimitivesDeprecated.ccDrawColor4F + +function CCDrawPrimitivesDeprecated.ccPointSize(pointSize) + deprecatedTip("ccPointSize","cc.DrawPrimitives.setPointSize") + return cc.DrawPrimitives.setPointSize(pointSize) +end +_G.ccPointSize = CCDrawPrimitivesDeprecated.ccPointSize +--functions of CCDrawPrimitives will be deprecated end +--CCDrawPrimitives will be deprecated end + +local CCProgressTimerDeprecated = {} +function CCProgressTimerDeprecated.setReverseProgress(self,...) + deprecatedTip("CCProgressTimer","CCProgressTimer:setReverseDirection") + return self:setReverseDirection(...) +end +CCProgressTimer.setReverseProgress = CCProgressTimerDeprecated.setReverseProgress + +--functions of CCSpriteFrameCache will be deprecated begin +local CCSpriteFrameCacheDeprecated = { } +function CCSpriteFrameCacheDeprecated.spriteFrameByName(self,szName) + deprecatedTip("CCSpriteFrameCache:spriteFrameByName","CCSpriteFrameCache:getSpriteFrameByName") + return self:getSpriteFrameByName(szName) +end +CCSpriteFrameCache.spriteFrameByName = CCSpriteFrameCacheDeprecated.spriteFrameByName + +function CCSpriteFrameCacheDeprecated.sharedSpriteFrameCache() + deprecatedTip("CCSpriteFrameCache:sharedSpriteFrameCache","CCSpriteFrameCache:getInstance") + return CCSpriteFrameCache:getInstance() +end +CCSpriteFrameCache.sharedSpriteFrameCache = CCSpriteFrameCacheDeprecated.sharedSpriteFrameCache + +function CCSpriteFrameCacheDeprecated.purgeSharedSpriteFrameCache() + deprecatedTip("CCSpriteFrameCache:purgeSharedSpriteFrameCache","CCSpriteFrameCache:destroyInstance") + return CCSpriteFrameCache:destroyInstance() +end +CCSpriteFrameCache.purgeSharedSpriteFrameCache = CCSpriteFrameCacheDeprecated.purgeSharedSpriteFrameCache + +function CCSpriteFrameCacheDeprecated.addSpriteFramesWithFile(self,...) + deprecatedTip("CCSpriteFrameCache:addSpriteFramesWithFile","CCSpriteFrameCache:addSpriteFrames") + return self:addSpriteFrames(...) +end +rawset(CCSpriteFrameCache,"addSpriteFramesWithFile",CCSpriteFrameCacheDeprecated.addSpriteFramesWithFile) + +function CCSpriteFrameCacheDeprecated.getSpriteFrameByName(self,...) + deprecatedTip("CCSpriteFrameCache:getSpriteFrameByName","CCSpriteFrameCache:getSpriteFrame") + return self:getSpriteFrame(...) +end +CCSpriteFrameCache.getSpriteFrameByName = CCSpriteFrameCacheDeprecated.getSpriteFrameByName +--functions of CCSpriteFrameCache will be deprecated end + +--functions of CCLabelAtlas will be deprecated begin +local CCLabelAtlasDeprecated = {} +function CCLabelAtlasDeprecated.create(self,...) + deprecatedTip("CCLabelAtlas:create","CCLabelAtlas:_create") + return self:_create(...) +end +CCLabelAtlas.create = CCLabelAtlasDeprecated.create +--functions of CCLabelAtlas will be deprecated end + + +--------------------------- +--global functions wil be deprecated, begin +local function CCRectMake(x,y,width,height) + deprecatedTip("CCRectMake(x,y,width,height)","cc.rect(x,y,width,height) in lua") + return cc.rect(x,y,width,height) +end +_G.CCRectMake = CCRectMake + +local function ccc3(r,g,b) + deprecatedTip("ccc3(r,g,b)","cc.c3b(r,g,b)") + return cc.c3b(r,g,b) +end +_G.ccc3 = ccc3 + +local function ccp(x,y) + deprecatedTip("ccp(x,y)","cc.p(x,y)") + return cc.p(x,y) +end +_G.ccp = ccp + +local function CCSizeMake(width,height) + deprecatedTip("CCSizeMake(width,height)","cc.size(width,height)") + return cc.size(width,height) +end +_G.CCSizeMake = CCSizeMake + +local function ccc4(r,g,b,a) + deprecatedTip("ccc4(r,g,b,a)","cc.c4b(r,g,b,a)") + return cc.c4b(r,g,b,a) +end +_G.ccc4 = ccc4 + +local function ccc4FFromccc3B(color3B) + deprecatedTip("ccc4FFromccc3B(color3B)","cc.c4f(color3B.r / 255.0,color3B.g / 255.0,color3B.b / 255.0,1.0)") + return cc.c4f(color3B.r/255.0, color3B.g/255.0, color3B.b/255.0, 1.0) +end +_G.ccc4FFromccc3B = ccc4FFromccc3B + +local function ccc4f(r,g,b,a) + deprecatedTip("ccc4f(r,g,b,a)","cc.c4f(r,g,b,a)") + return cc.c4f(r,g,b,a) +end +_G.ccc4f = ccc4f + +local function ccc4FFromccc4B(color4B) + deprecatedTip("ccc4FFromccc4B(color4B)","cc.c4f(color4B.r/255.0, color4B.g/255.0, color4B.b/255.0, color4B.a/255.0)") + return cc.c4f(color4B.r/255.0, color4B.g/255.0, color4B.b/255.0, color4B.a/255.0) +end +_G.ccc4FFromccc4B = ccc4FFromccc4B + +local function ccc4FEqual(a,b) + deprecatedTip("ccc4FEqual(a,b)","a:equals(b)") + return a:equals(b) +end +_G.ccc4FEqual = ccc4FEqual +--global functions wil be deprecated, end + + +--functions of _G will be deprecated begin +local function ccpLineIntersect(a,b,c,d,s,t) + deprecatedTip("ccpLineIntersect","cc.pIsLineIntersect") + return cc.pIsLineIntersect(a,b,c,d,s,t) +end +_G.ccpLineIntersect = ccpLineIntersect + + +local function CCPointMake(x,y) + deprecatedTip("CCPointMake(x,y)","cc.p(x,y)") + return cc.p(x,y) +end +_G.CCPointMake = CCPointMake + + + +local function ccpNeg(pt) + deprecatedTip("ccpNeg","cc.pSub") + return cc.pSub({x = 0,y = 0}, pt) +end +_G.ccpNeg = ccpNeg + +local function ccpAdd(pt1,pt2) + deprecatedTip("ccpAdd","cc.pAdd") + return cc.pAdd(pt1,pt2) +end +_G.ccpAdd = ccpAdd + +local function ccpSub(pt1,pt2) + deprecatedTip("ccpSub","cc.pSub") + return cc.pSub(pt1,pt2) +end +_G.ccpSub = ccpSub + +local function ccpMult(pt,factor) + deprecatedTip("ccpMult","cc.pMul") + return cc.pMul(pt,factor) +end +_G.ccpMult = ccpMult + +local function ccpMidpoint(pt1,pt2) + deprecatedTip("ccpMidpoint","cc.pMidpoint") + return cc.pMidpoint(pt1,pt2) +end +_G.ccpMidpoint = ccpMidpoint + +local function ccpDot(pt1,pt2) + deprecatedTip("ccpDot","cc.pDot") + return cc.pDot(pt1,pt2) +end +_G.ccpDot = ccpDot + +local function ccpCross(pt1,pt2) + deprecatedTip("ccpCross","cc.pCross") + return cc.pCross(pt1, pt2) +end +_G.ccpCross = ccpCross + +local function ccpPerp(pt) + deprecatedTip("ccpPerp","cc.pPerp") + return cc.pPerp(pt) +end +_G.ccpPerp = ccpPerp + +local function ccpRPerp(pt) + deprecatedTip("ccpRPerp","cc.RPerp") + return cc.RPerp(pt) +end +_G.ccpRPerp = ccpRPerp + +local function ccpProject(pt1,pt2) + deprecatedTip("ccpProject","cc.pProject") + return cc.pProject(pt1,pt2) +end +_G.ccpProject = ccpProject + +local function ccpRotate(pt1,pt2) + deprecatedTip("ccpRotate","cc.pRotate") + return cc.pRotate(pt1,pt2) +end +_G.ccpRotate = ccpRotate + +local function ccpUnrotate(pt1,pt2) + deprecatedTip("ccpUnrotate","cc.pUnrotate") + return cc.pUnrotate(pt1,pt2) +end +_G.ccpUnrotate = ccpUnrotate + +local function ccpLengthSQ(pt) + deprecatedTip("ccpLengthSQ","cc.pLengthSQ") + return cc.pLengthSQ(pt) +end +_G.ccpLengthSQ = ccpLengthSQ + +local function ccpDistanceSQ(pt1,pt2) + deprecatedTip("ccpDistanceSQ","cc.pDistanceSQ") + return cc.pDistanceSQ(pt1,pt2) +end +_G.ccpDistanceSQ = ccpDistanceSQ + +local function ccpLength(pt) + deprecatedTip("ccpLength","cc.pGetLength") + return cc.pGetLength(pt) +end +_G.ccpLength = ccpLength + +local function ccpDistance(pt1,pt2) + deprecatedTip("ccpDistance","cc.pGetDistance") + return cc.pGetDistance(pt1, pt2) +end +_G.ccpDistance = ccpDistance + +local function ccpNormalize(pt) + deprecatedTip("ccpNormalize","cc.pNormalize") + return cc.pNormalize(pt) +end +_G.ccpNormalize = ccpNormalize + +local function ccpForAngle(angle) + deprecatedTip("ccpForAngle","cc.pForAngle") + return cc.pForAngle(angle) +end +_G.ccpForAngle = ccpForAngle + +local function ccpToAngle(pt) + deprecatedTip("ccpToAngle","cc.pToAngleSelf") + return cc.pToAngleSelf(pt) +end +_G.ccpToAngle = ccpToAngle + +local function ccpClamp(pt1,pt2,pt3) + deprecatedTip("ccpClamp","cc.pGetClampPoint") + return cc.pGetClampPoint(pt1,pt2,pt3) +end +_G.ccpClamp = ccpClamp + + +local function ccpFromSize(sz) + deprecatedTip("ccpFromSize(sz)","cc.pFromSize") + return cc.pFromSize(sz) +end +_G.ccpFromSize = ccpFromSize + +local function ccpLerp(pt1,pt2,alpha) + deprecatedTip("ccpLerp","cc.pLerp") + return cc.pLerp(pt1,pt2,alpha) +end +_G.ccpLerp = ccpLerp + +local function ccpFuzzyEqual(pt1,pt2,variance) + deprecatedTip("ccpFuzzyEqual","cc.pFuzzyEqual") + return cc.pFuzzyEqual(pt1,pt2,variance) +end +_G.ccpFuzzyEqual = ccpFuzzyEqual + +local function ccpCompMult(pt1,pt2) + deprecatedTip("ccpCompMult","cc.p") + return cc.p(pt1.x * pt2.x , pt1.y * pt2.y) +end +_G.ccpCompMult = ccpCompMult + +local function ccpAngleSigned(pt1,pt2) + deprecatedTip("ccpAngleSigned","cc.pGetAngle") + return cc.pGetAngle(pt1, pt2) +end +_G.ccpAngleSigned = ccpAngleSigned + +local function ccpAngle(pt1,pt2) + deprecatedTip("ccpAngle","cc.pGetAngle") + return cc.pGetAngle(pt1,ptw) +end +_G.ccpAngle = ccpAngle + +local function ccpRotateByAngle(pt1,pt2,angle) + deprecatedTip("ccpRotateByAngle","cc.pRotateByAngle") + return cc.pRotateByAngle(pt1, pt2, angle) +end +_G.ccpRotateByAngle = ccpRotateByAngle + +local function ccpSegmentIntersect(pt1,pt2,pt3,pt4) + deprecatedTip("ccpSegmentIntersect","cc.pIsSegmentIntersect") + return cc.pIsSegmentIntersect(pt1,pt2,pt3,pt4) +end +_G.ccpSegmentIntersect = ccpSegmentIntersect + +local function ccpIntersectPoint(pt1,pt2,pt3,pt4) + deprecatedTip("ccpIntersectPoint","cc.pGetIntersectPoint") + return cc.pGetIntersectPoint(pt1,pt2,pt3,pt4) +end +_G.ccpIntersectPoint = ccpIntersectPoint + + +local function vertex2(x,y) + deprecatedTip("vertex2(x,y)","cc.vertex2F(x,y)") + return cc.vertex2F(x,y) +end +_G.vertex2 = vertex2 + +local function vertex3(x,y,z) + deprecatedTip("vertex3(x,y,z)","cc.Vertex3F(x,y,z)") + return cc.Vertex3F(x,y,z) +end +_G.vertex3 = vertex3 + +local function tex2(u,v) + deprecatedTip("tex2(u,v)","cc.tex2f(u,v)") + return cc.tex2f(u,v) +end +_G.tex2 = tex2 + +local function ccc4BFromccc4F(color4F) + deprecatedTip("ccc4BFromccc4F(color4F)","Color4B(color4F.r * 255.0, color4F.g * 255.0, color4F.b * 255.0, color4B.a * 255.0)") + return Color4B(color4F.r * 255.0, color4F.g * 255.0, color4F.b * 255.0, color4B.a * 255.0) +end +_G.ccc4BFromccc4F = ccc4BFromccc4F + +local function ccColor3BDeprecated() + deprecatedTip("ccColor3B","cc.c3b(0,0,0)") + return cc.c3b(0,0,0) +end +_G.ccColor3B = ccColor3BDeprecated + +local function ccColor4BDeprecated() + deprecatedTip("ccColor4B","cc.c4b(0,0,0,0)") + return cc.c4b(0,0,0,0) +end +_G.ccColor4B = ccColor4BDeprecated + +local function ccColor4FDeprecated() + deprecatedTip("ccColor4F","cc.c4f(0.0,0.0,0.0,0.0)") + return cc.c4f(0.0,0.0,0.0,0.0) +end +_G.ccColor4F = ccColor4FDeprecated + +local function ccVertex2FDeprecated() + deprecatedTip("ccVertex2F","cc.vertex2F(0.0,0.0)") + return cc.vertex2F(0.0,0.0) +end +_G.ccVertex2F = ccVertex2FDeprecated + +local function ccVertex3FDeprecated() + deprecatedTip("ccVertex3F","cc.Vertex3F(0.0, 0.0, 0.0)") + return cc.Vertex3F(0.0, 0.0, 0.0) +end +_G.ccVertex3F = ccVertex3FDeprecated + +local function ccTex2FDeprecated() + deprecatedTip("ccTex2F","cc.tex2F(0.0, 0.0)") + return cc.tex2F(0.0, 0.0) +end +_G.ccTex2F = ccTex2FDeprecated + +local function ccPointSpriteDeprecated() + deprecatedTip("ccPointSprite","cc.PointSprite(cc.vertex2F(0.0, 0.0),cc.c4b(0.0, 0.0, 0.0),0)") + return cc.PointSprite(cc.vertex2F(0.0, 0.0),cc.c4b(0.0, 0.0, 0.0),0) +end +_G.ccPointSprite = ccPointSpriteDeprecated + +local function ccQuad2Deprecated() + deprecatedTip("ccQuad2","cc.Quad2(cc.vertex2F(0.0, 0.0), cc.vertex2F(0.0, 0.0), cc.vertex2F(0.0, 0.0), cc.vertex2F(0.0, 0.0))") + return cc.Quad2(cc.vertex2F(0.0, 0.0), cc.vertex2F(0.0, 0.0), cc.vertex2F(0.0, 0.0), cc.vertex2F(0.0, 0.0)) +end +_G.ccQuad2 = ccQuad2Deprecated + +local function ccQuad3Deprecated() + deprecatedTip("ccQuad3","cc.Quad3(cc.Vertex3F(0.0, 0.0 ,0.0), cc.Vertex3F(0.0, 0.0 ,0.0), cc.Vertex3F(0.0, 0.0 ,0.0), cc.Vertex3F(0.0, 0.0 ,0.0))") + return cc.Quad3(cc.Vertex3F(0.0, 0.0 ,0.0), cc.Vertex3F(0.0, 0.0 ,0.0), cc.Vertex3F(0.0, 0.0 ,0.0), cc.Vertex3F(0.0, 0.0 ,0.0)) +end +_G.ccQuad3 = ccQuad3Deprecated + +local function ccV2FC4BT2FDeprecated() + deprecatedTip("ccV2F_C4B_T2F","cc.V2F_C4B_T2F(cc.vertex2F(0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0))") + return cc.V2F_C4B_T2F(cc.vertex2F(0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0)) +end +_G.ccV2F_C4B_T2F = ccV2FC4BT2FDeprecated + + +local function ccV2FC4FT2FDeprecated() + deprecatedTip("ccV2F_C4F_T2F","cc.V2F_C4F_T2F(cc.vertex2F(0.0, 0.0), cc.c4f(0.0 , 0.0 , 0.0 , 0.0 ), cc.tex2F(0.0, 0.0))") + return cc.V2F_C4F_T2F(cc.vertex2F(0.0, 0.0), cc.c4f(0.0 , 0.0 , 0.0 , 0.0), cc.tex2F(0.0, 0.0)) +end +_G.ccV2F_C4F_T2F = ccV2FC4FT2FDeprecated + +local function ccV3FC4BT2FDeprecated() + deprecatedTip("ccV3F_C4B_T2F","cc.V3F_C4B_T2F(cc.vertex3F(0.0, 0.0, 0.0), cc.c4b(0 , 0 , 0, 0 ), cc.tex2F(0.0, 0.0))") + return cc.V3F_C4B_T2F(cc.vertex3F(0.0, 0.0, 0.0), cc.c4b(0 , 0 , 0, 0 ), cc.tex2F(0.0, 0.0)) +end +_G.ccV3F_C4B_T2F = ccV3FC4BT2FDeprecated + +local function ccV2FC4BT2FQuadDeprecated() + deprecatedTip("ccV2F_C4B_T2F_Quad","cc.V2F_C4B_T2F_Quad(cc.V2F_C4B_T2F(cc.vertex2F(0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0)), cc.V2F_C4B_T2F(cc.vertex2F(0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0)), cc.V2F_C4B_T2F(cc.vertex2F(0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0)), cc.V2F_C4B_T2F(cc.vertex2F(0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0)))") + return cc.V2F_C4B_T2F_Quad(cc.V2F_C4B_T2F(cc.vertex2F(0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0)), cc.V2F_C4B_T2F(cc.vertex2F(0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0)), cc.V2F_C4B_T2F(cc.vertex2F(0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0)), cc.V2F_C4B_T2F(cc.vertex2F(0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0))) +end +_G.ccV2F_C4B_T2F_Quad = ccV2FC4BT2FQuadDeprecated + +local function ccV3FC4BT2FQuadDeprecated() + deprecatedTip("ccV3F_C4B_T2F_Quad","cc.V3F_C4B_T2F_Quad(_tl, _bl, _tr, _br)") + return cc.V3F_C4B_T2F_Quad(cc.V3F_C4B_T2F(cc.vertex3F(0.0, 0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0)), cc.V3F_C4B_T2F(cc.vertex3F(0.0, 0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0)), cc.V3F_C4B_T2F(cc.vertex3F(0.0, 0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0)), cc.V3F_C4B_T2F(cc.vertex3F(0.0, 0.0, 0.0), cc.c4b(0 , 0, 0, 0 ), cc.tex2F(0.0, 0.0))) +end +_G.ccV3F_C4B_T2F_Quad = ccV3FC4BT2FQuadDeprecated + +local function ccV2FC4FT2FQuadDeprecated() + deprecatedTip("ccV2F_C4F_T2F_Quad","cc.V2F_C4F_T2F_Quad(_bl, _br, _tl, _tr)") + return cc.V2F_C4F_T2F_Quad(cc.V2F_C4F_T2F(cc.vertex2F(0.0, 0.0), cc.c4f(0.0 , 0.0, 0.0, 0.0 ), cc.tex2F(0.0, 0.0)), cc.V2F_C4F_T2F(cc.vertex2F(0.0, 0.0), cc.c4f(0.0 , 0.0, 0.0, 0.0 ), cc.tex2F(0.0, 0.0)), cc.V3F_C4B_T2F(cc.vertex2F(0.0, 0.0), cc.c4f(0.0 , 0.0, 0.0, 0.0 ), cc.tex2F(0.0, 0.0)), cc.V2F_C4F_T2F(cc.vertex2F(0.0, 0.0), cc.c4f(0.0 , 0.0, 0.0, 0.0 ), cc.tex2F(0.0, 0.0))) +end +_G.ccV2F_C4F_T2F_Quad = ccV2FC4FT2FQuadDeprecated + +local function ccT2FQuadDeprecated() + deprecatedTip("ccT2F_Quad","cc.T2F_Quad(_bl, _br, _tl, _tr)") + return cc.T2F_Quad(cc.tex2F(0.0,0.0), cc.tex2F(0.0,0.0), cc.tex2F(0.0,0.0), cc.tex2F(0.0,0.0)) +end +_G.ccT2F_Quad = ccT2FQuadDeprecated + +local function ccAnimationFrameDataDeprecated() + deprecatedTip("ccAnimationFrameData","cc.AnimationFrameData( _texCoords, _delay, _size)") + return cc.AnimationFrameData(cc.T2F_Quad(cc.tex2F(0.0,0.0), cc.tex2F(0.0,0.0), cc.tex2F(0.0,0.0), cc.tex2F(0.0,0.0)), 0, cc.size(0,0)) +end +_G.ccAnimationFrameData = ccAnimationFrameDataDeprecated + + + +local function tex2(u,v) + deprecatedTip("tex2(u,v)","cc.tex2f(u,v)") + return cc.tex2f(u,v) +end +_G.tex2 = tex2 + + +--functions of CCApplication will be deprecated end +local CCApplicationDeprecated = { } +function CCApplicationDeprecated.sharedApplication() + deprecatedTip("CCApplication:sharedApplication","CCApplication:getInstance") + return CCApplication:getInstance() +end +CCApplication.sharedApplication = CCApplicationDeprecated.sharedApplication +--functions of CCApplication will be deprecated end + + +--functions of CCDirector will be deprecated end +local CCDirectorDeprecated = { } +function CCDirectorDeprecated.sharedDirector() + deprecatedTip("CCDirector:sharedDirector","CCDirector:getInstance") + return CCDirector:getInstance() +end +CCDirector.sharedDirector = CCDirectorDeprecated.sharedDirector +--functions of CCDirector will be deprecated end + + +--functions of CCUserDefault will be deprecated end +local CCUserDefaultDeprecated = { } +function CCUserDefaultDeprecated.sharedUserDefault() + deprecatedTip("CCUserDefault:sharedUserDefault","CCUserDefault:getInstance") + return CCUserDefault:getInstance() +end +CCUserDefault.sharedUserDefault = CCUserDefaultDeprecated.sharedUserDefault + +function CCUserDefaultDeprecated.purgeSharedUserDefault() + deprecatedTip("CCUserDefault:purgeSharedUserDefault","CCUserDefault:destroyInstance") + return CCUserDefault:destroyInstance() +end +CCUserDefault.purgeSharedUserDefault = CCUserDefaultDeprecated.purgeSharedUserDefault +--functions of CCUserDefault will be deprecated end + +--functions of CCGrid3DAction will be deprecated begin +local CCGrid3DActionDeprecated = { } +function CCGrid3DActionDeprecated.vertex(self,pt) + deprecatedTip("vertex","CCGrid3DAction:getVertex") + return self:getVertex(pt) +end +CCGrid3DAction.vertex = CCGrid3DActionDeprecated.vertex + +function CCGrid3DActionDeprecated.originalVertex(self,pt) + deprecatedTip("originalVertex","CCGrid3DAction:getOriginalVertex") + return self:getOriginalVertex(pt) +end +CCGrid3DAction.originalVertex = CCGrid3DActionDeprecated.originalVertex +--functions of CCGrid3DAction will be deprecated end + + +--functions of CCTiledGrid3DAction will be deprecated begin +local CCTiledGrid3DActionDeprecated = { } +function CCTiledGrid3DActionDeprecated.tile(self,pt) + deprecatedTip("tile","CCTiledGrid3DAction:getTile") + return self:getTile(pt) +end +CCTiledGrid3DAction.tile = CCTiledGrid3DActionDeprecated.tile + +function CCTiledGrid3DActionDeprecated.originalTile(self,pt) + deprecatedTip("originalTile","CCTiledGrid3DAction:getOriginalTile") + return self:getOriginalTile(pt) +end +CCTiledGrid3DAction.originalTile = CCTiledGrid3DActionDeprecated.originalTile +--functions of CCTiledGrid3DAction will be deprecated end + + +--functions of CCTexture2D will be deprecated begin +local CCTexture2DDeprecated = { } +function CCTexture2DDeprecated.stringForFormat(self) + deprecatedTip("Texture2D:stringForFormat","Texture2D:getStringForFormat") + return self:getStringForFormat() +end +CCTexture2D.stringForFormat = CCTexture2DDeprecated.stringForFormat + +function CCTexture2DDeprecated.bitsPerPixelForFormat(self) + deprecatedTip("Texture2D:bitsPerPixelForFormat","Texture2D:getBitsPerPixelForFormat") + return self:getBitsPerPixelForFormat() +end +CCTexture2D.bitsPerPixelForFormat = CCTexture2DDeprecated.bitsPerPixelForFormat + +function CCTexture2DDeprecated.bitsPerPixelForFormat(self,pixelFormat) + deprecatedTip("Texture2D:bitsPerPixelForFormat","Texture2D:getBitsPerPixelForFormat") + return self:getBitsPerPixelForFormat(pixelFormat) +end +CCTexture2D.bitsPerPixelForFormat = CCTexture2DDeprecated.bitsPerPixelForFormat + +function CCTexture2DDeprecated.defaultAlphaPixelFormat(self) + deprecatedTip("Texture2D:defaultAlphaPixelFormat","Texture2D:getDefaultAlphaPixelFormat") + return self:getDefaultAlphaPixelFormat() +end +CCTexture2D.defaultAlphaPixelFormat = CCTexture2DDeprecated.defaultAlphaPixelFormat +--functions of CCTexture2D will be deprecated end + + +--functions of CCTimer will be deprecated begin +local CCTimerDeprecated = { } +function CCTimerDeprecated.timerWithScriptHandler(handler,seconds) + deprecatedTip("CCTimer:timerWithScriptHandler","CCTimer:createWithScriptHandler") + return CCTimer:createWithScriptHandler(handler,seconds) +end +CCTimer.timerWithScriptHandler = CCTimerDeprecated.timerWithScriptHandler + +function CCTimerDeprecated.numberOfRunningActionsInTarget(self,target) + deprecatedTip("CCActionManager:numberOfRunningActionsInTarget","CCActionManager:getNumberOfRunningActionsInTarget") + return self:getNumberOfRunningActionsInTarget(target) +end +CCTimer.numberOfRunningActionsInTarget = CCTimerDeprecated.numberOfRunningActionsInTarget +--functions of CCTimer will be deprecated end + + +--functions of CCMenuItemFont will be deprecated begin +local CCMenuItemFontDeprecated = { } +function CCMenuItemFontDeprecated.fontSize() + deprecatedTip("CCMenuItemFont:fontSize","CCMenuItemFont:getFontSize") + return CCMenuItemFont:getFontSize() +end +CCMenuItemFont.fontSize = CCMenuItemFontDeprecated.fontSize + +function CCMenuItemFontDeprecated.fontName() + deprecatedTip("CCMenuItemFont:fontName","CCMenuItemFont:getFontName") + return CCMenuItemFont:getFontName() +end +CCMenuItemFont.fontName = CCMenuItemFontDeprecated.fontName + +function CCMenuItemFontDeprecated.fontSizeObj(self) + deprecatedTip("CCMenuItemFont:fontSizeObj","CCMenuItemFont:getFontSizeObj") + return self:getFontSizeObj() +end +CCMenuItemFont.fontSizeObj = CCMenuItemFontDeprecated.fontSizeObj + +function CCMenuItemFontDeprecated.fontNameObj(self) + deprecatedTip("CCMenuItemFont:fontNameObj","CCMenuItemFont:getFontNameObj") + return self:getFontNameObj() +end +CCMenuItemFont.fontNameObj = CCMenuItemFontDeprecated.fontNameObj +--functions of CCMenuItemFont will be deprecated end + + +--functions of CCMenuItemToggle will be deprecated begin +local CCMenuItemToggleDeprecated = { } +function CCMenuItemToggleDeprecated.selectedItem(self) + deprecatedTip("CCMenuItemToggle:selectedItem","CCMenuItemToggle:getSelectedItem") + return self:getSelectedItem() +end +CCMenuItemToggle.selectedItem = CCMenuItemToggleDeprecated.selectedItem +--functions of CCMenuItemToggle will be deprecated end + + +--functions of CCTileMapAtlas will be deprecated begin +local CCTileMapAtlasDeprecated = { } +function CCTileMapAtlasDeprecated.tileAt(self,pos) + deprecatedTip("CCTileMapAtlas:tileAt","CCTileMapAtlas:getTileAt") + return self:getTileAt(pos) +end +CCTileMapAtlas.tileAt = CCTileMapAtlasDeprecated.tileAt +--functions of CCTileMapAtlas will be deprecated end + + +--functions of CCTMXLayer will be deprecated begin +local CCTMXLayerDeprecated = { } +function CCTMXLayerDeprecated.tileAt(self,tileCoordinate) + deprecatedTip("CCTMXLayer:tileAt","CCTMXLayer:getTileAt") + return self:getTileAt(tileCoordinate) +end +CCTMXLayer.tileAt = CCTMXLayerDeprecated.tileAt + +function CCTMXLayerDeprecated.tileGIDAt(self,tileCoordinate) + deprecatedTip("CCTMXLayer:tileGIDAt","CCTMXLayer:getTileGIDAt") + return self:getTileGIDAt(tileCoordinate) +end +CCTMXLayer.tileGIDAt = CCTMXLayerDeprecated.tileGIDAt + +function CCTMXLayerDeprecated.positionAt(self,tileCoordinate) + deprecatedTip("CCTMXLayer:positionAt","CCTMXLayer:getPositionAt") + return self:getPositionAt(tileCoordinate) +end +CCTMXLayer.positionAt = CCTMXLayerDeprecated.positionAt + +function CCTMXLayerDeprecated.propertyNamed(self,propertyName) + deprecatedTip("CCTMXLayer:propertyNamed","CCTMXLayer:getProperty") + return self:getProperty(propertyName) +end +CCTMXLayer.propertyNamed = CCTMXLayerDeprecated.propertyNamed +--functions of CCTMXLayer will be deprecated end + +--functions of CCTMXTiledMap will be deprecated begin +local CCTMXTiledMapDeprecated = { } +function CCTMXTiledMapDeprecated.layerNamed(self,layerName) + deprecatedTip("CCTMXTiledMap:layerNamed","CCTMXTiledMap:getLayer") + return self:getLayer(layerName) +end +CCTMXTiledMap.layerNamed = CCTMXTiledMapDeprecated.layerNamed + +function CCTMXTiledMapDeprecated.propertyNamed(self,propertyName) + deprecatedTip("CCTMXTiledMap:propertyNamed","CCTMXTiledMap:getProperty") + return self:getProperty(propertyName) +end +CCTMXTiledMap.propertyNamed = CCTMXTiledMapDeprecated.propertyNamed + +function CCTMXTiledMapDeprecated.propertiesForGID(self,GID) + deprecatedTip("CCTMXTiledMap:propertiesForGID","CCTMXTiledMap:getPropertiesForGID") + return self:getPropertiesForGID(GID) +end +CCTMXTiledMap.propertiesForGID = CCTMXTiledMapDeprecated.propertiesForGID + +function CCTMXTiledMapDeprecated.objectGroupNamed(self,groupName) + deprecatedTip("CCTMXTiledMap:objectGroupNamed","CCTMXTiledMap:getObjectGroup") + return self:getObjectGroup(groupName) +end +CCTMXTiledMap.objectGroupNamed = CCTMXTiledMapDeprecated.objectGroupNamed +--functions of CCTMXTiledMap will be deprecated end + + +--functions of CCTMXMapInfo will be deprecated begin +local CCTMXMapInfoDeprecated = { } +function CCTMXMapInfoDeprecated.getStoringCharacters(self) + deprecatedTip("CCTMXMapInfo:getStoringCharacters","CCTMXMapInfo:isStoringCharacters") + return self:isStoringCharacters() +end +CCTMXMapInfo.getStoringCharacters = CCTMXMapInfoDeprecated.getStoringCharacters + +function CCTMXMapInfoDeprecated.formatWithTMXFile(infoTable,tmxFile) + deprecatedTip("CCTMXMapInfo:formatWithTMXFile","CCTMXMapInfo:create") + return CCTMXMapInfo:create(tmxFile) +end +CCTMXMapInfo.formatWithTMXFile = CCTMXMapInfoDeprecated.formatWithTMXFile + +function CCTMXMapInfoDeprecated.formatWithXML(infoTable,tmxString,resourcePath) + deprecatedTip("CCTMXMapInfo:formatWithXML","TMXMapInfo:createWithXML") + return CCTMXMapInfo:createWithXML(tmxString,resourcePath) +end +CCTMXMapInfo.formatWithXML = CCTMXMapInfoDeprecated.formatWithXML +--functions of CCTMXMapInfo will be deprecated end + + +--functions of CCTMXObject will be deprecated begin +local CCTMXObjectGroupDeprecated = { } +function CCTMXObjectGroupDeprecated.propertyNamed(self,propertyName) + deprecatedTip("CCTMXObjectGroup:propertyNamed","CCTMXObjectGroup:getProperty") + return self:getProperty(propertyName) +end +CCTMXObjectGroup.propertyNamed = CCTMXObjectGroupDeprecated.propertyNamed + +function CCTMXObjectGroupDeprecated.objectNamed(self, objectName) + deprecatedTip("CCTMXObjectGroup:objectNamed","CCTMXObjectGroup:getObject") + return self:getObject(objectName) +end +CCTMXObjectGroup.objectNamed = CCTMXObjectGroupDeprecated.objectNamed +--functions of CCTMXObject will be deprecated end + +--functions of CCRenderTexture will be deprecated begin +local CCRenderTextureDeprecated = { } +function CCRenderTextureDeprecated.newCCImage(self) + deprecatedTip("CCRenderTexture:newCCImage","CCRenderTexture:newImage") + return self:newImage() +end +CCRenderTexture.newCCImage = CCRenderTextureDeprecated.newCCImage +--functions of CCRenderTexture will be deprecated end + +--functions of Sprite will be deprecated begin +local CCSpriteDeprecated = { } +function CCSpriteDeprecated.setFlipX(self,flag) + deprecatedTip("CCSpriteDeprecated:setFlipX","CCSpriteDeprecated:setFlippedX") + return self:setFlippedX(flag) +end +cc.Sprite.setFlipX = CCSpriteDeprecated.setFlipX + +function CCSpriteDeprecated.setFlipY(self,flag) + deprecatedTip("CCSpriteDeprecated:setFlipY","CCSpriteDeprecated:setFlippedY") + return self:setFlippedY(flag) +end +cc.Sprite.setFlipY = CCSpriteDeprecated.setFlipY +--functions of Sprite will be deprecated end + + +--functions of Layer will be deprecated begin +local CCLayerDeprecated = {} +function CCLayerDeprecated.setKeypadEnabled( self, enabled) + return self:setKeyboardEnabled(enabled) +end +cc.Layer.setKeypadEnabled = CCLayerDeprecated.setKeypadEnabled + +function CCLayerDeprecated.isKeypadEnabled(self) + return self:isKeyboardEnabled() +end +cc.Layer.isKeypadEnabled = CCLayerDeprecated.isKeypadEnabled +--functions of Layer will be deprecated end + +--functions of cc.Node will be deprecated begin +local NodeDeprecated = { } +function NodeDeprecated.setZOrder(self,zOrder) + deprecatedTip("cc.Node:setZOrder","cc.Node:setLocalZOrder") + return self:setLocalZOrder(zOrder) +end +cc.Node.setZOrder = NodeDeprecated.setZOrder + +function NodeDeprecated.getZOrder(self) + deprecatedTip("cc.Node:getZOrder","cc.Node:getLocalZOrder") + return self:getLocalZOrder() +end +cc.Node.getZOrder = NodeDeprecated.getZOrder + +function NodeDeprecated.setVertexZ(self,vertexZ) + deprecatedTip("cc.Node:setVertexZ", "cc.Node:setPositionZ") + return self:setPositionZ(vertexZ) +end +cc.Node.setVertexZ = NodeDeprecated.setVertexZ + +function NodeDeprecated.getVertexZ(self) + deprecatedTip("cc.Node:getVertexZ", "cc.Node:getPositionZ") + return self:getPositionZ() +end +cc.Node.getVertexZ = NodeDeprecated.getVertexZ +--functions of cc.Node will be deprecated end + +--functions of cc.GLProgram will be deprecated begin +local GLProgram = { } +function GLProgram.initWithVertexShaderByteArray(self,vShaderByteArray, fShaderByteArray) + deprecatedTip("cc.GLProgram:initWithVertexShaderByteArray","cc.GLProgram:initWithByteArrays") + return self:initWithByteArrays(vShaderByteArray, fShaderByteArray) +end +cc.GLProgram.initWithVertexShaderByteArray = GLProgram.initWithVertexShaderByteArray + +function GLProgram.initWithVertexShaderFilename(self,vShaderByteArray, fShaderByteArray) + deprecatedTip("cc.GLProgram:initWithVertexShaderFilename","cc.GLProgram:initWithFilenames") + return self:initWithFilenames(vShaderByteArray, fShaderByteArray) +end +cc.GLProgram.initWithVertexShaderFilename = GLProgram.initWithVertexShaderFilename + +function GLProgram.addAttribute(self, attributeName, index) + deprecatedTip("cc.GLProgram:addAttribute","cc.GLProgram:bindAttribLocation") + return self:bindAttribLocation(attributeName, index) +end +cc.GLProgram.addAttribute = GLProgram.addAttribute +--functions of cc.GLProgram will be deprecated end diff --git a/src/cocos/cocos2d/DeprecatedOpenglEnum.lua b/src/cocos/cocos2d/DeprecatedOpenglEnum.lua new file mode 100644 index 0000000..1235e8d --- /dev/null +++ b/src/cocos/cocos2d/DeprecatedOpenglEnum.lua @@ -0,0 +1,288 @@ +-- This is the DeprecatedEnum + +DeprecatedClass = {} or DeprecatedClass + +_G.GL_RENDERBUFFER_INTERNAL_FORMAT = gl.RENDERBUFFER_INTERNAL_FORMAT +_G.GL_LINE_WIDTH = gl.LINE_WIDTH +_G.GL_CONSTANT_ALPHA = gl.CONSTANT_ALPHA +_G.GL_BLEND_SRC_ALPHA = gl.BLEND_SRC_ALPHA +_G.GL_GREEN_BITS = gl.GREEN_BITS +_G.GL_STENCIL_REF = gl.STENCIL_REF +_G.GL_ONE_MINUS_SRC_ALPHA = gl.ONE_MINUS_SRC_ALPHA +_G.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE +_G.GL_CCW = gl.CCW +_G.GL_MAX_TEXTURE_IMAGE_UNITS = gl.MAX_TEXTURE_IMAGE_UNITS +_G.GL_BACK = gl.BACK +_G.GL_ACTIVE_ATTRIBUTES = gl.ACTIVE_ATTRIBUTES +_G.GL_TEXTURE_CUBE_MAP_POSITIVE_X = gl.TEXTURE_CUBE_MAP_POSITIVE_X +_G.GL_STENCIL_BACK_VALUE_MASK = gl.STENCIL_BACK_VALUE_MASK +_G.GL_TEXTURE_CUBE_MAP_POSITIVE_Z = gl.TEXTURE_CUBE_MAP_POSITIVE_Z +_G.GL_ONE = gl.ONE +_G.GL_TRUE = gl.TRUE +_G.GL_TEXTURE12 = gl.TEXTURE12 +_G.GL_LINK_STATUS = gl.LINK_STATUS +_G.GL_BLEND = gl.BLEND +_G.GL_LESS = gl.LESS +_G.GL_TEXTURE16 = gl.TEXTURE16 +_G.GL_BOOL_VEC2 = gl.BOOL_VEC2 +_G.GL_KEEP = gl.KEEP +_G.GL_DST_COLOR = gl.DST_COLOR +_G.GL_VERTEX_ATTRIB_ARRAY_ENABLED = gl.VERTEX_ATTRIB_ARRAY_ENABLED +_G.GL_EXTENSIONS = gl.EXTENSIONS +_G.GL_FRONT = gl.FRONT +_G.GL_DST_ALPHA = gl.DST_ALPHA +_G.GL_ATTACHED_SHADERS = gl.ATTACHED_SHADERS +_G.GL_STENCIL_BACK_FUNC = gl.STENCIL_BACK_FUNC +_G.GL_ONE_MINUS_DST_COLOR = gl.ONE_MINUS_DST_COLOR +_G.GL_BLEND_EQUATION = gl.BLEND_EQUATION +_G.GL_RENDERBUFFER_DEPTH_SIZE = gl.RENDERBUFFER_DEPTH_SIZE +_G.GL_PACK_ALIGNMENT = gl.PACK_ALIGNMENT +_G.GL_VENDOR = gl.VENDOR +_G.GL_NEAREST_MIPMAP_LINEAR = gl.NEAREST_MIPMAP_LINEAR +_G.GL_TEXTURE_CUBE_MAP_POSITIVE_Y = gl.TEXTURE_CUBE_MAP_POSITIVE_Y +_G.GL_NEAREST = gl.NEAREST +_G.GL_RENDERBUFFER_WIDTH = gl.RENDERBUFFER_WIDTH +_G.GL_ARRAY_BUFFER_BINDING = gl.ARRAY_BUFFER_BINDING +_G.GL_ARRAY_BUFFER = gl.ARRAY_BUFFER +_G.GL_LEQUAL = gl.LEQUAL +_G.GL_VERSION = gl.VERSION +_G.GL_COLOR_CLEAR_VALUE = gl.COLOR_CLEAR_VALUE +_G.GL_RENDERER = gl.RENDERER +_G.GL_STENCIL_BACK_PASS_DEPTH_PASS = gl.STENCIL_BACK_PASS_DEPTH_PASS +_G.GL_STENCIL_BACK_PASS_DEPTH_FAIL = gl.STENCIL_BACK_PASS_DEPTH_FAIL +_G.GL_STENCIL_BACK_WRITEMASK = gl.STENCIL_BACK_WRITEMASK +_G.GL_BOOL = gl.BOOL +_G.GL_VIEWPORT = gl.VIEWPORT +_G.GL_FRAGMENT_SHADER = gl.FRAGMENT_SHADER +_G.GL_LUMINANCE = gl.LUMINANCE +_G.GL_DECR_WRAP = gl.DECR_WRAP +_G.GL_FUNC_ADD = gl.FUNC_ADD +_G.GL_ONE_MINUS_DST_ALPHA = gl.ONE_MINUS_DST_ALPHA +_G.GL_OUT_OF_MEMORY = gl.OUT_OF_MEMORY +_G.GL_BOOL_VEC4 = gl.BOOL_VEC4 +_G.GL_POLYGON_OFFSET_FACTOR = gl.POLYGON_OFFSET_FACTOR +_G.GL_STATIC_DRAW = gl.STATIC_DRAW +_G.GL_DITHER = gl.DITHER +_G.GL_TEXTURE31 = gl.TEXTURE31 +_G.GL_TEXTURE30 = gl.TEXTURE30 +_G.GL_UNSIGNED_BYTE = gl.UNSIGNED_BYTE +_G.GL_DEPTH_COMPONENT16 = gl.DEPTH_COMPONENT16 +_G.GL_TEXTURE23 = gl.TEXTURE23 +_G.GL_DEPTH_TEST = gl.DEPTH_TEST +_G.GL_STENCIL_PASS_DEPTH_FAIL = gl.STENCIL_PASS_DEPTH_FAIL +_G.GL_BOOL_VEC3 = gl.BOOL_VEC3 +_G.GL_POLYGON_OFFSET_UNITS = gl.POLYGON_OFFSET_UNITS +_G.GL_TEXTURE_BINDING_2D = gl.TEXTURE_BINDING_2D +_G.GL_TEXTURE21 = gl.TEXTURE21 +_G.GL_UNPACK_ALIGNMENT = gl.UNPACK_ALIGNMENT +_G.GL_DONT_CARE = gl.DONT_CARE +_G.GL_BUFFER_SIZE = gl.BUFFER_SIZE +_G.GL_FLOAT_MAT3 = gl.FLOAT_MAT3 +_G.GL_UNSIGNED_SHORT_5_6_5 = gl.UNSIGNED_SHORT_5_6_5 +_G.GL_INT_VEC2 = gl.INT_VEC2 +_G.GL_UNSIGNED_SHORT_4_4_4_4 = gl.UNSIGNED_SHORT_4_4_4_4 +_G.GL_NONE = gl.NONE +_G.GL_BLEND_DST_ALPHA = gl.BLEND_DST_ALPHA +_G.GL_VERTEX_ATTRIB_ARRAY_SIZE = gl.VERTEX_ATTRIB_ARRAY_SIZE +_G.GL_SRC_COLOR = gl.SRC_COLOR +_G.GL_COMPRESSED_TEXTURE_FORMATS = gl.COMPRESSED_TEXTURE_FORMATS +_G.GL_STENCIL_ATTACHMENT = gl.STENCIL_ATTACHMENT +_G.GL_MAX_VERTEX_ATTRIBS = gl.MAX_VERTEX_ATTRIBS +_G.GL_NUM_COMPRESSED_TEXTURE_FORMATS = gl.NUM_COMPRESSED_TEXTURE_FORMATS +_G.GL_BLEND_EQUATION_RGB = gl.BLEND_EQUATION_RGB +_G.GL_TEXTURE = gl.TEXTURE +_G.GL_LINEAR_MIPMAP_LINEAR = gl.LINEAR_MIPMAP_LINEAR +_G.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING +_G.GL_CURRENT_PROGRAM = gl.CURRENT_PROGRAM +_G.GL_COLOR_BUFFER_BIT = gl.COLOR_BUFFER_BIT +_G.GL_TEXTURE20 = gl.TEXTURE20 +_G.GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = gl.ACTIVE_ATTRIBUTE_MAX_LENGTH +_G.GL_TEXTURE28 = gl.TEXTURE28 +_G.GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE +_G.GL_TEXTURE22 = gl.TEXTURE22 +_G.GL_ELEMENT_ARRAY_BUFFER_BINDING = gl.ELEMENT_ARRAY_BUFFER_BINDING +_G.GL_STREAM_DRAW = gl.STREAM_DRAW +_G.GL_SCISSOR_BOX = gl.SCISSOR_BOX +_G.GL_TEXTURE26 = gl.TEXTURE26 +_G.GL_TEXTURE27 = gl.TEXTURE27 +_G.GL_TEXTURE24 = gl.TEXTURE24 +_G.GL_TEXTURE25 = gl.TEXTURE25 +_G.GL_NO_ERROR = gl.NO_ERROR +_G.GL_TEXTURE29 = gl.TEXTURE29 +_G.GL_FLOAT_MAT4 = gl.FLOAT_MAT4 +_G.GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = gl.VERTEX_ATTRIB_ARRAY_NORMALIZED +_G.GL_SAMPLE_COVERAGE_INVERT = gl.SAMPLE_COVERAGE_INVERT +_G.GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL +_G.GL_FLOAT_VEC3 = gl.FLOAT_VEC3 +_G.GL_STENCIL_CLEAR_VALUE = gl.STENCIL_CLEAR_VALUE +_G.GL_UNSIGNED_SHORT_5_5_5_1 = gl.UNSIGNED_SHORT_5_5_5_1 +_G.GL_ACTIVE_UNIFORMS = gl.ACTIVE_UNIFORMS +_G.GL_INVALID_OPERATION = gl.INVALID_OPERATION +_G.GL_DEPTH_ATTACHMENT = gl.DEPTH_ATTACHMENT +_G.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS +_G.GL_FRAMEBUFFER_COMPLETE = gl.FRAMEBUFFER_COMPLETE +_G.GL_ONE_MINUS_CONSTANT_COLOR = gl.ONE_MINUS_CONSTANT_COLOR +_G.GL_TEXTURE2 = gl.TEXTURE2 +_G.GL_TEXTURE1 = gl.TEXTURE1 +_G.GL_GEQUAL = gl.GEQUAL +_G.GL_TEXTURE7 = gl.TEXTURE7 +_G.GL_TEXTURE6 = gl.TEXTURE6 +_G.GL_TEXTURE5 = gl.TEXTURE5 +_G.GL_TEXTURE4 = gl.TEXTURE4 +_G.GL_GENERATE_MIPMAP_HINT = gl.GENERATE_MIPMAP_HINT +_G.GL_ONE_MINUS_SRC_COLOR = gl.ONE_MINUS_SRC_COLOR +_G.GL_TEXTURE9 = gl.TEXTURE9 +_G.GL_STENCIL_TEST = gl.STENCIL_TEST +_G.GL_COLOR_WRITEMASK = gl.COLOR_WRITEMASK +_G.GL_DEPTH_COMPONENT = gl.DEPTH_COMPONENT +_G.GL_STENCIL_INDEX8 = gl.STENCIL_INDEX8 +_G.GL_VERTEX_ATTRIB_ARRAY_TYPE = gl.VERTEX_ATTRIB_ARRAY_TYPE +_G.GL_FLOAT_VEC2 = gl.FLOAT_VEC2 +_G.GL_BLUE_BITS = gl.BLUE_BITS +_G.GL_VERTEX_SHADER = gl.VERTEX_SHADER +_G.GL_SUBPIXEL_BITS = gl.SUBPIXEL_BITS +_G.GL_STENCIL_WRITEMASK = gl.STENCIL_WRITEMASK +_G.GL_FLOAT_VEC4 = gl.FLOAT_VEC4 +_G.GL_TEXTURE17 = gl.TEXTURE17 +_G.GL_ONE_MINUS_CONSTANT_ALPHA = gl.ONE_MINUS_CONSTANT_ALPHA +_G.GL_TEXTURE15 = gl.TEXTURE15 +_G.GL_TEXTURE14 = gl.TEXTURE14 +_G.GL_TEXTURE13 = gl.TEXTURE13 +_G.GL_SAMPLES = gl.SAMPLES +_G.GL_TEXTURE11 = gl.TEXTURE11 +_G.GL_TEXTURE10 = gl.TEXTURE10 +_G.GL_FUNC_SUBTRACT = gl.FUNC_SUBTRACT +_G.GL_STENCIL_BUFFER_BIT = gl.STENCIL_BUFFER_BIT +_G.GL_TEXTURE19 = gl.TEXTURE19 +_G.GL_TEXTURE18 = gl.TEXTURE18 +_G.GL_NEAREST_MIPMAP_NEAREST = gl.NEAREST_MIPMAP_NEAREST +_G.GL_SHORT = gl.SHORT +_G.GL_RENDERBUFFER_BINDING = gl.RENDERBUFFER_BINDING +_G.GL_REPEAT = gl.REPEAT +_G.GL_TEXTURE_MIN_FILTER = gl.TEXTURE_MIN_FILTER +_G.GL_RED_BITS = gl.RED_BITS +_G.GL_FRONT_FACE = gl.FRONT_FACE +_G.GL_BLEND_COLOR = gl.BLEND_COLOR +_G.GL_MIRRORED_REPEAT = gl.MIRRORED_REPEAT +_G.GL_INT_VEC4 = gl.INT_VEC4 +_G.GL_MAX_CUBE_MAP_TEXTURE_SIZE = gl.MAX_CUBE_MAP_TEXTURE_SIZE +_G.GL_RENDERBUFFER_BLUE_SIZE = gl.RENDERBUFFER_BLUE_SIZE +_G.GL_SAMPLE_COVERAGE = gl.SAMPLE_COVERAGE +_G.GL_SRC_ALPHA = gl.SRC_ALPHA +_G.GL_FUNC_REVERSE_SUBTRACT = gl.FUNC_REVERSE_SUBTRACT +_G.GL_DEPTH_WRITEMASK = gl.DEPTH_WRITEMASK +_G.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT +_G.GL_POLYGON_OFFSET_FILL = gl.POLYGON_OFFSET_FILL +_G.GL_STENCIL_FUNC = gl.STENCIL_FUNC +_G.GL_REPLACE = gl.REPLACE +_G.GL_LUMINANCE_ALPHA = gl.LUMINANCE_ALPHA +_G.GL_DEPTH_RANGE = gl.DEPTH_RANGE +_G.GL_FASTEST = gl.FASTEST +_G.GL_STENCIL_FAIL = gl.STENCIL_FAIL +_G.GL_UNSIGNED_SHORT = gl.UNSIGNED_SHORT +_G.GL_RENDERBUFFER_HEIGHT = gl.RENDERBUFFER_HEIGHT +_G.GL_STENCIL_BACK_FAIL = gl.STENCIL_BACK_FAIL +_G.GL_BLEND_SRC_RGB = gl.BLEND_SRC_RGB +_G.GL_TEXTURE3 = gl.TEXTURE3 +_G.GL_RENDERBUFFER = gl.RENDERBUFFER +_G.GL_RGB5_A1 = gl.RGB5_A1 +_G.GL_RENDERBUFFER_ALPHA_SIZE = gl.RENDERBUFFER_ALPHA_SIZE +_G.GL_RENDERBUFFER_STENCIL_SIZE = gl.RENDERBUFFER_STENCIL_SIZE +_G.GL_NOTEQUAL = gl.NOTEQUAL +_G.GL_BLEND_DST_RGB = gl.BLEND_DST_RGB +_G.GL_FRONT_AND_BACK = gl.FRONT_AND_BACK +_G.GL_TEXTURE_BINDING_CUBE_MAP = gl.TEXTURE_BINDING_CUBE_MAP +_G.GL_MAX_RENDERBUFFER_SIZE = gl.MAX_RENDERBUFFER_SIZE +_G.GL_ZERO = gl.ZERO +_G.GL_TEXTURE0 = gl.TEXTURE0 +_G.GL_SAMPLE_ALPHA_TO_COVERAGE = gl.SAMPLE_ALPHA_TO_COVERAGE +_G.GL_BUFFER_USAGE = gl.BUFFER_USAGE +_G.GL_ACTIVE_TEXTURE = gl.ACTIVE_TEXTURE +_G.GL_BYTE = gl.BYTE +_G.GL_CW = gl.CW +_G.GL_DYNAMIC_DRAW = gl.DYNAMIC_DRAW +_G.GL_RENDERBUFFER_RED_SIZE = gl.RENDERBUFFER_RED_SIZE +_G.GL_FALSE = gl.FALSE +_G.GL_GREATER = gl.GREATER +_G.GL_RGBA4 = gl.RGBA4 +_G.GL_VALIDATE_STATUS = gl.VALIDATE_STATUS +_G.GL_STENCIL_BITS = gl.STENCIL_BITS +_G.GL_RGB = gl.RGB +_G.GL_INT = gl.INT +_G.GL_DEPTH_FUNC = gl.DEPTH_FUNC +_G.GL_SAMPLER_2D = gl.SAMPLER_2D +_G.GL_NICEST = gl.NICEST +_G.GL_MAX_VIEWPORT_DIMS = gl.MAX_VIEWPORT_DIMS +_G.GL_CULL_FACE = gl.CULL_FACE +_G.GL_INT_VEC3 = gl.INT_VEC3 +_G.GL_ALIASED_POINT_SIZE_RANGE = gl.ALIASED_POINT_SIZE_RANGE +_G.GL_INVALID_ENUM = gl.INVALID_ENUM +_G.GL_INVERT = gl.INVERT +_G.GL_CULL_FACE_MODE = gl.CULL_FACE_MODE +_G.GL_TEXTURE8 = gl.TEXTURE8 +_G.GL_VERTEX_ATTRIB_ARRAY_POINTER = gl.VERTEX_ATTRIB_ARRAY_POINTER +_G.GL_TEXTURE_WRAP_S = gl.TEXTURE_WRAP_S +_G.GL_VERTEX_ATTRIB_ARRAY_STRIDE = gl.VERTEX_ATTRIB_ARRAY_STRIDE +_G.GL_LINES = gl.LINES +_G.GL_EQUAL = gl.EQUAL +_G.GL_LINE_LOOP = gl.LINE_LOOP +_G.GL_TEXTURE_WRAP_T = gl.TEXTURE_WRAP_T +_G.GL_DEPTH_BUFFER_BIT = gl.DEPTH_BUFFER_BIT +_G.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS +_G.GL_SHADER_TYPE = gl.SHADER_TYPE +_G.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME +_G.GL_TEXTURE_CUBE_MAP_NEGATIVE_X = gl.TEXTURE_CUBE_MAP_NEGATIVE_X +_G.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = gl.TEXTURE_CUBE_MAP_NEGATIVE_Y +_G.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = gl.TEXTURE_CUBE_MAP_NEGATIVE_Z +_G.GL_DECR = gl.DECR +_G.GL_DELETE_STATUS = gl.DELETE_STATUS +_G.GL_DEPTH_BITS = gl.DEPTH_BITS +_G.GL_INCR = gl.INCR +_G.GL_SAMPLE_COVERAGE_VALUE = gl.SAMPLE_COVERAGE_VALUE +_G.GL_ALPHA_BITS = gl.ALPHA_BITS +_G.GL_FLOAT_MAT2 = gl.FLOAT_MAT2 +_G.GL_LINE_STRIP = gl.LINE_STRIP +_G.GL_SHADER_SOURCE_LENGTH = gl.SHADER_SOURCE_LENGTH +_G.GL_INVALID_VALUE = gl.INVALID_VALUE +_G.GL_NEVER = gl.NEVER +_G.GL_INCR_WRAP = gl.INCR_WRAP +_G.GL_BLEND_EQUATION_ALPHA = gl.BLEND_EQUATION_ALPHA +_G.GL_TEXTURE_MAG_FILTER = gl.TEXTURE_MAG_FILTER +_G.GL_POINTS = gl.POINTS +_G.GL_COLOR_ATTACHMENT0 = gl.COLOR_ATTACHMENT0 +_G.GL_RGBA = gl.RGBA +_G.GL_SRC_ALPHA_SATURATE = gl.SRC_ALPHA_SATURATE +_G.GL_SAMPLER_CUBE = gl.SAMPLER_CUBE +_G.GL_FRAMEBUFFER = gl.FRAMEBUFFER +_G.GL_TEXTURE_CUBE_MAP = gl.TEXTURE_CUBE_MAP +_G.GL_SAMPLE_BUFFERS = gl.SAMPLE_BUFFERS +_G.GL_LINEAR = gl.LINEAR +_G.GL_LINEAR_MIPMAP_NEAREST = gl.LINEAR_MIPMAP_NEAREST +_G.GL_ACTIVE_UNIFORM_MAX_LENGTH = gl.ACTIVE_UNIFORM_MAX_LENGTH +_G.GL_STENCIL_BACK_REF = gl.STENCIL_BACK_REF +_G.GL_ELEMENT_ARRAY_BUFFER = gl.ELEMENT_ARRAY_BUFFER +_G.GL_CLAMP_TO_EDGE = gl.CLAMP_TO_EDGE +_G.GL_TRIANGLE_STRIP = gl.TRIANGLE_STRIP +_G.GL_CONSTANT_COLOR = gl.CONSTANT_COLOR +_G.GL_COMPILE_STATUS = gl.COMPILE_STATUS +_G.GL_RENDERBUFFER_GREEN_SIZE = gl.RENDERBUFFER_GREEN_SIZE +_G.GL_UNSIGNED_INT = gl.UNSIGNED_INT +_G.GL_DEPTH_CLEAR_VALUE = gl.DEPTH_CLEAR_VALUE +_G.GL_ALIASED_LINE_WIDTH_RANGE = gl.ALIASED_LINE_WIDTH_RANGE +_G.GL_SHADING_LANGUAGE_VERSION = gl.SHADING_LANGUAGE_VERSION +_G.GL_FRAMEBUFFER_UNSUPPORTED = gl.FRAMEBUFFER_UNSUPPORTED +_G.GL_INFO_LOG_LENGTH = gl.INFO_LOG_LENGTH +_G.GL_STENCIL_PASS_DEPTH_PASS = gl.STENCIL_PASS_DEPTH_PASS +_G.GL_STENCIL_VALUE_MASK = gl.STENCIL_VALUE_MASK +_G.GL_ALWAYS = gl.ALWAYS +_G.GL_MAX_TEXTURE_SIZE = gl.MAX_TEXTURE_SIZE +_G.GL_FLOAT = gl.FLOAT +_G.GL_FRAMEBUFFER_BINDING = gl.FRAMEBUFFER_BINDING +_G.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT +_G.GL_TRIANGLE_FAN = gl.TRIANGLE_FAN +_G.GL_INVALID_FRAMEBUFFER_OPERATION = gl.INVALID_FRAMEBUFFER_OPERATION +_G.GL_TEXTURE_2D = gl.TEXTURE_2D +_G.GL_ALPHA = gl.ALPHA +_G.GL_CURRENT_VERTEX_ATTRIB = gl.CURRENT_VERTEX_ATTRIB +_G.GL_SCISSOR_TEST = gl.SCISSOR_TEST +_G.GL_TRIANGLES = gl.TRIANGLES diff --git a/src/cocos/cocos2d/DrawPrimitives.lua b/src/cocos/cocos2d/DrawPrimitives.lua new file mode 100644 index 0000000..e4f50a9 --- /dev/null +++ b/src/cocos/cocos2d/DrawPrimitives.lua @@ -0,0 +1,384 @@ + +local dp_initialized = false +local dp_shader = nil +local dp_colorLocation = -1 +local dp_color = { 1.0, 1.0, 1.0, 1.0 } +local dp_pointSizeLocation = -1 +local dp_pointSize = 1.0 + +local SHADER_NAME_POSITION_U_COLOR = "ShaderPosition_uColor" + +local targetPlatform = cc.Application:getInstance():getTargetPlatform() + +local function lazy_init() + if not dp_initialized then + dp_shader = cc.ShaderCache:getInstance():getProgram(SHADER_NAME_POSITION_U_COLOR) + --dp_shader:retain() + if nil ~= dp_shader then + dp_colorLocation = gl.getUniformLocation( dp_shader:getProgram(), "u_color") + dp_pointSizeLocation = gl.getUniformLocation( dp_shader:getProgram(), "u_pointSize") + dp_Initialized = true + end + end + + if nil == dp_shader then + print("Error:dp_shader is nil!") + return false + end + + return true +end + +local function setDrawProperty() + gl.glEnableVertexAttribs( CCConstants.VERTEX_ATTRIB_FLAG_POSITION ) + dp_shader:use() + dp_shader:setUniformsForBuiltins() + dp_shader:setUniformLocationWith4fv(dp_colorLocation, dp_color, 1) +end + +function ccDrawInit() + lazy_init() +end + +function ccDrawFree() + dp_initialized = false +end + +function ccDrawColor4f(r,g,b,a) + dp_color[1] = r + dp_color[2] = g + dp_color[3] = b + dp_color[4] = a +end + +function ccPointSize(pointSize) + dp_pointSize = pointSize * cc.Director:getInstance():getContentScaleFactor() +end + +function ccDrawColor4B(r,g,b,a) + dp_color[1] = r / 255.0 + dp_color[2] = g / 255.0 + dp_color[3] = b / 255.0 + dp_color[4] = a / 255.0 +end + +function ccDrawPoint(point) + if not lazy_init() then + return + end + + local vertexBuffer = { } + + local function initBuffer() + vertexBuffer.buffer_id = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) + local vertices = { point.x,point.y} + gl.bufferData(gl.ARRAY_BUFFER,2,vertices,gl.STATIC_DRAW) + gl.bindBuffer(gl.ARRAY_BUFFER, 0) + end + + initBuffer() + + setDrawProperty() + + dp_shader:setUniformLocationWith1f(dp_pointSizeLocation, dp_pointSize) + + gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) + gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) + gl.drawArrays(gl.POINTS,0,1) + gl.bindBuffer(gl.ARRAY_BUFFER,0) +end + +function ccDrawPoints(points,numOfPoint) + if not lazy_init() then + return + end + + local vertexBuffer = {} + local i = 1 + + local function initBuffer() + vertexBuffer.buffer_id = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) + local vertices = {} + for i = 1, numOfPoint do + vertices[2 * i - 1] = points[i].x + vertices[2 * i] = points[i].y + end + gl.bufferData(gl.ARRAY_BUFFER, numOfPoint * 2, vertices, gl.STATIC_DRAW) + gl.bindBuffer(gl.ARRAY_BUFFER, 0) + end + + initBuffer() + + setDrawProperty() + + dp_shader:setUniformLocationWith1f(dp_pointSizeLocation, dp_pointSize) + + gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) + gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) + gl.drawArrays(gl.POINTS,0,numOfPoint) + gl.bindBuffer(gl.ARRAY_BUFFER,0) +end + +function ccDrawLine(origin,destination) + if not lazy_init() then + return + end + + local vertexBuffer = {} + + local function initBuffer() + vertexBuffer.buffer_id = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) + local vertices = { origin.x, origin.y, destination.x, destination.y} + gl.bufferData(gl.ARRAY_BUFFER,4,vertices,gl.STATIC_DRAW) + gl.bindBuffer(gl.ARRAY_BUFFER, 0) + end + + initBuffer() + + setDrawProperty() + + gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) + gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) + gl.drawArrays(gl.LINES ,0,2) + gl.bindBuffer(gl.ARRAY_BUFFER,0) +end + +function ccDrawPoly(points,numOfPoints,closePolygon) + if not lazy_init() then + return + end + + local vertexBuffer = {} + local i = 1 + + local function initBuffer() + vertexBuffer.buffer_id = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) + local vertices = {} + for i = 1, numOfPoints do + vertices[2 * i - 1] = points[i].x + vertices[2 * i] = points[i].y + end + gl.bufferData(gl.ARRAY_BUFFER, numOfPoints * 2, vertices, gl.STATIC_DRAW) + gl.bindBuffer(gl.ARRAY_BUFFER, 0) + end + + initBuffer() + + setDrawProperty() + + gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) + gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) + if closePolygon then + gl.drawArrays(gl.LINE_LOOP , 0, numOfPoints) + else + gl.drawArrays(gl.LINE_STRIP, 0, numOfPoints) + end + gl.bindBuffer(gl.ARRAY_BUFFER,0) +end + +function ccDrawSolidPoly(points,numOfPoints,color) + if not lazy_init() then + return + end + + local vertexBuffer = {} + local i = 1 + + local function initBuffer() + vertexBuffer.buffer_id = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) + local vertices = {} + for i = 1, numOfPoints do + vertices[2 * i - 1] = points[i].x + vertices[2 * i] = points[i].y + + end + gl.bufferData(gl.ARRAY_BUFFER, numOfPoints * 2, vertices, gl.STATIC_DRAW) + gl.bindBuffer(gl.ARRAY_BUFFER, 0) + end + + initBuffer() + + gl.glEnableVertexAttribs( CCConstants.VERTEX_ATTRIB_FLAG_POSITION ) + dp_shader:use() + dp_shader:setUniformsForBuiltins() + dp_shader:setUniformLocationWith4fv(dp_colorLocation, color, 1) + + gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) + gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) + gl.drawArrays(gl.TRIANGLE_FAN , 0, numOfPoints) + gl.bindBuffer(gl.ARRAY_BUFFER,0) +end + +function ccDrawRect(origin,destination) + ccDrawLine(CCPoint:__call(origin.x, origin.y), CCPoint:__call(destination.x, origin.y)) + ccDrawLine(CCPoint:__call(destination.x, origin.y), CCPoint:__call(destination.x, destination.y)) + ccDrawLine(CCPoint:__call(destination.x, destination.y), CCPoint:__call(origin.x, destination.y)) + ccDrawLine(CCPoint:__call(origin.x, destination.y), CCPoint:__call(origin.x, origin.y)) +end + +function ccDrawSolidRect( origin,destination,color ) + local vertices = { origin, CCPoint:__call(destination.x, origin.y) , destination, CCPoint:__call(origin.x, destination.y) } + ccDrawSolidPoly(vertices,4,color) +end + +function ccDrawCircleScale( center, radius, angle, segments,drawLineToCenter,scaleX,scaleY) + if not lazy_init() then + return + end + + local additionalSegment = 1 + if drawLineToCenter then + additionalSegment = additionalSegment + 1 + end + + local vertexBuffer = { } + + local function initBuffer() + local coef = 2.0 * math.pi / segments + local i = 1 + local vertices = {} + vertexBuffer.buffer_id = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) + for i = 1, segments + 1 do + local rads = (i - 1) * coef + local j = radius * math.cos(rads + angle) * scaleX + center.x + local k = radius * math.sin(rads + angle) * scaleY + center.y + vertices[i * 2 - 1] = j + vertices[i * 2] = k + end + vertices[(segments + 2) * 2 - 1] = center.x + vertices[(segments + 2) * 2] = center.y + + gl.bufferData(gl.ARRAY_BUFFER, (segments + 2) * 2, vertices, gl.STATIC_DRAW) + gl.bindBuffer(gl.ARRAY_BUFFER, 0) + end + + initBuffer() + + setDrawProperty() + + gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) + gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) + gl.drawArrays(gl.LINE_STRIP , 0, segments + additionalSegment) + gl.bindBuffer(gl.ARRAY_BUFFER,0) +end + +function ccDrawCircle(center, radius, angle, segments, drawLineToCenter) + ccDrawCircleScale(center, radius, angle, segments, drawLineToCenter, 1.0, 1.0) +end + +function ccDrawSolidCircle(center, radius, angle, segments,scaleX,scaleY) + if not lazy_init() then + return + end + + local vertexBuffer = { } + + local function initBuffer() + local coef = 2.0 * math.pi / segments + local i = 1 + local vertices = {} + vertexBuffer.buffer_id = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) + for i = 1, segments + 1 do + local rads = (i - 1) * coef + local j = radius * math.cos(rads + angle) * scaleX + center.x + local k = radius * math.sin(rads + angle) * scaleY + center.y + vertices[i * 2 - 1] = j + vertices[i * 2] = k + end + vertices[(segments + 2) * 2 - 1] = center.x + vertices[(segments + 2) * 2] = center.y + + gl.bufferData(gl.ARRAY_BUFFER, (segments + 2) * 2, vertices, gl.STATIC_DRAW) + gl.bindBuffer(gl.ARRAY_BUFFER, 0) + end + + initBuffer() + + setDrawProperty() + + gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) + gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) + gl.drawArrays(gl.TRIANGLE_FAN , 0, segments + 1) + gl.bindBuffer(gl.ARRAY_BUFFER,0) +end + +function ccDrawQuadBezier(origin, control, destination, segments) + if not lazy_init() then + return + end + + local vertexBuffer = { } + + local function initBuffer() + local vertices = { } + local i = 1 + local t = 0.0 + + for i = 1, segments do + vertices[2 * i - 1] = math.pow(1 - t,2) * origin.x + 2.0 * (1 - t) * t * control.x + t * t * destination.x + vertices[2 * i] = math.pow(1 - t,2) * origin.y + 2.0 * (1 - t) * t * control.y + t * t * destination.y + t = t + 1.0 / segments + end + + vertices[2 * (segments + 1) - 1] = destination.x + vertices[2 * (segments + 1)] = destination.y + + vertexBuffer.buffer_id = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) + gl.bufferData(gl.ARRAY_BUFFER, (segments + 1) * 2, vertices, gl.STATIC_DRAW) + gl.bindBuffer(gl.ARRAY_BUFFER, 0) + end + + initBuffer() + + setDrawProperty() + + gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) + gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) + gl.drawArrays(gl.LINE_STRIP , 0, segments + 1) + gl.bindBuffer(gl.ARRAY_BUFFER,0) +end + +function ccDrawCubicBezier(origin, control1, control2, destination, segments) + if not lazy_init then + return + end + + local vertexBuffer = { } + + local function initBuffer() + local vertices = { } + local t = 0 + local i = 1 + + for i = 1, segments do + vertices[2 * i - 1] = math.pow(1 - t,3) * origin.x + 3.0 * math.pow(1 - t, 2) * t * control1.x + 3.0 * (1 - t) * t * t * control2.x + t * t * t * destination.x + vertices[2 * i] = math.pow(1 - t,3) * origin.y + 3.0 * math.pow(1 - t, 2) * t * control1.y + 3.0 * (1 - t) * t * t * control2.y + t * t * t * destination.y + t = t + 1.0 / segments + end + + vertices[2 * (segments + 1) - 1] = destination.x + vertices[2 * (segments + 1)] = destination.y + + vertexBuffer.buffer_id = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer_id) + gl.bufferData(gl.ARRAY_BUFFER, (segments + 1) * 2, vertices, gl.STATIC_DRAW) + gl.bindBuffer(gl.ARRAY_BUFFER, 0) + end + + initBuffer() + + setDrawProperty() + + gl.bindBuffer(gl.ARRAY_BUFFER,vertexBuffer.buffer_id) + gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0) + gl.drawArrays(gl.LINE_STRIP , 0, segments + 1) + gl.bindBuffer(gl.ARRAY_BUFFER,0) +end diff --git a/src/cocos/cocos2d/Opengl.lua b/src/cocos/cocos2d/Opengl.lua new file mode 100644 index 0000000..7465523 --- /dev/null +++ b/src/cocos/cocos2d/Opengl.lua @@ -0,0 +1,297 @@ + +if not gl then return end + +--Create functions +function gl.createTexture() + local retTable = {} + retTable.texture_id = gl._createTexture() + return retTable +end + +function gl.createBuffer() + local retTable = {} + retTable.buffer_id = gl._createBuffer() + return retTable +end + +function gl.createRenderbuffer() + local retTable = {} + retTable.renderbuffer_id = gl._createRenderuffer() + return retTable +end + +function gl.createFramebuffer( ) + local retTable = {} + retTable.framebuffer_id = gl._createFramebuffer() + return retTable +end + +function gl.createProgram() + local retTable = {} + retTable.program_id = gl._createProgram() + return retTable +end + +function gl.createShader(shaderType) + local retTable = {} + retTable.shader_id = gl._createShader(shaderType) + return retTable +end + +--Delete Fun +function gl.deleteTexture(texture) + local texture_id = 0 + if "number" == type(texture) then + texture_id = texture + elseif "table" == type(texture) then + texture_id = texture.texture_id + end + gl._deleteTexture(texture_id) +end + +function gl.deleteBuffer(buffer) + local buffer_id = 0 + if "number" == type(buffer) then + buffer_id = buffer + elseif "table" == type(buffer) then + buffer_id = buffer.buffer_id + end + gl._deleteBuffer(buffer_id) +end + +function gl.deleteRenderbuffer(buffer) + local renderbuffer_id = 0 + if "number" == type(buffer) then + renderbuffer_id = buffer + elseif "table" == type(buffer) then + renderbuffer_id = buffer.renderbuffer_id + end + gl._deleteRenderbuffer(renderbuffer_id) +end + +function gl.deleteFramebuffer(buffer) + local framebuffer_id = 0 + if "number" == type(buffer) then + framebuffer_id = buffer + elseif "table" == type(buffer) then + framebuffer_id = buffer.framebuffer_id + end + gl._deleteFramebuffer(framebuffer_id) +end + +function gl.deleteProgram( program ) + local program_id = 0 + if "number" == type(buffer) then + program_id = program + elseif "table" == type(program) then + program_id = program.program_id + end + + gl._deleteProgram(program_id) +end + +function gl.deleteShader(shader) + local shader_id = 0 + if "number" == type(shader) then + shader_id = shader + elseif "table" == type(shader) then + shader_id = shader.shader_id + end + + gl._deleteShader(shader_id) +end + +--Bind Related +function gl.bindTexture(target, texture) + local texture_id = 0 + if "number" == type(texture) then + texture_id = texture + elseif "table" == type(texture) then + texture_id = texture.texture_id + end + + gl._bindTexture(target,texture_id) +end + +function gl.bindBuffer( target,buffer ) + local buffer_id = 0 + if "number" == type(buffer) then + buffer_id = buffer + elseif "table" == type(buffer) then + buffer_id = buffer.buffer_id + end + + gl._bindBuffer(target, buffer_id) +end + +function gl.bindRenderBuffer(target, buffer) + local buffer_id = 0 + + if "number" == type(buffer) then + buffer_id = buffer; + elseif "table" == type(buffer) then + buffer_id = buffer.buffer_id + end + + gl._bindRenderbuffer(target, buffer_id) +end + +function gl.bindFramebuffer(target, buffer) + local buffer_id = 0 + + if "number" == type(buffer) then + buffer_id = buffer + elseif "table" == type(buffer) then + buffer_id = buffer.buffer_id + end + + gl._bindFramebuffer(target, buffer_id) +end + +--Uniform related +function gl.getUniform(program, location) + local program_id = 0 + local location_id = 0 + + if "number" == type(program) then + program_id = program + else + program_id = program.program_id + end + + if "number" == type(location) then + location_id = location + else + location_id = location.location_id + end + + return gl._getUniform(program_id, location_id) +end + +--shader related +function gl.compileShader(shader) + gl._compileShader( shader.shader_id) +end + +function gl.shaderSource(shader, source) + gl._shaderSource(shader.shader_id, source) +end + +function gl.getShaderParameter(shader, e) + return gl._getShaderParameter(shader.shader_id,e) +end + +function gl.getShaderInfoLog( shader ) + return gl._getShaderInfoLog(shader.shader_id) +end + +--program related +function gl.attachShader( program, shader ) + local program_id = 0 + + if "number" == type(program) then + program_id = program + elseif "table" == type(program) then + program_id = program.program_id + end + + gl._attachShader(program_id, shader.shader_id) +end + +function gl.linkProgram( program ) + local program_id = 0 + + if "number" == type(program) then + program_id = program + elseif "table" == type(program) then + program_id = program.program_id + end + + gl._linkProgram(program_id) +end + +function gl.getProgramParameter(program, e) + local program_id = 0 + + if "number" == type(program) then + program_id = program + elseif "table" == type(program) then + program_id = program.program_id + end + + return gl._getProgramParameter(program_id, e) +end + +function gl.useProgram(program) + local program_id = 0 + if "number" == type(program) then + program_id = program + elseif "table" == type(program) then + program_id = program.program_id + end + + gl._useProgram (program_id) +end + +function gl.getAttribLocation(program, name ) + local program_id = 0 + + if "number" == type(program) then + program_id = program + elseif "table" == type(program) then + program_id = program.program_id + end + + return gl._getAttribLocation(program_id, name) +end + +function gl.getUniformLocation( program, name ) + local program_id = 0 + + if "number" == type(program) then + program_id = program + elseif "table" == type(program) then + program_id = program.program_id + end + + return gl._getUniformLocation(program_id,name) +end + +function gl.getActiveAttrib( program, index ) + local program_id = 0 + if "number" == type(program) then + program_id = program + elseif "table" == type(program) then + program_id = program.program_id + end + + return gl._getActiveAttrib(program_id, index); +end + +function gl.getActiveUniform( program, index ) + local program_id = 0 + + if "number" == type(program) then + program_id = program + elseif "table" == type(program) then + program_id = program.program_id + end + + return gl._getActiveUniform(program_id, index) +end + +function gl.getAttachedShaders(program) + local program_id = 0 + + if "number" == type(program) then + program_id = program + elseif "table" == type(program) then + program_id = program.program_id + end + + return gl._getAttachedShaders(program_id) +end + +function gl.glNodeCreate() + return cc.GLNode:create() +end diff --git a/src/cocos/cocos2d/OpenglConstants.lua b/src/cocos/cocos2d/OpenglConstants.lua new file mode 100644 index 0000000..15adb23 --- /dev/null +++ b/src/cocos/cocos2d/OpenglConstants.lua @@ -0,0 +1,826 @@ + +if not gl then return end + +gl.GCCSO_SHADER_BINARY_FJ = 0x9260 +gl._3DC_XY_AMD = 0x87fa +gl._3DC_X_AMD = 0x87f9 +gl.ACTIVE_ATTRIBUTES = 0x8b89 +gl.ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8b8a +gl.ACTIVE_PROGRAM_EXT = 0x8259 +gl.ACTIVE_TEXTURE = 0x84e0 +gl.ACTIVE_UNIFORMS = 0x8b86 +gl.ACTIVE_UNIFORM_MAX_LENGTH = 0x8b87 +gl.ALIASED_LINE_WIDTH_RANGE = 0x846e +gl.ALIASED_POINT_SIZE_RANGE = 0x846d +gl.ALL_COMPLETED_NV = 0x84f2 +gl.ALL_SHADER_BITS_EXT = 0xffffffff +gl.ALPHA = 0x1906 +gl.ALPHA16F_EXT = 0x881c +gl.ALPHA32F_EXT = 0x8816 +gl.ALPHA8_EXT = 0x803c +gl.ALPHA8_OES = 0x803c +gl.ALPHA_BITS = 0xd55 +gl.ALPHA_TEST_FUNC_QCOM = 0xbc1 +gl.ALPHA_TEST_QCOM = 0xbc0 +gl.ALPHA_TEST_REF_QCOM = 0xbc2 +gl.ALREADY_SIGNALED_APPLE = 0x911a +gl.ALWAYS = 0x207 +gl.AMD_compressed_3DC_texture = 0x1 +gl.AMD_compressed_ATC_texture = 0x1 +gl.AMD_performance_monitor = 0x1 +gl.AMD_program_binary_Z400 = 0x1 +gl.ANGLE_depth_texture = 0x1 +gl.ANGLE_framebuffer_blit = 0x1 +gl.ANGLE_framebuffer_multisample = 0x1 +gl.ANGLE_instanced_arrays = 0x1 +gl.ANGLE_pack_reverse_row_order = 0x1 +gl.ANGLE_program_binary = 0x1 +gl.ANGLE_texture_compression_dxt3 = 0x1 +gl.ANGLE_texture_compression_dxt5 = 0x1 +gl.ANGLE_texture_usage = 0x1 +gl.ANGLE_translated_shader_source = 0x1 +gl.ANY_SAMPLES_PASSED_CONSERVATIVE_EXT = 0x8d6a +gl.ANY_SAMPLES_PASSED_EXT = 0x8c2f +gl.APPLE_copy_texture_levels = 0x1 +gl.APPLE_framebuffer_multisample = 0x1 +gl.APPLE_rgb_422 = 0x1 +gl.APPLE_sync = 0x1 +gl.APPLE_texture_format_BGRA8888 = 0x1 +gl.APPLE_texture_max_level = 0x1 +gl.ARM_mali_program_binary = 0x1 +gl.ARM_mali_shader_binary = 0x1 +gl.ARM_rgba8 = 0x1 +gl.ARRAY_BUFFER = 0x8892 +gl.ARRAY_BUFFER_BINDING = 0x8894 +gl.ATC_RGBA_EXPLICIT_ALPHA_AMD = 0x8c93 +gl.ATC_RGBA_INTERPOLATED_ALPHA_AMD = 0x87ee +gl.ATC_RGB_AMD = 0x8c92 +gl.ATTACHED_SHADERS = 0x8b85 +gl.BACK = 0x405 +gl.BGRA8_EXT = 0x93a1 +gl.BGRA_EXT = 0x80e1 +gl.BGRA_IMG = 0x80e1 +gl.BINNING_CONTROL_HINT_QCOM = 0x8fb0 +gl.BLEND = 0xbe2 +gl.BLEND_COLOR = 0x8005 +gl.BLEND_DST_ALPHA = 0x80ca +gl.BLEND_DST_RGB = 0x80c8 +gl.BLEND_EQUATION = 0x8009 +gl.BLEND_EQUATION_ALPHA = 0x883d +gl.BLEND_EQUATION_RGB = 0x8009 +gl.BLEND_SRC_ALPHA = 0x80cb +gl.BLEND_SRC_RGB = 0x80c9 +gl.BLUE_BITS = 0xd54 +gl.BOOL = 0x8b56 +gl.BOOL_VEC2 = 0x8b57 +gl.BOOL_VEC3 = 0x8b58 +gl.BOOL_VEC4 = 0x8b59 +gl.BUFFER = 0x82e0 +gl.BUFFER_ACCESS_OES = 0x88bb +gl.BUFFER_MAPPED_OES = 0x88bc +gl.BUFFER_MAP_POINTER_OES = 0x88bd +gl.BUFFER_OBJECT_EXT = 0x9151 +gl.BUFFER_SIZE = 0x8764 +gl.BUFFER_USAGE = 0x8765 +gl.BYTE = 0x1400 +gl.CCW = 0x901 +gl.CLAMP_TO_BORDER_NV = 0x812d +gl.CLAMP_TO_EDGE = 0x812f +gl.COLOR_ATTACHMENT0 = 0x8ce0 +gl.COLOR_ATTACHMENT0_NV = 0x8ce0 +gl.COLOR_ATTACHMENT10_NV = 0x8cea +gl.COLOR_ATTACHMENT11_NV = 0x8ceb +gl.COLOR_ATTACHMENT12_NV = 0x8cec +gl.COLOR_ATTACHMENT13_NV = 0x8ced +gl.COLOR_ATTACHMENT14_NV = 0x8cee +gl.COLOR_ATTACHMENT15_NV = 0x8cef +gl.COLOR_ATTACHMENT1_NV = 0x8ce1 +gl.COLOR_ATTACHMENT2_NV = 0x8ce2 +gl.COLOR_ATTACHMENT3_NV = 0x8ce3 +gl.COLOR_ATTACHMENT4_NV = 0x8ce4 +gl.COLOR_ATTACHMENT5_NV = 0x8ce5 +gl.COLOR_ATTACHMENT6_NV = 0x8ce6 +gl.COLOR_ATTACHMENT7_NV = 0x8ce7 +gl.COLOR_ATTACHMENT8_NV = 0x8ce8 +gl.COLOR_ATTACHMENT9_NV = 0x8ce9 +gl.COLOR_ATTACHMENT_EXT = 0x90f0 +gl.COLOR_BUFFER_BIT = 0x4000 +gl.COLOR_BUFFER_BIT0_QCOM = 0x1 +gl.COLOR_BUFFER_BIT1_QCOM = 0x2 +gl.COLOR_BUFFER_BIT2_QCOM = 0x4 +gl.COLOR_BUFFER_BIT3_QCOM = 0x8 +gl.COLOR_BUFFER_BIT4_QCOM = 0x10 +gl.COLOR_BUFFER_BIT5_QCOM = 0x20 +gl.COLOR_BUFFER_BIT6_QCOM = 0x40 +gl.COLOR_BUFFER_BIT7_QCOM = 0x80 +gl.COLOR_CLEAR_VALUE = 0xc22 +gl.COLOR_EXT = 0x1800 +gl.COLOR_WRITEMASK = 0xc23 +gl.COMPARE_REF_TO_TEXTURE_EXT = 0x884e +gl.COMPILE_STATUS = 0x8b81 +gl.COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93bb +gl.COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93b8 +gl.COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93b9 +gl.COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93ba +gl.COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93bc +gl.COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93bd +gl.COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93b0 +gl.COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93b1 +gl.COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93b2 +gl.COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93b3 +gl.COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93b4 +gl.COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93b5 +gl.COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93b6 +gl.COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93b7 +gl.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8c03 +gl.COMPRESSED_RGBA_PVRTC_2BPPV2_IMG = 0x9137 +gl.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8c02 +gl.COMPRESSED_RGBA_PVRTC_4BPPV2_IMG = 0x9138 +gl.COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83f1 +gl.COMPRESSED_RGBA_S3TC_DXT3_ANGLE = 0x83f2 +gl.COMPRESSED_RGBA_S3TC_DXT5_ANGLE = 0x83f3 +gl.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8c01 +gl.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8c00 +gl.COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83f0 +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93db +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93d8 +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93d9 +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93da +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93dc +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93dd +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93d0 +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93d1 +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93d2 +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93d3 +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93d4 +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93d5 +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93d6 +gl.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93d7 +gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV = 0x8c4d +gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV = 0x8c4e +gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV = 0x8c4f +gl.COMPRESSED_SRGB_S3TC_DXT1_NV = 0x8c4c +gl.COMPRESSED_TEXTURE_FORMATS = 0x86a3 +gl.CONDITION_SATISFIED_APPLE = 0x911c +gl.CONSTANT_ALPHA = 0x8003 +gl.CONSTANT_COLOR = 0x8001 +gl.CONTEXT_FLAG_DEBUG_BIT = 0x2 +gl.CONTEXT_ROBUST_ACCESS_EXT = 0x90f3 +gl.COUNTER_RANGE_AMD = 0x8bc1 +gl.COUNTER_TYPE_AMD = 0x8bc0 +gl.COVERAGE_ALL_FRAGMENTS_NV = 0x8ed5 +gl.COVERAGE_ATTACHMENT_NV = 0x8ed2 +gl.COVERAGE_AUTOMATIC_NV = 0x8ed7 +gl.COVERAGE_BUFFERS_NV = 0x8ed3 +gl.COVERAGE_BUFFER_BIT_NV = 0x8000 +gl.COVERAGE_COMPONENT4_NV = 0x8ed1 +gl.COVERAGE_COMPONENT_NV = 0x8ed0 +gl.COVERAGE_EDGE_FRAGMENTS_NV = 0x8ed6 +gl.COVERAGE_SAMPLES_NV = 0x8ed4 +gl.CPU_OPTIMIZED_QCOM = 0x8fb1 +gl.CULL_FACE = 0xb44 +gl.CULL_FACE_MODE = 0xb45 +gl.CURRENT_PROGRAM = 0x8b8d +gl.CURRENT_QUERY_EXT = 0x8865 +gl.CURRENT_VERTEX_ATTRIB = 0x8626 +gl.CW = 0x900 +gl.DEBUG_CALLBACK_FUNCTION = 0x8244 +gl.DEBUG_CALLBACK_USER_PARAM = 0x8245 +gl.DEBUG_GROUP_STACK_DEPTH = 0x826d +gl.DEBUG_LOGGED_MESSAGES = 0x9145 +gl.DEBUG_NEXT_LOGGED_MESSAGE_LENGTH = 0x8243 +gl.DEBUG_OUTPUT = 0x92e0 +gl.DEBUG_OUTPUT_SYNCHRONOUS = 0x8242 +gl.DEBUG_SEVERITY_HIGH = 0x9146 +gl.DEBUG_SEVERITY_LOW = 0x9148 +gl.DEBUG_SEVERITY_MEDIUM = 0x9147 +gl.DEBUG_SEVERITY_NOTIFICATION = 0x826b +gl.DEBUG_SOURCE_API = 0x8246 +gl.DEBUG_SOURCE_APPLICATION = 0x824a +gl.DEBUG_SOURCE_OTHER = 0x824b +gl.DEBUG_SOURCE_SHADER_COMPILER = 0x8248 +gl.DEBUG_SOURCE_THIRD_PARTY = 0x8249 +gl.DEBUG_SOURCE_WINDOW_SYSTEM = 0x8247 +gl.DEBUG_TYPE_DEPRECATED_BEHAVIOR = 0x824d +gl.DEBUG_TYPE_ERROR = 0x824c +gl.DEBUG_TYPE_MARKER = 0x8268 +gl.DEBUG_TYPE_OTHER = 0x8251 +gl.DEBUG_TYPE_PERFORMANCE = 0x8250 +gl.DEBUG_TYPE_POP_GROUP = 0x826a +gl.DEBUG_TYPE_PORTABILITY = 0x824f +gl.DEBUG_TYPE_PUSH_GROUP = 0x8269 +gl.DEBUG_TYPE_UNDEFINED_BEHAVIOR = 0x824e +gl.DECR = 0x1e03 +gl.DECR_WRAP = 0x8508 +gl.DELETE_STATUS = 0x8b80 +gl.DEPTH24_STENCIL8_OES = 0x88f0 +gl.DEPTH_ATTACHMENT = 0x8d00 +gl.DEPTH_BITS = 0xd56 +gl.DEPTH_BUFFER_BIT = 0x100 +gl.DEPTH_BUFFER_BIT0_QCOM = 0x100 +gl.DEPTH_BUFFER_BIT1_QCOM = 0x200 +gl.DEPTH_BUFFER_BIT2_QCOM = 0x400 +gl.DEPTH_BUFFER_BIT3_QCOM = 0x800 +gl.DEPTH_BUFFER_BIT4_QCOM = 0x1000 +gl.DEPTH_BUFFER_BIT5_QCOM = 0x2000 +gl.DEPTH_BUFFER_BIT6_QCOM = 0x4000 +gl.DEPTH_BUFFER_BIT7_QCOM = 0x8000 +gl.DEPTH_CLEAR_VALUE = 0xb73 +gl.DEPTH_COMPONENT = 0x1902 +gl.DEPTH_COMPONENT16 = 0x81a5 +gl.DEPTH_COMPONENT16_NONLINEAR_NV = 0x8e2c +gl.DEPTH_COMPONENT16_OES = 0x81a5 +gl.DEPTH_COMPONENT24_OES = 0x81a6 +gl.DEPTH_COMPONENT32_OES = 0x81a7 +gl.DEPTH_EXT = 0x1801 +gl.DEPTH_FUNC = 0xb74 +gl.DEPTH_RANGE = 0xb70 +gl.DEPTH_STENCIL_OES = 0x84f9 +gl.DEPTH_TEST = 0xb71 +gl.DEPTH_WRITEMASK = 0xb72 +gl.DITHER = 0xbd0 +gl.DMP_shader_binary = 0x1 +gl.DONT_CARE = 0x1100 +gl.DRAW_BUFFER0_NV = 0x8825 +gl.DRAW_BUFFER10_NV = 0x882f +gl.DRAW_BUFFER11_NV = 0x8830 +gl.DRAW_BUFFER12_NV = 0x8831 +gl.DRAW_BUFFER13_NV = 0x8832 +gl.DRAW_BUFFER14_NV = 0x8833 +gl.DRAW_BUFFER15_NV = 0x8834 +gl.DRAW_BUFFER1_NV = 0x8826 +gl.DRAW_BUFFER2_NV = 0x8827 +gl.DRAW_BUFFER3_NV = 0x8828 +gl.DRAW_BUFFER4_NV = 0x8829 +gl.DRAW_BUFFER5_NV = 0x882a +gl.DRAW_BUFFER6_NV = 0x882b +gl.DRAW_BUFFER7_NV = 0x882c +gl.DRAW_BUFFER8_NV = 0x882d +gl.DRAW_BUFFER9_NV = 0x882e +gl.DRAW_BUFFER_EXT = 0xc01 +gl.DRAW_FRAMEBUFFER_ANGLE = 0x8ca9 +gl.DRAW_FRAMEBUFFER_APPLE = 0x8ca9 +gl.DRAW_FRAMEBUFFER_BINDING_ANGLE = 0x8ca6 +gl.DRAW_FRAMEBUFFER_BINDING_APPLE = 0x8ca6 +gl.DRAW_FRAMEBUFFER_BINDING_NV = 0x8ca6 +gl.DRAW_FRAMEBUFFER_NV = 0x8ca9 +gl.DST_ALPHA = 0x304 +gl.DST_COLOR = 0x306 +gl.DYNAMIC_DRAW = 0x88e8 +gl.ELEMENT_ARRAY_BUFFER = 0x8893 +gl.ELEMENT_ARRAY_BUFFER_BINDING = 0x8895 +gl.EQUAL = 0x202 +gl.ES_VERSION_2_0 = 0x1 +gl.ETC1_RGB8_OES = 0x8d64 +gl.ETC1_SRGB8_NV = 0x88ee +gl.EXTENSIONS = 0x1f03 +gl.EXT_blend_minmax = 0x1 +gl.EXT_color_buffer_half_float = 0x1 +gl.EXT_debug_label = 0x1 +gl.EXT_debug_marker = 0x1 +gl.EXT_discard_framebuffer = 0x1 +gl.EXT_map_buffer_range = 0x1 +gl.EXT_multi_draw_arrays = 0x1 +gl.EXT_multisampled_render_to_texture = 0x1 +gl.EXT_multiview_draw_buffers = 0x1 +gl.EXT_occlusion_query_boolean = 0x1 +gl.EXT_read_format_bgra = 0x1 +gl.EXT_robustness = 0x1 +gl.EXT_sRGB = 0x1 +gl.EXT_separate_shader_objects = 0x1 +gl.EXT_shader_framebuffer_fetch = 0x1 +gl.EXT_shader_texture_lod = 0x1 +gl.EXT_shadow_samplers = 0x1 +gl.EXT_texture_compression_dxt1 = 0x1 +gl.EXT_texture_filter_anisotropic = 0x1 +gl.EXT_texture_format_BGRA8888 = 0x1 +gl.EXT_texture_rg = 0x1 +gl.EXT_texture_storage = 0x1 +gl.EXT_texture_type_2_10_10_10_REV = 0x1 +gl.EXT_unpack_subimage = 0x1 +gl.FALSE = 0x0 +gl.FASTEST = 0x1101 +gl.FENCE_CONDITION_NV = 0x84f4 +gl.FENCE_STATUS_NV = 0x84f3 +gl.FIXED = 0x140c +gl.FJ_shader_binary_GCCSO = 0x1 +gl.FLOAT = 0x1406 +gl.FLOAT_MAT2 = 0x8b5a +gl.FLOAT_MAT3 = 0x8b5b +gl.FLOAT_MAT4 = 0x8b5c +gl.FLOAT_VEC2 = 0x8b50 +gl.FLOAT_VEC3 = 0x8b51 +gl.FLOAT_VEC4 = 0x8b52 +gl.FRAGMENT_SHADER = 0x8b30 +gl.FRAGMENT_SHADER_BIT_EXT = 0x2 +gl.FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8b8b +gl.FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT = 0x8a52 +gl.FRAMEBUFFER = 0x8d40 +gl.FRAMEBUFFER_ATTACHMENT_ANGLE = 0x93a3 +gl.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT = 0x8210 +gl.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211 +gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8cd1 +gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8cd0 +gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES = 0x8cd4 +gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8cd3 +gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8cd2 +gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT = 0x8d6c +gl.FRAMEBUFFER_BINDING = 0x8ca6 +gl.FRAMEBUFFER_COMPLETE = 0x8cd5 +gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8cd6 +gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8cd9 +gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8cd7 +gl.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE = 0x8d56 +gl.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE = 0x8d56 +gl.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT = 0x8d56 +gl.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG = 0x9134 +gl.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV = 0x8d56 +gl.FRAMEBUFFER_UNDEFINED_OES = 0x8219 +gl.FRAMEBUFFER_UNSUPPORTED = 0x8cdd +gl.FRONT = 0x404 +gl.FRONT_AND_BACK = 0x408 +gl.FRONT_FACE = 0xb46 +gl.FUNC_ADD = 0x8006 +gl.FUNC_REVERSE_SUBTRACT = 0x800b +gl.FUNC_SUBTRACT = 0x800a +gl.GENERATE_MIPMAP_HINT = 0x8192 +gl.GEQUAL = 0x206 +gl.GPU_OPTIMIZED_QCOM = 0x8fb2 +gl.GREATER = 0x204 +gl.GREEN_BITS = 0xd53 +gl.GUILTY_CONTEXT_RESET_EXT = 0x8253 +gl.HALF_FLOAT_OES = 0x8d61 +gl.HIGH_FLOAT = 0x8df2 +gl.HIGH_INT = 0x8df5 +gl.IMG_multisampled_render_to_texture = 0x1 +gl.IMG_program_binary = 0x1 +gl.IMG_read_format = 0x1 +gl.IMG_shader_binary = 0x1 +gl.IMG_texture_compression_pvrtc = 0x1 +gl.IMG_texture_compression_pvrtc2 = 0x1 +gl.IMPLEMENTATION_COLOR_READ_FORMAT = 0x8b9b +gl.IMPLEMENTATION_COLOR_READ_TYPE = 0x8b9a +gl.INCR = 0x1e02 +gl.INCR_WRAP = 0x8507 +gl.INFO_LOG_LENGTH = 0x8b84 +gl.INNOCENT_CONTEXT_RESET_EXT = 0x8254 +gl.INT = 0x1404 +gl.INT_10_10_10_2_OES = 0x8df7 +gl.INT_VEC2 = 0x8b53 +gl.INT_VEC3 = 0x8b54 +gl.INT_VEC4 = 0x8b55 +gl.INVALID_ENUM = 0x500 +gl.INVALID_FRAMEBUFFER_OPERATION = 0x506 +gl.INVALID_OPERATION = 0x502 +gl.INVALID_VALUE = 0x501 +gl.INVERT = 0x150a +gl.KEEP = 0x1e00 +gl.KHR_debug = 0x1 +gl.KHR_texture_compression_astc_ldr = 0x1 +gl.LEQUAL = 0x203 +gl.LESS = 0x201 +gl.LINEAR = 0x2601 +gl.LINEAR_MIPMAP_LINEAR = 0x2703 +gl.LINEAR_MIPMAP_NEAREST = 0x2701 +gl.LINES = 0x1 +gl.LINE_LOOP = 0x2 +gl.LINE_STRIP = 0x3 +gl.LINE_WIDTH = 0xb21 +gl.LINK_STATUS = 0x8b82 +gl.LOSE_CONTEXT_ON_RESET_EXT = 0x8252 +gl.LOW_FLOAT = 0x8df0 +gl.LOW_INT = 0x8df3 +gl.LUMINANCE = 0x1909 +gl.LUMINANCE16F_EXT = 0x881e +gl.LUMINANCE32F_EXT = 0x8818 +gl.LUMINANCE4_ALPHA4_OES = 0x8043 +gl.LUMINANCE8_ALPHA8_EXT = 0x8045 +gl.LUMINANCE8_ALPHA8_OES = 0x8045 +gl.LUMINANCE8_EXT = 0x8040 +gl.LUMINANCE8_OES = 0x8040 +gl.LUMINANCE_ALPHA = 0x190a +gl.LUMINANCE_ALPHA16F_EXT = 0x881f +gl.LUMINANCE_ALPHA32F_EXT = 0x8819 +gl.MALI_PROGRAM_BINARY_ARM = 0x8f61 +gl.MALI_SHADER_BINARY_ARM = 0x8f60 +gl.MAP_FLUSH_EXPLICIT_BIT_EXT = 0x10 +gl.MAP_INVALIDATE_BUFFER_BIT_EXT = 0x8 +gl.MAP_INVALIDATE_RANGE_BIT_EXT = 0x4 +gl.MAP_READ_BIT_EXT = 0x1 +gl.MAP_UNSYNCHRONIZED_BIT_EXT = 0x20 +gl.MAP_WRITE_BIT_EXT = 0x2 +gl.MAX_3D_TEXTURE_SIZE_OES = 0x8073 +gl.MAX_COLOR_ATTACHMENTS_NV = 0x8cdf +gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8b4d +gl.MAX_CUBE_MAP_TEXTURE_SIZE = 0x851c +gl.MAX_DEBUG_GROUP_STACK_DEPTH = 0x826c +gl.MAX_DEBUG_LOGGED_MESSAGES = 0x9144 +gl.MAX_DEBUG_MESSAGE_LENGTH = 0x9143 +gl.MAX_DRAW_BUFFERS_NV = 0x8824 +gl.MAX_EXT = 0x8008 +gl.MAX_FRAGMENT_UNIFORM_VECTORS = 0x8dfd +gl.MAX_LABEL_LENGTH = 0x82e8 +gl.MAX_MULTIVIEW_BUFFERS_EXT = 0x90f2 +gl.MAX_RENDERBUFFER_SIZE = 0x84e8 +gl.MAX_SAMPLES_ANGLE = 0x8d57 +gl.MAX_SAMPLES_APPLE = 0x8d57 +gl.MAX_SAMPLES_EXT = 0x8d57 +gl.MAX_SAMPLES_IMG = 0x9135 +gl.MAX_SAMPLES_NV = 0x8d57 +gl.MAX_SERVER_WAIT_TIMEOUT_APPLE = 0x9111 +gl.MAX_TEXTURE_IMAGE_UNITS = 0x8872 +gl.MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84ff +gl.MAX_TEXTURE_SIZE = 0xd33 +gl.MAX_VARYING_VECTORS = 0x8dfc +gl.MAX_VERTEX_ATTRIBS = 0x8869 +gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8b4c +gl.MAX_VERTEX_UNIFORM_VECTORS = 0x8dfb +gl.MAX_VIEWPORT_DIMS = 0xd3a +gl.MEDIUM_FLOAT = 0x8df1 +gl.MEDIUM_INT = 0x8df4 +gl.MIN_EXT = 0x8007 +gl.MIRRORED_REPEAT = 0x8370 +gl.MULTISAMPLE_BUFFER_BIT0_QCOM = 0x1000000 +gl.MULTISAMPLE_BUFFER_BIT1_QCOM = 0x2000000 +gl.MULTISAMPLE_BUFFER_BIT2_QCOM = 0x4000000 +gl.MULTISAMPLE_BUFFER_BIT3_QCOM = 0x8000000 +gl.MULTISAMPLE_BUFFER_BIT4_QCOM = 0x10000000 +gl.MULTISAMPLE_BUFFER_BIT5_QCOM = 0x20000000 +gl.MULTISAMPLE_BUFFER_BIT6_QCOM = 0x40000000 +gl.MULTISAMPLE_BUFFER_BIT7_QCOM = 0x80000000 +gl.MULTIVIEW_EXT = 0x90f1 +gl.NEAREST = 0x2600 +gl.NEAREST_MIPMAP_LINEAR = 0x2702 +gl.NEAREST_MIPMAP_NEAREST = 0x2700 +gl.NEVER = 0x200 +gl.NICEST = 0x1102 +gl.NONE = 0x0 +gl.NOTEQUAL = 0x205 +gl.NO_ERROR = 0x0 +gl.NO_RESET_NOTIFICATION_EXT = 0x8261 +gl.NUM_COMPRESSED_TEXTURE_FORMATS = 0x86a2 +gl.NUM_PROGRAM_BINARY_FORMATS_OES = 0x87fe +gl.NUM_SHADER_BINARY_FORMATS = 0x8df9 +gl.NV_coverage_sample = 0x1 +gl.NV_depth_nonlinear = 0x1 +gl.NV_draw_buffers = 0x1 +gl.NV_draw_instanced = 0x1 +gl.NV_fbo_color_attachments = 0x1 +gl.NV_fence = 0x1 +gl.NV_framebuffer_blit = 0x1 +gl.NV_framebuffer_multisample = 0x1 +gl.NV_generate_mipmap_sRGB = 0x1 +gl.NV_instanced_arrays = 0x1 +gl.NV_read_buffer = 0x1 +gl.NV_read_buffer_front = 0x1 +gl.NV_read_depth = 0x1 +gl.NV_read_depth_stencil = 0x1 +gl.NV_read_stencil = 0x1 +gl.NV_sRGB_formats = 0x1 +gl.NV_shadow_samplers_array = 0x1 +gl.NV_shadow_samplers_cube = 0x1 +gl.NV_texture_border_clamp = 0x1 +gl.NV_texture_compression_s3tc_update = 0x1 +gl.NV_texture_npot_2D_mipmap = 0x1 +gl.OBJECT_TYPE_APPLE = 0x9112 +gl.OES_EGL_image = 0x1 +gl.OES_EGL_image_external = 0x1 +gl.OES_compressed_ETC1_RGB8_texture = 0x1 +gl.OES_compressed_paletted_texture = 0x1 +gl.OES_depth24 = 0x1 +gl.OES_depth32 = 0x1 +gl.OES_depth_texture = 0x1 +gl.OES_element_index_uint = 0x1 +gl.OES_fbo_render_mipmap = 0x1 +gl.OES_fragment_precision_high = 0x1 +gl.OES_get_program_binary = 0x1 +gl.OES_mapbuffer = 0x1 +gl.OES_packed_depth_stencil = 0x1 +gl.OES_required_internalformat = 0x1 +gl.OES_rgb8_rgba8 = 0x1 +gl.OES_standard_derivatives = 0x1 +gl.OES_stencil1 = 0x1 +gl.OES_stencil4 = 0x1 +gl.OES_surfaceless_context = 0x1 +gl.OES_texture_3D = 0x1 +gl.OES_texture_float = 0x1 +gl.OES_texture_float_linear = 0x1 +gl.OES_texture_half_float = 0x1 +gl.OES_texture_half_float_linear = 0x1 +gl.OES_texture_npot = 0x1 +gl.OES_vertex_array_object = 0x1 +gl.OES_vertex_half_float = 0x1 +gl.OES_vertex_type_10_10_10_2 = 0x1 +gl.ONE = 0x1 +gl.ONE_MINUS_CONSTANT_ALPHA = 0x8004 +gl.ONE_MINUS_CONSTANT_COLOR = 0x8002 +gl.ONE_MINUS_DST_ALPHA = 0x305 +gl.ONE_MINUS_DST_COLOR = 0x307 +gl.ONE_MINUS_SRC_ALPHA = 0x303 +gl.ONE_MINUS_SRC_COLOR = 0x301 +gl.OUT_OF_MEMORY = 0x505 +gl.PACK_ALIGNMENT = 0xd05 +gl.PACK_REVERSE_ROW_ORDER_ANGLE = 0x93a4 +gl.PALETTE4_R5_G6_B5_OES = 0x8b92 +gl.PALETTE4_RGB5_A1_OES = 0x8b94 +gl.PALETTE4_RGB8_OES = 0x8b90 +gl.PALETTE4_RGBA4_OES = 0x8b93 +gl.PALETTE4_RGBA8_OES = 0x8b91 +gl.PALETTE8_R5_G6_B5_OES = 0x8b97 +gl.PALETTE8_RGB5_A1_OES = 0x8b99 +gl.PALETTE8_RGB8_OES = 0x8b95 +gl.PALETTE8_RGBA4_OES = 0x8b98 +gl.PALETTE8_RGBA8_OES = 0x8b96 +gl.PERCENTAGE_AMD = 0x8bc3 +gl.PERFMON_GLOBAL_MODE_QCOM = 0x8fa0 +gl.PERFMON_RESULT_AMD = 0x8bc6 +gl.PERFMON_RESULT_AVAILABLE_AMD = 0x8bc4 +gl.PERFMON_RESULT_SIZE_AMD = 0x8bc5 +gl.POINTS = 0x0 +gl.POLYGON_OFFSET_FACTOR = 0x8038 +gl.POLYGON_OFFSET_FILL = 0x8037 +gl.POLYGON_OFFSET_UNITS = 0x2a00 +gl.PROGRAM = 0x82e2 +gl.PROGRAM_BINARY_ANGLE = 0x93a6 +gl.PROGRAM_BINARY_FORMATS_OES = 0x87ff +gl.PROGRAM_BINARY_LENGTH_OES = 0x8741 +gl.PROGRAM_OBJECT_EXT = 0x8b40 +gl.PROGRAM_PIPELINE_BINDING_EXT = 0x825a +gl.PROGRAM_PIPELINE_OBJECT_EXT = 0x8a4f +gl.PROGRAM_SEPARABLE_EXT = 0x8258 +gl.QCOM_alpha_test = 0x1 +gl.QCOM_binning_control = 0x1 +gl.QCOM_driver_control = 0x1 +gl.QCOM_extended_get = 0x1 +gl.QCOM_extended_get2 = 0x1 +gl.QCOM_perfmon_global_mode = 0x1 +gl.QCOM_tiled_rendering = 0x1 +gl.QCOM_writeonly_rendering = 0x1 +gl.QUERY = 0x82e3 +gl.QUERY_OBJECT_EXT = 0x9153 +gl.QUERY_RESULT_AVAILABLE_EXT = 0x8867 +gl.QUERY_RESULT_EXT = 0x8866 +gl.R16F_EXT = 0x822d +gl.R32F_EXT = 0x822e +gl.R8_EXT = 0x8229 +gl.READ_BUFFER_EXT = 0xc02 +gl.READ_BUFFER_NV = 0xc02 +gl.READ_FRAMEBUFFER_ANGLE = 0x8ca8 +gl.READ_FRAMEBUFFER_APPLE = 0x8ca8 +gl.READ_FRAMEBUFFER_BINDING_ANGLE = 0x8caa +gl.READ_FRAMEBUFFER_BINDING_APPLE = 0x8caa +gl.READ_FRAMEBUFFER_BINDING_NV = 0x8caa +gl.READ_FRAMEBUFFER_NV = 0x8ca8 +gl.RED_BITS = 0xd52 +gl.RED_EXT = 0x1903 +gl.RENDERBUFFER = 0x8d41 +gl.RENDERBUFFER_ALPHA_SIZE = 0x8d53 +gl.RENDERBUFFER_BINDING = 0x8ca7 +gl.RENDERBUFFER_BLUE_SIZE = 0x8d52 +gl.RENDERBUFFER_DEPTH_SIZE = 0x8d54 +gl.RENDERBUFFER_GREEN_SIZE = 0x8d51 +gl.RENDERBUFFER_HEIGHT = 0x8d43 +gl.RENDERBUFFER_INTERNAL_FORMAT = 0x8d44 +gl.RENDERBUFFER_RED_SIZE = 0x8d50 +gl.RENDERBUFFER_SAMPLES_ANGLE = 0x8cab +gl.RENDERBUFFER_SAMPLES_APPLE = 0x8cab +gl.RENDERBUFFER_SAMPLES_EXT = 0x8cab +gl.RENDERBUFFER_SAMPLES_IMG = 0x9133 +gl.RENDERBUFFER_SAMPLES_NV = 0x8cab +gl.RENDERBUFFER_STENCIL_SIZE = 0x8d55 +gl.RENDERBUFFER_WIDTH = 0x8d42 +gl.RENDERER = 0x1f01 +gl.RENDER_DIRECT_TO_FRAMEBUFFER_QCOM = 0x8fb3 +gl.REPEAT = 0x2901 +gl.REPLACE = 0x1e01 +gl.REQUIRED_TEXTURE_IMAGE_UNITS_OES = 0x8d68 +gl.RESET_NOTIFICATION_STRATEGY_EXT = 0x8256 +gl.RG16F_EXT = 0x822f +gl.RG32F_EXT = 0x8230 +gl.RG8_EXT = 0x822b +gl.RGB = 0x1907 +gl.RGB10_A2_EXT = 0x8059 +gl.RGB10_EXT = 0x8052 +gl.RGB16F_EXT = 0x881b +gl.RGB32F_EXT = 0x8815 +gl.RGB565 = 0x8d62 +gl.RGB565_OES = 0x8d62 +gl.RGB5_A1 = 0x8057 +gl.RGB5_A1_OES = 0x8057 +gl.RGB8_OES = 0x8051 +gl.RGBA = 0x1908 +gl.RGBA16F_EXT = 0x881a +gl.RGBA32F_EXT = 0x8814 +gl.RGBA4 = 0x8056 +gl.RGBA4_OES = 0x8056 +gl.RGBA8_OES = 0x8058 +gl.RGB_422_APPLE = 0x8a1f +gl.RG_EXT = 0x8227 +gl.SAMPLER = 0x82e6 +gl.SAMPLER_2D = 0x8b5e +gl.SAMPLER_2D_ARRAY_SHADOW_NV = 0x8dc4 +gl.SAMPLER_2D_SHADOW_EXT = 0x8b62 +gl.SAMPLER_3D_OES = 0x8b5f +gl.SAMPLER_CUBE = 0x8b60 +gl.SAMPLER_CUBE_SHADOW_NV = 0x8dc5 +gl.SAMPLER_EXTERNAL_OES = 0x8d66 +gl.SAMPLES = 0x80a9 +gl.SAMPLE_ALPHA_TO_COVERAGE = 0x809e +gl.SAMPLE_BUFFERS = 0x80a8 +gl.SAMPLE_COVERAGE = 0x80a0 +gl.SAMPLE_COVERAGE_INVERT = 0x80ab +gl.SAMPLE_COVERAGE_VALUE = 0x80aa +gl.SCISSOR_BOX = 0xc10 +gl.SCISSOR_TEST = 0xc11 +gl.SGX_BINARY_IMG = 0x8c0a +gl.SGX_PROGRAM_BINARY_IMG = 0x9130 +gl.SHADER = 0x82e1 +gl.SHADER_BINARY_DMP = 0x9250 +gl.SHADER_BINARY_FORMATS = 0x8df8 +gl.SHADER_BINARY_VIV = 0x8fc4 +gl.SHADER_COMPILER = 0x8dfa +gl.SHADER_OBJECT_EXT = 0x8b48 +gl.SHADER_SOURCE_LENGTH = 0x8b88 +gl.SHADER_TYPE = 0x8b4f +gl.SHADING_LANGUAGE_VERSION = 0x8b8c +gl.SHORT = 0x1402 +gl.SIGNALED_APPLE = 0x9119 +gl.SLUMINANCE8_ALPHA8_NV = 0x8c45 +gl.SLUMINANCE8_NV = 0x8c47 +gl.SLUMINANCE_ALPHA_NV = 0x8c44 +gl.SLUMINANCE_NV = 0x8c46 +gl.SRC_ALPHA = 0x302 +gl.SRC_ALPHA_SATURATE = 0x308 +gl.SRC_COLOR = 0x300 +gl.SRGB8_ALPHA8_EXT = 0x8c43 +gl.SRGB8_NV = 0x8c41 +gl.SRGB_ALPHA_EXT = 0x8c42 +gl.SRGB_EXT = 0x8c40 +gl.STACK_OVERFLOW = 0x503 +gl.STACK_UNDERFLOW = 0x504 +gl.STATE_RESTORE = 0x8bdc +gl.STATIC_DRAW = 0x88e4 +gl.STENCIL_ATTACHMENT = 0x8d20 +gl.STENCIL_BACK_FAIL = 0x8801 +gl.STENCIL_BACK_FUNC = 0x8800 +gl.STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802 +gl.STENCIL_BACK_PASS_DEPTH_PASS = 0x8803 +gl.STENCIL_BACK_REF = 0x8ca3 +gl.STENCIL_BACK_VALUE_MASK = 0x8ca4 +gl.STENCIL_BACK_WRITEMASK = 0x8ca5 +gl.STENCIL_BITS = 0xd57 +gl.STENCIL_BUFFER_BIT = 0x400 +gl.STENCIL_BUFFER_BIT0_QCOM = 0x10000 +gl.STENCIL_BUFFER_BIT1_QCOM = 0x20000 +gl.STENCIL_BUFFER_BIT2_QCOM = 0x40000 +gl.STENCIL_BUFFER_BIT3_QCOM = 0x80000 +gl.STENCIL_BUFFER_BIT4_QCOM = 0x100000 +gl.STENCIL_BUFFER_BIT5_QCOM = 0x200000 +gl.STENCIL_BUFFER_BIT6_QCOM = 0x400000 +gl.STENCIL_BUFFER_BIT7_QCOM = 0x800000 +gl.STENCIL_CLEAR_VALUE = 0xb91 +gl.STENCIL_EXT = 0x1802 +gl.STENCIL_FAIL = 0xb94 +gl.STENCIL_FUNC = 0xb92 +gl.STENCIL_INDEX1_OES = 0x8d46 +gl.STENCIL_INDEX4_OES = 0x8d47 +gl.STENCIL_INDEX8 = 0x8d48 +gl.STENCIL_PASS_DEPTH_FAIL = 0xb95 +gl.STENCIL_PASS_DEPTH_PASS = 0xb96 +gl.STENCIL_REF = 0xb97 +gl.STENCIL_TEST = 0xb90 +gl.STENCIL_VALUE_MASK = 0xb93 +gl.STENCIL_WRITEMASK = 0xb98 +gl.STREAM_DRAW = 0x88e0 +gl.SUBPIXEL_BITS = 0xd50 +gl.SYNC_CONDITION_APPLE = 0x9113 +gl.SYNC_FENCE_APPLE = 0x9116 +gl.SYNC_FLAGS_APPLE = 0x9115 +gl.SYNC_FLUSH_COMMANDS_BIT_APPLE = 0x1 +gl.SYNC_GPU_COMMANDS_COMPLETE_APPLE = 0x9117 +gl.SYNC_OBJECT_APPLE = 0x8a53 +gl.SYNC_STATUS_APPLE = 0x9114 +gl.TEXTURE = 0x1702 +gl.TEXTURE0 = 0x84c0 +gl.TEXTURE1 = 0x84c1 +gl.TEXTURE10 = 0x84ca +gl.TEXTURE11 = 0x84cb +gl.TEXTURE12 = 0x84cc +gl.TEXTURE13 = 0x84cd +gl.TEXTURE14 = 0x84ce +gl.TEXTURE15 = 0x84cf +gl.TEXTURE16 = 0x84d0 +gl.TEXTURE17 = 0x84d1 +gl.TEXTURE18 = 0x84d2 +gl.TEXTURE19 = 0x84d3 +gl.TEXTURE2 = 0x84c2 +gl.TEXTURE20 = 0x84d4 +gl.TEXTURE21 = 0x84d5 +gl.TEXTURE22 = 0x84d6 +gl.TEXTURE23 = 0x84d7 +gl.TEXTURE24 = 0x84d8 +gl.TEXTURE25 = 0x84d9 +gl.TEXTURE26 = 0x84da +gl.TEXTURE27 = 0x84db +gl.TEXTURE28 = 0x84dc +gl.TEXTURE29 = 0x84dd +gl.TEXTURE3 = 0x84c3 +gl.TEXTURE30 = 0x84de +gl.TEXTURE31 = 0x84df +gl.TEXTURE4 = 0x84c4 +gl.TEXTURE5 = 0x84c5 +gl.TEXTURE6 = 0x84c6 +gl.TEXTURE7 = 0x84c7 +gl.TEXTURE8 = 0x84c8 +gl.TEXTURE9 = 0x84c9 +gl.TEXTURE_2D = 0xde1 +gl.TEXTURE_3D_OES = 0x806f +gl.TEXTURE_BINDING_2D = 0x8069 +gl.TEXTURE_BINDING_3D_OES = 0x806a +gl.TEXTURE_BINDING_CUBE_MAP = 0x8514 +gl.TEXTURE_BINDING_EXTERNAL_OES = 0x8d67 +gl.TEXTURE_BORDER_COLOR_NV = 0x1004 +gl.TEXTURE_COMPARE_FUNC_EXT = 0x884d +gl.TEXTURE_COMPARE_MODE_EXT = 0x884c +gl.TEXTURE_CUBE_MAP = 0x8513 +gl.TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516 +gl.TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518 +gl.TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851a +gl.TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515 +gl.TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517 +gl.TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519 +gl.TEXTURE_DEPTH_QCOM = 0x8bd4 +gl.TEXTURE_EXTERNAL_OES = 0x8d65 +gl.TEXTURE_FORMAT_QCOM = 0x8bd6 +gl.TEXTURE_HEIGHT_QCOM = 0x8bd3 +gl.TEXTURE_IMAGE_VALID_QCOM = 0x8bd8 +gl.TEXTURE_IMMUTABLE_FORMAT_EXT = 0x912f +gl.TEXTURE_INTERNAL_FORMAT_QCOM = 0x8bd5 +gl.TEXTURE_MAG_FILTER = 0x2800 +gl.TEXTURE_MAX_ANISOTROPY_EXT = 0x84fe +gl.TEXTURE_MAX_LEVEL_APPLE = 0x813d +gl.TEXTURE_MIN_FILTER = 0x2801 +gl.TEXTURE_NUM_LEVELS_QCOM = 0x8bd9 +gl.TEXTURE_OBJECT_VALID_QCOM = 0x8bdb +gl.TEXTURE_SAMPLES_IMG = 0x9136 +gl.TEXTURE_TARGET_QCOM = 0x8bda +gl.TEXTURE_TYPE_QCOM = 0x8bd7 +gl.TEXTURE_USAGE_ANGLE = 0x93a2 +gl.TEXTURE_WIDTH_QCOM = 0x8bd2 +gl.TEXTURE_WRAP_R_OES = 0x8072 +gl.TEXTURE_WRAP_S = 0x2802 +gl.TEXTURE_WRAP_T = 0x2803 +gl.TIMEOUT_EXPIRED_APPLE = 0x911b +gl.TIMEOUT_IGNORED_APPLE = 0xffffffffffffffff +gl.TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE = 0x93a0 +gl.TRIANGLES = 0x4 +gl.TRIANGLE_FAN = 0x6 +gl.TRIANGLE_STRIP = 0x5 +gl.TRUE = 0x1 +gl.UNKNOWN_CONTEXT_RESET_EXT = 0x8255 +gl.UNPACK_ALIGNMENT = 0xcf5 +gl.UNPACK_ROW_LENGTH = 0xcf2 +gl.UNPACK_SKIP_PIXELS = 0xcf4 +gl.UNPACK_SKIP_ROWS = 0xcf3 +gl.UNSIGNALED_APPLE = 0x9118 +gl.UNSIGNED_BYTE = 0x1401 +gl.UNSIGNED_INT = 0x1405 +gl.UNSIGNED_INT64_AMD = 0x8bc2 +gl.UNSIGNED_INT_10_10_10_2_OES = 0x8df6 +gl.UNSIGNED_INT_24_8_OES = 0x84fa +gl.UNSIGNED_INT_2_10_10_10_REV_EXT = 0x8368 +gl.UNSIGNED_NORMALIZED_EXT = 0x8c17 +gl.UNSIGNED_SHORT = 0x1403 +gl.UNSIGNED_SHORT_1_5_5_5_REV_EXT = 0x8366 +gl.UNSIGNED_SHORT_4_4_4_4 = 0x8033 +gl.UNSIGNED_SHORT_4_4_4_4_REV_EXT = 0x8365 +gl.UNSIGNED_SHORT_4_4_4_4_REV_IMG = 0x8365 +gl.UNSIGNED_SHORT_5_5_5_1 = 0x8034 +gl.UNSIGNED_SHORT_5_6_5 = 0x8363 +gl.UNSIGNED_SHORT_8_8_APPLE = 0x85ba +gl.UNSIGNED_SHORT_8_8_REV_APPLE = 0x85bb +gl.VALIDATE_STATUS = 0x8b83 +gl.VENDOR = 0x1f00 +gl.VERSION = 0x1f02 +gl.VERTEX_ARRAY_BINDING_OES = 0x85b5 +gl.VERTEX_ARRAY_OBJECT_EXT = 0x9154 +gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889f +gl.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88fe +gl.VERTEX_ATTRIB_ARRAY_DIVISOR_NV = 0x88fe +gl.VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622 +gl.VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886a +gl.VERTEX_ATTRIB_ARRAY_POINTER = 0x8645 +gl.VERTEX_ATTRIB_ARRAY_SIZE = 0x8623 +gl.VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624 +gl.VERTEX_ATTRIB_ARRAY_TYPE = 0x8625 +gl.VERTEX_SHADER = 0x8b31 +gl.VERTEX_SHADER_BIT_EXT = 0x1 +gl.VIEWPORT = 0xba2 +gl.VIV_shader_binary = 0x1 +gl.WAIT_FAILED_APPLE = 0x911d +gl.WRITEONLY_RENDERING_QCOM = 0x8823 +gl.WRITE_ONLY_OES = 0x88b9 +gl.Z400_BINARY_AMD = 0x8740 +gl.ZERO = 0x0 +gl.VERTEX_ATTRIB_POINTER_VEC3 = 0 +gl.VERTEX_ATTRIB_POINTER_COLOR4B = 1 diff --git a/src/cocos/cocos2d/bitExtend.lua b/src/cocos/cocos2d/bitExtend.lua new file mode 100644 index 0000000..fe024aa --- /dev/null +++ b/src/cocos/cocos2d/bitExtend.lua @@ -0,0 +1,96 @@ +-- bit operation + +bit = bit or {} +bit.data32 = {} + +for i=1,32 do + bit.data32[i]=2^(32-i) +end + +function bit._b2d(arg) + local nr=0 + for i=1,32 do + if arg[i] ==1 then + nr=nr+bit.data32[i] + end + end + return nr +end + +function bit._d2b(arg) + arg = arg >= 0 and arg or (0xFFFFFFFF + arg + 1) + local tr={} + for i=1,32 do + if arg >= bit.data32[i] then + tr[i]=1 + arg=arg-bit.data32[i] + else + tr[i]=0 + end + end + return tr +end + +function bit._and(a,b) + local op1=bit._d2b(a) + local op2=bit._d2b(b) + local r={} + + for i=1,32 do + if op1[i]==1 and op2[i]==1 then + r[i]=1 + else + r[i]=0 + end + end + return bit._b2d(r) + +end + +function bit._rshift(a,n) + local op1=bit._d2b(a) + n = n <= 32 and n or 32 + n = n >= 0 and n or 0 + + for i=32, n+1, -1 do + op1[i] = op1[i-n] + end + for i=1, n do + op1[i] = 0 + end + + return bit._b2d(op1) +end + +function bit._not(a) + local op1=bit._d2b(a) + local r={} + + for i=1,32 do + if op1[i]==1 then + r[i]=0 + else + r[i]=1 + end + end + return bit._b2d(r) +end + +function bit._or(a,b) + local op1=bit._d2b(a) + local op2=bit._d2b(b) + local r={} + + for i=1,32 do + if op1[i]==1 or op2[i]==1 then + r[i]=1 + else + r[i]=0 + end + end + return bit._b2d(r) +end + +bit.band = bit.band or bit._and +bit.rshift = bit.rshift or bit._rshift +bit.bnot = bit.bnot or bit._not diff --git a/src/cocos/cocos2d/deprecated.lua b/src/cocos/cocos2d/deprecated.lua new file mode 100644 index 0000000..9c82fa8 --- /dev/null +++ b/src/cocos/cocos2d/deprecated.lua @@ -0,0 +1,15 @@ + +function schedule(node, callback, delay) + local delay = cc.DelayTime:create(delay) + local sequence = cc.Sequence:create(delay, cc.CallFunc:create(callback)) + local action = cc.RepeatForever:create(sequence) + node:runAction(action) + return action +end + +function performWithDelay(node, callback, delay) + local delay = cc.DelayTime:create(delay) + local sequence = cc.Sequence:create(delay, cc.CallFunc:create(callback)) + node:runAction(sequence) + return sequence +end diff --git a/src/cocos/cocos2d/functions.lua b/src/cocos/cocos2d/functions.lua new file mode 100644 index 0000000..24a54f2 --- /dev/null +++ b/src/cocos/cocos2d/functions.lua @@ -0,0 +1,633 @@ +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +function printLog(tag, fmt, ...) + local t = { + "[", + string.upper(tostring(tag)), + "] ", + string.format(tostring(fmt), ...) + } + print(table.concat(t)) +end + +function printError(fmt, ...) + printLog("ERR", fmt, ...) + print(debug.traceback("", 2)) +end + +function printInfo(fmt, ...) + if type(DEBUG) ~= "number" or DEBUG < 2 then return end + printLog("INFO", fmt, ...) +end + +local function dump_value_(v) + if type(v) == "string" then + v = "\"" .. v .. "\"" + end + return tostring(v) +end + +function dump(value, desciption, nesting) + if type(nesting) ~= "number" then nesting = 3 end + + local lookupTable = {} + local result = {} + + local traceback = string.split(debug.traceback("", 2), "\n") + print("dump from: " .. string.trim(traceback[3])) + + local function dump_(value, desciption, indent, nest, keylen) + desciption = desciption or "" + local spc = "" + if type(keylen) == "number" then + spc = string.rep(" ", keylen - string.len(dump_value_(desciption))) + end + if type(value) ~= "table" then + result[#result +1 ] = string.format("%s%s%s = %s", indent, dump_value_(desciption), spc, dump_value_(value)) + elseif lookupTable[tostring(value)] then + result[#result +1 ] = string.format("%s%s%s = *REF*", indent, dump_value_(desciption), spc) + else + lookupTable[tostring(value)] = true + if nest > nesting then + result[#result +1 ] = string.format("%s%s = *MAX NESTING*", indent, dump_value_(desciption)) + else + result[#result +1 ] = string.format("%s%s = {", indent, dump_value_(desciption)) + local indent2 = indent.." " + local keys = {} + local keylen = 0 + local values = {} + for k, v in pairs(value) do + keys[#keys + 1] = k + local vk = dump_value_(k) + local vkl = string.len(vk) + if vkl > keylen then keylen = vkl end + values[k] = v + end + table.sort(keys, function(a, b) + if type(a) == "number" and type(b) == "number" then + return a < b + else + return tostring(a) < tostring(b) + end + end) + for i, k in ipairs(keys) do + dump_(values[k], k, indent2, nest + 1, keylen) + end + result[#result +1] = string.format("%s}", indent) + end + end + end + dump_(value, desciption, "- ", 1) + + for i, line in ipairs(result) do + print(line) + end +end + +function printf(fmt, ...) + print(string.format(tostring(fmt), ...)) +end + +function checknumber(value, base) + return tonumber(value, base) or 0 +end + +function checkint(value) + return math.round(checknumber(value)) +end + +function checkbool(value) + return (value ~= nil and value ~= false) +end + +function checktable(value) + if type(value) ~= "table" then value = {} end + return value +end + +function isset(hashtable, key) + local t = type(hashtable) + return (t == "table" or t == "userdata") and hashtable[key] ~= nil +end + +local setmetatableindex_ +setmetatableindex_ = function(t, index) + if type(t) == "userdata" then + local peer = tolua.getpeer(t) + if not peer then + peer = {} + tolua.setpeer(t, peer) + end + setmetatableindex_(peer, index) + else + local mt = getmetatable(t) + if not mt then mt = {} end + if not mt.__index then + mt.__index = index + setmetatable(t, mt) + elseif mt.__index ~= index then + setmetatableindex_(mt, index) + end + end +end +setmetatableindex = setmetatableindex_ + +function clone(object) + local lookup_table = {} + local function _copy(object) + if type(object) ~= "table" then + return object + elseif lookup_table[object] then + return lookup_table[object] + end + local newObject = {} + lookup_table[object] = newObject + for key, value in pairs(object) do + newObject[_copy(key)] = _copy(value) + end + return setmetatable(newObject, getmetatable(object)) + end + return _copy(object) +end + +function class(classname, ...) + local cls = {__cname = classname} + + local supers = {...} + for _, super in ipairs(supers) do + local superType = type(super) + assert(superType == "nil" or superType == "table" or superType == "function", + string.format("class() - create class \"%s\" with invalid super class type \"%s\"", + classname, superType)) + + if superType == "function" then + assert(cls.__create == nil, + string.format("class() - create class \"%s\" with more than one creating function", + classname)); + -- if super is function, set it to __create + cls.__create = super + elseif superType == "table" then + if super[".isclass"] then + -- super is native class + assert(cls.__create == nil, + string.format("class() - create class \"%s\" with more than one creating function or native class", + classname)); + cls.__create = function() return super:create() end + else + -- super is pure lua class + cls.__supers = cls.__supers or {} + cls.__supers[#cls.__supers + 1] = super + if not cls.super then + -- set first super pure lua class as class.super + cls.super = super + end + end + else + error(string.format("class() - create class \"%s\" with invalid super type", + classname), 0) + end + end + + cls.__index = cls + if not cls.__supers or #cls.__supers == 1 then + setmetatable(cls, {__index = cls.super}) + else + setmetatable(cls, {__index = function(_, key) + local supers = cls.__supers + for i = 1, #supers do + local super = supers[i] + if super[key] then return super[key] end + end + end}) + end + + if not cls.ctor then + -- add default constructor + cls.ctor = function() end + end + cls.new = function(...) + local instance + if cls.__create then + instance = cls.__create(...) + else + instance = {} + end + setmetatableindex(instance, cls) + instance.class = cls + instance:ctor(...) + return instance + end + cls.create = function(_, ...) + return cls.new(...) + end + + return cls +end + +local iskindof_ +iskindof_ = function(cls, name) + local __index = rawget(cls, "__index") + if type(__index) == "table" and rawget(__index, "__cname") == name then return true end + + if rawget(cls, "__cname") == name then return true end + local __supers = rawget(cls, "__supers") + if not __supers then return false end + for _, super in ipairs(__supers) do + if iskindof_(super, name) then return true end + end + return false +end + +function iskindof(obj, classname) + local t = type(obj) + if t ~= "table" and t ~= "userdata" then return false end + + local mt + if t == "userdata" then + if tolua.iskindof(obj, classname) then return true end + mt = tolua.getpeer(obj) + else + mt = getmetatable(obj) + end + if mt then + return iskindof_(mt, classname) + end + return false +end + +function import(moduleName, currentModuleName) + local currentModuleNameParts + local moduleFullName = moduleName + local offset = 1 + + while true do + if string.byte(moduleName, offset) ~= 46 then -- . + moduleFullName = string.sub(moduleName, offset) + if currentModuleNameParts and #currentModuleNameParts > 0 then + moduleFullName = table.concat(currentModuleNameParts, ".") .. "." .. moduleFullName + end + break + end + offset = offset + 1 + + if not currentModuleNameParts then + if not currentModuleName then + local n,v = debug.getlocal(3, 1) + currentModuleName = v + end + + currentModuleNameParts = string.split(currentModuleName, ".") + end + table.remove(currentModuleNameParts, #currentModuleNameParts) + end + + return require(moduleFullName) +end + +function handler(obj, method) + return function(...) + return method(obj, ...) + end +end + +function math.newrandomseed() + local ok, socket = pcall(function() + return require("socket") + end) + + if ok then + math.randomseed(socket.gettime() * 1000) + else + math.randomseed(os.time()) + end + math.random() + math.random() + math.random() + math.random() +end + +function math.round(value) + value = checknumber(value) + return math.floor(value + 0.5) +end + +local pi_div_180 = math.pi / 180 +function math.angle2radian(angle) + return angle * pi_div_180 +end + +local pi_mul_180 = math.pi * 180 +function math.radian2angle(radian) + return radian / pi_mul_180 +end + +function io.exists(path) + local file = io.open(path, "r") + if file then + io.close(file) + return true + end + return false +end + +function io.readfile(path) + local file = io.open(path, "r") + if file then + local content = file:read("*a") + io.close(file) + return content + end + return nil +end + +function io.writefile(path, content, mode) + mode = mode or "w+b" + local file = io.open(path, mode) + if file then + if file:write(content) == nil then return false end + io.close(file) + return true + else + return false + end +end + +function io.pathinfo(path) + local pos = string.len(path) + local extpos = pos + 1 + while pos > 0 do + local b = string.byte(path, pos) + if b == 46 then -- 46 = char "." + extpos = pos + elseif b == 47 then -- 47 = char "/" + break + end + pos = pos - 1 + end + + local dirname = string.sub(path, 1, pos) + local filename = string.sub(path, pos + 1) + extpos = extpos - pos + local basename = string.sub(filename, 1, extpos - 1) + local extname = string.sub(filename, extpos) + return { + dirname = dirname, + filename = filename, + basename = basename, + extname = extname + } +end + +function io.filesize(path) + local size = false + local file = io.open(path, "r") + if file then + local current = file:seek() + size = file:seek("end") + file:seek("set", current) + io.close(file) + end + return size +end + +function table.nums(t) + local count = 0 + for k, v in pairs(t) do + count = count + 1 + end + return count +end + +function table.keys(hashtable) + local keys = {} + for k, v in pairs(hashtable) do + keys[#keys + 1] = k + end + return keys +end + +function table.values(hashtable) + local values = {} + for k, v in pairs(hashtable) do + values[#values + 1] = v + end + return values +end + +function table.merge(dest, src) + for k, v in pairs(src) do + dest[k] = v + end +end + +function table.insertto(dest, src, begin) + begin = checkint(begin) + if begin <= 0 then + begin = #dest + 1 + end + + local len = #src + for i = 0, len - 1 do + dest[i + begin] = src[i + 1] + end +end + +function table.indexof(array, value, begin) + for i = begin or 1, #array do + if array[i] == value then return i end + end + return false +end + +function table.keyof(hashtable, value) + for k, v in pairs(hashtable) do + if v == value then return k end + end + return nil +end + +function table.removebyvalue(array, value, removeall) + local c, i, max = 0, 1, #array + while i <= max do + if array[i] == value then + table.remove(array, i) + c = c + 1 + i = i - 1 + max = max - 1 + if not removeall then break end + end + i = i + 1 + end + return c +end + +function table.map(t, fn) + for k, v in pairs(t) do + t[k] = fn(v, k) + end +end + +function table.walk(t, fn) + for k,v in pairs(t) do + fn(v, k) + end +end + +function table.filter(t, fn) + for k, v in pairs(t) do + if not fn(v, k) then t[k] = nil end + end +end + +function table.unique(t, bArray) + local check = {} + local n = {} + local idx = 1 + for k, v in pairs(t) do + if not check[v] then + if bArray then + n[idx] = v + idx = idx + 1 + else + n[k] = v + end + check[v] = true + end + end + return n +end + +string._htmlspecialchars_set = {} +string._htmlspecialchars_set["&"] = "&" +string._htmlspecialchars_set["\""] = """ +string._htmlspecialchars_set["'"] = "'" +string._htmlspecialchars_set["<"] = "<" +string._htmlspecialchars_set[">"] = ">" + +function string.htmlspecialchars(input) + for k, v in pairs(string._htmlspecialchars_set) do + input = string.gsub(input, k, v) + end + return input +end + +function string.restorehtmlspecialchars(input) + for k, v in pairs(string._htmlspecialchars_set) do + input = string.gsub(input, v, k) + end + return input +end + +function string.nl2br(input) + return string.gsub(input, "\n", "
") +end + +function string.text2html(input) + input = string.gsub(input, "\t", " ") + input = string.htmlspecialchars(input) + input = string.gsub(input, " ", " ") + input = string.nl2br(input) + return input +end + +function string.split(input, delimiter) + input = tostring(input) + delimiter = tostring(delimiter) + if (delimiter=='') then return false end + local pos,arr = 0, {} + -- for each divider found + for st,sp in function() return string.find(input, delimiter, pos, true) end do + table.insert(arr, string.sub(input, pos, st - 1)) + pos = sp + 1 + end + table.insert(arr, string.sub(input, pos)) + return arr +end + +function string.ltrim(input) + return string.gsub(input, "^[ \t\n\r]+", "") +end + +function string.rtrim(input) + return string.gsub(input, "[ \t\n\r]+$", "") +end + +function string.trim(input) + input = string.gsub(input, "^[ \t\n\r]+", "") + return string.gsub(input, "[ \t\n\r]+$", "") +end + +function string.ucfirst(input) + return string.upper(string.sub(input, 1, 1)) .. string.sub(input, 2) +end + +local function urlencodechar(char) + return "%" .. string.format("%02X", string.byte(char)) +end +function string.urlencode(input) + -- convert line endings + input = string.gsub(tostring(input), "\n", "\r\n") + -- escape all characters but alphanumeric, '.' and '-' + input = string.gsub(input, "([^%w%.%- ])", urlencodechar) + -- convert spaces to "+" symbols + return string.gsub(input, " ", "+") +end + +function string.urldecode(input) + input = string.gsub (input, "+", " ") + input = string.gsub (input, "%%(%x%x)", function(h) return string.char(checknumber(h,16)) end) + input = string.gsub (input, "\r\n", "\n") + return input +end + +function string.utf8len(input) + local len = string.len(input) + local left = len + local cnt = 0 + local arr = {0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc} + while left ~= 0 do + local tmp = string.byte(input, -left) + local i = #arr + while arr[i] do + if tmp >= arr[i] then + left = left - i + break + end + i = i - 1 + end + cnt = cnt + 1 + end + return cnt +end + +function string.formatnumberthousands(num) + local formatted = tostring(checknumber(num)) + local k + while true do + formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') + if k == 0 then break end + end + return formatted +end diff --git a/src/cocos/cocos2d/json.lua b/src/cocos/cocos2d/json.lua new file mode 100644 index 0000000..0192c34 --- /dev/null +++ b/src/cocos/cocos2d/json.lua @@ -0,0 +1,376 @@ +----------------------------------------------------------------------------- +-- JSON4Lua: JSON encoding / decoding support for the Lua language. +-- json Module. +-- Author: Craig Mason-Jones +-- Homepage: http://json.luaforge.net/ +-- Version: 0.9.40 +-- This module is released under the MIT License (MIT). +-- Please see LICENCE.txt for details. +-- +-- USAGE: +-- This module exposes two functions: +-- encode(o) +-- Returns the table / string / boolean / number / nil / json.null value as a JSON-encoded string. +-- decode(json_string) +-- Returns a Lua object populated with the data encoded in the JSON string json_string. +-- +-- REQUIREMENTS: +-- compat-5.1 if using Lua 5.0 +-- +-- CHANGELOG +-- 0.9.20 Introduction of local Lua functions for private functions (removed _ function prefix). +-- Fixed Lua 5.1 compatibility issues. +-- Introduced json.null to have null values in associative arrays. +-- encode() performance improvement (more than 50%) through table.concat rather than .. +-- Introduced decode ability to ignore /**/ comments in the JSON string. +-- 0.9.10 Fix to array encoding / decoding to correctly manage nil/null values in arrays. +----------------------------------------------------------------------------- + +----------------------------------------------------------------------------- +-- Imports and dependencies +----------------------------------------------------------------------------- +local math = require('math') +local string = require("string") +local table = require("table") + +local base = _G + +----------------------------------------------------------------------------- +-- Module declaration +----------------------------------------------------------------------------- +module("json") + +-- Public functions + +-- Private functions +local decode_scanArray +local decode_scanComment +local decode_scanConstant +local decode_scanNumber +local decode_scanObject +local decode_scanString +local decode_scanWhitespace +local encodeString +local isArray +local isEncodable + +----------------------------------------------------------------------------- +-- PUBLIC FUNCTIONS +----------------------------------------------------------------------------- +--- Encodes an arbitrary Lua object / variable. +-- @param v The Lua object / variable to be JSON encoded. +-- @return String containing the JSON encoding in internal Lua string format (i.e. not unicode) +function encode (v) + -- Handle nil values + if v==nil then + return "null" + end + + local vtype = base.type(v) + + -- Handle strings + if vtype=='string' then + return '"' .. encodeString(v) .. '"' -- Need to handle encoding in string + end + + -- Handle booleans + if vtype=='number' or vtype=='boolean' then + return base.tostring(v) + end + + -- Handle tables + if vtype=='table' then + local rval = {} + -- Consider arrays separately + local bArray, maxCount = isArray(v) + if bArray then + for i = 1,maxCount do + table.insert(rval, encode(v[i])) + end + else -- An object, not an array + for i,j in base.pairs(v) do + if isEncodable(i) and isEncodable(j) then + table.insert(rval, '"' .. encodeString(i) .. '":' .. encode(j)) + end + end + end + if bArray then + return '[' .. table.concat(rval,',') ..']' + else + return '{' .. table.concat(rval,',') .. '}' + end + end + + -- Handle null values + if vtype=='function' and v==null then + return 'null' + end + + base.assert(false,'encode attempt to encode unsupported type ' .. vtype .. ':' .. base.tostring(v)) +end + + +--- Decodes a JSON string and returns the decoded value as a Lua data structure / value. +-- @param s The string to scan. +-- @param [startPos] Optional starting position where the JSON string is located. Defaults to 1. +-- @param Lua object, number The object that was scanned, as a Lua table / string / number / boolean or nil, +-- and the position of the first character after +-- the scanned JSON object. +function decode(s, startPos) + startPos = startPos and startPos or 1 + startPos = decode_scanWhitespace(s,startPos) + base.assert(startPos<=string.len(s), 'Unterminated JSON encoded object found at position in [' .. s .. ']') + local curChar = string.sub(s,startPos,startPos) + -- Object + if curChar=='{' then + return decode_scanObject(s,startPos) + end + -- Array + if curChar=='[' then + return decode_scanArray(s,startPos) + end + -- Number + if string.find("+-0123456789.e", curChar, 1, true) then + return decode_scanNumber(s,startPos) + end + -- String + if curChar==[["]] or curChar==[[']] then + return decode_scanString(s,startPos) + end + if string.sub(s,startPos,startPos+1)=='/*' then + return decode(s, decode_scanComment(s,startPos)) + end + -- Otherwise, it must be a constant + return decode_scanConstant(s,startPos) +end + +--- The null function allows one to specify a null value in an associative array (which is otherwise +-- discarded if you set the value with 'nil' in Lua. Simply set t = { first=json.null } +function null() + return null -- so json.null() will also return null ;-) +end +----------------------------------------------------------------------------- +-- Internal, PRIVATE functions. +-- Following a Python-like convention, I have prefixed all these 'PRIVATE' +-- functions with an underscore. +----------------------------------------------------------------------------- + +--- Scans an array from JSON into a Lua object +-- startPos begins at the start of the array. +-- Returns the array and the next starting position +-- @param s The string being scanned. +-- @param startPos The starting position for the scan. +-- @return table, int The scanned array as a table, and the position of the next character to scan. +function decode_scanArray(s,startPos) + local array = {} -- The return value + local stringLen = string.len(s) + base.assert(string.sub(s,startPos,startPos)=='[','decode_scanArray called but array does not start at position ' .. startPos .. ' in string:\n'..s ) + startPos = startPos + 1 + -- Infinite loop for array elements + repeat + startPos = decode_scanWhitespace(s,startPos) + base.assert(startPos<=stringLen,'JSON String ended unexpectedly scanning array.') + local curChar = string.sub(s,startPos,startPos) + if (curChar==']') then + return array, startPos+1 + end + if (curChar==',') then + startPos = decode_scanWhitespace(s,startPos+1) + end + base.assert(startPos<=stringLen, 'JSON String ended unexpectedly scanning array.') + object, startPos = decode(s,startPos) + table.insert(array,object) + until false +end + +--- Scans a comment and discards the comment. +-- Returns the position of the next character following the comment. +-- @param string s The JSON string to scan. +-- @param int startPos The starting position of the comment +function decode_scanComment(s, startPos) + base.assert( string.sub(s,startPos,startPos+1)=='/*', "decode_scanComment called but comment does not start at position " .. startPos) + local endPos = string.find(s,'*/',startPos+2) + base.assert(endPos~=nil, "Unterminated comment in string at " .. startPos) + return endPos+2 +end + +--- Scans for given constants: true, false or null +-- Returns the appropriate Lua type, and the position of the next character to read. +-- @param s The string being scanned. +-- @param startPos The position in the string at which to start scanning. +-- @return object, int The object (true, false or nil) and the position at which the next character should be +-- scanned. +function decode_scanConstant(s, startPos) + local consts = { ["true"] = true, ["false"] = false, ["null"] = nil } + local constNames = {"true","false","null"} + + for i,k in base.pairs(constNames) do + --print ("[" .. string.sub(s,startPos, startPos + string.len(k) -1) .."]", k) + if string.sub(s,startPos, startPos + string.len(k) -1 )==k then + return consts[k], startPos + string.len(k) + end + end + base.assert(nil, 'Failed to scan constant from string ' .. s .. ' at starting position ' .. startPos) +end + +--- Scans a number from the JSON encoded string. +-- (in fact, also is able to scan numeric +- eqns, which is not +-- in the JSON spec.) +-- Returns the number, and the position of the next character +-- after the number. +-- @param s The string being scanned. +-- @param startPos The position at which to start scanning. +-- @return number, int The extracted number and the position of the next character to scan. +function decode_scanNumber(s,startPos) + local endPos = startPos+1 + local stringLen = string.len(s) + local acceptableChars = "+-0123456789.e" + while (string.find(acceptableChars, string.sub(s,endPos,endPos), 1, true) + and endPos<=stringLen + ) do + endPos = endPos + 1 + end + local stringValue = 'return ' .. string.sub(s,startPos, endPos-1) + local stringEval = base.loadstring(stringValue) + base.assert(stringEval, 'Failed to scan number [ ' .. stringValue .. '] in JSON string at position ' .. startPos .. ' : ' .. endPos) + return stringEval(), endPos +end + +--- Scans a JSON object into a Lua object. +-- startPos begins at the start of the object. +-- Returns the object and the next starting position. +-- @param s The string being scanned. +-- @param startPos The starting position of the scan. +-- @return table, int The scanned object as a table and the position of the next character to scan. +function decode_scanObject(s,startPos) + local object = {} + local stringLen = string.len(s) + local key, value + base.assert(string.sub(s,startPos,startPos)=='{','decode_scanObject called but object does not start at position ' .. startPos .. ' in string:\n' .. s) + startPos = startPos + 1 + repeat + startPos = decode_scanWhitespace(s,startPos) + base.assert(startPos<=stringLen, 'JSON string ended unexpectedly while scanning object.') + local curChar = string.sub(s,startPos,startPos) + if (curChar=='}') then + return object,startPos+1 + end + if (curChar==',') then + startPos = decode_scanWhitespace(s,startPos+1) + end + base.assert(startPos<=stringLen, 'JSON string ended unexpectedly scanning object.') + -- Scan the key + key, startPos = decode(s,startPos) + base.assert(startPos<=stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key) + startPos = decode_scanWhitespace(s,startPos) + base.assert(startPos<=stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key) + base.assert(string.sub(s,startPos,startPos)==':','JSON object key-value assignment mal-formed at ' .. startPos) + startPos = decode_scanWhitespace(s,startPos+1) + base.assert(startPos<=stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key) + value, startPos = decode(s,startPos) + object[key]=value + until false -- infinite loop while key-value pairs are found +end + +--- Scans a JSON string from the opening inverted comma or single quote to the +-- end of the string. +-- Returns the string extracted as a Lua string, +-- and the position of the next non-string character +-- (after the closing inverted comma or single quote). +-- @param s The string being scanned. +-- @param startPos The starting position of the scan. +-- @return string, int The extracted string as a Lua string, and the next character to parse. +function decode_scanString(s,startPos) + base.assert(startPos, 'decode_scanString(..) called without start position') + local startChar = string.sub(s,startPos,startPos) + base.assert(startChar==[[']] or startChar==[["]],'decode_scanString called for a non-string') + local escaped = false + local endPos = startPos + 1 + local bEnded = false + local stringLen = string.len(s) + repeat + local curChar = string.sub(s,endPos,endPos) + if not escaped then + if curChar==[[\]] then + escaped = true + else + bEnded = curChar==startChar + end + else + -- If we're escaped, we accept the current character come what may + escaped = false + end + endPos = endPos + 1 + base.assert(endPos <= stringLen+1, "String decoding failed: unterminated string at position " .. endPos) + until bEnded + local stringValue = 'return ' .. string.sub(s, startPos, endPos-1) + local stringEval = base.loadstring(stringValue) + base.assert(stringEval, 'Failed to load string [ ' .. stringValue .. '] in JSON4Lua.decode_scanString at position ' .. startPos .. ' : ' .. endPos) + return stringEval(), endPos +end + +--- Scans a JSON string skipping all whitespace from the current start position. +-- Returns the position of the first non-whitespace character, or nil if the whole end of string is reached. +-- @param s The string being scanned +-- @param startPos The starting position where we should begin removing whitespace. +-- @return int The first position where non-whitespace was encountered, or string.len(s)+1 if the end of string +-- was reached. +function decode_scanWhitespace(s,startPos) + local whitespace=" \n\r\t" + local stringLen = string.len(s) + while ( string.find(whitespace, string.sub(s,startPos,startPos), 1, true) and startPos <= stringLen) do + startPos = startPos + 1 + end + return startPos +end + +--- Encodes a string to be JSON-compatible. +-- This just involves back-quoting inverted commas, back-quotes and newlines, I think ;-) +-- @param s The string to return as a JSON encoded (i.e. backquoted string) +-- @return The string appropriately escaped. +function encodeString(s) + s = string.gsub(s,'\\','\\\\') + s = string.gsub(s,'"','\\"') + s = string.gsub(s,"'","\\'") + s = string.gsub(s,'\n','\\n') + s = string.gsub(s,'\t','\\t') + return s +end + +-- Determines whether the given Lua type is an array or a table / dictionary. +-- We consider any table an array if it has indexes 1..n for its n items, and no +-- other data in the table. +-- I think this method is currently a little 'flaky', but can't think of a good way around it yet... +-- @param t The table to evaluate as an array +-- @return boolean, number True if the table can be represented as an array, false otherwise. If true, +-- the second returned value is the maximum +-- number of indexed elements in the array. +function isArray(t) + -- Next we count all the elements, ensuring that any non-indexed elements are not-encodable + -- (with the possible exception of 'n') + local maxIndex = 0 + for k,v in base.pairs(t) do + if (base.type(k)=='number' and math.floor(k)==k and 1<=k) then -- k,v is an indexed pair + if (not isEncodable(v)) then return false end -- All array elements must be encodable + maxIndex = math.max(maxIndex,k) + else + if (k=='n') then + if v ~= table.getn(t) then return false end -- False if n does not hold the number of elements + else -- Else of (k=='n') + if isEncodable(v) then return false end + end -- End of (k~='n') + end -- End of k,v not an indexed pair + end -- End of loop across all pairs + return true, maxIndex +end + +--- Determines whether the given Lua object / table / variable can be JSON encoded. The only +-- types that are JSON encodable are: string, boolean, number, nil, table and json.null. +-- In this implementation, all other types are ignored. +-- @param o The object to examine. +-- @return boolean True if the object should be JSON encoded, false if it should be ignored. +function isEncodable(o) + local t = base.type(o) + return (t=='string' or t=='boolean' or t=='number' or t=='nil' or t=='table') or (t=='function' and o==null) +end + diff --git a/src/cocos/cocos2d/luaj.lua b/src/cocos/cocos2d/luaj.lua new file mode 100644 index 0000000..8ec45a3 --- /dev/null +++ b/src/cocos/cocos2d/luaj.lua @@ -0,0 +1,34 @@ + +local luaj = {} + +local callJavaStaticMethod = LuaJavaBridge.callStaticMethod + +local function checkArguments(args, sig) + if type(args) ~= "table" then args = {} end + if sig then return args, sig end + + sig = {"("} + for i, v in ipairs(args) do + local t = type(v) + if t == "number" then + sig[#sig + 1] = "F" + elseif t == "boolean" then + sig[#sig + 1] = "Z" + elseif t == "function" then + sig[#sig + 1] = "I" + else + sig[#sig + 1] = "Ljava/lang/String;" + end + end + sig[#sig + 1] = ")V" + + return args, table.concat(sig) +end + +function luaj.callStaticMethod(className, methodName, args, sig) + local args, sig = checkArguments(args, sig) + --echoInfo("luaj.callStaticMethod(\"%s\",\n\t\"%s\",\n\targs,\n\t\"%s\"", className, methodName, sig) + return callJavaStaticMethod(className, methodName, args, sig) +end + +return luaj diff --git a/src/cocos/cocos2d/luaoc.lua b/src/cocos/cocos2d/luaoc.lua new file mode 100644 index 0000000..ff6d157 --- /dev/null +++ b/src/cocos/cocos2d/luaoc.lua @@ -0,0 +1,28 @@ + +local luaoc = {} + +local callStaticMethod = LuaObjcBridge.callStaticMethod + +function luaoc.callStaticMethod(className, methodName, args) + local ok, ret = callStaticMethod(className, methodName, args) + if not ok then + local msg = string.format("luaoc.callStaticMethod(\"%s\", \"%s\", \"%s\") - error: [%s] ", + className, methodName, tostring(args), tostring(ret)) + if ret == -1 then + print(msg .. "INVALID PARAMETERS") + elseif ret == -2 then + print(msg .. "CLASS NOT FOUND") + elseif ret == -3 then + print(msg .. "METHOD NOT FOUND") + elseif ret == -4 then + print(msg .. "EXCEPTION OCCURRED") + elseif ret == -5 then + print(msg .. "INVALID METHOD SIGNATURE") + else + print(msg .. "UNKNOWN") + end + end + return ok, ret +end + +return luaoc diff --git a/src/cocos/cocosbuilder/CCBReaderLoad.lua b/src/cocos/cocosbuilder/CCBReaderLoad.lua new file mode 100644 index 0000000..30ee404 --- /dev/null +++ b/src/cocos/cocosbuilder/CCBReaderLoad.lua @@ -0,0 +1,125 @@ +if nil == cc.CCBReader then + return +end + +ccb = ccb or {} + +function CCBReaderLoad(strFilePath,proxy,owner) + if nil == proxy then + return nil + end + + local ccbReader = proxy:createCCBReader() + local node = ccbReader:load(strFilePath) + local rootName = "" + --owner set in readCCBFromFile is proxy + if nil ~= owner then + --Callbacks + local ownerCallbackNames = ccbReader:getOwnerCallbackNames() + local ownerCallbackNodes = ccbReader:getOwnerCallbackNodes() + local ownerCallbackControlEvents = ccbReader:getOwnerCallbackControlEvents() + local i = 1 + for i = 1,table.getn(ownerCallbackNames) do + local callbackName = ownerCallbackNames[i] + local callbackNode = tolua.cast(ownerCallbackNodes[i],"cc.Node") + + if "function" == type(owner[callbackName]) then + proxy:setCallback(callbackNode, owner[callbackName], ownerCallbackControlEvents[i]) + else + print("Warning: Cannot find owner's lua function:" .. ":" .. callbackName .. " for ownerVar selector") + end + + end + + --Variables + local ownerOutletNames = ccbReader:getOwnerOutletNames() + local ownerOutletNodes = ccbReader:getOwnerOutletNodes() + + for i = 1, table.getn(ownerOutletNames) do + local outletName = ownerOutletNames[i] + local outletNode = tolua.cast(ownerOutletNodes[i],"cc.Node") + owner[outletName] = outletNode + end + end + + local nodesWithAnimationManagers = ccbReader:getNodesWithAnimationManagers() + local animationManagersForNodes = ccbReader:getAnimationManagersForNodes() + + for i = 1 , table.getn(nodesWithAnimationManagers) do + local innerNode = tolua.cast(nodesWithAnimationManagers[i], "cc.Node") + local animationManager = tolua.cast(animationManagersForNodes[i], "cc.CCBAnimationManager") + local documentControllerName = animationManager:getDocumentControllerName() + if "" == documentControllerName then + + end + if nil ~= ccb[documentControllerName] then + ccb[documentControllerName]["mAnimationManager"] = animationManager + end + + --Callbacks + local documentCallbackNames = animationManager:getDocumentCallbackNames() + local documentCallbackNodes = animationManager:getDocumentCallbackNodes() + local documentCallbackControlEvents = animationManager:getDocumentCallbackControlEvents() + + for i = 1,table.getn(documentCallbackNames) do + local callbackName = documentCallbackNames[i] + local callbackNode = tolua.cast(documentCallbackNodes[i],"cc.Node") + if "" ~= documentControllerName and nil ~= ccb[documentControllerName] then + if "function" == type(ccb[documentControllerName][callbackName]) then + proxy:setCallback(callbackNode, ccb[documentControllerName][callbackName], documentCallbackControlEvents[i]) + else + print("Warning: Cannot found lua function [" .. documentControllerName .. ":" .. callbackName .. "] for docRoot selector") + end + end + end + + --Variables + local documentOutletNames = animationManager:getDocumentOutletNames() + local documentOutletNodes = animationManager:getDocumentOutletNodes() + + for i = 1, table.getn(documentOutletNames) do + local outletName = documentOutletNames[i] + local outletNode = tolua.cast(documentOutletNodes[i],"cc.Node") + + if nil ~= ccb[documentControllerName] then + ccb[documentControllerName][outletName] = tolua.cast(outletNode, proxy:getNodeTypeName(outletNode)) + end + end + --[[ + if (typeof(controller.onDidLoadFromCCB) == "function") + controller.onDidLoadFromCCB(); + ]]-- + --Setup timeline callbacks + local keyframeCallbacks = animationManager:getKeyframeCallbacks() + + for i = 1 , table.getn(keyframeCallbacks) do + local callbackCombine = keyframeCallbacks[i] + local beignIndex,endIndex = string.find(callbackCombine,":") + local callbackType = tonumber(string.sub(callbackCombine,1,beignIndex - 1)) + local callbackName = string.sub(callbackCombine,endIndex + 1, -1) + --Document callback + + if 1 == callbackType and nil ~= ccb[documentControllerName] then + local callfunc = cc.CallFunc:create(ccb[documentControllerName][callbackName]) + animationManager:setCallFuncForLuaCallbackNamed(callfunc, callbackCombine); + elseif 2 == callbackType and nil ~= owner then --Owner callback + local callfunc = cc.CallFunc:create(owner[callbackName])--need check + animationManager:setCallFuncForLuaCallbackNamed(callfunc, callbackCombine) + end + end + --start animation + local autoPlaySeqId = animationManager:getAutoPlaySequenceId() + if -1 ~= autoPlaySeqId then + animationManager:runAnimationsForSequenceIdTweenDuration(autoPlaySeqId, 0) + end + end + + return node +end + + +local function CCBuilderReaderLoad(strFilePath,proxy,owner) + print("\n********** \n".."CCBuilderReaderLoad(strFilePath,proxy,owner)".." was deprecated please use ".. "CCBReaderLoad(strFilePath,proxy,owner)" .. " instead.\n**********") + return CCBReaderLoad(strFilePath,proxy,owner) +end +rawset(_G,"CCBuilderReaderLoad",CCBuilderReaderLoad) \ No newline at end of file diff --git a/src/cocos/cocosbuilder/DeprecatedCocosBuilderClass.lua b/src/cocos/cocosbuilder/DeprecatedCocosBuilderClass.lua new file mode 100644 index 0000000..aaa6654 --- /dev/null +++ b/src/cocos/cocosbuilder/DeprecatedCocosBuilderClass.lua @@ -0,0 +1,35 @@ +if nil == cc.CCBProxy then + return +end +-- This is the DeprecatedCocosBuilderClass + +DeprecatedCocosBuilderClass = {} or DeprecatedCocosBuilderClass + +--tip +local function deprecatedTip(old_name,new_name) + print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") +end + +--CCBReader class will be Deprecated,begin +function DeprecatedCocosBuilderClass.CCBReader() + deprecatedTip("CCBReader","cc.BReader") + return cc.BReader +end +_G["CCBReader"] = DeprecatedCocosBuilderClass.CCBReader() +--CCBReader class will be Deprecated,end + +--CCBAnimationManager class will be Deprecated,begin +function DeprecatedCocosBuilderClass.CCBAnimationManager() + deprecatedTip("CCBAnimationManager","cc.BAnimationManager") + return cc.BAnimationManager +end +_G["CCBAnimationManager"] = DeprecatedCocosBuilderClass.CCBAnimationManager() +--CCBAnimationManager class will be Deprecated,end + +--CCBProxy class will be Deprecated,begin +function DeprecatedCocosBuilderClass.CCBProxy() + deprecatedTip("CCBProxy","cc.CCBProxy") + return cc.CCBProxy +end +_G["CCBProxy"] = DeprecatedCocosBuilderClass.CCBProxy() +--CCBProxy class will be Deprecated,end diff --git a/src/cocos/cocosdenshion/AudioEngine.lua b/src/cocos/cocosdenshion/AudioEngine.lua new file mode 100644 index 0000000..deea904 --- /dev/null +++ b/src/cocos/cocosdenshion/AudioEngine.lua @@ -0,0 +1,111 @@ +if nil == cc.SimpleAudioEngine then + return +end +--Encapsulate SimpleAudioEngine to AudioEngine,Play music and sound effects. +local M = {} + +function M.stopAllEffects() + cc.SimpleAudioEngine:getInstance():stopAllEffects() +end + +function M.getMusicVolume() + return cc.SimpleAudioEngine:getInstance():getMusicVolume() +end + +function M.isMusicPlaying() + return cc.SimpleAudioEngine:getInstance():isMusicPlaying() +end + +function M.getEffectsVolume() + return cc.SimpleAudioEngine:getInstance():getEffectsVolume() +end + +function M.setMusicVolume(volume) + cc.SimpleAudioEngine:getInstance():setMusicVolume(volume) +end + +function M.stopEffect(handle) + cc.SimpleAudioEngine:getInstance():stopEffect(handle) +end + +function M.stopMusic(isReleaseData) + local releaseDataValue = false + if nil ~= isReleaseData then + releaseDataValue = isReleaseData + end + cc.SimpleAudioEngine:getInstance():stopMusic(releaseDataValue) +end + +function M.playMusic(filename, isLoop) + local loopValue = false + if nil ~= isLoop then + loopValue = isLoop + end + cc.SimpleAudioEngine:getInstance():playMusic(filename, loopValue) +end + +function M.pauseAllEffects() + cc.SimpleAudioEngine:getInstance():pauseAllEffects() +end + +function M.preloadMusic(filename) + cc.SimpleAudioEngine:getInstance():preloadMusic(filename) +end + +function M.resumeMusic() + cc.SimpleAudioEngine:getInstance():resumeMusic() +end + +function M.playEffect(filename, isLoop) + local loopValue = false + if nil ~= isLoop then + loopValue = isLoop + end + return cc.SimpleAudioEngine:getInstance():playEffect(filename, loopValue) +end + +function M.rewindMusic() + cc.SimpleAudioEngine:getInstance():rewindMusic() +end + +function M.willPlayMusic() + return cc.SimpleAudioEngine:getInstance():willPlayMusic() +end + +function M.unloadEffect(filename) + cc.SimpleAudioEngine:getInstance():unloadEffect(filename) +end + +function M.preloadEffect(filename) + cc.SimpleAudioEngine:getInstance():preloadEffect(filename) +end + +function M.setEffectsVolume(volume) + cc.SimpleAudioEngine:getInstance():setEffectsVolume(volume) +end + +function M.pauseEffect(handle) + cc.SimpleAudioEngine:getInstance():pauseEffect(handle) +end + +function M.resumeAllEffects(handle) + cc.SimpleAudioEngine:getInstance():resumeAllEffects() +end + +function M.pauseMusic() + cc.SimpleAudioEngine:getInstance():pauseMusic() +end + +function M.resumeEffect(handle) + cc.SimpleAudioEngine:getInstance():resumeEffect(handle) +end + +function M.getInstance() + return cc.SimpleAudioEngine:getInstance() +end + +function M.destroyInstance() + return cc.SimpleAudioEngine:destroyInstance() +end + +AudioEngine = M diff --git a/src/cocos/cocosdenshion/DeprecatedCocosDenshionClass.lua b/src/cocos/cocosdenshion/DeprecatedCocosDenshionClass.lua new file mode 100644 index 0000000..64f23f6 --- /dev/null +++ b/src/cocos/cocosdenshion/DeprecatedCocosDenshionClass.lua @@ -0,0 +1,19 @@ +if nil == cc.SimpleAudioEngine then + return +end +-- This is the DeprecatedCocosDenshionClass + +DeprecatedCocosDenshionClass = {} or DeprecatedCocosDenshionClass + +--tip +local function deprecatedTip(old_name,new_name) + print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") +end + +--SimpleAudioEngine class will be Deprecated,begin +function DeprecatedCocosDenshionClass.SimpleAudioEngine() + deprecatedTip("SimpleAudioEngine","cc.SimpleAudioEngine") + return cc.SimpleAudioEngine +end +_G["SimpleAudioEngine"] = DeprecatedCocosDenshionClass.SimpleAudioEngine() +--SimpleAudioEngine class will be Deprecated,end diff --git a/src/cocos/cocosdenshion/DeprecatedCocosDenshionFunc.lua b/src/cocos/cocosdenshion/DeprecatedCocosDenshionFunc.lua new file mode 100644 index 0000000..9588a1f --- /dev/null +++ b/src/cocos/cocosdenshion/DeprecatedCocosDenshionFunc.lua @@ -0,0 +1,22 @@ +if nil == cc.SimpleAudioEngine then + return +end +--tip +local function deprecatedTip(old_name,new_name) + print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") +end + +--functions of SimpleAudioEngine will be deprecated begin +local SimpleAudioEngineDeprecated = { } +function SimpleAudioEngineDeprecated.sharedEngine() + deprecatedTip("SimpleAudioEngine:sharedEngine","SimpleAudioEngine:getInstance") + return cc.SimpleAudioEngine:getInstance() +end +SimpleAudioEngine.sharedEngine = SimpleAudioEngineDeprecated.sharedEngine + +function SimpleAudioEngineDeprecated.playBackgroundMusic(self,...) + deprecatedTip("SimpleAudioEngine:playBackgroundMusic","SimpleAudioEngine:playMusic") + return self:playMusic(...) +end +SimpleAudioEngine.playBackgroundMusic = SimpleAudioEngineDeprecated.playBackgroundMusic +--functions of SimpleAudioEngine will be deprecated end diff --git a/src/cocos/cocostudio/CocoStudio.lua b/src/cocos/cocostudio/CocoStudio.lua new file mode 100644 index 0000000..d5a3205 --- /dev/null +++ b/src/cocos/cocostudio/CocoStudio.lua @@ -0,0 +1,389 @@ +if nil == ccs then + return +end + +if not json then + require "cocos.cocos2d.json" +end + +require "cocos.cocostudio.StudioConstants" + +function ccs.sendTriggerEvent(event) + local triggerObjArr = ccs.TriggerMng.getInstance():get(event) + + if nil == triggerObjArr then + return + end + + for i = 1, table.getn(triggerObjArr) do + local triObj = triggerObjArr[i] + if nil ~= triObj and triObj:detect() then + triObj:done() + end + end +end + +function ccs.registerTriggerClass(className, createFunc) + ccs.TInfo.new(className,createFunc) +end + +ccs.TInfo = class("TInfo") +ccs.TInfo._className = "" +ccs.TInfo._fun = nil + +function ccs.TInfo:ctor(c,f) + -- @param {String|ccs.TInfo}c + -- @param {Function}f + if nil ~= f then + self._className = c + self._fun = f + else + self._className = c._className + self._fun = c._fun + end + + ccs.ObjectFactory.getInstance():registerType(self) +end + +ccs.ObjectFactory = class("ObjectFactory") +ccs.ObjectFactory._typeMap = nil +ccs.ObjectFactory._instance = nil + +function ccs.ObjectFactory:ctor() + self._typeMap = {} +end + +function ccs.ObjectFactory.getInstance() + if nil == ccs.ObjectFactory._instance then + ccs.ObjectFactory._instance = ccs.ObjectFactory.new() + end + + return ccs.ObjectFactory._instance +end + +function ccs.ObjectFactory.destroyInstance() + ccs.ObjectFactory._instance = nil +end + +function ccs.ObjectFactory:createObject(classname) + local obj = nil + local t = self._typeMap[classname] + if nil ~= t then + obj = t._fun() + end + + return obj +end + +function ccs.ObjectFactory:registerType(t) + self._typeMap[t._className] = t +end + +ccs.TriggerObj = class("TriggerObj") +ccs.TriggerObj._cons = {} +ccs.TriggerObj._acts = {} +ccs.TriggerObj._enable = false +ccs.TriggerObj._id = 0 +ccs.TriggerObj._vInt = {} + +function ccs.TriggerObj.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TriggerObj) + return target +end + +function ccs.TriggerObj:ctor() + self:init() +end + +function ccs.TriggerObj:init() + self._id = 0 + self._enable = true + self._cons = {} + self._acts = {} + self._vInt = {} +end + +function ccs.TriggerObj:detect() + if (not self._enable) or (table.getn(self._cons) == 0) then + return true + end + + local ret = true + local obj = nil + for i = 1 , table.getn(self._cons) do + obj = self._cons[i] + if nil ~= obj and nil ~= obj.detect then + ret = ret and obj:detect() + end + end + return ret +end + +function ccs.TriggerObj:done() + if (not self._enable) or (table.getn(self._acts) == 0) then + return + end + + local obj = nil + for i = 1, table.getn(self._acts) do + obj = self._acts[i] + if nil ~= obj and obj.done then + obj:done() + end + end +end + +function ccs.TriggerObj:removeAll() + local obj = nil + for i=1, table.getn(self._cons) do + obj = self._cons[i] + if nil ~= obj then + obj:removeAll() + end + end + self._cons = {} + + for i=1, table.getn(self._acts) do + obj = self._acts[i] + if nil ~= obj then + obj:removeAll() + end + end + self._acts = {} +end + +function ccs.TriggerObj:serialize(jsonValue) + self._id = jsonValue["id"] + local count = 0 + + --condition + local cons = jsonValue["conditions"] + if nil ~= cons then + count = table.getn(cons) + for i = 1, count do + local subDict = cons[i] + local className = subDict["classname"] + if nil ~= className then + local obj = ccs.ObjectFactory.getInstance():createObject(className) + assert(nil ~= obj, string.format("class named %s can not implement!",className)) + obj:serialize(subDict) + obj:init() + table.insert(self._cons, obj) + end + end + end + + local actions = jsonValue["actions"] + if nil ~= actions then + count = table.getn(actions) + for i = 1,count do + local subAction = actions[i] + local className = subAction["classname"] + if nil ~= className then + local act = ccs.ObjectFactory.getInstance():createObject(className) + assert(nil ~= act ,string.format("class named %s can not implement!",className)) + act:serialize(subAction) + act:init() + table.insert(self._acts,act) + end + end + end + + local events = jsonValue["events"] + if nil ~= events then + count = table.getn(events) + for i = 1, count do + local subEveent = events[i] + local eventID = subEveent["id"] + if eventID >= 0 then + table.insert(self._vInt,eventID) + end + end + end +end + +function ccs.TriggerObj:getId() + return self._id +end + +function ccs.TriggerObj:setEnable(enable) + self._enable = enable +end + +function ccs.TriggerObj:getEvents() + return self._vInt +end + +ccs.TriggerMng = class("TriggerMng") +ccs.TriggerMng._eventTriggers = nil +ccs.TriggerMng._triggerObjs = nil +ccs.TriggerMng._movementDispatches = nil +ccs.TriggerMng._instance = nil + +function ccs.TriggerMng:ctor() + self._triggerObjs = {} + self._movementDispatches = {} + self._eventTriggers = {} +end + +function ccs.TriggerMng.getInstance() + if ccs.TriggerMng._instance == nil then + ccs.TriggerMng._instance = ccs.TriggerMng.new() + end + + return ccs.TriggerMng._instance +end + +function ccs.TriggerMng.destroyInstance() + if ccs.TriggerMng._instance ~= nil then + ccs.TriggerMng._instance:removeAll() + ccs.TriggerMng._instance = nil + end +end + +function ccs.TriggerMng:triggerMngVersion() + return "1.0.0.0" +end + +function ccs.TriggerMng:parse(jsonStr) + local parseTable = json.decode(jsonStr,1) + if nil == parseTable then + return + end + + local count = table.getn(parseTable) + for i = 1, count do + local subDict = parseTable[i] + local triggerObj = ccs.TriggerObj.new() + triggerObj:serialize(subDict) + local events = triggerObj:getEvents() + for j = 1, table.getn(events) do + local event = events[j] + self:add(event, triggerObj) + end + + self._triggerObjs[triggerObj:getId()] = triggerObj + end +end + +function ccs.TriggerMng:get(event) + return self._eventTriggers[event] +end + +function ccs.TriggerMng:getTriggerObj(id) + return self._triggerObjs[id] +end + +function ccs.TriggerMng:add(event,triggerObj) + local eventTriggers = self._eventTriggers[event] + if nil == eventTriggers then + eventTriggers = {} + end + + local exist = false + for i = 1, table.getn(eventTriggers) do + if eventTriggers[i] == triggers then + exist = true + break + end + end + + if not exist then + table.insert(eventTriggers,triggerObj) + self._eventTriggers[event] = eventTriggers + end +end + +function ccs.TriggerMng:removeAll( ) + for k in pairs(self._eventTriggers) do + local triObjArr = self._eventTriggers[k] + for j = 1, table.getn(triObjArr) do + local obj = triObjArr[j] + obj:removeAll() + end + end + self._eventTriggers = {} +end + +function ccs.TriggerMng:remove(event, obj) + + if nil ~= obj then + return self:removeObjByEvent(event, obj) + end + + assert(event >= 0,"event must be larger than 0") + if nil == self._eventTriggers then + return false + end + + local triObjects = self._eventTriggers[event] + if nil == triObjects then + return false + end + + for i = 1, table.getn(triObjects) do + local triObject = triggers[i] + if nil ~= triObject then + triObject:remvoeAll() + end + end + + self._eventTriggers[event] = nil + return true +end + +function ccs.TriggerMng:removeObjByEvent(event, obj) + assert(event >= 0,"event must be larger than 0") + if nil == self._eventTriggers then + return false + end + + local triObjects = self._eventTriggers[event] + if nil == triObjects then + return false + end + + for i = 1,table.getn(triObjects) do + local triObject = triObjects[i] + if nil ~= triObject and triObject == obj then + triObject:remvoeAll() + table.remove(triObjects, i) + return true + end + end +end + +function ccs.TriggerMng:removeTriggerObj(id) + local obj = self.getTriggerObj(id) + + if nil == obj then + return false + end + + local events = obj:getEvents() + for i = 1, table.getn(events) do + self:remove(events[i],obj) + end + + return true +end + +function ccs.TriggerMng:isEmpty() + return (not (nil == self._eventTriggers)) or table.getn(self._eventTriggers) <= 0 +end + +function __onParseConfig(configType,jasonStr) + if configType == cc.ConfigType.COCOSTUDIO then + ccs.TriggerMng.getInstance():parse(jasonStr) + end +end + +function ccs.AnimationInfo(_name, _startIndex, _endIndex) + assert(nil ~= _name and type(_name) == "string" and _startIndex ~= nil and type(_startIndex) == "number" and _endIndex ~= nil and type(_endIndex) == "number", "ccs.AnimationInfo() - invalid input parameters") + return { name = _name, startIndex = _startIndex, endIndex = _endIndex} +end diff --git a/src/cocos/cocostudio/DeprecatedCocoStudioClass.lua b/src/cocos/cocostudio/DeprecatedCocoStudioClass.lua new file mode 100644 index 0000000..712886b --- /dev/null +++ b/src/cocos/cocostudio/DeprecatedCocoStudioClass.lua @@ -0,0 +1,307 @@ +if nil == ccs then + return +end +-- This is the DeprecatedExtensionClass + +DeprecatedExtensionClass = {} or DeprecatedExtensionClass + +--tip +local function deprecatedTip(old_name,new_name) + print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") +end + +--CCArmature class will be Deprecated,begin +function DeprecatedExtensionClass.CCArmature() + deprecatedTip("CCArmature","ccs.Armature") + return ccs.Armature +end +_G["CCArmature"] = DeprecatedExtensionClass.CCArmature() +--CCArmature class will be Deprecated,end + +--CCArmatureAnimation class will be Deprecated,begin +function DeprecatedExtensionClass.CCArmatureAnimation() + deprecatedTip("CCArmatureAnimation","ccs.ArmatureAnimation") + return ccs.ArmatureAnimation +end +_G["CCArmatureAnimation"] = DeprecatedExtensionClass.CCArmatureAnimation() +--CCArmatureAnimation class will be Deprecated,end + +--CCSkin class will be Deprecated,begin +function DeprecatedExtensionClass.CCSkin() + deprecatedTip("CCSkin","ccs.Skin") + return ccs.Skin +end +_G["CCSkin"] = DeprecatedExtensionClass.CCSkin() +--CCSkin class will be Deprecated,end + +--CCBone class will be Deprecated,begin +function DeprecatedExtensionClass.CCBone() + deprecatedTip("CCBone","ccs.Bone") + return ccs.Bone +end +_G["CCBone"] = DeprecatedExtensionClass.CCBone() +--CCBone class will be Deprecated,end + +--CCArmatureDataManager class will be Deprecated,begin +function DeprecatedExtensionClass.CCArmatureDataManager() + deprecatedTip("CCArmatureDataManager","ccs.ArmatureDataManager") + return ccs.ArmatureDataManager +end +_G["CCArmatureDataManager"] = DeprecatedExtensionClass.CCArmatureDataManager() +--CCArmatureDataManager class will be Deprecated,end + +--CCBatchNode class will be Deprecated,begin +function DeprecatedExtensionClass.CCBatchNode() + deprecatedTip("CCBatchNode","ccs.BatchNode") + return ccs.BatchNode +end +_G["CCBatchNode"] = DeprecatedExtensionClass.CCBatchNode() +--CCBatchNode class will be Deprecated,end + +--CCTween class will be Deprecated,begin +function DeprecatedExtensionClass.CCTween() + deprecatedTip("CCTween","ccs.Tween") + return ccs.Tween +end +_G["CCTween"] = DeprecatedExtensionClass.CCTween() +--CCTween class will be Deprecated,end + +--CCBaseData class will be Deprecated,begin +function DeprecatedExtensionClass.CCBaseData() + deprecatedTip("CCBaseData","ccs.BaseData") + return ccs.BaseData +end +_G["CCBaseData"] = DeprecatedExtensionClass.CCBaseData() +--CCBaseData class will be Deprecated,end + +--CCDisplayManager class will be Deprecated,begin +function DeprecatedExtensionClass.CCDisplayManager() + deprecatedTip("CCDisplayManager","ccs.DisplayManager") + return ccs.DisplayManager +end +_G["CCDisplayManager"] = DeprecatedExtensionClass.CCDisplayManager() +--CCDisplayManager class will be Deprecated,end + +--UIHelper class will be Deprecated,begin +function DeprecatedExtensionClass.UIHelper() + deprecatedTip("UIHelper","ccs.UIHelper") + return ccs.UIHelper +end +_G["UIHelper"] = DeprecatedExtensionClass.UIHelper() +--UIHelper class will be Deprecated,end + +--UILayout class will be Deprecated,begin +function DeprecatedExtensionClass.UILayout() + deprecatedTip("UILayout","ccs.UILayout") + return ccs.UILayout +end +_G["UILayout"] = DeprecatedExtensionClass.UILayout() +--UILayout class will be Deprecated,end + +--UIWidget class will be Deprecated,begin +function DeprecatedExtensionClass.UIWidget() + deprecatedTip("UIWidget","ccs.UIWidget") + return ccs.UIWidget +end +_G["UIWidget"] = DeprecatedExtensionClass.UIWidget() +--UIWidget class will be Deprecated,end + +--UILayer class will be Deprecated,begin +function DeprecatedExtensionClass.UILayer() + deprecatedTip("UILayer","ccs.UILayer") + return ccs.UILayer +end +_G["UILayer"] = DeprecatedExtensionClass.UILayer() +--UILayer class will be Deprecated,end + +--UIButton class will be Deprecated,begin +function DeprecatedExtensionClass.UIButton() + deprecatedTip("UIButton","ccs.UIButton") + return ccs.UIButton +end +_G["UIButton"] = DeprecatedExtensionClass.UIButton() +--UIButton class will be Deprecated,end + +--UICheckBox class will be Deprecated,begin +function DeprecatedExtensionClass.UICheckBox() + deprecatedTip("UICheckBox","ccs.UICheckBox") + return ccs.UICheckBox +end +_G["UICheckBox"] = DeprecatedExtensionClass.UICheckBox() +--UICheckBox class will be Deprecated,end + +--UIImageView class will be Deprecated,begin +function DeprecatedExtensionClass.UIImageView() + deprecatedTip("UIImageView","ccs.UIImageView") + return ccs.UIImageView +end +_G["UIImageView"] = DeprecatedExtensionClass.UIImageView() +--UIImageView class will be Deprecated,end + +--UILabel class will be Deprecated,begin +function DeprecatedExtensionClass.UILabel() + deprecatedTip("UILabel","ccs.UILabel") + return ccs.UILabel +end +_G["UILabel"] = DeprecatedExtensionClass.UILabel() +--UILabel class will be Deprecated,end + +--UILabelAtlas class will be Deprecated,begin +function DeprecatedExtensionClass.UILabelAtlas() + deprecatedTip("UILabelAtlas","ccs.UILabelAtlas") + return ccs.UILabelAtlas +end +_G["UILabelAtlas"] = DeprecatedExtensionClass.UILabelAtlas() +--UILabelAtlas class will be Deprecated,end + +--UILabelBMFont class will be Deprecated,begin +function DeprecatedExtensionClass.UILabelBMFont() + deprecatedTip("UILabelBMFont","ccs.UILabelBMFont") + return ccs.UILabelBMFont +end +_G["UILabelBMFont"] = DeprecatedExtensionClass.UILabelBMFont() +--UILabelBMFont class will be Deprecated,end + +--UILoadingBar class will be Deprecated,begin +function DeprecatedExtensionClass.UILoadingBar() + deprecatedTip("UILoadingBar","ccs.UILoadingBar") + return ccs.UILoadingBar +end +_G["UILoadingBar"] = DeprecatedExtensionClass.UILoadingBar() +--UILoadingBar class will be Deprecated,end + +--UISlider class will be Deprecated,begin +function DeprecatedExtensionClass.UISlider() + deprecatedTip("UISlider","ccs.UISlider") + return ccs.UISlider +end +_G["UISlider"] = DeprecatedExtensionClass.UISlider() +--UISlider class will be Deprecated,end + +--UITextField class will be Deprecated,begin +function DeprecatedExtensionClass.UITextField() + deprecatedTip("UITextField","ccs.UITextField") + return ccs.UITextField +end +_G["UITextField"] = DeprecatedExtensionClass.UITextField() +--UITextField class will be Deprecated,end + +--UIScrollView class will be Deprecated,begin +function DeprecatedExtensionClass.UIScrollView() + deprecatedTip("UIScrollView","ccs.UIScrollView") + return ccs.UIScrollView +end +_G["UIScrollView"] = DeprecatedExtensionClass.UIScrollView() +--UIScrollView class will be Deprecated,end + +--UIPageView class will be Deprecated,begin +function DeprecatedExtensionClass.UIPageView() + deprecatedTip("UIPageView","ccs.UIPageView") + return ccs.UIPageView +end +_G["UIPageView"] = DeprecatedExtensionClass.UIPageView() +--UIPageView class will be Deprecated,end + +--UIListView class will be Deprecated,begin +function DeprecatedExtensionClass.UIListView() + deprecatedTip("UIListView","ccs.UIListView") + return ccs.UIListView +end +_G["UIListView"] = DeprecatedExtensionClass.UIListView() +--UIListView class will be Deprecated,end + +--UILayoutParameter class will be Deprecated,begin +function DeprecatedExtensionClass.UILayoutParameter() + deprecatedTip("UILayoutParameter","ccs.UILayoutParameter") + return ccs.UILayoutParameter +end +_G["UILayoutParameter"] = DeprecatedExtensionClass.UILayoutParameter() +--UILayoutParameter class will be Deprecated,end + +--UILinearLayoutParameter class will be Deprecated,begin +function DeprecatedExtensionClass.UILinearLayoutParameter() + deprecatedTip("UILinearLayoutParameter","ccs.UILinearLayoutParameter") + return ccs.UILinearLayoutParameter +end +_G["UILinearLayoutParameter"] = DeprecatedExtensionClass.UILinearLayoutParameter() +--UILinearLayoutParameter class will be Deprecated,end + +--UIRelativeLayoutParameter class will be Deprecated,begin +function DeprecatedExtensionClass.UIRelativeLayoutParameter() + deprecatedTip("UIRelativeLayoutParameter","ccs.UIRelativeLayoutParameter") + return ccs.UIRelativeLayoutParameter +end +_G["UIRelativeLayoutParameter"] = DeprecatedExtensionClass.UIRelativeLayoutParameter() +--UIRelativeLayoutParameter class will be Deprecated,end + +--CCComController class will be Deprecated,begin +function DeprecatedExtensionClass.CCComController() + deprecatedTip("CCComController","ccs.ComController") + return ccs.CCComController +end +_G["CCComController"] = DeprecatedExtensionClass.CCComController() +--CCComController class will be Deprecated,end + +--CCComAudio class will be Deprecated,begin +function DeprecatedExtensionClass.CCComAudio() + deprecatedTip("CCComAudio","ccs.ComAudio") + return ccs.ComAudio +end +_G["CCComAudio"] = DeprecatedExtensionClass.CCComAudio() +--CCComAudio class will be Deprecated,end + +--CCComAttribute class will be Deprecated,begin +function DeprecatedExtensionClass.CCComAttribute() + deprecatedTip("CCComAttribute","ccs.ComAttribute") + return ccs.ComAttribute +end +_G["CCComAttribute"] = DeprecatedExtensionClass.CCComAttribute() +--CCComAttribute class will be Deprecated,end + +--CCComRender class will be Deprecated,begin +function DeprecatedExtensionClass.CCComRender() + deprecatedTip("CCComRender","ccs.ComRender") + return ccs.ComRender +end +_G["CCComRender"] = DeprecatedExtensionClass.CCComRender() +--CCComRender class will be Deprecated,end + +--ActionManager class will be Deprecated,begin +function DeprecatedExtensionClass.ActionManager() + deprecatedTip("ActionManager","ccs.ActionManagerEx") + return ccs.ActionManagerEx +end +_G["ActionManager"] = DeprecatedExtensionClass.ActionManager() +--CCComRender class will be Deprecated,end + +--SceneReader class will be Deprecated,begin +function DeprecatedExtensionClass.SceneReader() + deprecatedTip("SceneReader","ccs.SceneReader") + return ccs.SceneReader +end +_G["SceneReader"] = DeprecatedExtensionClass.SceneReader() +--SceneReader class will be Deprecated,end + +--GUIReader class will be Deprecated,begin +function DeprecatedExtensionClass.GUIReader() + deprecatedTip("GUIReader","ccs.GUIReader") + return ccs.GUIReader +end +_G["GUIReader"] = DeprecatedExtensionClass.GUIReader() +--GUIReader class will be Deprecated,end + +--UIRootWidget class will be Deprecated,begin +function DeprecatedExtensionClass.UIRootWidget() + deprecatedTip("UIRootWidget","ccs.UIRootWidget") + return ccs.UIRootWidget +end +_G["UIRootWidget"] = DeprecatedExtensionClass.UIRootWidget() +--UIRootWidget class will be Deprecated,end + +--ActionObject class will be Deprecated,begin +function DeprecatedExtensionClass.ActionObject() + deprecatedTip("ActionObject","ccs.ActionObject") + return ccs.ActionObject +end +_G["ActionObject"] = DeprecatedExtensionClass.ActionObject() +--ActionObject class will be Deprecated,end \ No newline at end of file diff --git a/src/cocos/cocostudio/DeprecatedCocoStudioFunc.lua b/src/cocos/cocostudio/DeprecatedCocoStudioFunc.lua new file mode 100644 index 0000000..f8e867d --- /dev/null +++ b/src/cocos/cocostudio/DeprecatedCocoStudioFunc.lua @@ -0,0 +1,81 @@ +if nil == ccs then + return +end + +--tip +local function deprecatedTip(old_name,new_name) + print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") +end + +--functions of GUIReader will be deprecated begin +local GUIReaderDeprecated = { } +function GUIReaderDeprecated.shareReader() + deprecatedTip("GUIReader:shareReader","ccs.GUIReader:getInstance") + return ccs.GUIReader:getInstance() +end +GUIReader.shareReader = GUIReaderDeprecated.shareReader + +function GUIReaderDeprecated.purgeGUIReader() + deprecatedTip("GUIReader:purgeGUIReader","ccs.GUIReader:destroyInstance") + return ccs.GUIReader:destroyInstance() +end +GUIReader.purgeGUIReader = GUIReaderDeprecated.purgeGUIReader +--functions of GUIReader will be deprecated end + +--functions of SceneReader will be deprecated begin +local SceneReaderDeprecated = { } +function SceneReaderDeprecated.sharedSceneReader() + deprecatedTip("SceneReader:sharedSceneReader","ccs.SceneReader:getInstance") + return ccs.SceneReader:getInstance() +end +SceneReader.sharedSceneReader = SceneReaderDeprecated.sharedSceneReader + +function SceneReaderDeprecated.purgeSceneReader(self) + deprecatedTip("SceneReader:purgeSceneReader","ccs.SceneReader:destroyInstance") + return self:destroyInstance() +end +SceneReader.purgeSceneReader = SceneReaderDeprecated.purgeSceneReader +--functions of SceneReader will be deprecated end + + +--functions of ccs.GUIReader will be deprecated begin +local CCSGUIReaderDeprecated = { } +function CCSGUIReaderDeprecated.purgeGUIReader() + deprecatedTip("ccs.GUIReader:purgeGUIReader","ccs.GUIReader:destroyInstance") + return ccs.GUIReader:destroyInstance() +end +ccs.GUIReader.purgeGUIReader = CCSGUIReaderDeprecated.purgeGUIReader +--functions of ccs.GUIReader will be deprecated end + +--functions of ccs.ActionManagerEx will be deprecated begin +local CCSActionManagerExDeprecated = { } +function CCSActionManagerExDeprecated.destroyActionManager() + deprecatedTip("ccs.ActionManagerEx:destroyActionManager","ccs.ActionManagerEx:destroyInstance") + return ccs.ActionManagerEx:destroyInstance() +end +ccs.ActionManagerEx.destroyActionManager = CCSActionManagerExDeprecated.destroyActionManager +--functions of ccs.ActionManagerEx will be deprecated end + +--functions of ccs.SceneReader will be deprecated begin +local CCSSceneReaderDeprecated = { } +function CCSSceneReaderDeprecated.destroySceneReader(self) + deprecatedTip("ccs.SceneReader:destroySceneReader","ccs.SceneReader:destroyInstance") + return self:destroyInstance() +end +ccs.SceneReader.destroySceneReader = CCSSceneReaderDeprecated.destroySceneReader +--functions of ccs.SceneReader will be deprecated end + +--functions of CCArmatureDataManager will be deprecated begin +local CCArmatureDataManagerDeprecated = { } +function CCArmatureDataManagerDeprecated.sharedArmatureDataManager() + deprecatedTip("CCArmatureDataManager:sharedArmatureDataManager","ccs.ArmatureDataManager:getInstance") + return ccs.ArmatureDataManager:getInstance() +end +CCArmatureDataManager.sharedArmatureDataManager = CCArmatureDataManagerDeprecated.sharedArmatureDataManager + +function CCArmatureDataManagerDeprecated.purge() + deprecatedTip("CCArmatureDataManager:purge","ccs.ArmatureDataManager:destoryInstance") + return ccs.ArmatureDataManager:destoryInstance() +end +CCArmatureDataManager.purge = CCArmatureDataManagerDeprecated.purge +--functions of CCArmatureDataManager will be deprecated end diff --git a/src/cocos/cocostudio/StudioConstants.lua b/src/cocos/cocostudio/StudioConstants.lua new file mode 100644 index 0000000..34fa418 --- /dev/null +++ b/src/cocos/cocostudio/StudioConstants.lua @@ -0,0 +1,15 @@ +if nil == ccs then + return +end + +ccs.MovementEventType = { + start = 0, + complete = 1, + loopComplete = 2, +} + +ccs.InnerActionType = { + LoopAction = 0, + NoLoopAction = 1, + SingleFrame = 2, +} diff --git a/src/cocos/controller/ControllerConstants.lua b/src/cocos/controller/ControllerConstants.lua new file mode 100644 index 0000000..730e92a --- /dev/null +++ b/src/cocos/controller/ControllerConstants.lua @@ -0,0 +1,38 @@ + +cc = cc or {} + +cc.ControllerKey = +{ + JOYSTICK_LEFT_X = 1000, + JOYSTICK_LEFT_Y = 1001, + JOYSTICK_RIGHT_X = 1002, + JOYSTICK_RIGHT_Y = 1003, + + BUTTON_A = 1004, + BUTTON_B = 1005, + BUTTON_C = 1006, + BUTTON_X = 1007, + BUTTON_Y = 1008, + BUTTON_Z = 1009, + + BUTTON_DPAD_UP = 1010, + BUTTON_DPAD_DOWN = 1011, + BUTTON_DPAD_LEFT = 1012, + BUTTON_DPAD_RIGHT = 1013, + BUTTON_DPAD_CENTER = 1014, + + BUTTON_LEFT_SHOULDER = 1015, + BUTTON_RIGHT_SHOULDER = 1016, + + AXIS_LEFT_TRIGGER = 1017, + AXIS_RIGHT_TRIGGER = 1018, + + BUTTON_LEFT_THUMBSTICK = 1019, + BUTTON_RIGHT_THUMBSTICK = 1020, + + BUTTON_START = 1021, + BUTTON_SELECT = 1022, + + BUTTON_PAUSE = 1023, + KEY_MAX = 1024, +} diff --git a/src/cocos/extension/DeprecatedExtensionClass.lua b/src/cocos/extension/DeprecatedExtensionClass.lua new file mode 100644 index 0000000..a5a5930 --- /dev/null +++ b/src/cocos/extension/DeprecatedExtensionClass.lua @@ -0,0 +1,134 @@ +if nil == cc.Control then + return +end + +-- This is the DeprecatedExtensionClass +DeprecatedExtensionClass = {} or DeprecatedExtensionClass + +--tip +local function deprecatedTip(old_name,new_name) + print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") +end + +--CCControl class will be Deprecated,begin +function DeprecatedExtensionClass.CCControl() + deprecatedTip("CCControl","cc.Control") + return cc.Control +end +_G["CCControl"] = DeprecatedExtensionClass.CCControl() +--CCControl class will be Deprecated,end + +--CCScrollView class will be Deprecated,begin +function DeprecatedExtensionClass.CCScrollView() + deprecatedTip("CCScrollView","cc.ScrollView") + return cc.ScrollView +end +_G["CCScrollView"] = DeprecatedExtensionClass.CCScrollView() +--CCScrollView class will be Deprecated,end + +--CCTableView class will be Deprecated,begin +function DeprecatedExtensionClass.CCTableView() + deprecatedTip("CCTableView","cc.TableView") + return cc.TableView +end +_G["CCTableView"] = DeprecatedExtensionClass.CCTableView() +--CCTableView class will be Deprecated,end + +--CCControlPotentiometer class will be Deprecated,begin +function DeprecatedExtensionClass.CCControlPotentiometer() + deprecatedTip("CCControlPotentiometer","cc.ControlPotentiometer") + return cc.ControlPotentiometer +end +_G["CCControlPotentiometer"] = DeprecatedExtensionClass.CCControlPotentiometer() +--CCControlPotentiometer class will be Deprecated,end + +--CCControlStepper class will be Deprecated,begin +function DeprecatedExtensionClass.CCControlStepper() + deprecatedTip("CCControlStepper","cc.ControlStepper") + return cc.ControlStepper +end +_G["CCControlStepper"] = DeprecatedExtensionClass.CCControlStepper() +--CCControlStepper class will be Deprecated,end + +--CCControlHuePicker class will be Deprecated,begin +function DeprecatedExtensionClass.CCControlHuePicker() + deprecatedTip("CCControlHuePicker","cc.ControlHuePicker") + return cc.ControlHuePicker +end +_G["CCControlHuePicker"] = DeprecatedExtensionClass.CCControlHuePicker() +--CCControlHuePicker class will be Deprecated,end + +--CCControlSlider class will be Deprecated,begin +function DeprecatedExtensionClass.CCControlSlider() + deprecatedTip("CCControlSlider","cc.ControlSlider") + return cc.ControlSlider +end +_G["CCControlSlider"] = DeprecatedExtensionClass.CCControlSlider() +--CCControlSlider class will be Deprecated,end + +--CCControlSaturationBrightnessPicker class will be Deprecated,begin +function DeprecatedExtensionClass.CCControlSaturationBrightnessPicker() + deprecatedTip("CCControlSaturationBrightnessPicker","cc.ControlSaturationBrightnessPicker") + return cc.ControlSaturationBrightnessPicker +end +_G["CCControlSaturationBrightnessPicker"] = DeprecatedExtensionClass.CCControlSaturationBrightnessPicker() +--CCControlSaturationBrightnessPicker class will be Deprecated,end + +--CCControlSwitch class will be Deprecated,begin +function DeprecatedExtensionClass.CCControlSwitch() + deprecatedTip("CCControlSwitch","cc.ControlSwitch") + return cc.ControlSwitch +end +_G["CCControlSwitch"] = DeprecatedExtensionClass.CCControlSwitch() +--CCControlSwitch class will be Deprecated,end + +--CCControlButton class will be Deprecated,begin +function DeprecatedExtensionClass.CCControlButton() + deprecatedTip("CCControlButton","cc.ControlButton") + return cc.ControlButton +end +_G["CCControlButton"] = DeprecatedExtensionClass.CCControlButton() +--CCControlButton class will be Deprecated,end + +--CCControlColourPicker class will be Deprecated,begin +function DeprecatedExtensionClass.CCControlColourPicker() + deprecatedTip("CCControlColourPicker","cc.ControlColourPicker") + return cc.ControlColourPicker +end +_G["CCControlColourPicker"] = DeprecatedExtensionClass.CCControlColourPicker() +--CCControlColourPicker class will be Deprecated,end + + +if nil == ccui then + return +end + +--CCEditBox class will be Deprecated,begin +function DeprecatedExtensionClass.CCEditBox() + deprecatedTip("CCEditBox","ccui.EditBox") + return ccui.EditBox +end +_G["CCEditBox"] = DeprecatedExtensionClass.CCEditBox() + +function DeprecatedExtensionClass.CCUIEditBox() + deprecatedTip("cc.EditBox","ccui.EditBox") + return ccui.EditBox +end +_G["cc"]["EditBox"] = DeprecatedExtensionClass.CCUIEditBox() + +--CCEditBox class will be Deprecated,end + +--CCScale9Sprite class will be Deprecated,begin +function DeprecatedExtensionClass.CCScale9Sprite() + deprecatedTip("CCScale9Sprite","ccui.Scale9Sprite") + return ccui.Scale9Sprite +end +_G["CCScale9Sprite"] = DeprecatedExtensionClass.CCScale9Sprite() + +function DeprecatedExtensionClass.UIScale9Sprite() + deprecatedTip("cc.Scale9Sprite","ccui.Scale9Sprite") + return ccui.Scale9Sprite +end +_G["cc"]["Scale9Sprite"] = DeprecatedExtensionClass.UIScale9Sprite() +--CCScale9Sprite class will be Deprecated,end + diff --git a/src/cocos/extension/DeprecatedExtensionEnum.lua b/src/cocos/extension/DeprecatedExtensionEnum.lua new file mode 100644 index 0000000..9483df0 --- /dev/null +++ b/src/cocos/extension/DeprecatedExtensionEnum.lua @@ -0,0 +1,26 @@ +if nil == cc.Control then + return +end + +_G.kCCControlStepperPartMinus = cc.CONTROL_STEPPER_PART_MINUS +_G.kCCControlStepperPartPlus = cc.CONTROL_STEPPER_PART_PLUS +_G.kCCControlStepperPartNone = cc.CONTROL_STEPPER_PART_NONE + +_G.CCControlEventTouchDown = cc.CONTROL_EVENTTYPE_TOUCH_DOWN +_G.CCControlEventTouchDragInside = cc.CONTROL_EVENTTYPE_DRAG_INSIDE +_G.CCControlEventTouchDragOutside = cc.CONTROL_EVENTTYPE_DRAG_OUTSIDE +_G.CCControlEventTouchDragEnter = cc.CONTROL_EVENTTYPE_DRAG_ENTER +_G.CCControlEventTouchDragExit = cc.CONTROL_EVENTTYPE_DRAG_EXIT +_G.CCControlEventTouchUpInside = cc.CONTROL_EVENTTYPE_TOUCH_UP_INSIDE +_G.CCControlEventTouchUpOutside = cc.CONTROL_EVENTTYPE_TOUCH_UP_OUTSIDE +_G.CCControlEventTouchCancel = cc.CONTROL_EVENTTYPE_TOUCH_CANCEL +_G.CCControlEventValueChanged = cc.CONTROL_EVENTTYPE_VALUE_CHANGED +_G.CCControlStateNormal = cc.CONTROL_STATE_NORMAL +_G.CCControlStateHighlighted = cc.CONTROL_STATE_HIGH_LIGHTED +_G.CCControlStateDisabled = cc.CONTROL_STATE_DISABLED +_G.CCControlStateSelected = cc.CONTROL_STATE_SELECTED + +_G.kCCScrollViewDirectionHorizontal = cc.SCROLLVIEW_DIRECTION_HORIZONTAL +_G.kCCScrollViewDirectionVertical = cc.SCROLLVIEW_DIRECTION_VERTICAL +_G.kCCTableViewFillTopDown = cc.TABLEVIEW_FILL_TOPDOWN +_G.kCCTableViewFillBottomUp = cc.TABLEVIEW_FILL_BOTTOMUP diff --git a/src/cocos/extension/DeprecatedExtensionFunc.lua b/src/cocos/extension/DeprecatedExtensionFunc.lua new file mode 100644 index 0000000..2b617fc --- /dev/null +++ b/src/cocos/extension/DeprecatedExtensionFunc.lua @@ -0,0 +1,32 @@ +if nil == cc.Control then + return +end + +--tip +local function deprecatedTip(old_name,new_name) + print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") +end + +--functions of CCControl will be deprecated end +local CCControlDeprecated = { } +function CCControlDeprecated.addHandleOfControlEvent(self,func,controlEvent) + deprecatedTip("addHandleOfControlEvent","registerControlEventHandler") + print("come in addHandleOfControlEvent") + self:registerControlEventHandler(func,controlEvent) +end +CCControl.addHandleOfControlEvent = CCControlDeprecated.addHandleOfControlEvent +--functions of CCControl will be deprecated end + +--Enums of CCTableView will be deprecated begin +CCTableView.kTableViewScroll = cc.SCROLLVIEW_SCRIPT_SCROLL +CCTableView.kTableViewZoom = cc.SCROLLVIEW_SCRIPT_ZOOM +CCTableView.kTableCellTouched = cc.TABLECELL_TOUCHED +CCTableView.kTableCellSizeForIndex = cc.TABLECELL_SIZE_FOR_INDEX +CCTableView.kTableCellSizeAtIndex = cc.TABLECELL_SIZE_AT_INDEX +CCTableView.kNumberOfCellsInTableView = cc.NUMBER_OF_CELLS_IN_TABLEVIEW +--Enums of CCTableView will be deprecated end + +--Enums of CCScrollView will be deprecated begin +CCScrollView.kScrollViewScroll = cc.SCROLLVIEW_SCRIPT_SCROLL +CCScrollView.kScrollViewZoom = cc.SCROLLVIEW_SCRIPT_ZOOM +--Enums of CCScrollView will be deprecated end diff --git a/src/cocos/extension/ExtensionConstants.lua b/src/cocos/extension/ExtensionConstants.lua new file mode 100644 index 0000000..0bfc8f8 --- /dev/null +++ b/src/cocos/extension/ExtensionConstants.lua @@ -0,0 +1,70 @@ +if nil == cc.Control then + return +end + +cc.CONTROL_STATE_NORMAL = 1 +cc.CONTROL_STATE_HIGH_LIGHTED = 2 +cc.CONTROL_STATE_DISABLED = 4 +cc.CONTROL_STATE_SELECTED = 8 + +cc.CONTROL_STEPPER_PART_MINUS = 0 +cc.CONTROL_STEPPER_PART_PLUS = 1 +cc.CONTROL_STEPPER_PART_NONE = 2 + +cc.TABLEVIEW_FILL_TOPDOWN = 0 +cc.TABLEVIEW_FILL_BOTTOMUP = 1 + +cc.SCROLLVIEW_SCRIPT_SCROLL = 0 +cc.SCROLLVIEW_SCRIPT_ZOOM = 1 +cc.TABLECELL_TOUCHED = 2 +cc.TABLECELL_HIGH_LIGHT = 3 +cc.TABLECELL_UNHIGH_LIGHT = 4 +cc.TABLECELL_WILL_RECYCLE = 5 +cc.TABLECELL_SIZE_FOR_INDEX = 6 +cc.TABLECELL_SIZE_AT_INDEX = 7 +cc.NUMBER_OF_CELLS_IN_TABLEVIEW = 8 + +cc.SCROLLVIEW_DIRECTION_NONE = -1 +cc.SCROLLVIEW_DIRECTION_HORIZONTAL = 0 +cc.SCROLLVIEW_DIRECTION_VERTICAL = 1 +cc.SCROLLVIEW_DIRECTION_BOTH = 2 + +cc.CONTROL_EVENTTYPE_TOUCH_DOWN = 1 +cc.CONTROL_EVENTTYPE_DRAG_INSIDE = 2 +cc.CONTROL_EVENTTYPE_DRAG_OUTSIDE = 4 +cc.CONTROL_EVENTTYPE_DRAG_ENTER = 8 +cc.CONTROL_EVENTTYPE_DRAG_EXIT = 16 +cc.CONTROL_EVENTTYPE_TOUCH_UP_INSIDE = 32 +cc.CONTROL_EVENTTYPE_TOUCH_UP_OUTSIDE = 64 +cc.CONTROL_EVENTTYPE_TOUCH_CANCEL = 128 +cc.CONTROL_EVENTTYPE_VALUE_CHANGED = 256 + +cc.EDITBOX_INPUT_MODE_ANY = 0 +cc.EDITBOX_INPUT_MODE_EMAILADDR = 1 +cc.EDITBOX_INPUT_MODE_NUMERIC = 2 +cc.EDITBOX_INPUT_MODE_PHONENUMBER = 3 +cc.EDITBOX_INPUT_MODE_URL = 4 +cc.EDITBOX_INPUT_MODE_DECIMAL = 5 +cc.EDITBOX_INPUT_MODE_SINGLELINE = 6 + +cc.EDITBOX_INPUT_FLAG_PASSWORD = 0 +cc.EDITBOX_INPUT_FLAG_SENSITIVE = 1 +cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD = 2 +cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE = 3 +cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS = 4 + +cc.KEYBOARD_RETURNTYPE_DEFAULT = 0 +cc.KEYBOARD_RETURNTYPE_DONE = 1 +cc.KEYBOARD_RETURNTYPE_SEND = 2 +cc.KEYBOARD_RETURNTYPE_SEARCH = 3 +cc.KEYBOARD_RETURNTYPE_GO = 4 + +cc.ASSETSMANAGER_CREATE_FILE = 0 +cc.ASSETSMANAGER_NETWORK = 1 +cc.ASSETSMANAGER_NO_NEW_VERSION = 2 +cc.ASSETSMANAGER_UNCOMPRESS = 3 + +cc.ASSETSMANAGER_PROTOCOL_PROGRESS = 0 +cc.ASSETSMANAGER_PROTOCOL_SUCCESS = 1 +cc.ASSETSMANAGER_PROTOCOL_ERROR = 2 + diff --git a/src/cocos/framework/audio.lua b/src/cocos/framework/audio.lua new file mode 100644 index 0000000..59eb566 --- /dev/null +++ b/src/cocos/framework/audio.lua @@ -0,0 +1,206 @@ +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local audio = {} + +local engine = cc.SimpleAudioEngine:getInstance() + +function audio.getMusicVolume() + local volume = engine:getMusicVolume() + if DEBUG > 1 then + printf("[audio] getMusicVolume() - volume: %0.2f", volume) + end + return volume +end + +function audio.setMusicVolume(volume) + volume = checknumber(volume) + if DEBUG > 1 then + printf("[audio] setMusicVolume() - volume: %0.2f", volume) + end + engine:setMusicVolume(volume) +end + +function audio.preloadMusic(filename) + assert(filename, "audio.preloadMusic() - invalid filename") + if DEBUG > 1 then + printf("[audio] preloadMusic() - filename: %s", tostring(filename)) + end + engine:preloadMusic(filename) +end + +function audio.playMusic(filename, isLoop) + assert(filename, "audio.playMusic() - invalid filename") + if type(isLoop) ~= "boolean" then isLoop = true end + + audio.stopMusic() + if DEBUG > 1 then + printf("[audio] playMusic() - filename: %s, isLoop: %s", tostring(filename), tostring(isLoop)) + end + engine:playMusic(filename, isLoop) +end + +function audio.stopMusic(isReleaseData) + isReleaseData = checkbool(isReleaseData) + if DEBUG > 1 then + printf("[audio] stopMusic() - isReleaseData: %s", tostring(isReleaseData)) + end + engine:stopMusic(isReleaseData) +end + +function audio.pauseMusic() + if DEBUG > 1 then + printf("[audio] pauseMusic()") + end + engine:pauseMusic() +end + +function audio.resumeMusic() + if DEBUG > 1 then + printf("[audio] resumeMusic()") + end + engine:resumeMusic() +end + +function audio.rewindMusic() + if DEBUG > 1 then + printf("[audio] rewindMusic()") + end + engine:rewindMusic() +end + +function audio.isMusicPlaying() + local ret = engine:isMusicPlaying() + if DEBUG > 1 then + printf("[audio] isMusicPlaying() - ret: %s", tostring(ret)) + end + return ret +end + +function audio.getSoundsVolume() + local volume = engine:getEffectsVolume() + if DEBUG > 1 then + printf("[audio] getSoundsVolume() - volume: %0.1f", volume) + end + return volume +end + +function audio.setSoundsVolume(volume) + volume = checknumber(volume) + if DEBUG > 1 then + printf("[audio] setSoundsVolume() - volume: %0.1f", volume) + end + engine:setEffectsVolume(volume) +end + +function audio.playSound(filename, isLoop) + if not filename then + printError("audio.playSound() - invalid filename") + return + end + if type(isLoop) ~= "boolean" then isLoop = false end + if DEBUG > 1 then + printf("[audio] playSound() - filename: %s, isLoop: %s", tostring(filename), tostring(isLoop)) + end + return engine:playEffect(filename, isLoop) +end + +function audio.pauseSound(handle) + if not handle then + printError("audio.pauseSound() - invalid handle") + return + end + if DEBUG > 1 then + printf("[audio] pauseSound() - handle: %s", tostring(handle)) + end + engine:pauseEffect(handle) +end + +function audio.pauseAllSounds() + if DEBUG > 1 then + printf("[audio] pauseAllSounds()") + end + engine:pauseAllEffects() +end + +function audio.resumeSound(handle) + if not handle then + printError("audio.resumeSound() - invalid handle") + return + end + if DEBUG > 1 then + printf("[audio] resumeSound() - handle: %s", tostring(handle)) + end + engine:resumeEffect(handle) +end + +function audio.resumeAllSounds() + if DEBUG > 1 then + printf("[audio] resumeAllSounds()") + end + engine:resumeAllEffects() +end + +function audio.stopSound(handle) + if not handle then + printError("audio.stopSound() - invalid handle") + return + end + if DEBUG > 1 then + printf("[audio] stopSound() - handle: %s", tostring(handle)) + end + engine:stopEffect(handle) +end + +function audio.stopAllSounds() + if DEBUG > 1 then + printf("[audio] stopAllSounds()") + end + engine:stopAllEffects() +end +audio.stopAllEffects = audio.stopAllSounds + +function audio.preloadSound(filename) + if not filename then + printError("audio.preloadSound() - invalid filename") + return + end + if DEBUG > 1 then + printf("[audio] preloadSound() - filename: %s", tostring(filename)) + end + engine:preloadEffect(filename) +end + +function audio.unloadSound(filename) + if not filename then + printError("audio.unloadSound() - invalid filename") + return + end + if DEBUG > 1 then + printf("[audio] unloadSound() - filename: %s", tostring(filename)) + end + engine:unloadEffect(filename) +end + +return audio diff --git a/src/cocos/framework/components/event.lua b/src/cocos/framework/components/event.lua new file mode 100644 index 0000000..a6ca22b --- /dev/null +++ b/src/cocos/framework/components/event.lua @@ -0,0 +1,157 @@ + +local Event = class("Event") + +local EXPORTED_METHODS = { + "addEventListener", + "dispatchEvent", + "removeEventListener", + "removeEventListenersByTag", + "removeEventListenersByEvent", + "removeAllEventListeners", + "hasEventListener", + "dumpAllEventListeners", +} + +function Event:init_() + self.target_ = nil + self.listeners_ = {} + self.nextListenerHandleIndex_ = 0 +end + +function Event:bind(target) + self:init_() + cc.setmethods(target, self, EXPORTED_METHODS) + self.target_ = target +end + +function Event:unbind(target) + cc.unsetmethods(target, EXPORTED_METHODS) + self:init_() +end + +function Event:on(eventName, listener, tag) + assert(type(eventName) == "string" and eventName ~= "", + "Event:addEventListener() - invalid eventName") + eventName = string.upper(eventName) + if self.listeners_[eventName] == nil then + self.listeners_[eventName] = {} + end + + self.nextListenerHandleIndex_ = self.nextListenerHandleIndex_ + 1 + local handle = tostring(self.nextListenerHandleIndex_) + tag = tag or "" + self.listeners_[eventName][handle] = {listener, tag} + + if DEBUG > 1 then + printInfo("%s [Event] addEventListener() - event: %s, handle: %s, tag: \"%s\"", + tostring(self.target_), eventName, handle, tostring(tag)) + end + + return self.target_, handle +end + +Event.addEventListener = Event.on + +function Event:dispatchEvent(event) + event.name = string.upper(tostring(event.name)) + local eventName = event.name + if DEBUG > 1 then + printInfo("%s [Event] dispatchEvent() - event %s", tostring(self.target_), eventName) + end + + if self.listeners_[eventName] == nil then return end + event.target = self.target_ + event.stop_ = false + event.stop = function(self) + self.stop_ = true + end + + for handle, listener in pairs(self.listeners_[eventName]) do + if DEBUG > 1 then + printInfo("%s [Event] dispatchEvent() - dispatching event %s to listener %s", tostring(self.target_), eventName, handle) + end + -- listener[1] = listener + -- listener[2] = tag + event.tag = listener[2] + listener[1](event) + if event.stop_ then + if DEBUG > 1 then + printInfo("%s [Event] dispatchEvent() - break dispatching for event %s", tostring(self.target_), eventName) + end + break + end + end + + return self.target_ +end + +function Event:removeEventListener(handleToRemove) + for eventName, listenersForEvent in pairs(self.listeners_) do + for handle, _ in pairs(listenersForEvent) do + if handle == handleToRemove then + listenersForEvent[handle] = nil + if DEBUG > 1 then + printInfo("%s [Event] removeEventListener() - remove listener [%s] for event %s", tostring(self.target_), handle, eventName) + end + return self.target_ + end + end + end + + return self.target_ +end + +function Event:removeEventListenersByTag(tagToRemove) + for eventName, listenersForEvent in pairs(self.listeners_) do + for handle, listener in pairs(listenersForEvent) do + -- listener[1] = listener + -- listener[2] = tag + if listener[2] == tagToRemove then + listenersForEvent[handle] = nil + if DEBUG > 1 then + printInfo("%s [Event] removeEventListener() - remove listener [%s] for event %s", tostring(self.target_), handle, eventName) + end + end + end + end + + return self.target_ +end + +function Event:removeEventListenersByEvent(eventName) + self.listeners_[string.upper(eventName)] = nil + if DEBUG > 1 then + printInfo("%s [Event] removeAllEventListenersForEvent() - remove all listeners for event %s", tostring(self.target_), eventName) + end + return self.target_ +end + +function Event:removeAllEventListeners() + self.listeners_ = {} + if DEBUG > 1 then + printInfo("%s [Event] removeAllEventListeners() - remove all listeners", tostring(self.target_)) + end + return self.target_ +end + +function Event:hasEventListener(eventName) + eventName = string.upper(tostring(eventName)) + local t = self.listeners_[eventName] + for _, __ in pairs(t) do + return true + end + return false +end + +function Event:dumpAllEventListeners() + print("---- Event:dumpAllEventListeners() ----") + for name, listeners in pairs(self.listeners_) do + printf("-- event: %s", name) + for handle, listener in pairs(listeners) do + printf("-- listener: %s, handle: %s", tostring(listener[1]), tostring(handle)) + end + end + return self.target_ +end + +return Event diff --git a/src/cocos/framework/device.lua b/src/cocos/framework/device.lua new file mode 100644 index 0000000..acf7746 --- /dev/null +++ b/src/cocos/framework/device.lua @@ -0,0 +1,107 @@ +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local device = {} + +device.platform = "unknown" +device.model = "unknown" + +local app = cc.Application:getInstance() +local target = app:getTargetPlatform() +if target == cc.PLATFORM_OS_WINDOWS then + device.platform = "windows" +elseif target == cc.PLATFORM_OS_MAC then + device.platform = "mac" +elseif target == cc.PLATFORM_OS_ANDROID then + device.platform = "android" +elseif target == cc.PLATFORM_OS_IPHONE or target == cc.PLATFORM_OS_IPAD then + device.platform = "ios" + local director = cc.Director:getInstance() + local view = director:getOpenGLView() + local framesize = view:getFrameSize() + local w, h = framesize.width, framesize.height + if w == 640 and h == 960 then + device.model = "iphone 4" + elseif w == 640 and h == 1136 then + device.model = "iphone 5" + elseif w == 750 and h == 1334 then + device.model = "iphone 6" + elseif w == 1242 and h == 2208 then + device.model = "iphone 6 plus" + elseif w == 768 and h == 1024 then + device.model = "ipad" + elseif w == 1536 and h == 2048 then + device.model = "ipad retina" + end +elseif target == cc.PLATFORM_OS_WINRT then + device.platform = "winrt" +elseif target == cc.PLATFORM_OS_WP8 then + device.platform = "wp8" +end + +local language_ = app:getCurrentLanguage() +if language_ == cc.LANGUAGE_CHINESE then + language_ = "cn" +elseif language_ == cc.LANGUAGE_FRENCH then + language_ = "fr" +elseif language_ == cc.LANGUAGE_ITALIAN then + language_ = "it" +elseif language_ == cc.LANGUAGE_GERMAN then + language_ = "gr" +elseif language_ == cc.LANGUAGE_SPANISH then + language_ = "sp" +elseif language_ == cc.LANGUAGE_RUSSIAN then + language_ = "ru" +elseif language_ == cc.LANGUAGE_KOREAN then + language_ = "kr" +elseif language_ == cc.LANGUAGE_JAPANESE then + language_ = "jp" +elseif language_ == cc.LANGUAGE_HUNGARIAN then + language_ = "hu" +elseif language_ == cc.LANGUAGE_PORTUGUESE then + language_ = "pt" +elseif language_ == cc.LANGUAGE_ARABIC then + language_ = "ar" +else + language_ = "en" +end + +device.language = language_ +device.writablePath = cc.FileUtils:getInstance():getWritablePath() +device.directorySeparator = "/" +device.pathSeparator = ":" +if device.platform == "windows" then + device.directorySeparator = "\\" + device.pathSeparator = ";" +end + +printInfo("# device.platform = " .. device.platform) +printInfo("# device.model = " .. device.model) +printInfo("# device.language = " .. device.language) +printInfo("# device.writablePath = " .. device.writablePath) +printInfo("# device.directorySeparator = " .. device.directorySeparator) +printInfo("# device.pathSeparator = " .. device.pathSeparator) +printInfo("#") + +return device diff --git a/src/cocos/framework/display.lua b/src/cocos/framework/display.lua new file mode 100644 index 0000000..8466a30 --- /dev/null +++ b/src/cocos/framework/display.lua @@ -0,0 +1,541 @@ +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local display = {} + +local director = cc.Director:getInstance() +local view = director:getOpenGLView() + +if not view then + local width = 960 + local height = 640 + if CC_DESIGN_RESOLUTION then + if CC_DESIGN_RESOLUTION.width then + width = CC_DESIGN_RESOLUTION.width + end + if CC_DESIGN_RESOLUTION.height then + height = CC_DESIGN_RESOLUTION.height + end + end + view = cc.GLViewImpl:createWithRect("Cocos2d-Lua", cc.rect(0, 0, width, height)) + director:setOpenGLView(view) +end + +local framesize = view:getFrameSize() +local textureCache = director:getTextureCache() +local spriteFrameCache = cc.SpriteFrameCache:getInstance() +local animationCache = cc.AnimationCache:getInstance() + +-- auto scale +local function checkResolution(r) + r.width = checknumber(r.width) + r.height = checknumber(r.height) + r.autoscale = string.upper(r.autoscale) + assert(r.width > 0 and r.height > 0, + string.format("display - invalid design resolution size %d, %d", r.width, r.height)) +end + +local function setDesignResolution(r, framesize) + if r.autoscale == "FILL_ALL" then + view:setDesignResolutionSize(framesize.width, framesize.height, cc.ResolutionPolicy.FILL_ALL) + else + local scaleX, scaleY = framesize.width / r.width, framesize.height / r.height + local width, height = framesize.width, framesize.height + if r.autoscale == "FIXED_WIDTH" then + width = framesize.width / scaleX + height = framesize.height / scaleX + view:setDesignResolutionSize(width, height, cc.ResolutionPolicy.NO_BORDER) + elseif r.autoscale == "FIXED_HEIGHT" then + width = framesize.width / scaleY + height = framesize.height / scaleY + view:setDesignResolutionSize(width, height, cc.ResolutionPolicy.NO_BORDER) + elseif r.autoscale == "EXACT_FIT" then + view:setDesignResolutionSize(r.width, r.height, cc.ResolutionPolicy.EXACT_FIT) + elseif r.autoscale == "NO_BORDER" then + view:setDesignResolutionSize(r.width, r.height, cc.ResolutionPolicy.NO_BORDER) + elseif r.autoscale == "SHOW_ALL" then + view:setDesignResolutionSize(r.width, r.height, cc.ResolutionPolicy.SHOW_ALL) + else + printError(string.format("display - invalid r.autoscale \"%s\"", r.autoscale)) + end + end +end + +local function setConstants() + local sizeInPixels = view:getFrameSize() + display.sizeInPixels = {width = sizeInPixels.width, height = sizeInPixels.height} + + local viewsize = director:getWinSize() + display.contentScaleFactor = director:getContentScaleFactor() + display.size = {width = viewsize.width, height = viewsize.height} + display.width = display.size.width + display.height = display.size.height + display.cx = display.width / 2 + display.cy = display.height / 2 + display.c_left = -display.width / 2 + display.c_right = display.width / 2 + display.c_top = display.height / 2 + display.c_bottom = -display.height / 2 + display.left = 0 + display.right = display.width + display.top = display.height + display.bottom = 0 + display.center = cc.p(display.cx, display.cy) + display.left_top = cc.p(display.left, display.top) + display.left_bottom = cc.p(display.left, display.bottom) + display.left_center = cc.p(display.left, display.cy) + display.right_top = cc.p(display.right, display.top) + display.right_bottom = cc.p(display.right, display.bottom) + display.right_center = cc.p(display.right, display.cy) + display.top_center = cc.p(display.cx, display.top) + display.top_bottom = cc.p(display.cx, display.bottom) + + printInfo(string.format("# display.sizeInPixels = {width = %0.2f, height = %0.2f}", display.sizeInPixels.width, display.sizeInPixels.height)) + printInfo(string.format("# display.size = {width = %0.2f, height = %0.2f}", display.size.width, display.size.height)) + printInfo(string.format("# display.contentScaleFactor = %0.2f", display.contentScaleFactor)) + printInfo(string.format("# display.width = %0.2f", display.width)) + printInfo(string.format("# display.height = %0.2f", display.height)) + printInfo(string.format("# display.cx = %0.2f", display.cx)) + printInfo(string.format("# display.cy = %0.2f", display.cy)) + printInfo(string.format("# display.left = %0.2f", display.left)) + printInfo(string.format("# display.right = %0.2f", display.right)) + printInfo(string.format("# display.top = %0.2f", display.top)) + printInfo(string.format("# display.bottom = %0.2f", display.bottom)) + printInfo(string.format("# display.c_left = %0.2f", display.c_left)) + printInfo(string.format("# display.c_right = %0.2f", display.c_right)) + printInfo(string.format("# display.c_top = %0.2f", display.c_top)) + printInfo(string.format("# display.c_bottom = %0.2f", display.c_bottom)) + printInfo(string.format("# display.center = {x = %0.2f, y = %0.2f}", display.center.x, display.center.y)) + printInfo(string.format("# display.left_top = {x = %0.2f, y = %0.2f}", display.left_top.x, display.left_top.y)) + printInfo(string.format("# display.left_bottom = {x = %0.2f, y = %0.2f}", display.left_bottom.x, display.left_bottom.y)) + printInfo(string.format("# display.left_center = {x = %0.2f, y = %0.2f}", display.left_center.x, display.left_center.y)) + printInfo(string.format("# display.right_top = {x = %0.2f, y = %0.2f}", display.right_top.x, display.right_top.y)) + printInfo(string.format("# display.right_bottom = {x = %0.2f, y = %0.2f}", display.right_bottom.x, display.right_bottom.y)) + printInfo(string.format("# display.right_center = {x = %0.2f, y = %0.2f}", display.right_center.x, display.right_center.y)) + printInfo(string.format("# display.top_center = {x = %0.2f, y = %0.2f}", display.top_center.x, display.top_center.y)) + printInfo(string.format("# display.top_bottom = {x = %0.2f, y = %0.2f}", display.top_bottom.x, display.top_bottom.y)) + printInfo("#") +end + +function display.setAutoScale(configs) + if type(configs) ~= "table" then return end + + checkResolution(configs) + if type(configs.callback) == "function" then + local c = configs.callback(framesize) + for k, v in pairs(c or {}) do + configs[k] = v + end + checkResolution(configs) + end + + setDesignResolution(configs, framesize) + + printInfo(string.format("# design resolution size = {width = %0.2f, height = %0.2f}", configs.width, configs.height)) + printInfo(string.format("# design resolution autoscale = %s", configs.autoscale)) + setConstants() +end + +if type(CC_DESIGN_RESOLUTION) == "table" then + display.setAutoScale(CC_DESIGN_RESOLUTION) +end + +display.COLOR_WHITE = cc.c3b(255, 255, 255) +display.COLOR_BLACK = cc.c3b(0, 0, 0) +display.COLOR_RED = cc.c3b(255, 0, 0) +display.COLOR_GREEN = cc.c3b(0, 255, 0) +display.COLOR_BLUE = cc.c3b(0, 0, 255) + +display.AUTO_SIZE = 0 +display.FIXED_SIZE = 1 +display.LEFT_TO_RIGHT = 0 +display.RIGHT_TO_LEFT = 1 +display.TOP_TO_BOTTOM = 2 +display.BOTTOM_TO_TOP = 3 + +display.CENTER = cc.p(0.5, 0.5) +display.LEFT_TOP = cc.p(0, 1) +display.LEFT_BOTTOM = cc.p(0, 0) +display.LEFT_CENTER = cc.p(0, 0.5) +display.RIGHT_TOP = cc.p(1, 1) +display.RIGHT_BOTTOM = cc.p(1, 0) +display.RIGHT_CENTER = cc.p(1, 0.5) +display.CENTER_TOP = cc.p(0.5, 1) +display.CENTER_BOTTOM = cc.p(0.5, 0) + +display.SCENE_TRANSITIONS = { + CROSSFADE = cc.TransitionCrossFade, + FADE = {cc.TransitionFade, cc.c3b(0, 0, 0)}, + FADEBL = cc.TransitionFadeBL, + FADEDOWN = cc.TransitionFadeDown, + FADETR = cc.TransitionFadeTR, + FADEUP = cc.TransitionFadeUp, + FLIPANGULAR = {cc.TransitionFlipAngular, cc.TRANSITION_ORIENTATION_LEFT_OVER}, + FLIPX = {cc.TransitionFlipX, cc.TRANSITION_ORIENTATION_LEFT_OVER}, + FLIPY = {cc.TransitionFlipY, cc.TRANSITION_ORIENTATION_UP_OVER}, + JUMPZOOM = cc.TransitionJumpZoom, + MOVEINB = cc.TransitionMoveInB, + MOVEINL = cc.TransitionMoveInL, + MOVEINR = cc.TransitionMoveInR, + MOVEINT = cc.TransitionMoveInT, + PAGETURN = {cc.TransitionPageTurn, false}, + ROTOZOOM = cc.TransitionRotoZoom, + SHRINKGROW = cc.TransitionShrinkGrow, + SLIDEINB = cc.TransitionSlideInB, + SLIDEINL = cc.TransitionSlideInL, + SLIDEINR = cc.TransitionSlideInR, + SLIDEINT = cc.TransitionSlideInT, + SPLITCOLS = cc.TransitionSplitCols, + SPLITROWS = cc.TransitionSplitRows, + TURNOFFTILES = cc.TransitionTurnOffTiles, + ZOOMFLIPANGULAR = cc.TransitionZoomFlipAngular, + ZOOMFLIPX = {cc.TransitionZoomFlipX, cc.TRANSITION_ORIENTATION_LEFT_OVER}, + ZOOMFLIPY = {cc.TransitionZoomFlipY, cc.TRANSITION_ORIENTATION_UP_OVER}, +} + +display.TEXTURES_PIXEL_FORMAT = {} + +display.DEFAULT_TTF_FONT = "Arial" +display.DEFAULT_TTF_FONT_SIZE = 32 + + +local PARAMS_EMPTY = {} +local RECT_ZERO = cc.rect(0, 0, 0, 0) + +local sceneIndex = 0 +function display.newScene(name, params) + params = params or PARAMS_EMPTY + sceneIndex = sceneIndex + 1 + local scene + if not params.physics then + scene = cc.Scene:create() + else + scene = cc.Scene:createWithPhysics() + end + scene.name_ = string.format("%s:%d", name or "", sceneIndex) + + if params.transition then + scene = display.wrapSceneWithTransition(scene, params.transition, params.time, params.more) + end + + return scene +end + +function display.wrapScene(scene, transition, time, more) + local key = string.upper(tostring(transition)) + + if key == "RANDOM" then + local keys = table.keys(display.SCENE_TRANSITIONS) + key = keys[math.random(1, #keys)] + end + + if display.SCENE_TRANSITIONS[key] then + local t = display.SCENE_TRANSITIONS[key] + time = time or 0.2 + more = more or t[2] + if type(t) == "table" then + scene = t[1]:create(time, scene, more) + else + scene = t:create(time, scene) + end + else + error(string.format("display.wrapScene() - invalid transition %s", tostring(transition))) + end + return scene +end + +function display.runScene(newScene, transition, time, more) + if director:getRunningScene() then + if transition then + newScene = display.wrapScene(newScene, transition, time, more) + end + director:replaceScene(newScene) + else + director:runWithScene(newScene) + end +end + +function display.getRunningScene() + return director:getRunningScene() +end + +function display.newNode() + return cc.Node:create() +end + +function display.newLayer(...) + local params = {...} + local c = #params + local layer + if c == 0 then + -- /** creates a fullscreen black layer */ + -- static Layer *create(); + layer = cc.Layer:create() + elseif c == 1 then + -- /** creates a Layer with color. Width and height are the window size. */ + -- static LayerColor * create(const Color4B& color); + layer = cc.LayerColor:create(cc.convertColor(params[1], "4b")) + elseif c == 2 then + -- /** creates a Layer with color, width and height in Points */ + -- static LayerColor * create(const Color4B& color, const Size& size); + -- + -- /** Creates a full-screen Layer with a gradient between start and end. */ + -- static LayerGradient* create(const Color4B& start, const Color4B& end); + local color1 = cc.convertColor(params[1], "4b") + local p2 = params[2] + assert(type(p2) == "table" and (p2.width or p2.r), "display.newLayer() - invalid paramerter 2") + if p2.r then + layer = cc.LayerGradient:create(color1, cc.convertColor(p2, "4b")) + else + layer = cc.LayerColor:create(color1, p2.width, p2.height) + end + elseif c == 3 then + -- /** creates a Layer with color, width and height in Points */ + -- static LayerColor * create(const Color4B& color, GLfloat width, GLfloat height); + -- + -- /** Creates a full-screen Layer with a gradient between start and end in the direction of v. */ + -- static LayerGradient* create(const Color4B& start, const Color4B& end, const Vec2& v); + local color1 = cc.convertColor(params[1], "4b") + local p2 = params[2] + local p2type = type(p2) + if p2type == "table" then + layer = cc.LayerGradient:create(color1, cc.convertColor(p2, "4b"), params[3]) + else + layer = cc.LayerColor:create(color1, p2, params[3]) + end + end + return layer +end + +function display.newSprite(source, x, y, params) + local spriteClass = cc.Sprite + local scale9 = false + + if type(x) == "table" and not x.x then + -- x is params + params = x + x = nil + y = nil + end + + local params = params or PARAMS_EMPTY + if params.scale9 or params.capInsets then + spriteClass = ccui.Scale9Sprite + scale9 = true + params.capInsets = params.capInsets or RECT_ZERO + params.rect = params.rect or RECT_ZERO + end + + local sprite + while true do + -- create sprite + if not source then + sprite = spriteClass:create() + break + end + + local sourceType = type(source) + if sourceType == "string" then + if string.byte(source) == 35 then -- first char is # + -- create sprite from spriteFrame + if not scale9 then + sprite = spriteClass:createWithSpriteFrameName(string.sub(source, 2)) + else + sprite = spriteClass:createWithSpriteFrameName(string.sub(source, 2), params.capInsets) + end + break + end + + -- create sprite from image file + if display.TEXTURES_PIXEL_FORMAT[source] then + cc.Texture2D:setDefaultAlphaPixelFormat(display.TEXTURES_PIXEL_FORMAT[source]) + end + if not scale9 then + sprite = spriteClass:create(source) + else + sprite = spriteClass:create(source, params.rect, params.capInsets) + end + if display.TEXTURES_PIXEL_FORMAT[source] then + cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_BGR_A8888) + end + break + elseif sourceType ~= "userdata" then + error(string.format("display.newSprite() - invalid source type \"%s\"", sourceType), 0) + else + sourceType = tolua.type(source) + if sourceType == "cc.SpriteFrame" then + if not scale9 then + sprite = spriteClass:createWithSpriteFrame(source) + else + sprite = spriteClass:createWithSpriteFrame(source, params.capInsets) + end + elseif sourceType == "cc.Texture2D" then + sprite = spriteClass:createWithTexture(source) + else + error(string.format("display.newSprite() - invalid source type \"%s\"", sourceType), 0) + end + end + break + end + + if sprite then + if x and y then sprite:setPosition(x, y) end + if params.size then sprite:setContentSize(params.size) end + else + error(string.format("display.newSprite() - create sprite failure, source \"%s\"", tostring(source)), 0) + end + + return sprite +end + +function display.newSpriteFrame(source, ...) + local frame + if type(source) == "string" then + if string.byte(source) == 35 then -- first char is # + source = string.sub(source, 2) + end + frame = spriteFrameCache:getSpriteFrame(source) + if not frame then + error(string.format("display.newSpriteFrame() - invalid frame name \"%s\"", tostring(source)), 0) + end + elseif tolua.type(source) == "cc.Texture2D" then + frame = cc.SpriteFrame:createWithTexture(source, ...) + else + error("display.newSpriteFrame() - invalid parameters", 0) + end + return frame +end + +function display.newFrames(pattern, begin, length, isReversed) + local frames = {} + local step = 1 + local last = begin + length - 1 + if isReversed then + last, begin = begin, last + step = -1 + end + + for index = begin, last, step do + local frameName = string.format(pattern, index) + local frame = spriteFrameCache:getSpriteFrame(frameName) + if not frame then + error(string.format("display.newFrames() - invalid frame name %s", tostring(frameName)), 0) + end + frames[#frames + 1] = frame + end + return frames +end + +local function newAnimation(frames, time) + local count = #frames + assert(count > 0, "display.newAnimation() - invalid frames") + time = time or 1.0 / count + return cc.Animation:createWithSpriteFrames(frames, time), + cc.Sprite:createWithSpriteFrame(frames[1]) +end + +function display.newAnimation(...) + local params = {...} + local c = #params + if c == 2 then + -- frames, time + return newAnimation(params[1], params[2]) + elseif c == 4 then + -- pattern, begin, length, time + local frames = display.newFrames(params[1], params[2], params[3]) + return newAnimation(frames, params[4]) + elseif c == 5 then + -- pattern, begin, length, isReversed, time + local frames = display.newFrames(params[1], params[2], params[3], params[4]) + return newAnimation(frames, params[5]) + else + error("display.newAnimation() - invalid parameters") + end +end + +function display.loadImage(imageFilename, callback) + if not callback then + return textureCache:addImage(imageFilename) + else + textureCache:addImageAsync(imageFilename, callback) + end +end + +local fileUtils = cc.FileUtils:getInstance() +function display.getImage(imageFilename) + local fullpath = fileUtils:fullPathForFilename(imageFilename) + return textureCache:getTextureForKey(fullpath) +end + +function display.removeImage(imageFilename) + textureCache:removeTextureForKey(imageFilename) +end + +function display.loadSpriteFrames(dataFilename, imageFilename, callback) + if display.TEXTURES_PIXEL_FORMAT[imageFilename] then + cc.Texture2D:setDefaultAlphaPixelFormat(display.TEXTURES_PIXEL_FORMAT[imageFilename]) + end + if not callback then + spriteFrameCache:addSpriteFrames(dataFilename, imageFilename) + else + spriteFrameCache:addSpriteFramesAsync(dataFilename, imageFilename, callback) + end + if display.TEXTURES_PIXEL_FORMAT[imageFilename] then + cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_BGR_A8888) + end +end + +function display.removeSpriteFrames(dataFilename, imageFilename) + spriteFrameCache:removeSpriteFramesFromFile(dataFilename) + if imageFilename then + display.removeImage(imageFilename) + end +end + +function display.removeSpriteFrame(imageFilename) + spriteFrameCache:removeSpriteFrameByName(imageFilename) +end + +function display.setTexturePixelFormat(imageFilename, format) + display.TEXTURES_PIXEL_FORMAT[imageFilename] = format +end + +function display.setAnimationCache(name, animation) + animationCache:addAnimation(animation, name) +end + +function display.getAnimationCache(name) + return animationCache:getAnimation(name) +end + +function display.removeAnimationCache(name) + animationCache:removeAnimation(name) +end + +function display.removeUnusedSpriteFrames() + spriteFrameCache:removeUnusedSpriteFrames() + textureCache:removeUnusedTextures() +end + +return display diff --git a/src/cocos/framework/extends/LayerEx.lua b/src/cocos/framework/extends/LayerEx.lua new file mode 100644 index 0000000..6bba1b2 --- /dev/null +++ b/src/cocos/framework/extends/LayerEx.lua @@ -0,0 +1,80 @@ +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local Layer = cc.Layer + +function Layer:onTouch(callback, isMultiTouches, swallowTouches) + if type(isMultiTouches) ~= "boolean" then isMultiTouches = false end + if type(swallowTouches) ~= "boolean" then swallowTouches = false end + + self:registerScriptTouchHandler(function(state, ...) + local args = {...} + local event = {name = state} + if isMultiTouches then + args = args[1] + local points = {} + for i = 1, #args, 3 do + local x, y, id = args[i], args[i + 1], args[i + 2] + points[id] = {x = x, y = y, id = id} + end + event.points = points + else + event.x = args[1] + event.y = args[2] + end + return callback( event ) + end, isMultiTouches, 0, swallowTouches) + self:setTouchEnabled(true) + return self +end + +function Layer:removeTouch() + self:unregisterScriptTouchHandler() + self:setTouchEnabled(false) + return self +end + +function Layer:onKeypad(callback) + self:registerScriptKeypadHandler(callback) + self:setKeyboardEnabled(true) + return self +end + +function Layer:removeKeypad() + self:unregisterScriptKeypadHandler() + self:setKeyboardEnabled(false) + return self +end + +function Layer:onAccelerate(callback) + self:registerScriptAccelerateHandler(callback) + self:setAccelerometerEnabled(true) + return self +end + +function Layer:removeAccelerate() + self:unregisterScriptAccelerateHandler() + self:setAccelerometerEnabled(false) + return self +end diff --git a/src/cocos/framework/extends/MenuEx.lua b/src/cocos/framework/extends/MenuEx.lua new file mode 100644 index 0000000..1639327 --- /dev/null +++ b/src/cocos/framework/extends/MenuEx.lua @@ -0,0 +1,31 @@ +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local Menu = cc.Menu +local MenuItem = cc.MenuItem + +function MenuItem:onClicked(callback) + self:registerScriptTapHandler(callback) + return self +end diff --git a/src/cocos/framework/extends/NodeEx.lua b/src/cocos/framework/extends/NodeEx.lua new file mode 100644 index 0000000..a15807b --- /dev/null +++ b/src/cocos/framework/extends/NodeEx.lua @@ -0,0 +1,228 @@ +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local Node = cc.Node + +function Node:add(child, zorder, tag) + if tag then + self:addChild(child, zorder, tag) + elseif zorder then + self:addChild(child, zorder) + else + self:addChild(child) + end + return self +end + +function Node:addTo(parent, zorder, tag) + if tag then + parent:addChild(self, zorder, tag) + elseif zorder then + parent:addChild(self, zorder) + else + parent:addChild(self) + end + return self +end + +function Node:removeSelf() + self:removeFromParent() + return self +end + +function Node:align(anchorPoint, x, y) + self:setAnchorPoint(anchorPoint) + return self:move(x, y) +end + +function Node:show() + self:setVisible(true) + return self +end + +function Node:hide() + self:setVisible(false) + return self +end + +function Node:move(x, y) + if y then + self:setPosition(x, y) + else + self:setPosition(x) + end + return self +end + +function Node:moveTo(args) + transition.moveTo(self, args) + return self +end + +function Node:moveBy(args) + transition.moveBy(self, args) + return self +end + +function Node:fadeIn(args) + transition.fadeIn(self, args) + return self +end + +function Node:fadeOut(args) + transition.fadeOut(self, args) + return self +end + +function Node:fadeTo(args) + transition.fadeTo(self, args) + return self +end + +function Node:rotate(rotation) + self:setRotation(rotation) + return self +end + +function Node:rotateTo(args) + transition.rotateTo(self, args) + return self +end + +function Node:rotateBy(args) + transition.rotateBy(self, args) + return self +end + +function Node:scaleTo(args) + transition.scaleTo(self, args) + return self +end + +function Node:onUpdate(callback) + self:scheduleUpdateWithPriorityLua(callback, 0) + return self +end + +Node.scheduleUpdate = Node.onUpdate + +function Node:onNodeEvent(eventName, callback) + if "enter" == eventName then + self.onEnterCallback_ = callback + elseif "exit" == eventName then + self.onExitCallback_ = callback + elseif "enterTransitionFinish" == eventName then + self.onEnterTransitionFinishCallback_ = callback + elseif "exitTransitionStart" == eventName then + self.onExitTransitionStartCallback_ = callback + elseif "cleanup" == eventName then + self.onCleanupCallback_ = callback + end + self:enableNodeEvents() +end + +function Node:enableNodeEvents() + if self.isNodeEventEnabled_ then + return self + end + + self:registerScriptHandler(function(state) + if state == "enter" then + self:onEnter_() + elseif state == "exit" then + self:onExit_() + elseif state == "enterTransitionFinish" then + self:onEnterTransitionFinish_() + elseif state == "exitTransitionStart" then + self:onExitTransitionStart_() + elseif state == "cleanup" then + self:onCleanup_() + end + end) + self.isNodeEventEnabled_ = true + + return self +end + +function Node:disableNodeEvents() + self:unregisterScriptHandler() + self.isNodeEventEnabled_ = false + return self +end + + +function Node:onEnter() +end + +function Node:onExit() +end + +function Node:onEnterTransitionFinish() +end + +function Node:onExitTransitionStart() +end + +function Node:onCleanup() +end + +function Node:onEnter_() + self:onEnter() + if not self.onEnterCallback_ then + return + end + self:onEnterCallback_() +end + +function Node:onExit_() + self:onExit() + if not self.onExitCallback_ then + return + end + self:onExitCallback_() +end + +function Node:onEnterTransitionFinish_() + self:onEnterTransitionFinish() + if not self.onEnterTransitionFinishCallback_ then + return + end + self:onEnterTransitionFinishCallback_() +end + +function Node:onExitTransitionStart_() + self:onExitTransitionStart() + if not self.onExitTransitionStartCallback_ then + return + end + self:onExitTransitionStartCallback_() +end + +function Node:onCleanup_() + self:onCleanup() + if not self.onCleanupCallback_ then + return + end + self:onCleanupCallback_() +end diff --git a/src/cocos/framework/extends/SpriteEx.lua b/src/cocos/framework/extends/SpriteEx.lua new file mode 100644 index 0000000..0f1c8f7 --- /dev/null +++ b/src/cocos/framework/extends/SpriteEx.lua @@ -0,0 +1,67 @@ +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local Sprite = cc.Sprite + +function Sprite:playAnimationOnce(animation, args) + local actions = {} + + local showDelay = args.showDelay or 0 + if showDelay then + self:setVisible(false) + actions[#actions + 1] = cc.DelayTime:create(showDelay) + actions[#actions + 1] = cc.Show:create() + end + + local delay = args.delay or 0 + if delay > 0 then + actions[#actions + 1] = cc.DelayTime:create(delay) + end + + actions[#actions + 1] = cc.Animate:create(animation) + + if args.removeSelf then + actions[#actions + 1] = cc.RemoveSelf:create() + end + + if args.onComplete then + actions[#actions + 1] = cc.CallFunc:create(args.onComplete) + end + + local action + if #actions > 1 then + action = cc.Sequence:create(actions) + else + action = actions[1] + end + self:runAction(action) + return action +end + +function Sprite:playAnimationForever(animation) + local animate = cc.Animate:create(animation) + local action = cc.RepeatForever:create(animate) + self:runAction(action) + return action +end diff --git a/src/cocos/framework/extends/UICheckBox.lua b/src/cocos/framework/extends/UICheckBox.lua new file mode 100644 index 0000000..0707f82 --- /dev/null +++ b/src/cocos/framework/extends/UICheckBox.lua @@ -0,0 +1,40 @@ + +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local CheckBox = ccui.CheckBox + +function CheckBox:onEvent(callback) + self:addEventListener(function(sender, eventType) + local event = {} + if eventType == 0 then + event.name = "selected" + else + event.name = "unselected" + end + event.target = sender + callback(event) + end) + return self +end diff --git a/src/cocos/framework/extends/UIEditBox.lua b/src/cocos/framework/extends/UIEditBox.lua new file mode 100644 index 0000000..11b39ba --- /dev/null +++ b/src/cocos/framework/extends/UIEditBox.lua @@ -0,0 +1,41 @@ + +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local EditBox = ccui.EditBox + +function EditBox:onEditHandler(callback) + self:registerScriptEditBoxHandler(function(name, sender) + local event = {} + event.name = name + event.target = sender + callback(event) + end) + return self +end + +function EditBox:removeEditHandler() + self:unregisterScriptEditBoxHandler() + return self +end diff --git a/src/cocos/framework/extends/UIListView.lua b/src/cocos/framework/extends/UIListView.lua new file mode 100644 index 0000000..cab47a9 --- /dev/null +++ b/src/cocos/framework/extends/UIListView.lua @@ -0,0 +1,68 @@ + +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local ListView = ccui.ListView + +function ListView:onEvent(callback) + self:addEventListener(function(sender, eventType) + local event = {} + if eventType == 0 then + event.name = "ON_SELECTED_ITEM_START" + else + event.name = "ON_SELECTED_ITEM_END" + end + event.target = sender + callback(event) + end) + return self +end + +function ListView:onScroll(callback) + self:addScrollViewEventListener(function(sender, eventType) + local event = {} + if eventType == 0 then + event.name = "SCROLL_TO_TOP" + elseif eventType == 1 then + event.name = "SCROLL_TO_BOTTOM" + elseif eventType == 2 then + event.name = "SCROLL_TO_LEFT" + elseif eventType == 3 then + event.name = "SCROLL_TO_RIGHT" + elseif eventType == 4 then + event.name = "SCROLLING" + elseif eventType == 5 then + event.name = "BOUNCE_TOP" + elseif eventType == 6 then + event.name = "BOUNCE_BOTTOM" + elseif eventType == 7 then + event.name = "BOUNCE_LEFT" + elseif eventType == 8 then + event.name = "BOUNCE_RIGHT" + end + event.target = sender + callback(event) + end) + return self +end diff --git a/src/cocos/framework/extends/UIPageView.lua b/src/cocos/framework/extends/UIPageView.lua new file mode 100644 index 0000000..42c0c9f --- /dev/null +++ b/src/cocos/framework/extends/UIPageView.lua @@ -0,0 +1,38 @@ + +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local PageView = ccui.PageView + +function PageView:onEvent(callback) + self:addEventListener(function(sender, eventType) + local event = {} + if eventType == 0 then + event.name = "TURNING" + end + event.target = sender + callback(event) + end) + return self +end diff --git a/src/cocos/framework/extends/UIScrollView.lua b/src/cocos/framework/extends/UIScrollView.lua new file mode 100644 index 0000000..601faf9 --- /dev/null +++ b/src/cocos/framework/extends/UIScrollView.lua @@ -0,0 +1,56 @@ + +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local ScrollView = ccui.ScrollView + +function ScrollView:onEvent(callback) + self:addEventListener(function(sender, eventType) + local event = {} + if eventType == 0 then + event.name = "SCROLL_TO_TOP" + elseif eventType == 1 then + event.name = "SCROLL_TO_BOTTOM" + elseif eventType == 2 then + event.name = "SCROLL_TO_LEFT" + elseif eventType == 3 then + event.name = "SCROLL_TO_RIGHT" + elseif eventType == 4 then + event.name = "SCROLLING" + elseif eventType == 5 then + event.name = "BOUNCE_TOP" + elseif eventType == 6 then + event.name = "BOUNCE_BOTTOM" + elseif eventType == 7 then + event.name = "BOUNCE_LEFT" + elseif eventType == 8 then + event.name = "BOUNCE_RIGHT" + end + event.target = sender + callback(event) + end) + return self +end + +ScrollView.onScroll = ScrollView.onEvent diff --git a/src/cocos/framework/extends/UISlider.lua b/src/cocos/framework/extends/UISlider.lua new file mode 100644 index 0000000..68109b5 --- /dev/null +++ b/src/cocos/framework/extends/UISlider.lua @@ -0,0 +1,38 @@ + +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local Slider = ccui.Slider + +function Slider:onEvent(callback) + self:addEventListener(function(sender, eventType) + local event = {} + if eventType == 0 then + event.name = "ON_PERCENTAGE_CHANGED" + end + event.target = sender + callback(event) + end) + return self +end diff --git a/src/cocos/framework/extends/UITextField.lua b/src/cocos/framework/extends/UITextField.lua new file mode 100644 index 0000000..2574333 --- /dev/null +++ b/src/cocos/framework/extends/UITextField.lua @@ -0,0 +1,44 @@ + +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local TextField = ccui.TextField + +function TextField:onEvent(callback) + self:addEventListener(function(sender, eventType) + local event = {} + if eventType == 0 then + event.name = "ATTACH_WITH_IME" + elseif eventType == 1 then + event.name = "DETACH_WITH_IME" + elseif eventType == 2 then + event.name = "INSERT_TEXT" + elseif eventType == 3 then + event.name = "DELETE_BACKWARD" + end + event.target = sender + callback(event) + end) + return self +end diff --git a/src/cocos/framework/extends/UIWidget.lua b/src/cocos/framework/extends/UIWidget.lua new file mode 100644 index 0000000..59754d6 --- /dev/null +++ b/src/cocos/framework/extends/UIWidget.lua @@ -0,0 +1,43 @@ +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local Widget = ccui.Widget + +function Widget:onTouch(callback) + self:addTouchEventListener(function(sender, state) + local event = {x = 0, y = 0} + if state == 0 then + event.name = "began" + elseif state == 1 then + event.name = "moved" + elseif state == 2 then + event.name = "ended" + else + event.name = "cancelled" + end + event.target = sender + callback(event) + end) + return self +end diff --git a/src/cocos/framework/init.lua b/src/cocos/framework/init.lua new file mode 100644 index 0000000..89a7672 --- /dev/null +++ b/src/cocos/framework/init.lua @@ -0,0 +1,82 @@ +--[[ + +Copyright (c) 2011-2015 chukong-incc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +if type(DEBUG) ~= "number" then DEBUG = 0 end + +-- load framework +printInfo("") +printInfo("# DEBUG = " .. DEBUG) +printInfo("#") + +device = require("cocos.framework.device") +display = require("cocos.framework.display") +audio = require("cocos.framework.audio") +transition = require("cocos.framework.transition") + +require("cocos.framework.extends.NodeEx") +require("cocos.framework.extends.SpriteEx") +require("cocos.framework.extends.LayerEx") +require("cocos.framework.extends.MenuEx") + +if ccui then +require("cocos.framework.extends.UIWidget") +require("cocos.framework.extends.UICheckBox") +require("cocos.framework.extends.UIEditBox") +require("cocos.framework.extends.UIListView") +require("cocos.framework.extends.UIPageView") +require("cocos.framework.extends.UIScrollView") +require("cocos.framework.extends.UISlider") +require("cocos.framework.extends.UITextField") +end + +require("cocos.framework.package_support") + +-- register the build-in packages +cc.register("event", require("cocos.framework.components.event")) + +-- export global variable +local __g = _G +cc.exports = {} +setmetatable(cc.exports, { + __newindex = function(_, name, value) + rawset(__g, name, value) + end, + + __index = function(_, name) + return rawget(__g, name) + end +}) + +-- disable create unexpected global variable +function cc.disable_global() + setmetatable(__g, { + __newindex = function(_, name, value) + error(string.format("USE \" cc.exports.%s = value \" INSTEAD OF SET GLOBAL VARIABLE", name), 0) + end + }) +end + +if CC_DISABLE_GLOBAL then + cc.disable_global() +end diff --git a/src/cocos/framework/package_support.lua b/src/cocos/framework/package_support.lua new file mode 100644 index 0000000..e5c5e14 --- /dev/null +++ b/src/cocos/framework/package_support.lua @@ -0,0 +1,113 @@ +--[[ + +Copyright (c) 2011-2015 chukong-incc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +-- Cocos2d-Lua core functions +cc.loaded_packages = {} +local loaded_packages = cc.loaded_packages + +function cc.register(name, package) + cc.loaded_packages[name] = package +end + +function cc.load(...) + local names = {...} + assert(#names > 0, "cc.load() - invalid package names") + + local packages = {} + for _, name in ipairs(names) do + assert(type(name) == "string", string.format("cc.load() - invalid package name \"%s\"", tostring(name))) + if not loaded_packages[name] then + local packageName = string.format("packages.%s.init", name) + local cls = require(packageName) + assert(cls, string.format("cc.load() - package class \"%s\" load failed", packageName)) + loaded_packages[name] = cls + + if DEBUG > 1 then + printInfo("cc.load() - load module \"packages.%s.init\"", name) + end + end + packages[#packages + 1] = loaded_packages[name] + end + return unpack(packages) +end + +local load_ = cc.load +local bind_ +bind_ = function(target, ...) + local t = type(target) + assert(t == "table" or t == "userdata", string.format("cc.bind() - invalid target, expected is object, actual is %s", t)) + local names = {...} + assert(#names > 0, "cc.bind() - package names expected") + + load_(...) + if not target.components_ then target.components_ = {} end + for _, name in ipairs(names) do + assert(type(name) == "string" and name ~= "", string.format("cc.bind() - invalid package name \"%s\"", name)) + if not target.components_[name] then + local cls = loaded_packages[name] + for __, depend in ipairs(cls.depends or {}) do + if not target.components_[depend] then + bind_(target, depend) + end + end + local component = cls:create() + target.components_[name] = component + component:bind(target) + end + end + + return target +end +cc.bind = bind_ + +function cc.unbind(target, ...) + if not target.components_ then return end + + local names = {...} + assert(#names > 0, "cc.unbind() - invalid package names") + + for _, name in ipairs(names) do + assert(type(name) == "string" and name ~= "", string.format("cc.unbind() - invalid package name \"%s\"", name)) + local component = target.components_[name] + assert(component, string.format("cc.unbind() - component \"%s\" not found", tostring(name))) + component:unbind(target) + target.components_[name] = nil + end + return target +end + +function cc.setmethods(target, component, methods) + for _, name in ipairs(methods) do + local method = component[name] + target[name] = function(__, ...) + return method(component, ...) + end + end +end + +function cc.unsetmethods(target, methods) + for _, name in ipairs(methods) do + target[name] = nil + end +end diff --git a/src/cocos/framework/transition.lua b/src/cocos/framework/transition.lua new file mode 100644 index 0000000..78c4412 --- /dev/null +++ b/src/cocos/framework/transition.lua @@ -0,0 +1,213 @@ +--[[ + +Copyright (c) 2011-2014 chukong-inc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +local transition = {} + +local ACTION_EASING = {} +ACTION_EASING["BACKIN"] = {cc.EaseBackIn, 1} +ACTION_EASING["BACKINOUT"] = {cc.EaseBackInOut, 1} +ACTION_EASING["BACKOUT"] = {cc.EaseBackOut, 1} +ACTION_EASING["BOUNCE"] = {cc.EaseBounce, 1} +ACTION_EASING["BOUNCEIN"] = {cc.EaseBounceIn, 1} +ACTION_EASING["BOUNCEINOUT"] = {cc.EaseBounceInOut, 1} +ACTION_EASING["BOUNCEOUT"] = {cc.EaseBounceOut, 1} +ACTION_EASING["ELASTIC"] = {cc.EaseElastic, 2, 0.3} +ACTION_EASING["ELASTICIN"] = {cc.EaseElasticIn, 2, 0.3} +ACTION_EASING["ELASTICINOUT"] = {cc.EaseElasticInOut, 2, 0.3} +ACTION_EASING["ELASTICOUT"] = {cc.EaseElasticOut, 2, 0.3} +ACTION_EASING["EXPONENTIALIN"] = {cc.EaseExponentialIn, 1} +ACTION_EASING["EXPONENTIALINOUT"] = {cc.EaseExponentialInOut, 1} +ACTION_EASING["EXPONENTIALOUT"] = {cc.EaseExponentialOut, 1} +ACTION_EASING["IN"] = {cc.EaseIn, 2, 1} +ACTION_EASING["INOUT"] = {cc.EaseInOut, 2, 1} +ACTION_EASING["OUT"] = {cc.EaseOut, 2, 1} +ACTION_EASING["RATEACTION"] = {cc.EaseRateAction, 2, 1} +ACTION_EASING["SINEIN"] = {cc.EaseSineIn, 1} +ACTION_EASING["SINEINOUT"] = {cc.EaseSineInOut, 1} +ACTION_EASING["SINEOUT"] = {cc.EaseSineOut, 1} + +local actionManager = cc.Director:getInstance():getActionManager() + +function transition.newEasing(action, easingName, more) + local key = string.upper(tostring(easingName)) + local easing + if ACTION_EASING[key] then + local cls, count, default = unpack(ACTION_EASING[key]) + if count == 2 then + easing = cls:create(action, more or default) + else + easing = cls:create(action) + end + end + return easing or action +end + +function transition.create(action, args) + args = checktable(args) + if args.easing then + if type(args.easing) == "table" then + action = transition.newEasing(action, unpack(args.easing)) + else + action = transition.newEasing(action, args.easing) + end + end + + local actions = {} + local delay = checknumber(args.delay) + if delay > 0 then + actions[#actions + 1] = cc.DelayTime:create(delay) + end + actions[#actions + 1] = action + + local onComplete = args.onComplete + if type(onComplete) ~= "function" then onComplete = nil end + if onComplete then + actions[#actions + 1] = cc.CallFunc:create(onComplete) + end + + if args.removeSelf then + actions[#actions + 1] = cc.RemoveSelf:create() + end + + if #actions > 1 then + return transition.sequence(actions) + else + return actions[1] + end +end + +function transition.execute(target, action, args) + assert(not tolua.isnull(target), "transition.execute() - target is not cc.Node") + local action = transition.create(action, args) + target:runAction(action) + return action +end + +function transition.moveTo(target, args) + assert(not tolua.isnull(target), "transition.moveTo() - target is not cc.Node") + local x = args.x or target:getPositionX() + local y = args.y or target:getPositionY() + local action = cc.MoveTo:create(args.time, cc.p(x, y)) + return transition.execute(target, action, args) +end + +function transition.moveBy(target, args) + assert(not tolua.isnull(target), "transition.moveBy() - target is not cc.Node") + local x = args.x or 0 + local y = args.y or 0 + local action = cc.MoveBy:create(args.time, cc.p(x, y)) + return transition.execute(target, action, args) +end + +function transition.fadeIn(target, args) + assert(not tolua.isnull(target), "transition.fadeIn() - target is not cc.Node") + local action = cc.FadeIn:create(args.time) + return transition.execute(target, action, args) +end + +function transition.fadeOut(target, args) + assert(not tolua.isnull(target), "transition.fadeOut() - target is not cc.Node") + local action = cc.FadeOut:create(args.time) + return transition.execute(target, action, args) +end + +function transition.fadeTo(target, args) + assert(not tolua.isnull(target), "transition.fadeTo() - target is not cc.Node") + local opacity = checkint(args.opacity) + if opacity < 0 then + opacity = 0 + elseif opacity > 255 then + opacity = 255 + end + local action = cc.FadeTo:create(args.time, opacity) + return transition.execute(target, action, args) +end + +function transition.scaleTo(target, args) + assert(not tolua.isnull(target), "transition.scaleTo() - target is not cc.Node") + local action + if args.scale then + action = cc.ScaleTo:create(checknumber(args.time), checknumber(args.scale)) + elseif args.scaleX or args.scaleY then + local scaleX, scaleY + if args.scaleX then + scaleX = checknumber(args.scaleX) + else + scaleX = target:getScaleX() + end + if args.scaleY then + scaleY = checknumber(args.scaleY) + else + scaleY = target:getScaleY() + end + action = cc.ScaleTo:create(checknumber(args.time), scaleX, scaleY) + end + return transition.execute(target, action, args) +end + +function transition.rotateTo(target, args) + assert(not tolua.isnull(target), "transition.rotateTo() - target is not cc.Node") + local rotation = args.rotation or target:getRotation() + local action = cc.RotateTo:create(args.time, rotation) + return transition.execute(target, action, args) +end + +function transition.rotateBy(target, args) + assert(not tolua.isnull(target), "transition.rotateTo() - target is not cc.Node") + local rotation = args.rotation or 0 + local action = cc.RotateBy:create(args.time, rotation) + return transition.execute(target, action, args) +end + +function transition.sequence(actions) + if #actions < 1 then return end + if #actions < 2 then return actions[1] end + return cc.Sequence:create(actions) +end + +function transition.removeAction(action) + if not tolua.isnull(action) then + actionManager:removeAction(action) + end +end + +function transition.stopTarget(target) + if not tolua.isnull(target) then + actionManager:removeAllActionsFromTarget(target) + end +end + +function transition.pauseTarget(target) + if not tolua.isnull(target) then + actionManager:pauseTarget(target) + end +end + +function transition.resumeTarget(target) + if not tolua.isnull(target) then + actionManager:resumeTarget(target) + end +end + +return transition diff --git a/src/cocos/init.lua b/src/cocos/init.lua new file mode 100644 index 0000000..92fc120 --- /dev/null +++ b/src/cocos/init.lua @@ -0,0 +1,109 @@ +--[[ + +Copyright (c) 2011-2015 chukong-incc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +]] + +require "cocos.cocos2d.Cocos2d" +require "cocos.cocos2d.Cocos2dConstants" +require "cocos.cocos2d.functions" + +__G__TRACKBACK__ = function(msg) + local msg = debug.traceback(msg, 3) + print(msg) + return msg +end + +-- opengl +require "cocos.cocos2d.Opengl" +require "cocos.cocos2d.OpenglConstants" +-- audio +require "cocos.cocosdenshion.AudioEngine" +-- cocosstudio +if nil ~= ccs then + require "cocos.cocostudio.CocoStudio" +end +-- ui +if nil ~= ccui then + require "cocos.ui.GuiConstants" + require "cocos.ui.experimentalUIConstants" +end + +-- extensions +require "cocos.extension.ExtensionConstants" +-- network +require "cocos.network.NetworkConstants" +-- Spine +if nil ~= sp then + require "cocos.spine.SpineConstants" +end + +require "cocos.cocos2d.deprecated" +require "cocos.cocos2d.DrawPrimitives" + +-- Lua extensions +require "cocos.cocos2d.bitExtend" + +-- CCLuaEngine +require "cocos.cocos2d.DeprecatedCocos2dClass" +require "cocos.cocos2d.DeprecatedCocos2dEnum" +require "cocos.cocos2d.DeprecatedCocos2dFunc" +require "cocos.cocos2d.DeprecatedOpenglEnum" + +-- register_cocostudio_module +if nil ~= ccs then + require "cocos.cocostudio.DeprecatedCocoStudioClass" + require "cocos.cocostudio.DeprecatedCocoStudioFunc" +end + + +-- register_cocosbuilder_module +require "cocos.cocosbuilder.DeprecatedCocosBuilderClass" + +-- register_cocosdenshion_module +require "cocos.cocosdenshion.DeprecatedCocosDenshionClass" +require "cocos.cocosdenshion.DeprecatedCocosDenshionFunc" + +-- register_extension_module +require "cocos.extension.DeprecatedExtensionClass" +require "cocos.extension.DeprecatedExtensionEnum" +require "cocos.extension.DeprecatedExtensionFunc" + +-- register_network_module +require "cocos.network.DeprecatedNetworkClass" +require "cocos.network.DeprecatedNetworkEnum" +require "cocos.network.DeprecatedNetworkFunc" + +-- register_ui_moudle +if nil ~= ccui then + require "cocos.ui.DeprecatedUIEnum" + require "cocos.ui.DeprecatedUIFunc" +end + +-- cocosbuilder +require "cocos.cocosbuilder.CCBReaderLoad" + +-- physics3d +require "cocos.physics3d.physics3d-constants" + +if CC_USE_FRAMEWORK then + require "cocos.framework.init" +end diff --git a/src/cocos/network/DeprecatedNetworkClass.lua b/src/cocos/network/DeprecatedNetworkClass.lua new file mode 100644 index 0000000..06e280b --- /dev/null +++ b/src/cocos/network/DeprecatedNetworkClass.lua @@ -0,0 +1,19 @@ +if nil == cc.XMLHttpRequest then + return +end +-- This is the DeprecatedNetworkClass + +DeprecatedNetworkClass = {} or DeprecatedNetworkClass + +--tip +local function deprecatedTip(old_name,new_name) + print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") +end + +--WebSocket class will be Deprecated,begin +function DeprecatedNetworkClass.WebSocket() + deprecatedTip("WebSocket","cc.WebSocket") + return cc.WebSocket +end +_G["WebSocket"] = DeprecatedNetworkClass.WebSocket() +--WebSocket class will be Deprecated,end diff --git a/src/cocos/network/DeprecatedNetworkEnum.lua b/src/cocos/network/DeprecatedNetworkEnum.lua new file mode 100644 index 0000000..da08d35 --- /dev/null +++ b/src/cocos/network/DeprecatedNetworkEnum.lua @@ -0,0 +1,13 @@ +if nil == cc.XMLHttpRequest then + return +end + +_G.kWebSocketScriptHandlerOpen = cc.WEBSOCKET_OPEN +_G.kWebSocketScriptHandlerMessage = cc.WEBSOCKET_MESSAGE +_G.kWebSocketScriptHandlerClose = cc.WEBSOCKET_CLOSE +_G.kWebSocketScriptHandlerError = cc.WEBSOCKET_ERROR + +_G.kStateConnecting = cc.WEBSOCKET_STATE_CONNECTING +_G.kStateOpen = cc.WEBSOCKET_STATE_OPEN +_G.kStateClosing = cc.WEBSOCKET_STATE_CLOSING +_G.kStateClosed = cc.WEBSOCKET_STATE_CLOSED diff --git a/src/cocos/network/DeprecatedNetworkFunc.lua b/src/cocos/network/DeprecatedNetworkFunc.lua new file mode 100644 index 0000000..f114392 --- /dev/null +++ b/src/cocos/network/DeprecatedNetworkFunc.lua @@ -0,0 +1,27 @@ +if nil == cc.XMLHttpRequest then + return +end + +--tip +local function deprecatedTip(old_name,new_name) + print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") +end + +--functions of WebSocket will be deprecated begin +local targetPlatform = CCApplication:getInstance():getTargetPlatform() +if (kTargetIphone == targetPlatform) or (kTargetIpad == targetPlatform) or (kTargetAndroid == targetPlatform) or (kTargetWindows == targetPlatform) then + local WebSocketDeprecated = { } + function WebSocketDeprecated.sendTextMsg(self, string) + deprecatedTip("WebSocket:sendTextMsg","WebSocket:sendString") + return self:sendString(string) + end + WebSocket.sendTextMsg = WebSocketDeprecated.sendTextMsg + + function WebSocketDeprecated.sendBinaryMsg(self, table,tablesize) + deprecatedTip("WebSocket:sendBinaryMsg","WebSocket:sendString") + string.char(unpack(table)) + return self:sendString(string.char(unpack(table))) + end + WebSocket.sendBinaryMsg = WebSocketDeprecated.sendBinaryMsg +end +--functions of WebSocket will be deprecated end diff --git a/src/cocos/network/NetworkConstants.lua b/src/cocos/network/NetworkConstants.lua new file mode 100644 index 0000000..ee18d55 --- /dev/null +++ b/src/cocos/network/NetworkConstants.lua @@ -0,0 +1,19 @@ +if nil == cc.XMLHttpRequest then + return +end + +cc.WEBSOCKET_OPEN = 0 +cc.WEBSOCKET_MESSAGE = 1 +cc.WEBSOCKET_CLOSE = 2 +cc.WEBSOCKET_ERROR = 3 + +cc.WEBSOCKET_STATE_CONNECTING = 0 +cc.WEBSOCKET_STATE_OPEN = 1 +cc.WEBSOCKET_STATE_CLOSING = 2 +cc.WEBSOCKET_STATE_CLOSED = 3 + +cc.XMLHTTPREQUEST_RESPONSE_STRING = 0 +cc.XMLHTTPREQUEST_RESPONSE_ARRAY_BUFFER = 1 +cc.XMLHTTPREQUEST_RESPONSE_BLOB = 2 +cc.XMLHTTPREQUEST_RESPONSE_DOCUMENT = 3 +cc.XMLHTTPREQUEST_RESPONSE_JSON = 4 diff --git a/src/cocos/physics3d/physics3d-constants.lua b/src/cocos/physics3d/physics3d-constants.lua new file mode 100644 index 0000000..f33cef9 --- /dev/null +++ b/src/cocos/physics3d/physics3d-constants.lua @@ -0,0 +1,17 @@ +if nil == cc.Physics3DComponent then + return +end + +cc.Physics3DComponent.PhysicsSyncFlag = +{ + NONE = 0, + NODE_TO_PHYSICS = 1, + PHYSICS_TO_NODE = 2, + NODE_AND_NODE = 3, +} + +cc.Physics3DObject.PhysicsObjType = +{ + UNKNOWN = 0, + RIGID_BODY = 1, +} \ No newline at end of file diff --git a/src/cocos/spine/SpineConstants.lua b/src/cocos/spine/SpineConstants.lua new file mode 100644 index 0000000..a7d7dfa --- /dev/null +++ b/src/cocos/spine/SpineConstants.lua @@ -0,0 +1,11 @@ +if nil == sp then + return +end + +sp.EventType = +{ + ANIMATION_START = 0, + ANIMATION_END = 1, + ANIMATION_COMPLETE = 2, + ANIMATION_EVENT = 3, +} diff --git a/src/cocos/ui/DeprecatedUIEnum.lua b/src/cocos/ui/DeprecatedUIEnum.lua new file mode 100644 index 0000000..ae7d63f --- /dev/null +++ b/src/cocos/ui/DeprecatedUIEnum.lua @@ -0,0 +1,94 @@ +if nil == ccui then + return +end + +LAYOUT_COLOR_NONE = ccui.LayoutBackGroundColorType.none +LAYOUT_COLOR_SOLID = ccui.LayoutBackGroundColorType.solid +LAYOUT_COLOR_GRADIENT = ccui.LayoutBackGroundColorType.gradient + +LAYOUT_ABSOLUTE = ccui.LayoutType.ABSOLUTE +LAYOUT_LINEAR_VERTICAL = ccui.LayoutType.VERTICAL +LAYOUT_LINEAR_HORIZONTAL = ccui.LayoutType.HORIZONTAL +LAYOUT_RELATIVE = ccui.LayoutType.RELATIVE + +BRIGHT_NONE = ccui.BrightStyle.none +BRIGHT_NORMAL = ccui.BrightStyle.normal +BRIGHT_HIGHLIGHT = ccui.BrightStyle.highlight + +UI_TEX_TYPE_LOCAL = ccui.TextureResType.localType +UI_TEX_TYPE_PLIST = ccui.TextureResType.plistType + +TOUCH_EVENT_BEGAN = ccui.TouchEventType.began +TOUCH_EVENT_MOVED = ccui.TouchEventType.moved +TOUCH_EVENT_ENDED = ccui.TouchEventType.ended +TOUCH_EVENT_CANCELED = ccui.TouchEventType.canceled + +SIZE_ABSOLUTE = ccui.SizeType.absolute +SIZE_PERCENT = ccui.SizeType.percent + +POSITION_ABSOLUTE = ccui.PositionType.absolute +POSITION_PERCENT = ccui.PositionType.percent + +CHECKBOX_STATE_EVENT_SELECTED = ccui.CheckBoxEventType.selected +CHECKBOX_STATE_EVENT_UNSELECTED = ccui.CheckBoxEventType.unselected + +CHECKBOX_STATE_EVENT_SELECTED = ccui.CheckBoxEventType.selected +CHECKBOX_STATE_EVENT_UNSELECTED = ccui.CheckBoxEventType.unselected + +LoadingBarTypeLeft = ccui.LoadingBarDirection.LEFT +LoadingBarTypeRight = ccui.LoadingBarDirection.RIGHT + +LoadingBarTypeRight = ccui.SliderEventType.percent_changed + +TEXTFIELD_EVENT_ATTACH_WITH_IME = ccui.TextFiledEventType.attach_with_ime +TEXTFIELD_EVENT_DETACH_WITH_IME = ccui.TextFiledEventType.detach_with_ime +TEXTFIELD_EVENT_INSERT_TEXT = ccui.TextFiledEventType.insert_text +TEXTFIELD_EVENT_DELETE_BACKWARD = ccui.TextFiledEventType.delete_backward + +SCROLLVIEW_EVENT_SCROLL_TO_TOP = ccui.ScrollViewDir.none +SCROLLVIEW_DIR_VERTICAL = ccui.ScrollViewDir.vertical +SCROLLVIEW_DIR_HORIZONTAL = ccui.ScrollViewDir.horizontal +SCROLLVIEW_DIR_BOTH = ccui.ScrollViewDir.both + +SCROLLVIEW_EVENT_SCROLL_TO_TOP = ccui.ScrollviewEventType.scrollToTop +SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM = ccui.ScrollviewEventType.scrollToBottom +SCROLLVIEW_EVENT_SCROLL_TO_LEFT = ccui.ScrollviewEventType.scrollToLeft +SCROLLVIEW_EVENT_SCROLL_TO_RIGHT = ccui.ScrollviewEventType.scrollToRight +SCROLLVIEW_EVENT_SCROLLING = ccui.ScrollviewEventType.scrolling +SCROLLVIEW_EVENT_BOUNCE_TOP = ccui.ScrollviewEventType.bounceTop +SCROLLVIEW_EVENT_BOUNCE_BOTTOM = ccui.ScrollviewEventType.bounceBottom +SCROLLVIEW_EVENT_BOUNCE_LEFT = ccui.ScrollviewEventType.bounceLeft +SCROLLVIEW_EVENT_BOUNCE_RIGHT = ccui.ScrollviewEventType.bounceRight + +PAGEVIEW_EVENT_TURNING = ccui.PageViewEventType.turning + +PAGEVIEW_TOUCHLEFT = ccui.PVTouchDir.touch_left +PAGEVIEW_TOUCHRIGHT = ccui.PVTouchDir.touch_right + +LISTVIEW_DIR_NONE = ccui.ListViewDirection.none +LISTVIEW_DIR_VERTICAL = ccui.ListViewDirection.vertical +LISTVIEW_DIR_HORIZONTAL = ccui.ListViewDirection.horizontal + +LISTVIEW_MOVE_DIR_NONE = ccui.ListViewMoveDirection.none +LISTVIEW_MOVE_DIR_UP = ccui.ListViewMoveDirection.up +LISTVIEW_MOVE_DIR_DOWN = ccui.ListViewMoveDirection.down +LISTVIEW_MOVE_DIR_LEFT = ccui.ListViewMoveDirection.left +LISTVIEW_MOVE_DIR_RIGHT = ccui.ListViewMoveDirection.right + +LISTVIEW_EVENT_INIT_CHILD = ccui.ListViewEventType.init_child +LISTVIEW_EVENT_UPDATE_CHILD = ccui.ListViewEventType.update_child + +LAYOUT_PARAMETER_NONE = ccui.LayoutParameterType.none +LAYOUT_PARAMETER_LINEAR = ccui.LayoutParameterType.linear +LAYOUT_PARAMETER_RELATIVE = ccui.LayoutParameterType.relative + +ccui.LoadingBarType = ccui.LoadingBarDirection +ccui.LoadingBarType.left = ccui.LoadingBarDirection.LEFT +ccui.LoadingBarType.right = ccui.LoadingBarDirection.RIGHT + +ccui.LayoutType.absolute = ccui.LayoutType.ABSOLUTE +ccui.LayoutType.linearVertical = ccui.LayoutType.VERTICAL +ccui.LayoutType.linearHorizontal = ccui.LayoutType.HORIZONTAL +ccui.LayoutType.relative = ccui.LayoutType.RELATIVE + +ccui.ListViewEventType.onsSelectedItem = ccui.ListViewEventType.ONSELECTEDITEM_START diff --git a/src/cocos/ui/DeprecatedUIFunc.lua b/src/cocos/ui/DeprecatedUIFunc.lua new file mode 100644 index 0000000..52c5e2e --- /dev/null +++ b/src/cocos/ui/DeprecatedUIFunc.lua @@ -0,0 +1,183 @@ +if nil == ccui then + return +end + +--tip +local function deprecatedTip(old_name,new_name) + print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") +end + +--functions of ccui.Text will be deprecated begin +local TextDeprecated = { } +function TextDeprecated.setText(self, str) + deprecatedTip("ccui.Text:setText","ccui.Text:setString") + return self:setString(str) +end +ccui.Text.setText = TextDeprecated.setText + +function TextDeprecated.getStringValue(self) + deprecatedTip("ccui.Text:getStringValue","ccui.Text:getString") + return self:getString() +end +ccui.Text.getStringValue = TextDeprecated.getStringValue + +--functions of ccui.Text will be deprecated begin + +--functions of ccui.TextAtlas will be deprecated begin +local TextAtlasDeprecated = { } +function TextAtlasDeprecated.setStringValue(self, str) + deprecatedTip("ccui.TextAtlas:setStringValue","ccui.TextAtlas:setString") + return self:setString(str) +end +ccui.TextAtlas.setStringValue = TextAtlasDeprecated.setStringValue + +function TextAtlasDeprecated.getStringValue(self) + deprecatedTip("ccui.TextAtlas:getStringValue","ccui.TextAtlas:getString") + return self:getString() +end +ccui.TextAtlas.getStringValue = TextAtlasDeprecated.getStringValue +--functions of ccui.TextAtlas will be deprecated begin + + +--functions of ccui.TextBMFont will be deprecated begin +local TextBMFontDeprecated = { } +function TextBMFontDeprecated.setText(self, str) + deprecatedTip("ccui.TextBMFont:setText","ccui.TextBMFont:setString") + return self:setString(str) +end +ccui.TextBMFont.setText = TextBMFontDeprecated.setText + +function TextBMFontDeprecated.getStringValue(self) + deprecatedTip("ccui.Text:getStringValue","ccui.TextBMFont:getString") + return self:getString() +end +ccui.Text.getStringValue = TextBMFontDeprecated.getStringValue +--functions of ccui.TextBMFont will be deprecated begin + +--functions of cc.ShaderCache will be deprecated begin +local ShaderCacheDeprecated = { } +function ShaderCacheDeprecated.getProgram(self,strShader) + deprecatedTip("cc.ShaderCache:getProgram","cc.ShaderCache:getGLProgram") + return self:getGLProgram(strShader) +end +cc.ShaderCache.getProgram = ShaderCacheDeprecated.getProgram +--functions of ccui.TextBMFont will be deprecated begin + +--functions of ccui.Widget will be deprecated begin +local UIWidgetDeprecated = { } +function UIWidgetDeprecated.getLeftInParent(self) + deprecatedTip("ccui.Widget:getLeftInParent","ccui.Widget:getLeftBoundary") + return self:getLeftBoundary() +end +ccui.Widget.getLeftInParent = UIWidgetDeprecated.getLeftInParent + +function UIWidgetDeprecated.getBottomInParent(self) + deprecatedTip("ccui.Widget:getBottomInParent","ccui.Widget:getBottomBoundary") + return self:getBottomBoundary() +end +ccui.Widget.getBottomInParent = UIWidgetDeprecated.getBottomInParent + +function UIWidgetDeprecated.getRightInParent(self) + deprecatedTip("ccui.Widget:getRightInParent","ccui.Widget:getRightBoundary") + return self:getRightBoundary() +end +ccui.Widget.getRightInParent = UIWidgetDeprecated.getRightInParent + +function UIWidgetDeprecated.getTopInParent(self) + deprecatedTip("ccui.Widget:getTopInParent","ccui.Widget:getTopBoundary") + return self:getTopBoundary() +end +ccui.Widget.getTopInParent = UIWidgetDeprecated.getTopInParent + +function UIWidgetDeprecated.getSize(self) + deprecatedTip("ccui.Widget:getSize","ccui.Widget:getContentSize") + return self:getContentSize() +end +ccui.Widget.getSize = UIWidgetDeprecated.getSize + +function UIWidgetDeprecated.setSize(self, ...) + deprecatedTip("ccui.Widget:setSize","ccui.Widget:setContentSize") + return self:setContentSize(...) +end +ccui.Widget.setSize = UIWidgetDeprecated.setSize + +--functions of ccui.Widget will be deprecated end + +--functions of ccui.CheckBox will be deprecated begin +local UICheckBoxDeprecated = { } +function UICheckBoxDeprecated.addEventListenerCheckBox(self,handler) + deprecatedTip("ccui.CheckBox:addEventListenerCheckBox","ccui.CheckBox:addEventListener") + return self:addEventListener(handler) +end +ccui.CheckBox.addEventListenerCheckBox = UICheckBoxDeprecated.addEventListenerCheckBox + +function UICheckBoxDeprecated.setSelectedState(self,flag) + deprecatedTip("ccui.CheckBox:setSelectedState", "ccui.CheckBox:setSelected") + return self:setSelected(flag) +end +ccui.CheckBox.setSelectedState = UICheckBoxDeprecated.setSelectedState + +function UICheckBoxDeprecated.getSelectedState(self) + deprecatedTip("ccui.CheckBox:getSelectedState", "ccui.CheckBox:getSelected") + return self:getSelected() +end +ccui.CheckBox.getSelectedState = UICheckBoxDeprecated.setSelectedState + +--functions of ccui.CheckBox will be deprecated end + +--functions of ccui.Slider will be deprecated begin +local UISliderDeprecated = { } +function UISliderDeprecated.addEventListenerSlider(self,handler) + deprecatedTip("ccui.Slider:addEventListenerSlider","ccui.Slider:addEventListener") + return self:addEventListener(handler) +end +ccui.Slider.addEventListenerSlider = UISliderDeprecated.addEventListenerSlider +--functions of ccui.Slider will be deprecated end + +--functions of ccui.TextField will be deprecated begin +local UITextFieldDeprecated = { } +function UITextFieldDeprecated.addEventListenerTextField(self,handler) + deprecatedTip("ccui.TextField:addEventListenerTextField","ccui.TextField:addEventListener") + return self:addEventListener(handler) +end +ccui.TextField.addEventListenerTextField = UITextFieldDeprecated.addEventListenerTextField + +function UITextFieldDeprecated.setText(self, str) + deprecatedTip("ccui.TextField:setText","ccui.TextField:setString") + return self:setString(str) +end +ccui.TextField.setText = UITextFieldDeprecated.setText + +function UITextFieldDeprecated.getStringValue(self) + deprecatedTip("ccui.TextField:getStringValue","ccui.TextField:getString") + return self:getString() +end +ccui.TextField.getStringValue = UITextFieldDeprecated.getStringValue +--functions of ccui.TextField will be deprecated end + +--functions of ccui.PageView will be deprecated begin +local UIPageViewDeprecated = { } +function UIPageViewDeprecated.addEventListenerPageView(self,handler) + deprecatedTip("ccui.PageView:addEventListenerPageView","ccui.PageView:addEventListener") + return self:addEventListener(handler) +end +ccui.PageView.addEventListenerPageView = UIPageViewDeprecated.addEventListenerPageView +--functions of ccui.PageView will be deprecated end + +--functions of ccui.ScrollView will be deprecated begin +local UIScrollViewDeprecated = { } +function UIScrollViewDeprecated.addEventListenerScrollView(self,handler) + deprecatedTip("ccui.ScrollView:addEventListenerScrollView","ccui.ScrollView:addEventListener") + return self:addEventListener(handler) +end +ccui.ScrollView.addEventListenerScrollView = UIScrollViewDeprecated.addEventListenerScrollView +--functions of ccui.ScrollView will be deprecated end + +--functions of ccui.ListView will be deprecated begin +local UIListViewDeprecated = { } +function UIListViewDeprecated.addEventListenerListView(self,handler) + deprecatedTip("ccui.ListView:addEventListenerListView","ccui.ListView:addEventListener") + return self:addEventListener(handler) +end +ccui.ListView.addEventListenerListView = UIListViewDeprecated.addEventListenerListView +--functions of ccui.ListView will be deprecated end diff --git a/src/cocos/ui/GuiConstants.lua b/src/cocos/ui/GuiConstants.lua new file mode 100644 index 0000000..3a522ff --- /dev/null +++ b/src/cocos/ui/GuiConstants.lua @@ -0,0 +1,218 @@ +if nil == ccui then + return +end + +ccui.BrightStyle = +{ + none = -1, + normal = 0, + highlight = 1, +} + +ccui.TextureResType = +{ + localType = 0, + plistType = 1, +} + +ccui.TouchEventType = +{ + began = 0, + moved = 1, + ended = 2, + canceled = 3, +} + +ccui.SizeType = +{ + absolute = 0, + percent = 1, +} + +ccui.PositionType = { + absolute = 0, + percent = 1, +} + +ccui.CheckBoxEventType = +{ + selected = 0, + unselected = 1, +} + +ccui.RadioButtonEventType= +{ + selected = 0, + unselected = 1 +} + +ccui.RadioButtonGroupEventType= +{ + select_changed = 0 +} + +ccui.TextFiledEventType = +{ + attach_with_ime = 0, + detach_with_ime = 1, + insert_text = 2, + delete_backward = 3, +} + +ccui.LayoutBackGroundColorType = +{ + none = 0, + solid = 1, + gradient = 2, +} + +ccui.LayoutType = +{ + ABSOLUTE = 0, + VERTICAL = 1, + HORIZONTAL = 2, + RELATIVE = 3, +} + +ccui.LayoutParameterType = +{ + none = 0, + linear = 1, + relative = 2, +} + +ccui.LinearGravity = +{ + none = 0, + left = 1, + top = 2, + right = 3, + bottom = 4, + centerVertical = 5, + centerHorizontal = 6, +} + +ccui.RelativeAlign = +{ + alignNone = 0, + alignParentTopLeft = 1, + alignParentTopCenterHorizontal = 2, + alignParentTopRight = 3, + alignParentLeftCenterVertical = 4, + centerInParent = 5, + alignParentRightCenterVertical = 6, + alignParentLeftBottom = 7, + alignParentBottomCenterHorizontal = 8, + alignParentRightBottom = 9, + locationAboveLeftAlign = 10, + locationAboveCenter = 11, + locationAboveRightAlign = 12, + locationLeftOfTopAlign = 13, + locationLeftOfCenter = 14, + locationLeftOfBottomAlign = 15, + locationRightOfTopAlign = 16, + locationRightOfCenter = 17, + locationRightOfBottomAlign = 18, + locationBelowLeftAlign = 19, + locationBelowCenter = 20, + locationBelowRightAlign = 21, +} + +ccui.SliderEventType = { + percentChanged = 0, + slideBallDown = 1, + slideBallUp = 2, + slideBallCancel = 3 +} + +ccui.LoadingBarDirection = { LEFT = 0, RIGHT = 1} + +ccui.ScrollViewDir = { + none = 0, + vertical = 1, + horizontal = 2, + both = 3, +} + +ccui.ScrollViewMoveDir = { + none = 0, + up = 1, + down = 2, + left = 3, + right = 4, +} + +ccui.ScrollviewEventType = { + scrollToTop = 0, + scrollToBottom = 1, + scrollToLeft = 2, + scrollToRight = 3, + scrolling = 4, + bounceTop = 5, + bounceBottom = 6, + bounceLeft = 7, + bounceRight = 8, +} + +ccui.ListViewDirection = { + none = 0, + vertical = 1, + horizontal = 2, +} + +ccui.ListViewMoveDirection = { + none = 0, + up = 1, + down = 2, + left = 3, + right = 4, +} + +ccui.ListViewEventType = { + ONSELECTEDITEM_START = 0, + ONSELECTEDITEM_END = 1, +} + +ccui.PageViewEventType = { + turning = 0, +} + +ccui.PageViewDirection = { + HORIZONTAL = 0, + VERTICAL = 1 +} + +ccui.PVTouchDir = { + touchLeft = 0, + touchRight = 1, + touchUp = 2, + touchDown = 3 +} + +ccui.ListViewGravity = { + left = 0, + right = 1, + centerHorizontal = 2, + top = 3, + bottom = 4 , + centerVertical = 5, +} + +ccui.TextType = { + SYSTEM = 0, + TTF = 1, +} + +ccui.LayoutComponent.HorizontalEdge = { + None = 0, + Left = 1, + Right = 2, + Center = 3, +} + +ccui.LayoutComponent.VerticalEdge = { + None = 0, + Bottom = 1, + Top = 2, + Center = 3, +} diff --git a/src/cocos/ui/experimentalUIConstants.lua b/src/cocos/ui/experimentalUIConstants.lua new file mode 100644 index 0000000..b2bcc05 --- /dev/null +++ b/src/cocos/ui/experimentalUIConstants.lua @@ -0,0 +1,10 @@ +if nil == ccexp then + return +end + +ccexp.VideoPlayerEvent = { + PLAYING = 0, + PAUSED = 1, + STOPPED= 2, + COMPLETED =3, +} diff --git a/src/config.lua b/src/config.lua new file mode 100644 index 0000000..3ccae42 --- /dev/null +++ b/src/config.lua @@ -0,0 +1,26 @@ + +-- 0 - disable debug info, 1 - less debug info, 2 - verbose debug info +DEBUG = 2 + +-- use framework, will disable all deprecated API, false - use legacy API +CC_USE_FRAMEWORK = true + +-- show FPS on screen +CC_SHOW_FPS = true + +-- disable create unexpected global variable +CC_DISABLE_GLOBAL = true + +-- for module display +CC_DESIGN_RESOLUTION = { + width = 960, + height = 640, + autoscale = "FIXED_HEIGHT", + callback = function(framesize) + local ratio = framesize.width / framesize.height + if ratio <= 1.34 then + -- iPad 768*1024(1536*2048) is 4:3 screen + return {autoscale = "FIXED_WIDTH"} + end + end +} diff --git a/src/main.lua b/src/main.lua new file mode 100644 index 0000000..7b0a513 --- /dev/null +++ b/src/main.lua @@ -0,0 +1,16 @@ + +cc.FileUtils:getInstance():setPopupNotify(false) +cc.FileUtils:getInstance():addSearchPath("src/") +cc.FileUtils:getInstance():addSearchPath("res/") + +require "config" +require "cocos.init" + +local function main() + require("app.MyApp"):create():run() +end + +local status, msg = xpcall(main, __G__TRACKBACK__) +if not status then + print(msg) +end diff --git a/src/packages/mvc/AppBase.lua b/src/packages/mvc/AppBase.lua new file mode 100644 index 0000000..ccf9f57 --- /dev/null +++ b/src/packages/mvc/AppBase.lua @@ -0,0 +1,67 @@ + +local AppBase = class("AppBase") + +function AppBase:ctor(configs) + self.configs_ = { + viewsRoot = "app.views", + modelsRoot = "app.models", + defaultSceneName = "MainScene", + } + + for k, v in pairs(configs or {}) do + self.configs_[k] = v + end + + if type(self.configs_.viewsRoot) ~= "table" then + self.configs_.viewsRoot = {self.configs_.viewsRoot} + end + if type(self.configs_.modelsRoot) ~= "table" then + self.configs_.modelsRoot = {self.configs_.modelsRoot} + end + + if DEBUG > 1 then + dump(self.configs_, "AppBase configs") + end + + if CC_SHOW_FPS then + cc.Director:getInstance():setDisplayStats(true) + end + + -- event + self:onCreate() +end + +function AppBase:run(initSceneName) + initSceneName = initSceneName or self.configs_.defaultSceneName + self:enterScene(initSceneName) +end + +function AppBase:enterScene(sceneName, transition, time, more) + local view = self:createView(sceneName) + view:showWithScene(transition, time, more) + return view +end + +function AppBase:createView(name) + for _, root in ipairs(self.configs_.viewsRoot) do + local packageName = string.format("%s.%s", root, name) + local status, view = xpcall(function() + return require(packageName) + end, function(msg) + if not string.find(msg, string.format("'%s' not found:", packageName)) then + print("load view error: ", msg) + end + end) + local t = type(view) + if status and (t == "table" or t == "userdata") then + return view:create(self, name) + end + end + error(string.format("AppBase:createView() - not found view \"%s\" in search paths \"%s\"", + name, table.concat(self.configs_.viewsRoot, ",")), 0) +end + +function AppBase:onCreate() +end + +return AppBase diff --git a/src/packages/mvc/ViewBase.lua b/src/packages/mvc/ViewBase.lua new file mode 100644 index 0000000..64a26bd --- /dev/null +++ b/src/packages/mvc/ViewBase.lua @@ -0,0 +1,68 @@ + +local ViewBase = class("ViewBase", cc.Node) + +function ViewBase:ctor(app, name) + self:enableNodeEvents() + self.app_ = app + self.name_ = name + + -- check CSB resource file + local res = rawget(self.class, "RESOURCE_FILENAME") + if res then + self:createResoueceNode(res) + end + + local binding = rawget(self.class, "RESOURCE_BINDING") + if res and binding then + self:createResoueceBinding(binding) + end + + if self.onCreate then self:onCreate() end +end + +function ViewBase:getApp() + return self.app_ +end + +function ViewBase:getName() + return self.name_ +end + +function ViewBase:getResourceNode() + return self.resourceNode_ +end + +function ViewBase:createResoueceNode(resourceFilename) + if self.resourceNode_ then + self.resourceNode_:removeSelf() + self.resourceNode_ = nil + end + self.resourceNode_ = cc.CSLoader:createNode(resourceFilename) + assert(self.resourceNode_, string.format("ViewBase:createResoueceNode() - load resouce node from file \"%s\" failed", resourceFilename)) + self:addChild(self.resourceNode_) +end + +function ViewBase:createResoueceBinding(binding) + assert(self.resourceNode_, "ViewBase:createResoueceBinding() - not load resource node") + for nodeName, nodeBinding in pairs(binding) do + local node = self.resourceNode_:getChildByName(nodeName) + if nodeBinding.varname then + self[nodeBinding.varname] = node + end + for _, event in ipairs(nodeBinding.events or {}) do + if event.event == "touch" then + node:onTouch(handler(self, self[event.method])) + end + end + end +end + +function ViewBase:showWithScene(transition, time, more) + self:setVisible(true) + local scene = display.newScene(self.name_) + scene:addChild(self) + display.runScene(scene, transition, time, more) + return self +end + +return ViewBase diff --git a/src/packages/mvc/init.lua b/src/packages/mvc/init.lua new file mode 100644 index 0000000..3eb980c --- /dev/null +++ b/src/packages/mvc/init.lua @@ -0,0 +1,7 @@ + +local _M = {} + +_M.AppBase = import(".AppBase") +_M.ViewBase = import(".ViewBase") + +return _M