mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of github.com:super626/cocos2d-x into v3
This commit is contained in:
commit
a41bb40930
1
AUTHORS
1
AUTHORS
|
@ -536,6 +536,7 @@ Developers:
|
|||
|
||||
musikov
|
||||
Fixing a bug that missing precision when getting strokeColor and fontFillColor
|
||||
added Turkish and Ukrainian language support
|
||||
|
||||
hawkwood (Justin Hawkwood)
|
||||
Fixing a bug that EditBox doesn't show any text if it's initialized with text.
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
cocos2d-x-3.4beta0 ??
|
||||
[NEW] 3D: support frustum culling
|
||||
[NEW] Action: MoveTo and MoveBy support Vec3
|
||||
[NEW] Allocator: add custom allocator support, global, default, fixed block, object pool.
|
||||
[NEW] Allocator: add custom allocator support, global, default, fixed block, object pool
|
||||
[NEW] Application: added Turkish and Ukrainian language support
|
||||
[NEW] UI:LoadingBar: add TextureResType to LoadingBar's create method
|
||||
[NEW] Director: add setClearColor() to set clear values for the color buffers
|
||||
|
||||
[FIX] ui::Button: fix setTitleColor calls method setColor instead of setTextColor of title label.
|
||||
[FIX] FileUtils: WebP format with alpha channel displayed wrong
|
||||
[FIX] Label: content size of Label is incorrect if the string is set to empty string
|
||||
[FIX] GLProgramState: fix assert error caused by outdated uniform and attribute cache
|
||||
|
||||
cocos2d-x-3.3 Dec.12
|
||||
[FIX] Billboard: allow billboard rotate along z axis
|
||||
|
|
|
@ -185,7 +185,7 @@ Open the `cocos2d-x/build/cocos2d-win32.vc2012.sln`
|
|||
```
|
||||
$ cd cocos2d-x/build
|
||||
$ python ./android-build.py cpp-empty-test -p 10
|
||||
$ adb install ../tests/cpp-empty-tst/proj.android/bin/CppEmptyTest-debug.apk
|
||||
$ adb install ../tests/cpp-empty-test/proj.android/bin/CppEmptyTest-debug.apk
|
||||
```
|
||||
|
||||
Then click item on Android device to run tests. Available value of `-p` is the API level, cocos2d-x supports from level 10.
|
||||
|
|
|
@ -1170,6 +1170,10 @@
|
|||
29394CF519B01DBA00D2DE1A /* UIWebViewImpl-ios.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEE19B01DBA00D2DE1A /* UIWebViewImpl-ios.h */; };
|
||||
29394CF619B01DBA00D2DE1A /* UIWebViewImpl-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29394CEF19B01DBA00D2DE1A /* UIWebViewImpl-ios.mm */; };
|
||||
29394CF719B01DBA00D2DE1A /* UIWebViewImpl-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29394CEF19B01DBA00D2DE1A /* UIWebViewImpl-ios.mm */; };
|
||||
296BF6151A44059B0038EC44 /* UIShaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 296BF6141A44059B0038EC44 /* UIShaders.h */; };
|
||||
296BF6161A44059B0038EC44 /* UIShaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 296BF6141A44059B0038EC44 /* UIShaders.h */; };
|
||||
296BF6181A4405CB0038EC44 /* UIShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 296BF6171A4405CB0038EC44 /* UIShaders.cpp */; };
|
||||
296BF6191A4405CB0038EC44 /* UIShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 296BF6171A4405CB0038EC44 /* UIShaders.cpp */; };
|
||||
2986667F18B1B246000E39CA /* CCTweenFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2986667818B1B079000E39CA /* CCTweenFunction.cpp */; };
|
||||
299754F4193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; };
|
||||
299754F5193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; };
|
||||
|
@ -2400,6 +2404,9 @@
|
|||
29394CEF19B01DBA00D2DE1A /* UIWebViewImpl-ios.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIWebViewImpl-ios.mm"; sourceTree = "<group>"; };
|
||||
2958244919873D8E00F9746D /* UIScale9Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIScale9Sprite.cpp; sourceTree = "<group>"; };
|
||||
2958244A19873D8E00F9746D /* UIScale9Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScale9Sprite.h; sourceTree = "<group>"; };
|
||||
296BF6131A4403380038EC44 /* ccShader_grayscale.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_grayscale.frag; sourceTree = "<group>"; };
|
||||
296BF6141A44059B0038EC44 /* UIShaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIShaders.h; sourceTree = "<group>"; };
|
||||
296BF6171A4405CB0038EC44 /* UIShaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIShaders.cpp; sourceTree = "<group>"; };
|
||||
2986667818B1B079000E39CA /* CCTweenFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTweenFunction.cpp; sourceTree = "<group>"; };
|
||||
2986667918B1B079000E39CA /* CCTweenFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTweenFunction.h; sourceTree = "<group>"; };
|
||||
299754F2193EC95400A54AC3 /* ObjectFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjectFactory.cpp; path = ../base/ObjectFactory.cpp; sourceTree = "<group>"; };
|
||||
|
@ -4182,6 +4189,7 @@
|
|||
2905F9E618CF08D000240AA3 /* ui */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
296BF6121A4403380038EC44 /* shaders */,
|
||||
29CB8F531929D67D00C841D6 /* widgets */,
|
||||
29CB8F521929D65500C841D6 /* experimental */,
|
||||
29CB8F511929D64500C841D6 /* base */,
|
||||
|
@ -4214,6 +4222,16 @@
|
|||
path = UIEditBox;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
296BF6121A4403380038EC44 /* shaders */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
296BF6131A4403380038EC44 /* ccShader_grayscale.frag */,
|
||||
296BF6141A44059B0038EC44 /* UIShaders.h */,
|
||||
296BF6171A4405CB0038EC44 /* UIShaders.cpp */,
|
||||
);
|
||||
path = shaders;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
29CB8F501929D63600C841D6 /* layout */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -5477,6 +5495,7 @@
|
|||
5034CA2F191D591100CE6051 /* ccShader_PositionTexture.vert in Headers */,
|
||||
15AE1C1219AAE2C600C27E9E /* CCPhysicsDebugNode.h in Headers */,
|
||||
50ABBE951925AB6F00A911A9 /* CCProfiling.h in Headers */,
|
||||
296BF6151A44059B0038EC44 /* UIShaders.h in Headers */,
|
||||
5034CA4B191D591100CE6051 /* ccShader_Label_df_glow.frag in Headers */,
|
||||
50ABBE4F1925AB6F00A911A9 /* CCEventCustom.h in Headers */,
|
||||
50ABBD521925AB0000A911A9 /* Quaternion.h in Headers */,
|
||||
|
@ -5898,6 +5917,7 @@
|
|||
50ABBD571925AB0000A911A9 /* TransformUtils.h in Headers */,
|
||||
1A570115180BC8EE0088DEC7 /* CCDrawNode.h in Headers */,
|
||||
1A57011E180BC90D0088DEC7 /* CCGrabber.h in Headers */,
|
||||
296BF6161A44059B0038EC44 /* UIShaders.h in Headers */,
|
||||
1A570122180BC90D0088DEC7 /* CCGrid.h in Headers */,
|
||||
15AE1AB319AAD40300C27E9E /* b2CircleContact.h in Headers */,
|
||||
5034CA2E191D591100CE6051 /* ccShader_PositionTextureA8Color.frag in Headers */,
|
||||
|
@ -6789,6 +6809,7 @@
|
|||
15AE1B5119AADA9900C27E9E /* UIPageView.cpp in Sources */,
|
||||
50ED2BE619BEAF7900A0AB90 /* UIEditBoxImpl-wp8.cpp in Sources */,
|
||||
15AE18EC19AAD35000C27E9E /* CCActionObject.cpp in Sources */,
|
||||
296BF6181A4405CB0038EC44 /* UIShaders.cpp in Sources */,
|
||||
1A01C68E18F57BE800EFE3A6 /* CCDictionary.cpp in Sources */,
|
||||
50ABBD381925AB0000A911A9 /* CCAffineTransform.cpp in Sources */,
|
||||
46C02E0718E91123004B7456 /* xxhash.c in Sources */,
|
||||
|
@ -7149,6 +7170,7 @@
|
|||
50ABC0061926664800A911A9 /* CCThread-apple.mm in Sources */,
|
||||
B375107C1823ACA100B3BA6A /* CCPhysicsBodyInfo_chipmunk.cpp in Sources */,
|
||||
50ABBEB61925AB6F00A911A9 /* CCUserDefault-android.cpp in Sources */,
|
||||
296BF6191A4405CB0038EC44 /* UIShaders.cpp in Sources */,
|
||||
1A57034C180BD09B0088DEC7 /* tinyxml2.cpp in Sources */,
|
||||
50ABBDB61925AB4100A911A9 /* CCTexture2D.cpp in Sources */,
|
||||
15AE1BAB19AADFDF00C27E9E /* UILayout.cpp in Sources */,
|
||||
|
|
|
@ -70,7 +70,7 @@ Camera::Camera()
|
|||
, _viewProjectionDirty(true)
|
||||
, _cameraFlag(1)
|
||||
, _frustumDirty(true)
|
||||
, _enableFrustumCull(true)
|
||||
, _enableFrustumCulling(true)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -253,22 +253,22 @@ void Camera::unproject(const Size& viewport, Vec3* src, Vec3* dst) const
|
|||
dst->set(screen.x, screen.y, screen.z);
|
||||
}
|
||||
|
||||
void Camera::enableFrustumCull(bool bEnalbe, bool bClipZ)
|
||||
void Camera::enableFrustumCulling(bool enalbe, bool clipZ)
|
||||
{
|
||||
_enableFrustumCull = bEnalbe;
|
||||
_frustum.setClipZ(bClipZ);
|
||||
_enableFrustumCulling = enalbe;
|
||||
_frustum.setClipZ(clipZ);
|
||||
}
|
||||
|
||||
bool Camera::visibleInFrustum(const AABB& aabb) const
|
||||
bool Camera::isVisibleInFrustum(const AABB* aabb) const
|
||||
{
|
||||
if (_enableFrustumCull)
|
||||
if (_enableFrustumCulling)
|
||||
{
|
||||
if (_frustumDirty)
|
||||
{
|
||||
_frustum.initFrustum(this);
|
||||
_frustumDirty = false;
|
||||
}
|
||||
return !_frustum.isOutFrustum(aabb);
|
||||
return !_frustum.isOutOfFrustum(*aabb);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -139,12 +139,12 @@ public:
|
|||
/**
|
||||
* Enable frustum culling
|
||||
*/
|
||||
void enableFrustumCull(bool bEnalbe, bool bClipZ);
|
||||
void enableFrustumCulling(bool enalbe, bool clipZ);
|
||||
|
||||
/**
|
||||
* Is this aabb visible in frustum
|
||||
*/
|
||||
bool visibleInFrustum(const AABB& aabb)const;
|
||||
bool isVisibleInFrustum(const AABB* aabb)const;
|
||||
|
||||
//override
|
||||
virtual void onEnter() override;
|
||||
|
@ -184,7 +184,7 @@ protected:
|
|||
unsigned short _cameraFlag; // camera flag
|
||||
mutable Frustum _frustum; // camera frustum
|
||||
mutable bool _frustumDirty;
|
||||
bool _enableFrustumCull;
|
||||
bool _enableFrustumCulling;
|
||||
static Camera* _visitingCamera;
|
||||
|
||||
friend class Director;
|
||||
|
|
|
@ -336,6 +336,8 @@ void Node::setRotation(float rotation)
|
|||
updatePhysicsBodyRotation(getScene());
|
||||
}
|
||||
#endif
|
||||
|
||||
updateRotationQuat();
|
||||
}
|
||||
|
||||
float Node::getRotationSkewX() const
|
||||
|
@ -357,6 +359,8 @@ void Node::setRotation3D(const Vec3& rotation)
|
|||
|
||||
// rotation Z is decomposed in 2 to simulate Skew for Flash animations
|
||||
_rotationZ_Y = _rotationZ_X = rotation.z;
|
||||
|
||||
updateRotationQuat();
|
||||
|
||||
#if CC_USE_PHYSICS
|
||||
if (_physicsBody != nullptr)
|
||||
|
@ -374,6 +378,44 @@ Vec3 Node::getRotation3D() const
|
|||
return Vec3(_rotationX,_rotationY,_rotationZ_X);
|
||||
}
|
||||
|
||||
void Node::updateRotationQuat()
|
||||
{
|
||||
// convert Euler angle to quaternion
|
||||
// when _rotationZ_X == _rotationZ_Y, _rotationQuat = RotationZ_X * RotationY * RotationX
|
||||
// when _rotationZ_X != _rotationZ_Y, _rotationQuat = RotationY * RotationX
|
||||
float halfRadx = CC_DEGREES_TO_RADIANS(_rotationX / 2.f), halfRady = CC_DEGREES_TO_RADIANS(_rotationY / 2.f), halfRadz = _rotationZ_X == _rotationZ_Y ? -CC_DEGREES_TO_RADIANS(_rotationZ_X / 2.f) : 0;
|
||||
float coshalfRadx = cosf(halfRadx), sinhalfRadx = sinf(halfRadx), coshalfRady = cosf(halfRady), sinhalfRady = sinf(halfRady), coshalfRadz = cosf(halfRadz), sinhalfRadz = sinf(halfRadz);
|
||||
_rotationQuat.x = sinhalfRadx * coshalfRady * coshalfRadz - coshalfRadx * sinhalfRady * sinhalfRadz;
|
||||
_rotationQuat.y = coshalfRadx * sinhalfRady * coshalfRadz + sinhalfRadx * coshalfRady * sinhalfRadz;
|
||||
_rotationQuat.z = coshalfRadx * coshalfRady * sinhalfRadz - sinhalfRadx * sinhalfRady * coshalfRadz;
|
||||
_rotationQuat.w = coshalfRadx * coshalfRady * coshalfRadz + sinhalfRadx * sinhalfRady * sinhalfRadz;
|
||||
}
|
||||
|
||||
void Node::updateRotation3D()
|
||||
{
|
||||
//convert quaternion to Euler angle
|
||||
float x = _rotationQuat.x, y = _rotationQuat.y, z = _rotationQuat.z, w = _rotationQuat.w;
|
||||
_rotationX = atan2f(2.f * (w * x + y * z), 1.f - 2.f * (x * x + y * y));
|
||||
_rotationY = asinf(2.f * (w * y - z * x));
|
||||
_rotationZ_X = atanf(2.f * (w * z + x * y) / (1.f - 2.f * (y * y + z * z)));
|
||||
|
||||
_rotationX = CC_RADIANS_TO_DEGREES(_rotationX);
|
||||
_rotationY = CC_RADIANS_TO_DEGREES(_rotationY);
|
||||
_rotationZ_X = _rotationZ_Y = -CC_RADIANS_TO_DEGREES(_rotationZ_X);
|
||||
}
|
||||
|
||||
void Node::setRotationQuat(const Quaternion& quat)
|
||||
{
|
||||
_rotationQuat = quat;
|
||||
updateRotation3D();
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
}
|
||||
|
||||
Quaternion Node::getRotationQuat() const
|
||||
{
|
||||
return _rotationQuat;
|
||||
}
|
||||
|
||||
void Node::setRotationSkewX(float rotationX)
|
||||
{
|
||||
if (_rotationZ_X == rotationX)
|
||||
|
@ -388,6 +430,8 @@ void Node::setRotationSkewX(float rotationX)
|
|||
|
||||
_rotationZ_X = rotationX;
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
|
||||
updateRotationQuat();
|
||||
}
|
||||
|
||||
float Node::getRotationSkewY() const
|
||||
|
@ -409,6 +453,8 @@ void Node::setRotationSkewY(float rotationY)
|
|||
|
||||
_rotationZ_Y = rotationY;
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
|
||||
updateRotationQuat();
|
||||
}
|
||||
|
||||
/// scale getter
|
||||
|
@ -1708,11 +1754,12 @@ const Mat4& Node::getNodeToParentTransform() const
|
|||
y += _anchorPointInPoints.y;
|
||||
}
|
||||
|
||||
bool needsSkewMatrix = ( _skewX || _skewY );
|
||||
// Rotation values
|
||||
// Change rotation code to handle X and Y
|
||||
// If we skew with the exact same value for both x and y then we're simply just rotating
|
||||
float cx = 1, sx = 0, cy = 1, sy = 0;
|
||||
if (_rotationZ_X || _rotationZ_Y)
|
||||
if (_rotationZ_X != _rotationZ_Y || (! needsSkewMatrix && !_anchorPointInPoints.equals(Vec2::ZERO)))
|
||||
{
|
||||
float radiansX = -CC_DEGREES_TO_RADIANS(_rotationZ_X);
|
||||
float radiansY = -CC_DEGREES_TO_RADIANS(_rotationZ_Y);
|
||||
|
@ -1722,8 +1769,6 @@ const Mat4& Node::getNodeToParentTransform() const
|
|||
sy = sinf(radiansY);
|
||||
}
|
||||
|
||||
bool needsSkewMatrix = ( _skewX || _skewY );
|
||||
|
||||
Vec2 anchorPoint(_anchorPointInPoints.x * _scaleX, _anchorPointInPoints.y * _scaleY);
|
||||
|
||||
// optimization:
|
||||
|
@ -1737,39 +1782,26 @@ const Mat4& Node::getNodeToParentTransform() const
|
|||
|
||||
// Build Transform Matrix
|
||||
// Adjusted transform calculation for rotational skew
|
||||
float mat[] = {
|
||||
cy * _scaleX, sy * _scaleX, 0, 0,
|
||||
-sx * _scaleY, cx * _scaleY, 0, 0,
|
||||
0, 0, _scaleZ, 0,
|
||||
x, y, z, 1 };
|
||||
|
||||
_transform.set(mat);
|
||||
|
||||
if(!_ignoreAnchorPointForPosition)
|
||||
Mat4::createRotation(_rotationQuat, &_transform);
|
||||
if (_rotationZ_X != _rotationZ_Y)
|
||||
{
|
||||
_transform.translate(anchorPoint.x, anchorPoint.y, 0);
|
||||
float m0 = _transform.m[0], m1 = _transform.m[1], m4 = _transform.m[4], m5 = _transform.m[5], m8 = _transform.m[8], m9 = _transform.m[9];
|
||||
_transform.m[0] = cy * m0 - sx * m1, _transform.m[4] = cy * m4 - sx * m5, _transform.m[8] = cy * m8 - sx * m9;
|
||||
_transform.m[1] = sy * m0 + cx * m1, _transform.m[5] = sy * m4 + cx * m5, _transform.m[9] = sy * m8 + cx * m9;
|
||||
}
|
||||
|
||||
// FIXME:
|
||||
// FIX ME: Expensive operation.
|
||||
// FIX ME: It should be done together with the rotationZ
|
||||
if(_rotationY)
|
||||
if (_scaleX != 1.f)
|
||||
{
|
||||
Mat4 rotY;
|
||||
Mat4::createRotationY(CC_DEGREES_TO_RADIANS(_rotationY), &rotY);
|
||||
_transform = _transform * rotY;
|
||||
_transform.m[0] *= _scaleX, _transform.m[1] *= _scaleX, _transform.m[2] *= _scaleX;
|
||||
}
|
||||
if(_rotationX)
|
||||
if (_scaleY != 1.f)
|
||||
{
|
||||
Mat4 rotX;
|
||||
Mat4::createRotationX(CC_DEGREES_TO_RADIANS(_rotationX), &rotX);
|
||||
_transform = _transform * rotX;
|
||||
_transform.m[4] *= _scaleY, _transform.m[5] *= _scaleY, _transform.m[6] *= _scaleY;
|
||||
}
|
||||
|
||||
if(!_ignoreAnchorPointForPosition)
|
||||
if (_scaleZ != 1.f)
|
||||
{
|
||||
_transform.translate(-anchorPoint.x, -anchorPoint.y, 0);
|
||||
_transform.m[8] *= _scaleZ, _transform.m[9] *= _scaleZ, _transform.m[10] *= _scaleZ;
|
||||
}
|
||||
_transform.m[12] = x, _transform.m[13] = y, _transform.m[14] = z;
|
||||
|
||||
// FIXME:: Try to inline skew
|
||||
// If skew is needed, apply skew and then anchor point
|
||||
|
|
|
@ -541,6 +541,17 @@ public:
|
|||
* returns the rotation (X,Y,Z) in degrees.
|
||||
*/
|
||||
virtual Vec3 getRotation3D() const;
|
||||
|
||||
/**
|
||||
* set rotation by quaternion
|
||||
*/
|
||||
virtual void setRotationQuat(const Quaternion& quat);
|
||||
|
||||
/**
|
||||
* return the rotation by quaternion, Note that when _rotationZ_X == _rotationZ_Y, the returned quaternion equals to RotationZ_X * RotationY * RotationX,
|
||||
* it equals to RotationY * RotationX otherwise
|
||||
*/
|
||||
virtual Quaternion getRotationQuat() const;
|
||||
|
||||
/**
|
||||
* Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew.
|
||||
|
@ -1596,6 +1607,11 @@ protected:
|
|||
//check whether this camera mask is visible by the current visiting camera
|
||||
bool isVisitableByVisitingCamera() const;
|
||||
|
||||
// update quaternion from Rotation3D
|
||||
void updateRotationQuat();
|
||||
// update Rotation3D from quaternion
|
||||
void updateRotation3D();
|
||||
|
||||
#if CC_USE_PHYSICS
|
||||
void updatePhysicsBodyTransform(Scene* layer);
|
||||
virtual void updatePhysicsBodyPosition(Scene* layer);
|
||||
|
@ -1614,6 +1630,8 @@ protected:
|
|||
// rotation Z is decomposed in 2 to simulate Skew for Flash animations
|
||||
float _rotationZ_X; ///< rotation angle on Z-axis, component X
|
||||
float _rotationZ_Y; ///< rotation angle on Z-axis, component Y
|
||||
|
||||
Quaternion _rotationQuat; ///rotation using quaternion, if _rotationZ_X == _rotationZ_Y, _rotationQuat = RotationZ_X * RotationY * RotationX, else _rotationQuat = RotationY * RotationX
|
||||
|
||||
float _scaleX; ///< scaling factor on x-axis
|
||||
float _scaleY; ///< scaling factor on y-axis
|
||||
|
|
|
@ -264,6 +264,7 @@ Sprite::Sprite(void)
|
|||
: _batchNode(nullptr)
|
||||
, _shouldBeHidden(false)
|
||||
, _texture(nullptr)
|
||||
, _spriteFrame(nullptr)
|
||||
, _insideBounds(true)
|
||||
{
|
||||
#if CC_SPRITE_DEBUG_DRAW
|
||||
|
@ -274,6 +275,7 @@ Sprite::Sprite(void)
|
|||
|
||||
Sprite::~Sprite(void)
|
||||
{
|
||||
CC_SAFE_RELEASE(_spriteFrame);
|
||||
CC_SAFE_RELEASE(_texture);
|
||||
}
|
||||
|
||||
|
@ -936,6 +938,14 @@ void Sprite::setSpriteFrame(const std::string &spriteFrameName)
|
|||
|
||||
void Sprite::setSpriteFrame(SpriteFrame *spriteFrame)
|
||||
{
|
||||
// retain the sprite frame
|
||||
// do not removed by SpriteFrameCache::removeUnusedSpriteFrames
|
||||
if (_spriteFrame != spriteFrame)
|
||||
{
|
||||
CC_SAFE_RELEASE(_spriteFrame);
|
||||
_spriteFrame = spriteFrame;
|
||||
spriteFrame->retain();
|
||||
}
|
||||
_unflippedOffsetPositionFromCenter = spriteFrame->getOffset();
|
||||
|
||||
Texture2D *texture = spriteFrame->getTexture();
|
||||
|
|
|
@ -159,7 +159,7 @@ public:
|
|||
/**
|
||||
* Updates the quad according the rotation, position, scale values.
|
||||
*/
|
||||
virtual void updateTransform(void);
|
||||
virtual void updateTransform();
|
||||
|
||||
/**
|
||||
* Returns the batch node object if this sprite is rendered by SpriteBatchNode
|
||||
|
@ -232,7 +232,7 @@ public:
|
|||
/**
|
||||
* Returns whether or not a SpriteFrame is being displayed
|
||||
*/
|
||||
virtual bool isFrameDisplayed(SpriteFrame *pFrame) const;
|
||||
virtual bool isFrameDisplayed(SpriteFrame *frame) const;
|
||||
|
||||
/**
|
||||
* Returns the current displayed frame.
|
||||
|
@ -264,7 +264,7 @@ public:
|
|||
*
|
||||
* @return true if the sprite needs to be updated in the Atlas, false otherwise.
|
||||
*/
|
||||
virtual bool isDirty(void) const { return _dirty; }
|
||||
virtual bool isDirty() const { return _dirty; }
|
||||
|
||||
/**
|
||||
* Makes the Sprite to be updated in the Atlas.
|
||||
|
@ -276,17 +276,17 @@ public:
|
|||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
inline V3F_C4B_T2F_Quad getQuad(void) const { return _quad; }
|
||||
inline V3F_C4B_T2F_Quad getQuad() const { return _quad; }
|
||||
|
||||
/**
|
||||
* Returns whether or not the texture rectangle is rotated.
|
||||
*/
|
||||
inline bool isTextureRectRotated(void) const { return _rectRotated; }
|
||||
inline bool isTextureRectRotated() const { return _rectRotated; }
|
||||
|
||||
/**
|
||||
* Returns the index used on the TextureAtlas.
|
||||
*/
|
||||
inline ssize_t getAtlasIndex(void) const { return _atlasIndex; }
|
||||
inline ssize_t getAtlasIndex() const { return _atlasIndex; }
|
||||
|
||||
/**
|
||||
* Sets the index used on the TextureAtlas.
|
||||
|
@ -297,22 +297,22 @@ public:
|
|||
/**
|
||||
* Returns the rect of the Sprite in points
|
||||
*/
|
||||
inline const Rect& getTextureRect(void) { return _rect; }
|
||||
inline const Rect& getTextureRect() const { return _rect; }
|
||||
|
||||
/**
|
||||
* Gets the weak reference of the TextureAtlas when the sprite is rendered using via SpriteBatchNode
|
||||
*/
|
||||
inline TextureAtlas* getTextureAtlas(void) { return _textureAtlas; }
|
||||
inline TextureAtlas* getTextureAtlas() const { return _textureAtlas; }
|
||||
|
||||
/**
|
||||
* Sets the weak reference of the TextureAtlas when the sprite is rendered using via SpriteBatchNode
|
||||
*/
|
||||
inline void setTextureAtlas(TextureAtlas *pobTextureAtlas) { _textureAtlas = pobTextureAtlas; }
|
||||
inline void setTextureAtlas(TextureAtlas *textureAtlas) { _textureAtlas = textureAtlas; }
|
||||
|
||||
/**
|
||||
* Gets the offset position of the sprite. Calculated automatically by editors like Zwoptex.
|
||||
*/
|
||||
inline const Vec2& getOffsetPosition(void) const { return _offsetPosition; }
|
||||
inline const Vec2& getOffsetPosition() const { return _offsetPosition; }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -325,7 +325,7 @@ public:
|
|||
*
|
||||
* @return true if the sprite is flipped horizontally, false otherwise.
|
||||
*/
|
||||
bool isFlippedX(void) const;
|
||||
bool isFlippedX() const;
|
||||
/**
|
||||
* Sets whether the sprite should be flipped horizontally or not.
|
||||
*
|
||||
|
@ -351,7 +351,7 @@ public:
|
|||
*
|
||||
* @return true if the sprite is flipped vertically, false otherwise.
|
||||
*/
|
||||
bool isFlippedY(void) const;
|
||||
bool isFlippedY() const;
|
||||
/**
|
||||
* Sets whether the sprite should be flipped vertically or not.
|
||||
*
|
||||
|
@ -418,16 +418,16 @@ public:
|
|||
virtual void setVisible(bool bVisible) override;
|
||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
||||
virtual void setOpacityModifyRGB(bool modify) override;
|
||||
virtual bool isOpacityModifyRGB(void) const override;
|
||||
virtual bool isOpacityModifyRGB() const override;
|
||||
/// @}
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
||||
Sprite(void);
|
||||
virtual ~Sprite(void);
|
||||
Sprite();
|
||||
virtual ~Sprite();
|
||||
|
||||
/* Initializes an empty sprite with nothing init. */
|
||||
virtual bool init(void);
|
||||
virtual bool init();
|
||||
|
||||
/**
|
||||
* Initializes a sprite with a texture.
|
||||
|
@ -471,7 +471,7 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
* @param pSpriteFrame A SpriteFrame object. It should includes a valid texture and a rect
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithSpriteFrame(SpriteFrame *pSpriteFrame);
|
||||
virtual bool initWithSpriteFrame(SpriteFrame *spriteFrame);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with an sprite frame name.
|
||||
|
@ -515,11 +515,11 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
|
||||
protected:
|
||||
|
||||
void updateColor(void);
|
||||
void updateColor();
|
||||
virtual void setTextureCoords(Rect rect);
|
||||
virtual void updateBlendFunc(void);
|
||||
virtual void setReorderChildDirtyRecursively(void);
|
||||
virtual void setDirtyRecursively(bool bValue);
|
||||
virtual void updateBlendFunc();
|
||||
virtual void setReorderChildDirtyRecursively();
|
||||
virtual void setDirtyRecursively(bool value);
|
||||
|
||||
//
|
||||
// Data used when the sprite is rendered using a SpriteSheet
|
||||
|
@ -538,6 +538,7 @@ protected:
|
|||
//
|
||||
BlendFunc _blendFunc; /// It's required for TextureProtocol inheritance
|
||||
Texture2D* _texture; /// Texture2D object that is used to render the sprite
|
||||
SpriteFrame* _spriteFrame;
|
||||
QuadCommand _quadCommand; /// quad command
|
||||
#if CC_SPRITE_DEBUG_DRAW
|
||||
DrawNode *_debugDrawNode;
|
||||
|
|
|
@ -228,11 +228,13 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClCompile Include="..\3d\CCBillBoard.cpp" />
|
||||
<ClCompile Include="..\3d\CCBundle3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCBundleReader.cpp" />
|
||||
<ClCompile Include="..\3d\CCFrustum.cpp" />
|
||||
<ClCompile Include="..\3d\CCMesh.cpp" />
|
||||
<ClCompile Include="..\3d\CCMeshSkin.cpp" />
|
||||
<ClCompile Include="..\3d\CCMeshVertexIndexData.cpp" />
|
||||
<ClCompile Include="..\3d\CCOBB.cpp" />
|
||||
<ClCompile Include="..\3d\CCObjLoader.cpp" />
|
||||
<ClCompile Include="..\3d\CCPlane.cpp" />
|
||||
<ClCompile Include="..\3d\CCRay.cpp" />
|
||||
<ClCompile Include="..\3d\CCSkeleton3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3D.cpp" />
|
||||
|
@ -445,6 +447,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClCompile Include="..\renderer\CCVertexIndexData.cpp" />
|
||||
<ClCompile Include="..\storage\local-storage\LocalStorage.cpp" />
|
||||
<ClCompile Include="..\ui\CocosGUI.cpp" />
|
||||
<ClCompile Include="..\ui\shaders\UIShaders.cpp" />
|
||||
<ClCompile Include="..\ui\UIButton.cpp" />
|
||||
<ClCompile Include="..\ui\UICheckBox.cpp" />
|
||||
<ClCompile Include="..\ui\UIDeprecated.cpp" />
|
||||
|
@ -599,11 +602,13 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClInclude Include="..\3d\CCBundle3D.h" />
|
||||
<ClInclude Include="..\3d\CCBundle3DData.h" />
|
||||
<ClInclude Include="..\3d\CCBundleReader.h" />
|
||||
<ClInclude Include="..\3d\CCFrustum.h" />
|
||||
<ClInclude Include="..\3d\CCMesh.h" />
|
||||
<ClInclude Include="..\3d\CCMeshSkin.h" />
|
||||
<ClInclude Include="..\3d\CCMeshVertexIndexData.h" />
|
||||
<ClInclude Include="..\3d\CCOBB.h" />
|
||||
<ClInclude Include="..\3d\CCObjLoader.h" />
|
||||
<ClInclude Include="..\3d\CCPlane.h" />
|
||||
<ClInclude Include="..\3d\CCRay.h" />
|
||||
<ClInclude Include="..\3d\CCSkeleton3D.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3D.h" />
|
||||
|
@ -864,6 +869,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClInclude Include="..\storage\local-storage\LocalStorage.h" />
|
||||
<ClInclude Include="..\ui\CocosGUI.h" />
|
||||
<ClInclude Include="..\ui\GUIExport.h" />
|
||||
<ClInclude Include="..\ui\shaders\UIShaders.h" />
|
||||
<ClInclude Include="..\ui\UIButton.h" />
|
||||
<ClInclude Include="..\ui\UICheckBox.h" />
|
||||
<ClInclude Include="..\ui\UIDeprecated.h" />
|
||||
|
@ -972,6 +978,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<None Include="..\math\Vec2.inl" />
|
||||
<None Include="..\math\Vec3.inl" />
|
||||
<None Include="..\math\Vec4.inl" />
|
||||
<None Include="..\ui\shaders\ccShader_grayscale.frag" />
|
||||
<None Include="cocos2d.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="physics">
|
||||
|
@ -244,6 +244,9 @@
|
|||
<Filter Include="cocostudio\reader\WidgetReader\ArmatureNodeReader">
|
||||
<UniqueIdentifier>{e1848cce-b225-42c4-bb6e-6430b6da123b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ui\shaders">
|
||||
<UniqueIdentifier>{e6eaa24a-a21e-4c1d-b6b2-19326d129af2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\physics\CCPhysicsBody.cpp">
|
||||
|
@ -1313,6 +1316,9 @@
|
|||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\ArmatureNodeReader.cpp">
|
||||
<Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ui\shaders\UIShaders.cpp">
|
||||
<Filter>ui\shaders</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||
|
@ -2568,6 +2574,9 @@
|
|||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\CSArmatureNode_generated.h">
|
||||
<Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ui\shaders\UIShaders.h">
|
||||
<Filter>ui\shaders</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\math\Mat4.inl">
|
||||
|
@ -2595,5 +2604,8 @@
|
|||
<None Include="..\3d\CCAnimationCurve.inl">
|
||||
<Filter>3d</Filter>
|
||||
</None>
|
||||
<None Include="..\ui\shaders\ccShader_grayscale.frag">
|
||||
<Filter>ui\shaders</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -70,11 +70,13 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCBundle3D.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCBundle3DData.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCBundleReader.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCFrustum.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMesh.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshSkin.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshVertexIndexData.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCOBB.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCObjLoader.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCPlane.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCRay.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCSkeleton3D.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCSprite3D.h" />
|
||||
|
@ -185,6 +187,7 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocosbuilder\CocosBuilder.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimeline.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineCache.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCFrame.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCNodeReader.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCTimeLine.h" />
|
||||
|
@ -311,6 +314,7 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\CCStdC.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\CCWinRTUtils.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\inet_ntop_winrt.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\inet_pton_winrt.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\InputEvent.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\InputEventTypes.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\Keyboard-winrt.h" />
|
||||
|
@ -341,6 +345,7 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\storage\local-storage\LocalStorage.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\CocosGUI.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\GUIExport.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\UIShaders.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UICheckBox.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIDeprecated.h" />
|
||||
|
@ -487,11 +492,13 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCBillBoard.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCBundle3D.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCBundleReader.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCFrustum.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMesh.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshSkin.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshVertexIndexData.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCOBB.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCObjLoader.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCPlane.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCRay.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCSkeleton3D.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCSprite3D.cpp" />
|
||||
|
@ -595,6 +602,7 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocosbuilder\CCSpriteLoader.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimeline.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineCache.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCFrame.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCNodeReader.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCTimeLine.cpp" />
|
||||
|
@ -699,6 +707,7 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\CCStdC.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\CCWinRTUtils.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\inet_ntop_winrt.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\inet_pton_winrt.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\InputEvent.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\Keyboard-winrt.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\pch.cpp">
|
||||
|
@ -730,6 +739,7 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCVertexIndexData.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\storage\local-storage\LocalStorage.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\CocosGUI.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\UIShaders.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UICheckBox.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIDeprecated.cpp" />
|
||||
|
@ -830,6 +840,7 @@
|
|||
<ProjectCapability Include="SourceItemsFromImports" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCAnimationCurve.inl" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\math\Mat4.inl" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\math\MathUtil.inl" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\math\MathUtilNeon.inl" />
|
||||
|
@ -866,6 +877,7 @@
|
|||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\ccShader_Position_uColor.frag" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\ccShader_Position_uColor.vert" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\ccShader_grayscale.frag" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\cocos2d.def" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d.vcxproj.filters" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d_wp8.vcxproj.filters" />
|
||||
|
|
|
@ -1267,6 +1267,21 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\ArmatureNodeReader.h">
|
||||
<Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\UIShaders.h">
|
||||
<Filter>ui\shaders</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.h">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCFrustum.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCPlane.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\inet_pton_winrt.h">
|
||||
<Filter>platform\winrt</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\cocos2d.cpp" />
|
||||
|
@ -2345,6 +2360,21 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\ArmatureNodeReader.cpp">
|
||||
<Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\UIShaders.cpp">
|
||||
<Filter>ui\shaders</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.cpp">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCFrustum.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCPlane.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\inet_pton_winrt.cpp">
|
||||
<Filter>platform\winrt</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="2d">
|
||||
|
@ -2578,6 +2608,9 @@
|
|||
<Filter Include="cocostudio\reader\WidgetReader\ArmatureNodeReader">
|
||||
<UniqueIdentifier>{1151b6b3-739f-4cff-add0-6b772fa7d226}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ui\shaders">
|
||||
<UniqueIdentifier>{10d3def7-52ba-4939-8de7-d9960a752f1e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\cocos2d.def" />
|
||||
|
@ -2689,5 +2722,11 @@
|
|||
<None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d_wp8.vcxproj.filters">
|
||||
<Filter>2d</Filter>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\ccShader_grayscale.frag">
|
||||
<Filter>ui\shaders</Filter>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCAnimationCurve.inl">
|
||||
<Filter>3d</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -224,15 +224,18 @@
|
|||
<ClInclude Include="..\3d\CCBundle3D.h" />
|
||||
<ClInclude Include="..\3d\CCBundle3DData.h" />
|
||||
<ClInclude Include="..\3d\CCBundleReader.h" />
|
||||
<ClInclude Include="..\3d\CCFrustum.h" />
|
||||
<ClInclude Include="..\3d\CCMesh.h" />
|
||||
<ClInclude Include="..\3d\CCMeshSkin.h" />
|
||||
<ClInclude Include="..\3d\CCMeshVertexIndexData.h" />
|
||||
<ClInclude Include="..\3d\CCOBB.h" />
|
||||
<ClInclude Include="..\3d\CCObjLoader.h" />
|
||||
<ClInclude Include="..\3d\CCPlane.h" />
|
||||
<ClInclude Include="..\3d\CCRay.h" />
|
||||
<ClInclude Include="..\3d\CCSkeleton3D.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3D.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3DMaterial.h" />
|
||||
<ClInclude Include="..\3d\cocos3d.h" />
|
||||
<ClInclude Include="..\audio\include\Export.h" />
|
||||
<ClInclude Include="..\audio\include\SimpleAudioEngine.h" />
|
||||
<ClInclude Include="..\audio\wp8\Audio.h" />
|
||||
|
@ -332,6 +335,7 @@
|
|||
<ClInclude Include="..\editor-support\cocosbuilder\CocosBuilder.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimeline.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineCache.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCFrame.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCNodeReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.h" />
|
||||
|
@ -457,6 +461,7 @@
|
|||
<ClInclude Include="..\platform\winrt\CCWinRTUtils.h" />
|
||||
<ClInclude Include="..\platform\winrt\DirectXHelper.h" />
|
||||
<ClInclude Include="..\platform\winrt\inet_ntop_winrt.h" />
|
||||
<ClInclude Include="..\platform\winrt\inet_pton_winrt.h" />
|
||||
<ClInclude Include="..\platform\winrt\InputEvent.h" />
|
||||
<ClInclude Include="..\platform\winrt\InputEventTypes.h" />
|
||||
<ClInclude Include="..\platform\winrt\pch.h" />
|
||||
|
@ -488,6 +493,7 @@
|
|||
<ClInclude Include="..\renderer\CCVertexIndexData.h" />
|
||||
<ClInclude Include="..\storage\local-storage\LocalStorage.h" />
|
||||
<ClInclude Include="..\ui\CocosGUI.h" />
|
||||
<ClInclude Include="..\ui\shaders\UIShaders.h" />
|
||||
<ClInclude Include="..\ui\UIButton.h" />
|
||||
<ClInclude Include="..\ui\UIDeprecated.h" />
|
||||
<ClInclude Include="..\ui\UIEditBox\UIEditBox.h" />
|
||||
|
@ -662,11 +668,13 @@
|
|||
<ClCompile Include="..\3d\CCBillBoard.cpp" />
|
||||
<ClCompile Include="..\3d\CCBundle3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCBundleReader.cpp" />
|
||||
<ClCompile Include="..\3d\CCFrustum.cpp" />
|
||||
<ClCompile Include="..\3d\CCMesh.cpp" />
|
||||
<ClCompile Include="..\3d\CCMeshSkin.cpp" />
|
||||
<ClCompile Include="..\3d\CCMeshVertexIndexData.cpp" />
|
||||
<ClCompile Include="..\3d\CCOBB.cpp" />
|
||||
<ClCompile Include="..\3d\CCObjLoader.cpp" />
|
||||
<ClCompile Include="..\3d\CCPlane.cpp" />
|
||||
<ClCompile Include="..\3d\CCRay.cpp" />
|
||||
<ClCompile Include="..\3d\CCSkeleton3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3D.cpp" />
|
||||
|
@ -814,6 +822,7 @@
|
|||
<ClCompile Include="..\editor-support\cocosbuilder\CCSpriteLoader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimeline.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineCache.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCFrame.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCNodeReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.cpp" />
|
||||
|
@ -917,6 +926,7 @@
|
|||
<ClCompile Include="..\platform\winrt\CCStdC.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\CCWinRTUtils.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\inet_ntop_winrt.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\inet_pton_winrt.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\InputEvent.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
|
@ -951,6 +961,7 @@
|
|||
<ClCompile Include="..\renderer\CCVertexIndexData.cpp" />
|
||||
<ClCompile Include="..\storage\local-storage\LocalStorage.cpp" />
|
||||
<ClCompile Include="..\ui\CocosGUI.cpp" />
|
||||
<ClCompile Include="..\ui\shaders\UIShaders.cpp" />
|
||||
<ClCompile Include="..\ui\UIButton.cpp" />
|
||||
<ClCompile Include="..\ui\UICheckBox.cpp" />
|
||||
<ClCompile Include="..\ui\UIDeprecated.cpp" />
|
||||
|
@ -1057,6 +1068,7 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\3d\CCAnimationCurve.inl" />
|
||||
<None Include="..\math\Mat4.inl" />
|
||||
<None Include="..\math\MathUtil.inl" />
|
||||
<None Include="..\math\MathUtilNeon.inl" />
|
||||
|
@ -1086,6 +1098,7 @@
|
|||
<None Include="..\renderer\ccShader_PositionTexture_uColor.vert" />
|
||||
<None Include="..\renderer\ccShader_Position_uColor.frag" />
|
||||
<None Include="..\renderer\ccShader_Position_uColor.vert" />
|
||||
<None Include="..\ui\shaders\ccShader_grayscale.frag" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\external\Box2D\proj.wp8\Box2D.vcxproj">
|
||||
|
|
|
@ -245,6 +245,9 @@
|
|||
<Filter Include="cocostudio\reader\WidgetReader\ArmatureNodeReader">
|
||||
<UniqueIdentifier>{939d9d3e-06b3-494e-affd-070c2c1cbe1d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ui\shaders">
|
||||
<UniqueIdentifier>{f6df0f43-3b03-4746-b786-4323895be3b1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CCAction.cpp">
|
||||
|
@ -1317,6 +1320,21 @@
|
|||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\ArmatureNodeReader.cpp">
|
||||
<Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ui\shaders\UIShaders.cpp">
|
||||
<Filter>ui\shaders</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.cpp">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCFrustum.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCPlane.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\winrt\inet_pton_winrt.cpp">
|
||||
<Filter>platform\winrt</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="CCAction.h">
|
||||
|
@ -2556,6 +2574,24 @@
|
|||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\CSArmatureNode_generated.h">
|
||||
<Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ui\shaders\UIShaders.h">
|
||||
<Filter>ui\shaders</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.h">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCFrustum.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCPlane.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\cocos3d.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\winrt\inet_pton_winrt.h">
|
||||
<Filter>platform\winrt</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\math\Mat4.inl">
|
||||
|
@ -2645,5 +2681,11 @@
|
|||
<None Include="..\renderer\ccShader_Position_uColor.vert">
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\ui\shaders\ccShader_grayscale.frag">
|
||||
<Filter>ui\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\3d\CCAnimationCurve.inl">
|
||||
<Filter>3d</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -27,46 +27,44 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
bool Frustum::initFrustum(const Camera* pCamera)
|
||||
bool Frustum::initFrustum(const Camera* camera)
|
||||
{
|
||||
_bInit = true;
|
||||
createPlane(pCamera);
|
||||
_initialized = true;
|
||||
createPlane(camera);
|
||||
return true;
|
||||
}
|
||||
bool Frustum::isOutFrustum(const AABB& aabb) const
|
||||
bool Frustum::isOutOfFrustum(const AABB& aabb) const
|
||||
{
|
||||
if (_bInit)
|
||||
if (_initialized)
|
||||
{
|
||||
Vec3 point;
|
||||
|
||||
int nplane = _bClipZ ? 6 : 4;
|
||||
for (int i = 0; i < nplane; i++)
|
||||
int plane = _clipZ ? 6 : 4;
|
||||
for (int i = 0; i < plane; i++)
|
||||
{
|
||||
const Vec3& normal = _plane[i].getNormal();
|
||||
point.x = normal.x < 0 ? aabb._max.x : aabb._min.x;
|
||||
point.y = normal.y < 0 ? aabb._max.y : aabb._min.y;
|
||||
point.z = normal.z < 0 ? aabb._max.z : aabb._min.z;
|
||||
|
||||
if (_plane[i].getSide(point) == Plane::FRONT_PLANE )
|
||||
if (_plane[i].getSide(point) == PointSide::FRONT_PLANE )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Frustum::isOutFrustum(const OBB& obb) const
|
||||
bool Frustum::isOutOfFrustum(const OBB& obb) const
|
||||
{
|
||||
if (_bInit)
|
||||
if (_initialized)
|
||||
{
|
||||
Vec3 point;
|
||||
|
||||
int nplane = _bClipZ ? 6 : 4;
|
||||
|
||||
int plane = _clipZ ? 6 : 4;
|
||||
Vec3 obbExtentX = obb._xAxis * obb._extents.x;
|
||||
Vec3 obbExtentY = obb._yAxis * obb._extents.y;
|
||||
Vec3 obbExtentZ = obb._zAxis * obb._extents.z;
|
||||
|
||||
for (int i = 0; i < nplane; i++)
|
||||
for (int i = 0; i < plane; i++)
|
||||
{
|
||||
const Vec3& normal = _plane[i].getNormal();
|
||||
point = obb._center;
|
||||
|
@ -74,16 +72,16 @@ bool Frustum::isOutFrustum(const OBB& obb) const
|
|||
point = normal.dot(obb._yAxis) > 0 ? point - obbExtentY : point + obbExtentY;
|
||||
point = normal.dot(obb._zAxis) > 0 ? point - obbExtentZ : point + obbExtentZ;
|
||||
|
||||
if (_plane[i].getSide(point) == Plane::FRONT_PLANE)
|
||||
if (_plane[i].getSide(point) == PointSide::FRONT_PLANE)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Frustum::createPlane(const Camera* pcamera)
|
||||
void Frustum::createPlane(const Camera* camera)
|
||||
{
|
||||
const Mat4& mat = pcamera->getViewProjectionMatrix();
|
||||
const Mat4& mat = camera->getViewProjectionMatrix();
|
||||
//ref http://www.lighthouse3d.com/tutorials/view-frustum-culling/clip-space-approach-extracting-the-planes/
|
||||
//extract frustum plane
|
||||
_plane[0].initPlane(-Vec3(mat.m[3] + mat.m[0], mat.m[7] + mat.m[4], mat.m[11] + mat.m[8]), (mat.m[15] + mat.m[12]));//left
|
||||
|
|
|
@ -41,38 +41,38 @@ public:
|
|||
/**
|
||||
* Constructor & Destructor.
|
||||
*/
|
||||
Frustum(): _bInit(false), _bClipZ(true){}
|
||||
Frustum(): _initialized(false), _clipZ(true){}
|
||||
~Frustum(){}
|
||||
|
||||
/**
|
||||
* init frustum from camera.
|
||||
*/
|
||||
bool initFrustum(const Camera* pCamera);
|
||||
bool initFrustum(const Camera* camera);
|
||||
|
||||
/**
|
||||
* is aabb out of frustum.
|
||||
*/
|
||||
bool isOutFrustum(const AABB& aabb) const;
|
||||
bool isOutOfFrustum(const AABB& aabb) const;
|
||||
/**
|
||||
* is obb out of frustum
|
||||
*/
|
||||
bool isOutFrustum(const OBB& obb) const;
|
||||
bool isOutOfFrustum(const OBB& obb) const;
|
||||
|
||||
/**
|
||||
* get & set z clip. if bclipZ == true use near and far plane
|
||||
*/
|
||||
void setClipZ(bool bclipZ) { _bClipZ = bclipZ; }
|
||||
bool isClipZ() { return _bClipZ; }
|
||||
void setClipZ(bool clipZ) { _clipZ = clipZ; }
|
||||
bool isClipZ() { return _clipZ; }
|
||||
|
||||
protected:
|
||||
/**
|
||||
* create clip plane
|
||||
*/
|
||||
void createPlane(const Camera* pcamera);
|
||||
void createPlane(const Camera* camera);
|
||||
|
||||
Plane _plane[6]; // clip plane, left, right, top, bottom, near, far
|
||||
bool _bClipZ; // use near and far clip plane
|
||||
bool _bInit;
|
||||
bool _clipZ; // use near and far clip plane
|
||||
bool _initialized;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -215,6 +215,8 @@ OBB::OBB(const AABB& aabb)
|
|||
|
||||
_extents = aabb._max - aabb._min;
|
||||
_extents.scale(0.5f);
|
||||
|
||||
computeExtAxis();
|
||||
}
|
||||
|
||||
OBB::OBB(const Vec3* verts, int num)
|
||||
|
@ -259,6 +261,8 @@ OBB::OBB(const Vec3* verts, int num)
|
|||
_zAxis.normalize();
|
||||
|
||||
_extents = 0.5f * (vecMax - vecMin);
|
||||
|
||||
computeExtAxis();
|
||||
}
|
||||
|
||||
bool OBB::containPoint(const Vec3& point) const
|
||||
|
@ -296,19 +300,15 @@ void OBB::reset()
|
|||
|
||||
void OBB::getCorners(Vec3* verts) const
|
||||
{
|
||||
Vec3 extX = _xAxis * _extents.x;
|
||||
Vec3 extY = _yAxis * _extents.y;
|
||||
Vec3 extZ = _zAxis * _extents.z;
|
||||
verts[0] = _center - _extentX + _extentY + _extentZ; // left top front
|
||||
verts[1] = _center - _extentX - _extentY + _extentZ; // left bottom front
|
||||
verts[2] = _center + _extentX - _extentY + _extentZ; // right bottom front
|
||||
verts[3] = _center + _extentX + _extentY + _extentZ; // right top front
|
||||
|
||||
verts[0] = _center - extX + extY + extZ; // left top front
|
||||
verts[1] = _center - extX - extY + extZ; // left bottom front
|
||||
verts[2] = _center + extX - extY + extZ; // right bottom front
|
||||
verts[3] = _center + extX + extY + extZ; // right top front
|
||||
|
||||
verts[4] = _center + extX + extY - extZ; // right top back
|
||||
verts[5] = _center + extX - extY - extZ; // right bottom back
|
||||
verts[6] = _center - extX - extY - extZ; // left bottom back
|
||||
verts[7] = _center - extX + extY - extZ; // left top back
|
||||
verts[4] = _center + _extentX + _extentY - _extentZ; // right top back
|
||||
verts[5] = _center + _extentX - _extentY - _extentZ; // right bottom back
|
||||
verts[6] = _center - _extentX - _extentY - _extentZ; // left bottom back
|
||||
verts[7] = _center - _extentX + _extentY - _extentZ; // left top back
|
||||
}
|
||||
|
||||
float OBB::projectPoint(const Vec3& point, const Vec3& axis)const
|
||||
|
@ -447,6 +447,8 @@ void OBB::transform(const Mat4& mat)
|
|||
_extents.x *= scale.x;
|
||||
_extents.y *= scale.y;
|
||||
_extents.z *= scale.z;
|
||||
|
||||
computeExtAxis();
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -84,6 +84,16 @@ public:
|
|||
void transform(const Mat4& mat);
|
||||
|
||||
protected:
|
||||
/*
|
||||
* compute extX, extY, extZ
|
||||
*/
|
||||
void computeExtAxis()
|
||||
{
|
||||
_extentX = _xAxis * _extents.x;
|
||||
_extentY = _yAxis * _extents.y;
|
||||
_extentZ = _zAxis * _extents.z;
|
||||
}
|
||||
|
||||
/*
|
||||
* Project point to the target axis
|
||||
*/
|
||||
|
@ -109,6 +119,9 @@ public:
|
|||
Vec3 _xAxis; // x axis of obb, unit vector
|
||||
Vec3 _yAxis; // y axis of obb, unit vecotr
|
||||
Vec3 _zAxis; // z axis of obb, unit vector
|
||||
Vec3 _extentX; // _xAxis * _extents.x
|
||||
Vec3 _extentY; // _yAxis * _extents.y
|
||||
Vec3 _extentZ; // _zAxis * _extents.z
|
||||
Vec3 _extents; // obb length along each axis
|
||||
};
|
||||
|
||||
|
|
|
@ -27,9 +27,11 @@
|
|||
NS_CC_BEGIN
|
||||
|
||||
Plane::Plane()
|
||||
:
|
||||
_normal(0.f, 0.f, 1.f),
|
||||
_dist(0.f)
|
||||
{
|
||||
_normal.set(0.0f, 0.0f, 1.0f);
|
||||
_dist = 0.0f;
|
||||
|
||||
}
|
||||
|
||||
// create plane from tree point
|
||||
|
@ -54,9 +56,7 @@ void Plane::initPlane(const Vec3& p1, const Vec3& p2, const Vec3& p3)
|
|||
{
|
||||
Vec3 p21 = p2 - p1;
|
||||
Vec3 p32 = p3 - p2;
|
||||
|
||||
Vec3::cross(p21, p32, &_normal);
|
||||
|
||||
_normal.normalize();
|
||||
_dist = _normal.dot(p1);
|
||||
}
|
||||
|
@ -81,15 +81,15 @@ float Plane::dist2Plane(const Vec3& p) const
|
|||
}
|
||||
|
||||
|
||||
Plane::POINT_SIDE Plane::getSide(const Vec3& point) const
|
||||
PointSide Plane::getSide(const Vec3& point) const
|
||||
{
|
||||
float dist = dist2Plane(point);
|
||||
if (dist > 0)
|
||||
return Plane::FRONT_PLANE;
|
||||
return PointSide::FRONT_PLANE;
|
||||
else if (dist < 0)
|
||||
return Plane::BEHIND_PLANE;
|
||||
|
||||
return Plane::ON_PLANE;
|
||||
return PointSide::BEHIND_PLANE;
|
||||
else
|
||||
return PointSide::IN_PLANE;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -30,16 +30,15 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
enum class PointSide
|
||||
{
|
||||
IN_PLANE,
|
||||
FRONT_PLANE,
|
||||
BEHIND_PLANE,
|
||||
};
|
||||
|
||||
class CC_DLL Plane
|
||||
{
|
||||
public:
|
||||
enum POINT_SIDE
|
||||
{
|
||||
ON_PLANE,
|
||||
FRONT_PLANE,
|
||||
BEHIND_PLANE,
|
||||
};
|
||||
|
||||
public:
|
||||
/**
|
||||
* create plane from tree point.
|
||||
|
@ -55,6 +54,10 @@ public:
|
|||
* create plane from normal and a point on plane.
|
||||
*/
|
||||
Plane(const Vec3& normal, const Vec3& point);
|
||||
|
||||
/**
|
||||
* create a default plan whose normal is (0, 0, 1), and _dist is 0, xoy plan in fact.
|
||||
*/
|
||||
Plane();
|
||||
|
||||
/**
|
||||
|
@ -90,7 +93,7 @@ public:
|
|||
/**
|
||||
* Return the side where the point is.
|
||||
*/
|
||||
POINT_SIDE getSide(const Vec3& point) const;
|
||||
PointSide getSide(const Vec3& point) const;
|
||||
|
||||
protected:
|
||||
Vec3 _normal;
|
||||
|
|
|
@ -142,17 +142,17 @@ bool Ray::intersects(const OBB& obb) const
|
|||
|
||||
float Ray::dist(const Plane& plane) const
|
||||
{
|
||||
float ndd = Vec3::dot(plane.getNormal(),_direction);
|
||||
if(ndd == 0)
|
||||
return 0.0f;
|
||||
float ndo = Vec3::dot(plane.getNormal(),_origin);
|
||||
return (plane.getDist() - ndo) / ndd;
|
||||
float ndd = Vec3::dot(plane.getNormal(), _direction);
|
||||
if(ndd == 0)
|
||||
return 0.0f;
|
||||
float ndo = Vec3::dot(plane.getNormal(), _origin);
|
||||
return (plane.getDist() - ndo) / ndd;
|
||||
}
|
||||
|
||||
Vec3 Ray::intersects(const Plane& plane) const
|
||||
{
|
||||
float dis = this->dist(plane);
|
||||
return _origin + dis * _direction;
|
||||
return _origin + dis * _direction;
|
||||
}
|
||||
|
||||
void Ray::set(const Vec3& origin, const Vec3& direction)
|
||||
|
|
|
@ -151,6 +151,10 @@ void Sprite3D::afterAsyncLoad(void* param)
|
|||
setTexture(asyncParam->texPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOG("file load failed: %s ", asyncParam->modlePath.c_str());
|
||||
}
|
||||
asyncParam->afterLoadCallback(this, asyncParam->callbackParam);
|
||||
}
|
||||
}
|
||||
|
@ -598,7 +602,7 @@ static Texture2D * getDummyTexture()
|
|||
void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||
{
|
||||
// camera clipping
|
||||
if(!Camera::getVisitingCamera()->visibleInFrustum(this->getAABB()))
|
||||
if(!Camera::getVisitingCamera()->isVisibleInFrustum(&this->getAABB()))
|
||||
return;
|
||||
|
||||
if (_skeleton)
|
||||
|
|
|
@ -11,11 +11,13 @@ set(COCOS_3D_SRC
|
|||
3d/CCAttachNode.cpp
|
||||
3d/CCBundle3D.cpp
|
||||
3d/CCBundleReader.cpp
|
||||
3d/CCFrustum.cpp
|
||||
3d/CCMesh.cpp
|
||||
3d/CCMeshSkin.cpp
|
||||
3d/CCMeshVertexIndexData.cpp
|
||||
3d/CCOBB.cpp
|
||||
3d/CCObjLoader.cpp
|
||||
3d/CCPlane.cpp
|
||||
3d/CCRay.cpp
|
||||
3d/CCSkeleton3D.cpp
|
||||
3d/CCSprite3D.cpp
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#define bzero(a, b) memset(a, 0, b);
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||
#include "inet_ntop_winrt.h"
|
||||
#include "inet_pton_winrt.h"
|
||||
#include "CCWinRTUtils.h"
|
||||
#endif
|
||||
#else
|
||||
|
@ -201,6 +202,25 @@ static const char* inet_ntop(int af, const void* src, char* dst, int cnt)
|
|||
}
|
||||
#endif
|
||||
|
||||
static const int CCLOG_STRING_TAG = 1;
|
||||
void SendLogToWindow(const char *log)
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
// Send data as a message
|
||||
COPYDATASTRUCT myCDS;
|
||||
myCDS.dwData = CCLOG_STRING_TAG;
|
||||
myCDS.cbData = (DWORD)strlen(log) + 1;
|
||||
myCDS.lpData = (PVOID)log;
|
||||
if (Director::getInstance()->getOpenGLView())
|
||||
{
|
||||
HWND hwnd = Director::getInstance()->getOpenGLView()->getWin32Window();
|
||||
SendMessage(hwnd,
|
||||
WM_COPYDATA,
|
||||
(WPARAM)(HWND)hwnd,
|
||||
(LPARAM)(LPVOID)&myCDS);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Free functions to log
|
||||
|
@ -222,6 +242,7 @@ static void _log(const char *format, va_list args)
|
|||
OutputDebugStringW(wszBuf);
|
||||
WideCharToMultiByte(CP_ACP, 0, wszBuf, -1, buf, sizeof(buf), nullptr, FALSE);
|
||||
printf("%s", buf);
|
||||
SendLogToWindow(buf);
|
||||
fflush(stdout);
|
||||
#else
|
||||
// Linux, Mac, iOS, etc
|
||||
|
@ -259,6 +280,7 @@ Console::Console()
|
|||
, _running(false)
|
||||
, _endThread(false)
|
||||
, _sendDebugStrings(false)
|
||||
, _bindAddress("")
|
||||
{
|
||||
// VS2012 doesn't support initializer list, so we create a new array and assign its elements to '_command'.
|
||||
Command commands[] = {
|
||||
|
@ -345,6 +367,22 @@ bool Console::listenOnTCP(int port)
|
|||
continue; /* error, try next one */
|
||||
|
||||
setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on));
|
||||
|
||||
// bind address
|
||||
if (_bindAddress.length() > 0)
|
||||
{
|
||||
if (res->ai_family == AF_INET)
|
||||
{
|
||||
struct sockaddr_in *sin = (struct sockaddr_in*) res->ai_addr;
|
||||
inet_pton(res->ai_family, _bindAddress.c_str(), (void*)&sin->sin_addr);
|
||||
}
|
||||
else if (res->ai_family == AF_INET6)
|
||||
{
|
||||
struct sockaddr_in6 *sin = (struct sockaddr_in6*) res->ai_addr;
|
||||
inet_pton(res->ai_family, _bindAddress.c_str(), (void*)&sin->sin6_addr);
|
||||
}
|
||||
}
|
||||
|
||||
if (bind(listenfd, res->ai_addr, res->ai_addrlen) == 0)
|
||||
break; /* success */
|
||||
|
||||
|
@ -1140,6 +1178,9 @@ void Console::loop()
|
|||
_running = false;
|
||||
}
|
||||
|
||||
|
||||
void Console::setBindAddress(const std::string &address)
|
||||
{
|
||||
_bindAddress = address;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -51,7 +51,6 @@ typedef SSIZE_T ssize_t;
|
|||
#include "base/ccMacros.h"
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/// The max length of CCLog message.
|
||||
|
@ -101,6 +100,13 @@ public:
|
|||
void addCommand(const Command& cmd);
|
||||
/** log something in the console */
|
||||
void log(const char *buf);
|
||||
|
||||
/**
|
||||
* set bind address
|
||||
*
|
||||
* @address : 127.0.0.1
|
||||
*/
|
||||
void setBindAddress(const std::string &address);
|
||||
|
||||
protected:
|
||||
void loop();
|
||||
|
@ -144,6 +150,8 @@ protected:
|
|||
std::vector<std::string> _DebugStrings;
|
||||
|
||||
intptr_t _touchId;
|
||||
|
||||
std::string _bindAddress;
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Console);
|
||||
};
|
||||
|
|
|
@ -61,6 +61,10 @@ THE SOFTWARE.
|
|||
#include "platform/CCApplication.h"
|
||||
//#include "platform/CCGLViewImpl.h"
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
#include "CCScriptSupport.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
Position of the FPS
|
||||
|
||||
|
@ -120,12 +124,16 @@ bool Director::init(void)
|
|||
_FPSLabel = _drawnBatchesLabel = _drawnVerticesLabel = nullptr;
|
||||
_totalFrames = 0;
|
||||
_lastUpdate = new struct timeval;
|
||||
_secondsPerFrame = 1.0f;
|
||||
|
||||
// paused ?
|
||||
_paused = false;
|
||||
|
||||
// purge ?
|
||||
_purgeDirectorInNextLoop = false;
|
||||
|
||||
// restart ?
|
||||
_restartDirectorInNextLoop = false;
|
||||
|
||||
_winSizeInPoints = Size::ZERO;
|
||||
|
||||
|
@ -940,17 +948,22 @@ void Director::end()
|
|||
_purgeDirectorInNextLoop = true;
|
||||
}
|
||||
|
||||
void Director::purgeDirector()
|
||||
void Director::restart()
|
||||
{
|
||||
_restartDirectorInNextLoop = true;
|
||||
}
|
||||
|
||||
void Director::reset()
|
||||
{
|
||||
// cleanup scheduler
|
||||
getScheduler()->unscheduleAll();
|
||||
|
||||
// Disable event dispatching
|
||||
// Remove all events
|
||||
if (_eventDispatcher)
|
||||
{
|
||||
_eventDispatcher->setEnabled(false);
|
||||
_eventDispatcher->removeAllEventListeners();
|
||||
}
|
||||
|
||||
|
||||
if (_runningScene)
|
||||
{
|
||||
_runningScene->onExit();
|
||||
|
@ -960,22 +973,22 @@ void Director::purgeDirector()
|
|||
|
||||
_runningScene = nullptr;
|
||||
_nextScene = nullptr;
|
||||
|
||||
|
||||
// remove all objects, but don't release it.
|
||||
// runWithScene might be executed after 'end'.
|
||||
_scenesStack.clear();
|
||||
|
||||
|
||||
stopAnimation();
|
||||
|
||||
|
||||
CC_SAFE_RELEASE_NULL(_FPSLabel);
|
||||
CC_SAFE_RELEASE_NULL(_drawnBatchesLabel);
|
||||
CC_SAFE_RELEASE_NULL(_drawnVerticesLabel);
|
||||
|
||||
|
||||
// purge bitmap cache
|
||||
FontFNT::purgeCachedData();
|
||||
|
||||
|
||||
FontFreeType::shutdownFreeType();
|
||||
|
||||
|
||||
// purge all managed caches
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
|
||||
|
@ -996,13 +1009,18 @@ void Director::purgeDirector()
|
|||
GLProgramStateCache::destroyInstance();
|
||||
FileUtils::destroyInstance();
|
||||
AsyncTaskPool::destoryInstance();
|
||||
|
||||
|
||||
// cocos2d-x specific data structures
|
||||
UserDefault::destroyInstance();
|
||||
|
||||
GL::invalidateStateCache();
|
||||
|
||||
destroyTextureCache();
|
||||
}
|
||||
|
||||
void Director::purgeDirector()
|
||||
{
|
||||
reset();
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
|
@ -1017,6 +1035,23 @@ void Director::purgeDirector()
|
|||
release();
|
||||
}
|
||||
|
||||
void Director::restartDirector()
|
||||
{
|
||||
reset();
|
||||
|
||||
// Texture cache need to be reinitialized
|
||||
initTextureCache();
|
||||
|
||||
// release the objects
|
||||
PoolManager::getInstance()->getCurrentPool()->clear();
|
||||
|
||||
// Real restart in script level
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
ScriptEvent scriptEvent(kRestartGame, NULL);
|
||||
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Director::setNextScene()
|
||||
{
|
||||
bool runningIsTransition = dynamic_cast<TransitionScene*>(_runningScene) != nullptr;
|
||||
|
@ -1304,6 +1339,11 @@ void DisplayLinkDirector::mainLoop()
|
|||
_purgeDirectorInNextLoop = false;
|
||||
purgeDirector();
|
||||
}
|
||||
else if (_restartDirectorInNextLoop)
|
||||
{
|
||||
_restartDirectorInNextLoop = false;
|
||||
restartDirector();
|
||||
}
|
||||
else if (! _invalid)
|
||||
{
|
||||
drawScene();
|
||||
|
|
|
@ -287,6 +287,10 @@ public:
|
|||
The "delta time" will be 0 (as if the game wasn't paused)
|
||||
*/
|
||||
void resume();
|
||||
|
||||
/** Restart the director
|
||||
*/
|
||||
void restart();
|
||||
|
||||
/** Stops the animation. Nothing will be drawn. The main loop won't be triggered anymore.
|
||||
If you don't want to pause your animation call [pause] instead.
|
||||
|
@ -396,9 +400,14 @@ public:
|
|||
void resetMatrixStack();
|
||||
|
||||
protected:
|
||||
void reset();
|
||||
|
||||
void purgeDirector();
|
||||
bool _purgeDirectorInNextLoop; // this flag will be set to true in end()
|
||||
|
||||
void restartDirector();
|
||||
bool _restartDirectorInNextLoop; // this flag will be set to true in restart()
|
||||
|
||||
void setNextScene();
|
||||
|
||||
void showStats();
|
||||
|
|
|
@ -211,7 +211,8 @@ enum ScriptEventType
|
|||
kAccelerometerEvent,
|
||||
kControlEvent,
|
||||
kCommonEvent,
|
||||
kComponentEvent
|
||||
kComponentEvent,
|
||||
kRestartGame
|
||||
};
|
||||
|
||||
struct BasicScriptData
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -283,6 +283,8 @@ THE SOFTWARE.
|
|||
#include "3d/CCMeshVertexIndexData.h"
|
||||
#include "3d/CCSkeleton3D.h"
|
||||
#include "3d/CCBillBoard.h"
|
||||
#include "3d/CCFrustum.h"
|
||||
#include "3d/CCPlane.h"
|
||||
|
||||
// Deprecated include
|
||||
#include "deprecated/CCDictionary.h"
|
||||
|
|
|
@ -91,6 +91,18 @@ bool ActionTimeline::init()
|
|||
return true;
|
||||
}
|
||||
|
||||
void ActionTimeline::play(std::string name, bool loop)
|
||||
{
|
||||
if(_indexes.find(name) == _indexes.end())
|
||||
{
|
||||
CCLOG("Cann't find action indexes for %s.", name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
ActionIndexes& indexes = _indexes[name];
|
||||
gotoFrameAndPlay(indexes.startIndex, indexes.endIndex, loop);
|
||||
}
|
||||
|
||||
void ActionTimeline::gotoFrameAndPlay(int startIndex)
|
||||
{
|
||||
gotoFrameAndPlay(startIndex, true);
|
||||
|
@ -266,6 +278,28 @@ void ActionTimeline::removeTimeline(Timeline* timeline)
|
|||
}
|
||||
}
|
||||
|
||||
void ActionTimeline::addIndexes(const ActionIndexes& indexes)
|
||||
{
|
||||
if(_indexes.find(indexes.name) != _indexes.end())
|
||||
{
|
||||
CCLOG("ActionIndexes (%s) already exsists.", indexes.name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
_indexes[indexes.name] = indexes;
|
||||
}
|
||||
|
||||
void ActionTimeline::removeIndexes(std::string name)
|
||||
{
|
||||
if(_indexes.find(name) == _indexes.end())
|
||||
{
|
||||
CCLOG("ActionIndexes %s don't exsists.", name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
_indexes.erase(name);
|
||||
}
|
||||
|
||||
void ActionTimeline::setFrameEventCallFunc(std::function<void(Frame *)> listener)
|
||||
{
|
||||
_frameEventListener = listener;
|
||||
|
|
|
@ -31,6 +31,13 @@ THE SOFTWARE.
|
|||
|
||||
NS_TIMELINE_BEGIN
|
||||
|
||||
struct ActionIndexes
|
||||
{
|
||||
std::string name;
|
||||
int startIndex;
|
||||
int endIndex;
|
||||
};
|
||||
|
||||
class CC_STUDIO_DLL ActionTimelineData : public cocos2d::Ref
|
||||
{
|
||||
public:
|
||||
|
@ -57,6 +64,8 @@ public:
|
|||
virtual ~ActionTimeline();
|
||||
|
||||
virtual bool init();
|
||||
|
||||
virtual void play(std::string name, bool loop);
|
||||
|
||||
/** Goto the specified frame index, and start playing from this index.
|
||||
* @param startIndex The animation will play from this index.
|
||||
|
@ -88,6 +97,7 @@ public:
|
|||
* @param startIndex The animation will pause at this index.
|
||||
*/
|
||||
virtual void gotoFrameAndPause(int startIndex);
|
||||
|
||||
|
||||
/** Pause the animation. */
|
||||
virtual void pause();
|
||||
|
@ -122,7 +132,11 @@ public:
|
|||
/** add Timeline to ActionTimeline */
|
||||
virtual void addTimeline(Timeline* timeline);
|
||||
virtual void removeTimeline(Timeline* timeline);
|
||||
|
||||
|
||||
/** add ActionIndexes */
|
||||
virtual void addIndexes(const ActionIndexes& indexes);
|
||||
virtual void removeIndexes(std::string name);
|
||||
|
||||
virtual const cocos2d::Vector<Timeline*>& getTimelines() const { return _timelineList; }
|
||||
|
||||
/** Set ActionTimeline's frame event callback function */
|
||||
|
@ -168,6 +182,7 @@ protected:
|
|||
|
||||
std::function<void(Frame*)> _frameEventListener;
|
||||
std::function<void()> _lastFrameListener;
|
||||
std::map<std::string, ActionIndexes> _indexes;
|
||||
};
|
||||
|
||||
NS_TIMELINE_END
|
||||
|
|
|
@ -439,6 +439,7 @@ ActionTimeline* ActionTimelineCache::loadAnimationActionWithFlatBuffersFile(cons
|
|||
float speed = nodeAction->speed();
|
||||
action->setTimeSpeed(speed);
|
||||
|
||||
|
||||
auto timelines = nodeAction->timeLines();
|
||||
int timelineLength = timelines->size();
|
||||
for (int i = 0; i < timelineLength; i++)
|
||||
|
|
|
@ -181,6 +181,7 @@ CSLoader::CSLoader()
|
|||
, _jsonPath("")
|
||||
, _monoCocos2dxVersion("")
|
||||
, _rootNode(nullptr)
|
||||
, _csBuildID("2.0.8.0")
|
||||
{
|
||||
CREATE_CLASS_NODE_READER_INFO(NodeReader);
|
||||
CREATE_CLASS_NODE_READER_INFO(SingleNodeReader);
|
||||
|
@ -782,6 +783,21 @@ Node* CSLoader::nodeWithFlatBuffersFile(const std::string &fileName)
|
|||
Data buf = FileUtils::getInstance()->getDataFromFile(fullPath);
|
||||
|
||||
auto csparsebinary = GetCSParseBinary(buf.getBytes());
|
||||
|
||||
auto csBuildId = csparsebinary->version();
|
||||
if (csBuildId)
|
||||
{
|
||||
CCASSERT(strcmp(_csBuildID.c_str(), csBuildId->c_str()) == 0,
|
||||
String::createWithFormat("%s%s%s%s%s%s%s%s",
|
||||
"The build id of your CocosStudio exported file(",
|
||||
csBuildId->c_str(),
|
||||
") and the build id of your cocos reader(",
|
||||
_csBuildID.c_str(),
|
||||
") are not match.\n",
|
||||
"Please get the correct cocos reader from ",
|
||||
"https://github.com/chukong/cocos-reader",
|
||||
" and replace the reader in your Cocos2d-x")->getCString());
|
||||
}
|
||||
|
||||
// decode plist
|
||||
auto textures = csparsebinary->textures();
|
||||
|
@ -791,9 +807,6 @@ Node* CSLoader::nodeWithFlatBuffersFile(const std::string &fileName)
|
|||
{
|
||||
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(textures->Get(i)->c_str());
|
||||
}
|
||||
|
||||
auto v = csparsebinary->version();
|
||||
if (v) _csdVersion = v->c_str();
|
||||
|
||||
Node* node = nodeWithFlatBuffers(csparsebinary->nodeTree());
|
||||
|
||||
|
@ -1137,9 +1150,6 @@ Node* CSLoader::createNodeWithFlatBuffersForSimulator(const std::string& filenam
|
|||
|
||||
auto nodeTree = csparsebinary->nodeTree();
|
||||
|
||||
auto v = csparsebinary->version();
|
||||
if (v) _csdVersion = v->c_str();
|
||||
|
||||
Node* node = nodeWithFlatBuffersForSimulator(nodeTree);
|
||||
|
||||
_rootNode = nullptr;
|
||||
|
|
|
@ -104,7 +104,6 @@ public:
|
|||
|
||||
cocos2d::Node* createNodeWithFlatBuffersForSimulator(const std::string& filename);
|
||||
cocos2d::Node* nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree* nodetree);
|
||||
std::string getCsdVersion() { return _csdVersion; }
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -151,8 +150,7 @@ protected:
|
|||
std::string _monoCocos2dxVersion;
|
||||
|
||||
Node* _rootNode;
|
||||
// std::vector<Node*> _loadingNodeParentHierarchy;
|
||||
std::string _csdVersion;
|
||||
std::string _csBuildID;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -1218,19 +1218,19 @@ Offset<ProjectNodeOptions> FlatBuffersSerialize::createProjectNodeOptionsForSimu
|
|||
|
||||
if (name == "FileData")
|
||||
{
|
||||
const tinyxml2::XMLAttribute* attribute = child->FirstAttribute();
|
||||
const tinyxml2::XMLAttribute* attributeFileData = child->FirstAttribute();
|
||||
|
||||
while (attribute)
|
||||
while (attributeFileData)
|
||||
{
|
||||
name = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
name = attributeFileData->Name();
|
||||
std::string value = attributeFileData->Value();
|
||||
|
||||
if (name == "Path")
|
||||
{
|
||||
filename = value;
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
attributeFileData = attributeFileData->Next();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,17 +115,25 @@ void ArmatureNodeReader::setPropsWithFlatBuffers(cocos2d::Node *node,
|
|||
const flatbuffers::Table *nodeOptions)
|
||||
{
|
||||
|
||||
auto* custom = static_cast<CCArmature*>(node);
|
||||
auto options = (flatbuffers::CSArmatureNodeOption*)nodeOptions;
|
||||
auto reader = ArmatureNodeReader::getInstance();
|
||||
auto* custom = static_cast<Armature*>(node);
|
||||
auto options = (flatbuffers::CSArmatureNodeOption*)nodeOptions;
|
||||
|
||||
std::string filepath(options->fileData()->path()->c_str());
|
||||
ArmatureDataManager::getInstance()->addArmatureFileInfo(FileUtils::getInstance()->fullPathForFilename(filepath));
|
||||
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(filepath);
|
||||
|
||||
std::string dirpath = fullpath.substr(0, fullpath.find_last_of("/"));
|
||||
FileUtils::getInstance()->addSearchPath(dirpath);
|
||||
|
||||
ArmatureDataManager::getInstance()->addArmatureFileInfo(fullpath);
|
||||
custom->init(getArmatureName(filepath));
|
||||
std::string currentname = options->currentAnimationName()->c_str();
|
||||
if (options->isAutoPlay())
|
||||
custom->getAnimation()->play(options->currentAnimationName()->c_str(), -1, options->isLoop());
|
||||
custom->getAnimation()->play(currentname, -1, options->isLoop());
|
||||
else
|
||||
custom->getAnimation()->setIsPlaying(false);
|
||||
{
|
||||
custom->getAnimation()->play(currentname);
|
||||
custom->getAnimation()->gotoAndPause(0);
|
||||
}
|
||||
}
|
||||
|
||||
cocos2d::Node* ArmatureNodeReader::createNodeWithFlatBuffers(const flatbuffers::Table *nodeOptions)
|
||||
|
@ -148,9 +156,9 @@ cocos2d::Node* ArmatureNodeReader::createNodeWithFlatBuffers(const flatbuffers:
|
|||
std::string ArmatureNodeReader::getArmatureName(const std::string& exporJsonPath)
|
||||
{
|
||||
//FileUtils.getFileData(exporJsonPath, "r", size) // need read armature name in exportJsonPath
|
||||
int end = exporJsonPath.find_last_of(".");
|
||||
int start = exporJsonPath.find_last_of("\\") + 1;
|
||||
int start1 = exporJsonPath.find_last_of("/") + 1;
|
||||
size_t end = exporJsonPath.find_last_of(".");
|
||||
size_t start = exporJsonPath.find_last_of("\\") + 1;
|
||||
size_t start1 = exporJsonPath.find_last_of("/") + 1;
|
||||
if (start < start1)
|
||||
start = start1;
|
||||
|
||||
|
|
|
@ -776,12 +776,20 @@ namespace cocostudio
|
|||
}
|
||||
|
||||
int CheckBoxReader::getResourceType(std::string key)
|
||||
{
|
||||
if(key == "Normal" || key == "Default" || key == "MarkedSubImage")
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
{
|
||||
if(key == "Normal" || key == "Default")
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance();
|
||||
if(fbs->_isSimulator)
|
||||
{
|
||||
if(key == "MarkedSubImage")
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,11 +185,11 @@ namespace cocostudio
|
|||
|
||||
if (name == "InnerNodeSize")
|
||||
{
|
||||
auto attribute = child->FirstAttribute();
|
||||
while (attribute)
|
||||
auto attributeInnerNodeSize = child->FirstAttribute();
|
||||
while (attributeInnerNodeSize)
|
||||
{
|
||||
name = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
name = attributeInnerNodeSize->Name();
|
||||
std::string value = attributeInnerNodeSize->Value();
|
||||
|
||||
if (name == "Width")
|
||||
{
|
||||
|
@ -200,17 +200,17 @@ namespace cocostudio
|
|||
innerSize.height = atof(value.c_str());
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
attributeInnerNodeSize = attributeInnerNodeSize->Next();
|
||||
}
|
||||
}
|
||||
else if (name == "Size" && backGroundScale9Enabled)
|
||||
{
|
||||
auto attribute = child->FirstAttribute();
|
||||
auto attributeSize = child->FirstAttribute();
|
||||
|
||||
while (attribute)
|
||||
while (attributeSize)
|
||||
{
|
||||
name = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
name = attributeSize->Name();
|
||||
std::string value = attributeSize->Value();
|
||||
|
||||
if (name == "X")
|
||||
{
|
||||
|
@ -221,17 +221,17 @@ namespace cocostudio
|
|||
scale9Size.height = atof(value.c_str());
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
attributeSize = attributeSize->Next();
|
||||
}
|
||||
}
|
||||
else if (name == "SingleColor")
|
||||
{
|
||||
auto attribute = child->FirstAttribute();
|
||||
auto attributeSingleColor = child->FirstAttribute();
|
||||
|
||||
while (attribute)
|
||||
while (attributeSingleColor)
|
||||
{
|
||||
name = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
name = attributeSingleColor->Name();
|
||||
std::string value = attributeSingleColor->Value();
|
||||
|
||||
if (name == "R")
|
||||
{
|
||||
|
@ -246,17 +246,17 @@ namespace cocostudio
|
|||
bgColor.b = atoi(value.c_str());
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
attributeSingleColor = attributeSingleColor->Next();
|
||||
}
|
||||
}
|
||||
else if (name == "EndColor")
|
||||
{
|
||||
auto attribute = child->FirstAttribute();
|
||||
auto attributeEndColor = child->FirstAttribute();
|
||||
|
||||
while (attribute)
|
||||
while (attributeEndColor)
|
||||
{
|
||||
name = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
name = attributeEndColor->Name();
|
||||
std::string value = attributeEndColor->Value();
|
||||
|
||||
if (name == "R")
|
||||
{
|
||||
|
@ -271,17 +271,17 @@ namespace cocostudio
|
|||
bgEndColor.b = atoi(value.c_str());
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
attributeEndColor = attributeEndColor->Next();
|
||||
}
|
||||
}
|
||||
else if (name == "FirstColor")
|
||||
{
|
||||
auto attribute = child->FirstAttribute();
|
||||
auto attributeFirstColor = child->FirstAttribute();
|
||||
|
||||
while (attribute)
|
||||
while (attributeFirstColor)
|
||||
{
|
||||
name = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
name = attributeFirstColor->Name();
|
||||
std::string value = attributeFirstColor->Value();
|
||||
|
||||
if (name == "R")
|
||||
{
|
||||
|
@ -296,16 +296,16 @@ namespace cocostudio
|
|||
bgStartColor.b = atoi(value.c_str());
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
attributeFirstColor = attributeFirstColor->Next();
|
||||
}
|
||||
}
|
||||
else if (name == "ColorVector")
|
||||
{
|
||||
auto attribute = child->FirstAttribute();
|
||||
while (attribute)
|
||||
auto attributeColorVector = child->FirstAttribute();
|
||||
while (attributeColorVector)
|
||||
{
|
||||
name = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
name = attributeColorVector->Name();
|
||||
std::string value = attributeColorVector->Value();
|
||||
|
||||
if (name == "ScaleX")
|
||||
{
|
||||
|
@ -316,7 +316,7 @@ namespace cocostudio
|
|||
colorVector.y = atof(value.c_str());
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
attributeColorVector = attributeColorVector->Next();
|
||||
}
|
||||
}
|
||||
else if (name == "FileData")
|
||||
|
@ -324,12 +324,12 @@ namespace cocostudio
|
|||
std::string texture;
|
||||
std::string texturePng;
|
||||
|
||||
auto attribute = child->FirstAttribute();
|
||||
auto attributeFileData = child->FirstAttribute();
|
||||
|
||||
while (attribute)
|
||||
while (attributeFileData)
|
||||
{
|
||||
name = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
name = attributeFileData->Name();
|
||||
std::string value = attributeFileData->Value();
|
||||
|
||||
if (name == "Path")
|
||||
{
|
||||
|
@ -345,7 +345,7 @@ namespace cocostudio
|
|||
texture = value;
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
attributeFileData = attributeFileData->Next();
|
||||
}
|
||||
|
||||
if (resourceType == 1)
|
||||
|
|
|
@ -519,6 +519,8 @@ namespace cocostudio
|
|||
auto layoutComponentTable = ((WidgetOptions*)nodeOptions)->layoutComponent();
|
||||
if (!layoutComponentTable) return;
|
||||
|
||||
auto layoutComponent = ui::LayoutComponent::bindLayoutComponent(node);
|
||||
|
||||
bool positionXPercentEnabled = layoutComponentTable->positionXPercentEnabled();
|
||||
bool positionYPercentEnabled = layoutComponentTable->positionYPercentEnabled();
|
||||
float positionXPercent = layoutComponentTable->positionXPercent();
|
||||
|
@ -536,9 +538,6 @@ namespace cocostudio
|
|||
float topMargin = layoutComponentTable->topMargin();
|
||||
float bottomMargin = layoutComponentTable->bottomMargin();
|
||||
|
||||
auto layoutComponent = ui::LayoutComponent::create();
|
||||
node->addComponent(layoutComponent);
|
||||
|
||||
layoutComponent->setPositionPercentXEnabled(positionXPercentEnabled);
|
||||
layoutComponent->setPositionPercentYEnabled(positionYPercentEnabled);
|
||||
layoutComponent->setPositionPercentX(positionXPercent);
|
||||
|
|
|
@ -98,12 +98,12 @@ namespace cocostudio
|
|||
|
||||
if (name == "FileData")
|
||||
{
|
||||
const tinyxml2::XMLAttribute* attribute = child->FirstAttribute();
|
||||
const tinyxml2::XMLAttribute* attributeFileData = child->FirstAttribute();
|
||||
|
||||
while (attribute)
|
||||
while (attributeFileData)
|
||||
{
|
||||
name = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
name = attributeFileData->Name();
|
||||
std::string value = attributeFileData->Value();
|
||||
|
||||
if (name == "Path")
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ namespace cocostudio
|
|||
filename = convert;
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
attributeFileData = attributeFileData->Next();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,8 +106,13 @@ namespace cocostudio
|
|||
|
||||
textField->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize,20));
|
||||
|
||||
|
||||
textField->setFontName(DICTOOL->getStringValue_json(options, P_FontName, ""));
|
||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
||||
std::string fontName = DICTOOL->getStringValue_json(options, P_FontName, "");
|
||||
std::string fontFilePath = jsonPath.append(fontName);
|
||||
if (FileUtils::getInstance()->isFileExist(fontFilePath))
|
||||
textField->setFontName(fontFilePath);
|
||||
else
|
||||
textField->setFontName(fontName);
|
||||
|
||||
bool tsw = DICTOOL->checkObjectExist_json(options, P_TouchSizeWidth);
|
||||
bool tsh = DICTOOL->checkObjectExist_json(options, P_TouchSizeHeight);
|
||||
|
|
|
@ -771,44 +771,11 @@ namespace cocostudio
|
|||
widget->setCascadeOpacityEnabled(true);
|
||||
widget->setAnchorPoint(Vec2::ZERO);
|
||||
|
||||
widget->setUnifySizeEnabled(true);
|
||||
std::string versionString = CSLoader::getInstance()->getCsdVersion();
|
||||
|
||||
//assume versionString is like "2.0.6.0"
|
||||
if (versionString.length() > 0)
|
||||
{
|
||||
int p1, p2, p3, v1, v2, v3;
|
||||
p1 = p2 = p3 = v1 = v2 = v3 = 0;
|
||||
p1 = versionString.find('.');
|
||||
if (p1 > 0)
|
||||
{
|
||||
p2 = versionString.find('.', p1 + 1);
|
||||
v1 = atoi(versionString.substr(0, p1).c_str());
|
||||
}
|
||||
if (p2 > p1)
|
||||
{
|
||||
p3 = versionString.find('.', p2 + 1);
|
||||
v2 = atoi(versionString.substr(p1 + 1, p2 - p1 - 1).c_str());
|
||||
}
|
||||
if (p3 > p2)
|
||||
{
|
||||
v3 = atoi(versionString.substr(p2 + 1, p3 - p2 - 1).c_str());
|
||||
}
|
||||
|
||||
if (!(v1 <= 2 && v2 == 0 && v3 <= 6))
|
||||
{
|
||||
widget->setUnifySizeEnabled(false);
|
||||
widget->setLayoutComponentEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
bool ignoreSize = options->ignoreSize();
|
||||
widget->ignoreContentAdaptWithSize(ignoreSize);
|
||||
|
||||
/*
|
||||
widget->setUnifySizeEnabled(false);
|
||||
widget->setLayoutComponentEnabled(true);
|
||||
widget->ignoreContentAdaptWithSize(false);
|
||||
Size contentSize(options->size()->width(), options->size()->height());
|
||||
widget->setContentSize(contentSize);
|
||||
*/
|
||||
|
||||
int tag = options->tag();
|
||||
widget->setTag(tag);
|
||||
|
@ -871,6 +838,8 @@ namespace cocostudio
|
|||
auto layoutComponentTable = ((WidgetOptions*)nodeOptions)->layoutComponent();
|
||||
if (!layoutComponentTable) return;
|
||||
|
||||
auto layoutComponent = ui::LayoutComponent::bindLayoutComponent(node);
|
||||
|
||||
bool positionXPercentEnabled = layoutComponentTable->positionXPercentEnabled();
|
||||
bool positionYPercentEnabled = layoutComponentTable->positionYPercentEnabled();
|
||||
float positionXPercent = layoutComponentTable->positionXPercent();
|
||||
|
@ -888,9 +857,6 @@ namespace cocostudio
|
|||
float topMargin = layoutComponentTable->topMargin();
|
||||
float bottomMargin = layoutComponentTable->bottomMargin();
|
||||
|
||||
auto layoutComponent = ui::LayoutComponent::create();
|
||||
node->addComponent(layoutComponent);
|
||||
|
||||
layoutComponent->setPositionPercentXEnabled(positionXPercentEnabled);
|
||||
layoutComponent->setPositionPercentYEnabled(positionYPercentEnabled);
|
||||
layoutComponent->setPositionPercentX(positionXPercent);
|
||||
|
|
|
@ -64,7 +64,9 @@ enum class LanguageType
|
|||
PORTUGUESE,
|
||||
ARABIC,
|
||||
NORWEGIAN,
|
||||
POLISH
|
||||
POLISH,
|
||||
TURKISH,
|
||||
UKRAINIAN
|
||||
};
|
||||
|
||||
// END of platform group
|
||||
|
|
|
@ -513,7 +513,16 @@ void FileUtils::destroyInstance()
|
|||
CC_SAFE_DELETE(s_sharedFileUtils);
|
||||
}
|
||||
|
||||
void FileUtils::setDelegate(FileUtils *delegate)
|
||||
{
|
||||
if (s_sharedFileUtils)
|
||||
delete s_sharedFileUtils;
|
||||
|
||||
s_sharedFileUtils = delegate;
|
||||
}
|
||||
|
||||
FileUtils::FileUtils()
|
||||
: _writablePath("")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -521,6 +530,8 @@ FileUtils::~FileUtils()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool FileUtils::init()
|
||||
{
|
||||
_searchPathArray.push_back(_defaultResRootPath);
|
||||
|
@ -828,6 +839,16 @@ const std::vector<std::string>& FileUtils::getSearchPaths() const
|
|||
return _searchPathArray;
|
||||
}
|
||||
|
||||
void FileUtils::setWritablePath(const std::string& writablePath)
|
||||
{
|
||||
_writablePath = writablePath;
|
||||
}
|
||||
|
||||
void FileUtils::setDefaultResourceRootPath(const std::string& path)
|
||||
{
|
||||
_defaultResRootPath = path;
|
||||
}
|
||||
|
||||
void FileUtils::setSearchPaths(const std::vector<std::string>& searchPaths)
|
||||
{
|
||||
bool existDefaultRootPath = false;
|
||||
|
|
|
@ -54,6 +54,20 @@ public:
|
|||
* Destroys the instance of FileUtils.
|
||||
*/
|
||||
static void destroyInstance();
|
||||
|
||||
/**
|
||||
* You can inherit from platform dependent implementation of FileUtils, such as FileUtilsAndroid,
|
||||
* and use this function to set delegate, then FileUtils will invoke delegate's implementation.
|
||||
* Fox example, your resources are encrypted, so you need to decrypt it after reading data from
|
||||
* resources, then you can implement all getXXX functions, and engine will invoke your own getXX
|
||||
* functions when reading data of resources.
|
||||
*
|
||||
* If you don't want to system default implementation after setting delegate, you can just pass nullptr
|
||||
* to this function.
|
||||
*
|
||||
* @warm It will delete previous delegate
|
||||
*/
|
||||
static void setDelegate(FileUtils *delegate);
|
||||
|
||||
/** @deprecated Use getInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static FileUtils* sharedFileUtils() { return getInstance(); }
|
||||
|
@ -261,6 +275,11 @@ public:
|
|||
*/
|
||||
virtual void setSearchPaths(const std::vector<std::string>& searchPaths);
|
||||
|
||||
/**
|
||||
* Set default resource root path.
|
||||
*/
|
||||
void setDefaultResourceRootPath(const std::string& path);
|
||||
|
||||
/**
|
||||
* Add search path.
|
||||
*
|
||||
|
@ -283,6 +302,11 @@ public:
|
|||
*/
|
||||
virtual std::string getWritablePath() const = 0;
|
||||
|
||||
/**
|
||||
* Set writable/cache path.
|
||||
*/
|
||||
virtual void setWritablePath(const std::string& writablePath);
|
||||
|
||||
/**
|
||||
* Sets/Gets whether to pop-up a message box when failed to load an image.
|
||||
*/
|
||||
|
@ -495,6 +519,11 @@ protected:
|
|||
*/
|
||||
std::unordered_map<std::string, std::string> _fullPathCache;
|
||||
|
||||
/**
|
||||
* Writable path.
|
||||
*/
|
||||
std::string _writablePath;
|
||||
|
||||
/**
|
||||
* The singleton pointer of FileUtils.
|
||||
*/
|
||||
|
|
|
@ -31,7 +31,6 @@ Copyright (c) 2013-2014 Chukong Technologies
|
|||
#include "base/ccConfig.h"
|
||||
#include "platform/CCPlatformConfig.h"
|
||||
#include "platform/CCPlatformDefine.h"
|
||||
#include <new>
|
||||
|
||||
/**
|
||||
* define a create function for a specific type, such as Layer
|
||||
|
|
|
@ -115,7 +115,7 @@ LanguageType Application::getCurrentLanguage()
|
|||
std::string languageName = getCurrentLanguageJNI();
|
||||
const char* pLanguageName = languageName.c_str();
|
||||
LanguageType ret = LanguageType::ENGLISH;
|
||||
|
||||
|
||||
if (0 == strcmp("zh", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::CHINESE;
|
||||
|
@ -176,6 +176,14 @@ LanguageType Application::getCurrentLanguage()
|
|||
{
|
||||
ret = LanguageType::POLISH;
|
||||
}
|
||||
else if (0 == strcmp("tr", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::TURKISH;
|
||||
}
|
||||
else if (0 == strcmp("uk", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::UKRAINIAN;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,11 +99,11 @@ LanguageType Application::getCurrentLanguage()
|
|||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
|
||||
NSString *currentLanguage = [languages objectAtIndex:0];
|
||||
|
||||
|
||||
// get the current language code.(such as English is "en", Chinese is "zh" and so on)
|
||||
NSDictionary* temp = [NSLocale componentsFromLocaleIdentifier:currentLanguage];
|
||||
NSString * languageCode = [temp objectForKey:NSLocaleLanguageCode];
|
||||
|
||||
|
||||
LanguageType ret = LanguageType::ENGLISH;
|
||||
if ([languageCode isEqualToString:@"zh"])
|
||||
{
|
||||
|
@ -152,6 +152,12 @@ LanguageType Application::getCurrentLanguage()
|
|||
else if ([languageCode isEqualToString:@"pl"]){
|
||||
ret = LanguageType::POLISH;
|
||||
}
|
||||
else if ([languageCode isEqualToString:@"tr"]){
|
||||
ret = LanguageType::TURKISH;
|
||||
}
|
||||
else if ([languageCode isEqualToString:@"uk"]){
|
||||
ret = LanguageType::UKRAINIAN;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -173,62 +173,62 @@ const char * Application::getCurrentLanguageCode()
|
|||
|
||||
LanguageType Application::getCurrentLanguage()
|
||||
{
|
||||
char *pLanguageName = getenv("LANG");
|
||||
LanguageType ret = LanguageType::ENGLISH;
|
||||
if (!pLanguageName)
|
||||
{
|
||||
return LanguageType::ENGLISH;
|
||||
}
|
||||
strtok(pLanguageName, "_");
|
||||
if (!pLanguageName)
|
||||
{
|
||||
return LanguageType::ENGLISH;
|
||||
}
|
||||
|
||||
if (0 == strcmp("zh", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::CHINESE;
|
||||
}
|
||||
else if (0 == strcmp("en", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::ENGLISH;
|
||||
}
|
||||
else if (0 == strcmp("fr", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::FRENCH;
|
||||
}
|
||||
else if (0 == strcmp("it", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::ITALIAN;
|
||||
}
|
||||
else if (0 == strcmp("de", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::GERMAN;
|
||||
}
|
||||
else if (0 == strcmp("es", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::SPANISH;
|
||||
}
|
||||
else if (0 == strcmp("nl", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::DUTCH;
|
||||
}
|
||||
else if (0 == strcmp("ru", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::RUSSIAN;
|
||||
}
|
||||
else if (0 == strcmp("ko", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::KOREAN;
|
||||
}
|
||||
else if (0 == strcmp("ja", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::JAPANESE;
|
||||
}
|
||||
else if (0 == strcmp("hu", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::HUNGARIAN;
|
||||
}
|
||||
char *pLanguageName = getenv("LANG");
|
||||
LanguageType ret = LanguageType::ENGLISH;
|
||||
if (!pLanguageName)
|
||||
{
|
||||
return LanguageType::ENGLISH;
|
||||
}
|
||||
strtok(pLanguageName, "_");
|
||||
if (!pLanguageName)
|
||||
{
|
||||
return LanguageType::ENGLISH;
|
||||
}
|
||||
|
||||
if (0 == strcmp("zh", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::CHINESE;
|
||||
}
|
||||
else if (0 == strcmp("en", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::ENGLISH;
|
||||
}
|
||||
else if (0 == strcmp("fr", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::FRENCH;
|
||||
}
|
||||
else if (0 == strcmp("it", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::ITALIAN;
|
||||
}
|
||||
else if (0 == strcmp("de", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::GERMAN;
|
||||
}
|
||||
else if (0 == strcmp("es", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::SPANISH;
|
||||
}
|
||||
else if (0 == strcmp("nl", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::DUTCH;
|
||||
}
|
||||
else if (0 == strcmp("ru", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::RUSSIAN;
|
||||
}
|
||||
else if (0 == strcmp("ko", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::KOREAN;
|
||||
}
|
||||
else if (0 == strcmp("ja", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::JAPANESE;
|
||||
}
|
||||
else if (0 == strcmp("hu", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::HUNGARIAN;
|
||||
}
|
||||
else if (0 == strcmp("pt", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::PORTUGUESE;
|
||||
|
@ -245,6 +245,14 @@ LanguageType Application::getCurrentLanguage()
|
|||
{
|
||||
ret = LanguageType::POLISH;
|
||||
}
|
||||
else if (0 == strcmp("tr", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::TURKISH;
|
||||
}
|
||||
else if (0 == strcmp("uk", pLanguageName))
|
||||
{
|
||||
ret = LanguageType::UKRAINIAN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -155,18 +155,16 @@ LanguageType Application::getCurrentLanguage()
|
|||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
|
||||
NSString *currentLanguage = [languages objectAtIndex:0];
|
||||
|
||||
|
||||
// get the current language code.(such as English is "en", Chinese is "zh" and so on)
|
||||
NSDictionary* temp = [NSLocale componentsFromLocaleIdentifier:currentLanguage];
|
||||
NSString * languageCode = [temp objectForKey:NSLocaleLanguageCode];
|
||||
|
||||
|
||||
LanguageType ret = LanguageType::ENGLISH;
|
||||
if ([languageCode isEqualToString:@"zh"])
|
||||
{
|
||||
if ([languageCode isEqualToString:@"zh"]){
|
||||
ret = LanguageType::CHINESE;
|
||||
}
|
||||
else if ([languageCode isEqualToString:@"en"])
|
||||
{
|
||||
else if ([languageCode isEqualToString:@"en"]){
|
||||
ret = LanguageType::ENGLISH;
|
||||
}
|
||||
else if ([languageCode isEqualToString:@"fr"]){
|
||||
|
@ -196,12 +194,10 @@ LanguageType Application::getCurrentLanguage()
|
|||
else if ([languageCode isEqualToString:@"hu"]){
|
||||
ret = LanguageType::HUNGARIAN;
|
||||
}
|
||||
else if ([languageCode isEqualToString:@"pt"])
|
||||
{
|
||||
else if ([languageCode isEqualToString:@"pt"]){
|
||||
ret = LanguageType::PORTUGUESE;
|
||||
}
|
||||
else if ([languageCode isEqualToString:@"ar"])
|
||||
{
|
||||
else if ([languageCode isEqualToString:@"ar"]){
|
||||
ret = LanguageType::ARABIC;
|
||||
}
|
||||
else if ([languageCode isEqualToString:@"nb"]){
|
||||
|
@ -210,6 +206,12 @@ LanguageType Application::getCurrentLanguage()
|
|||
else if ([languageCode isEqualToString:@"pl"]){
|
||||
ret = LanguageType::POLISH;
|
||||
}
|
||||
else if ([languageCode isEqualToString:@"tr"]){
|
||||
ret = LanguageType::TURKISH;
|
||||
}
|
||||
else if ([languageCode isEqualToString:@"uk"]){
|
||||
ret = LanguageType::UKRAINIAN;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ Application* Application::sharedApplication()
|
|||
LanguageType Application::getCurrentLanguage()
|
||||
{
|
||||
LanguageType ret = LanguageType::ENGLISH;
|
||||
|
||||
|
||||
LCID localeID = GetUserDefaultLCID();
|
||||
unsigned short primaryLanguageID = localeID & 0xFF;
|
||||
|
||||
|
@ -179,14 +179,20 @@ LanguageType Application::getCurrentLanguage()
|
|||
case LANG_ARABIC:
|
||||
ret = LanguageType::ARABIC;
|
||||
break;
|
||||
case LANG_NORWEGIAN:
|
||||
case LANG_NORWEGIAN:
|
||||
ret = LanguageType::NORWEGIAN;
|
||||
break;
|
||||
case LANG_POLISH:
|
||||
case LANG_POLISH:
|
||||
ret = LanguageType::POLISH;
|
||||
break;
|
||||
case LANG_TURKISH:
|
||||
ret = LanguageType::TURKISH;
|
||||
break;
|
||||
case LANG_UKRAINIAN:
|
||||
ret = LanguageType::UKRAINIAN;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -134,9 +134,9 @@ const char * Application::getCurrentLanguageCode()
|
|||
LanguageType Application::getCurrentLanguage()
|
||||
{
|
||||
LanguageType ret = LanguageType::ENGLISH;
|
||||
|
||||
|
||||
const char* code = getCurrentLanguageCode();
|
||||
|
||||
|
||||
if (strncmp(code, "zh", 2) == 0)
|
||||
{
|
||||
ret = LanguageType::CHINESE;
|
||||
|
@ -184,8 +184,23 @@ LanguageType Application::getCurrentLanguage()
|
|||
else if (strncmp(code, "ar", 2) == 0)
|
||||
{
|
||||
ret = LanguageType::ARABIC;
|
||||
}
|
||||
|
||||
}
|
||||
else if (strncmp(code, "nb", 2) == 0)
|
||||
{
|
||||
ret = LanguageType::NORWEGIAN;
|
||||
}
|
||||
else if (strncmp(code, "pl", 2) == 0)
|
||||
{
|
||||
ret = LanguageType::POLISH;
|
||||
}
|
||||
else if (strncmp(code, "tr", 2) == 0)
|
||||
{
|
||||
ret = LanguageType::TURKISH;
|
||||
}
|
||||
else if (strncmp(code, "uk", 2) == 0)
|
||||
{
|
||||
ret = LanguageType::UKRAINIAN;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef HEADER_CURL_INET_NTOP_H
|
||||
#define HEADER_CURL_INET_NTOP_H
|
||||
#ifndef HEADER_CURL_INET_NTOP_WINRT_H
|
||||
#define HEADER_CURL_INET_NTOP_WINRT_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
|
|
|
@ -0,0 +1,234 @@
|
|||
/* This is from the BIND 4.9.4 release, modified to compile by itself */
|
||||
|
||||
/* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* Portions Copyright (c) Microsoft Open Technologies, Inc. */
|
||||
|
||||
/*modifications by Microsoft Open Technologies, Inc. to implement missing inet_pton() from Windows 8 SDK */
|
||||
|
||||
#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
|
||||
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define ERRNO ((int)GetLastError())
|
||||
#define SET_ERRNO(x) (SetLastError((DWORD)(x)))
|
||||
|
||||
#include "inet_pton_winrt.h"
|
||||
|
||||
#define ENABLE_IPV6
|
||||
|
||||
#define IN6ADDRSZ 16
|
||||
#define INADDRSZ 4
|
||||
#define INT16SZ 2
|
||||
|
||||
/*
|
||||
* WARNING: Don't even consider trying to compile this on a system where
|
||||
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
||||
*/
|
||||
|
||||
static int inet_pton4(const char *src, unsigned char *dst);
|
||||
#ifdef ENABLE_IPV6
|
||||
static int inet_pton6(const char *src, unsigned char *dst);
|
||||
#endif
|
||||
|
||||
/* int
|
||||
* inet_pton(af, src, dst)
|
||||
* convert from presentation format (which usually means ASCII printable)
|
||||
* to network format (which is usually some kind of binary format).
|
||||
* return:
|
||||
* 1 if the address was valid for the specified address family
|
||||
* 0 if the address wasn't valid (`dst' is untouched in this case)
|
||||
* -1 if some other error occurred (`dst' is untouched in this case, too)
|
||||
* notice:
|
||||
* On Windows we store the error in the thread errno, not
|
||||
* in the winsock error code. This is to avoid losing the
|
||||
* actual last winsock error. So use macro ERRNO to fetch the
|
||||
* errno this function sets when returning (-1), not SOCKERRNO.
|
||||
* author:
|
||||
* Paul Vixie, 1996.
|
||||
*/
|
||||
|
||||
int inet_pton(int af, const char *src, void *dst)
|
||||
{
|
||||
switch (af) {
|
||||
case AF_INET:
|
||||
return (inet_pton4(src, (unsigned char *)dst));
|
||||
#ifdef ENABLE_IPV6
|
||||
case AF_INET6:
|
||||
return (inet_pton6(src, (unsigned char *)dst));
|
||||
#endif
|
||||
default:
|
||||
SET_ERRNO(EAFNOSUPPORT);
|
||||
return (-1);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/* int
|
||||
* inet_pton4(src, dst)
|
||||
* like inet_aton() but without all the hexadecimal and shorthand.
|
||||
* return:
|
||||
* 1 if `src' is a valid dotted quad, else 0.
|
||||
* notice:
|
||||
* does not touch `dst' unless it's returning 1.
|
||||
* author:
|
||||
* Paul Vixie, 1996.
|
||||
*/
|
||||
static int
|
||||
inet_pton4(const char *src, unsigned char *dst)
|
||||
{
|
||||
static const char digits[] = "0123456789";
|
||||
int saw_digit, octets, ch;
|
||||
unsigned char tmp[INADDRSZ], *tp;
|
||||
|
||||
saw_digit = 0;
|
||||
octets = 0;
|
||||
tp = tmp;
|
||||
*tp = 0;
|
||||
while((ch = *src++) != '\0') {
|
||||
const char *pch;
|
||||
|
||||
if((pch = strchr(digits, ch)) != NULL) {
|
||||
unsigned int val = *tp * 10 + (unsigned int)(pch - digits);
|
||||
|
||||
if(saw_digit && *tp == 0)
|
||||
return (0);
|
||||
if(val > 255)
|
||||
return (0);
|
||||
*tp = (unsigned char)val;
|
||||
if(! saw_digit) {
|
||||
if(++octets > 4)
|
||||
return (0);
|
||||
saw_digit = 1;
|
||||
}
|
||||
}
|
||||
else if(ch == '.' && saw_digit) {
|
||||
if(octets == 4)
|
||||
return (0);
|
||||
*++tp = 0;
|
||||
saw_digit = 0;
|
||||
}
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
if(octets < 4)
|
||||
return (0);
|
||||
memcpy(dst, tmp, INADDRSZ);
|
||||
return (1);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
/* int
|
||||
* inet_pton6(src, dst)
|
||||
* convert presentation level address to network order binary form.
|
||||
* return:
|
||||
* 1 if `src' is a valid [RFC1884 2.2] address, else 0.
|
||||
* notice:
|
||||
* (1) does not touch `dst' unless it's returning 1.
|
||||
* (2) :: in a full address is silently ignored.
|
||||
* credit:
|
||||
* inspired by Mark Andrews.
|
||||
* author:
|
||||
* Paul Vixie, 1996.
|
||||
*/
|
||||
static int
|
||||
inet_pton6(const char *src, unsigned char *dst)
|
||||
{
|
||||
static const char xdigits_l[] = "0123456789abcdef",
|
||||
xdigits_u[] = "0123456789ABCDEF";
|
||||
unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
|
||||
const char *xdigits, *curtok;
|
||||
int ch, saw_xdigit;
|
||||
size_t val;
|
||||
|
||||
memset((tp = tmp), 0, IN6ADDRSZ);
|
||||
endp = tp + IN6ADDRSZ;
|
||||
colonp = NULL;
|
||||
/* Leading :: requires some special handling. */
|
||||
if(*src == ':')
|
||||
if(*++src != ':')
|
||||
return (0);
|
||||
curtok = src;
|
||||
saw_xdigit = 0;
|
||||
val = 0;
|
||||
while((ch = *src++) != '\0') {
|
||||
const char *pch;
|
||||
|
||||
if((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
|
||||
pch = strchr((xdigits = xdigits_u), ch);
|
||||
if(pch != NULL) {
|
||||
val <<= 4;
|
||||
val |= (pch - xdigits);
|
||||
if(++saw_xdigit > 4)
|
||||
return (0);
|
||||
continue;
|
||||
}
|
||||
if(ch == ':') {
|
||||
curtok = src;
|
||||
if(!saw_xdigit) {
|
||||
if(colonp)
|
||||
return (0);
|
||||
colonp = tp;
|
||||
continue;
|
||||
}
|
||||
if(tp + INT16SZ > endp)
|
||||
return (0);
|
||||
*tp++ = (unsigned char) (val >> 8) & 0xff;
|
||||
*tp++ = (unsigned char) val & 0xff;
|
||||
saw_xdigit = 0;
|
||||
val = 0;
|
||||
continue;
|
||||
}
|
||||
if(ch == '.' && ((tp + INADDRSZ) <= endp) &&
|
||||
inet_pton4(curtok, tp) > 0) {
|
||||
tp += INADDRSZ;
|
||||
saw_xdigit = 0;
|
||||
break; /* '\0' was seen by inet_pton4(). */
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
if(saw_xdigit) {
|
||||
if(tp + INT16SZ > endp)
|
||||
return (0);
|
||||
*tp++ = (unsigned char) (val >> 8) & 0xff;
|
||||
*tp++ = (unsigned char) val & 0xff;
|
||||
}
|
||||
if(colonp != NULL) {
|
||||
/*
|
||||
* Since some memmove()'s erroneously fail to handle
|
||||
* overlapping regions, we'll do the shift by hand.
|
||||
*/
|
||||
const ssize_t n = tp - colonp;
|
||||
ssize_t i;
|
||||
|
||||
if(tp == endp)
|
||||
return (0);
|
||||
for(i = 1; i <= n; i++) {
|
||||
*(endp - i) = *(colonp + n - i);
|
||||
*(colonp + n - i) = 0;
|
||||
}
|
||||
tp = endp;
|
||||
}
|
||||
if(tp != endp)
|
||||
return (0);
|
||||
memcpy(dst, tmp, IN6ADDRSZ);
|
||||
return (1);
|
||||
}
|
||||
#endif /* ENABLE_IPV6 */
|
||||
|
||||
#endif /* HAVE_INET_PTON */
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef HEADER_CURL_INET_PTON_WINIRT_H
|
||||
#define HEADER_CURL_INET_PTON_WINIRT_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* Portions Copyright (c) Microsoft Open Technologies, Inc.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
|
||||
int inet_pton(int af, const char *src, void *dst);
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CURL_INET_PTON_WINIRT_H */
|
||||
|
|
@ -282,7 +282,12 @@ GLProgramState::GLProgramState()
|
|||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||
/** listen the event that renderer was recreated on Android/WP8 */
|
||||
CCLOG("create rendererRecreatedListener for GLProgramState");
|
||||
_backToForegroundlistener = EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom*) { _uniformAttributeValueDirty = true; });
|
||||
_backToForegroundlistener = EventListenerCustom::create(EVENT_RENDERER_RECREATED,
|
||||
[this](EventCustom*)
|
||||
{
|
||||
CCLOG("Dirty Uniform and Attributes of GLProgramState");
|
||||
_uniformAttributeValueDirty = true;
|
||||
});
|
||||
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundlistener, -1);
|
||||
#endif
|
||||
}
|
||||
|
@ -335,7 +340,7 @@ void GLProgramState::apply(const Mat4& modelView)
|
|||
applyUniforms();
|
||||
}
|
||||
|
||||
void GLProgramState::applyGLProgram(const Mat4& modelView)
|
||||
void GLProgramState::updateUniformsAndAttributes()
|
||||
{
|
||||
CCASSERT(_glprogram, "invalid glprogram");
|
||||
if(_uniformAttributeValueDirty)
|
||||
|
@ -356,6 +361,12 @@ void GLProgramState::applyGLProgram(const Mat4& modelView)
|
|||
_uniformAttributeValueDirty = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void GLProgramState::applyGLProgram(const Mat4& modelView)
|
||||
{
|
||||
CCASSERT(_glprogram, "invalid glprogram");
|
||||
updateUniformsAndAttributes();
|
||||
// set shader
|
||||
_glprogram->use();
|
||||
_glprogram->setUniformsForBuiltins(modelView);
|
||||
|
@ -395,6 +406,7 @@ void GLProgramState::setGLProgram(GLProgram *glprogram)
|
|||
|
||||
UniformValue* GLProgramState::getUniformValue(GLint uniformLocation)
|
||||
{
|
||||
updateUniformsAndAttributes();
|
||||
const auto itr = _uniforms.find(uniformLocation);
|
||||
if (itr != _uniforms.end())
|
||||
return &itr->second;
|
||||
|
@ -403,6 +415,7 @@ UniformValue* GLProgramState::getUniformValue(GLint uniformLocation)
|
|||
|
||||
UniformValue* GLProgramState::getUniformValue(const std::string &name)
|
||||
{
|
||||
updateUniformsAndAttributes();
|
||||
const auto itr = _uniformsByName.find(name);
|
||||
if (itr != _uniformsByName.end())
|
||||
return &_uniforms[itr->second];
|
||||
|
@ -411,6 +424,7 @@ UniformValue* GLProgramState::getUniformValue(const std::string &name)
|
|||
|
||||
VertexAttribValue* GLProgramState::getVertexAttribValue(const std::string &name)
|
||||
{
|
||||
updateUniformsAndAttributes();
|
||||
const auto itr = _attributes.find(name);
|
||||
if( itr != _attributes.end())
|
||||
return &itr->second;
|
||||
|
|
|
@ -204,6 +204,7 @@ protected:
|
|||
~GLProgramState();
|
||||
bool init(GLProgram* program);
|
||||
void resetGLProgram();
|
||||
void updateUniformsAndAttributes();
|
||||
VertexAttribValue* getVertexAttribValue(const std::string &attributeName);
|
||||
UniformValue* getUniformValue(const std::string &uniformName);
|
||||
UniformValue* getUniformValue(GLint uniformLocation);
|
||||
|
|
|
@ -44,7 +44,7 @@ QuadCommand::QuadCommand()
|
|||
_type = RenderCommand::Type::QUAD_COMMAND;
|
||||
}
|
||||
|
||||
void QuadCommand::init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, BlendFunc blendType, V3F_C4B_T2F_Quad* quad, ssize_t quadCount, const Mat4 &mv)
|
||||
void QuadCommand::init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, const BlendFunc& blendType, V3F_C4B_T2F_Quad* quad, ssize_t quadCount, const Mat4 &mv)
|
||||
{
|
||||
CCASSERT(glProgramState, "Invalid GLProgramState");
|
||||
CCASSERT(glProgramState->getVertexAttribsFlags() == 0, "No custom attributes are supported in QuadCommand");
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
/** Initializes the command with a globalZOrder, a texture ID, a `GLProgram`, a blending function, a pointer to quads,
|
||||
* quantity of quads, and the Model View transform to be used for the quads */
|
||||
void init(float globalOrder, GLuint texutreID, GLProgramState* shader, BlendFunc blendType, V3F_C4B_T2F_Quad* quads, ssize_t quadCount,
|
||||
void init(float globalOrder, GLuint texutreID, GLProgramState* shader, const BlendFunc& blendType, V3F_C4B_T2F_Quad* quads, ssize_t quadCount,
|
||||
const Mat4& mv);
|
||||
|
||||
void useMaterial() const;
|
||||
|
|
|
@ -321,10 +321,8 @@ void Renderer::addCommand(RenderCommand* command, int renderQueue)
|
|||
CCASSERT(!_isRendering, "Cannot add command while rendering");
|
||||
CCASSERT(renderQueue >=0, "Invalid render queue");
|
||||
CCASSERT(command->getType() != RenderCommand::Type::UNKNOWN_COMMAND, "Invalid Command Type");
|
||||
if (command->isTransparent())
|
||||
_transparentRenderGroups.push_back(command);
|
||||
else
|
||||
_renderGroups[renderQueue].push_back(command);
|
||||
|
||||
_renderGroups[renderQueue].push_back(command);
|
||||
}
|
||||
|
||||
void Renderer::pushGroup(int renderQueueID)
|
||||
|
@ -589,15 +587,12 @@ void Renderer::fillVerticesAndIndices(const TrianglesCommand* cmd)
|
|||
|
||||
void Renderer::fillQuads(const QuadCommand *cmd)
|
||||
{
|
||||
memcpy(_quadVerts + _numberQuads * 4, cmd->getQuads(), sizeof(V3F_C4B_T2F_Quad) * cmd->getQuadCount());
|
||||
|
||||
const Mat4& modelView = cmd->getModelView();
|
||||
|
||||
const V3F_C4B_T2F* quads = (V3F_C4B_T2F*)cmd->getQuads();
|
||||
for(ssize_t i=0; i< cmd->getQuadCount() * 4; ++i)
|
||||
{
|
||||
V3F_C4B_T2F *q = &_quadVerts[i + _numberQuads * 4];
|
||||
Vec3 *vec1 = (Vec3*)&q->vertices;
|
||||
modelView.transformPoint(vec1);
|
||||
_quadVerts[i + _numberQuads * 4] = quads[i];
|
||||
modelView.transformPoint(quads[i].vertices,&(_quadVerts[i + _numberQuads * 4].vertices));
|
||||
}
|
||||
|
||||
_numberQuads += cmd->getQuadCount();
|
||||
|
@ -824,10 +819,23 @@ void Renderer::flush()
|
|||
|
||||
void Renderer::flush2D()
|
||||
{
|
||||
//Check depth write
|
||||
GLboolean depthWirte;
|
||||
glGetBooleanv(GL_DEPTH_WRITEMASK, &depthWirte);
|
||||
//Turn depth write off if necessary
|
||||
if(depthWirte)
|
||||
{
|
||||
glDepthMask(false);
|
||||
}
|
||||
drawBatchedQuads();
|
||||
_lastMaterialID = 0;
|
||||
drawBatchedTriangles();
|
||||
_lastMaterialID = 0;
|
||||
//Turn depth write on if necessary
|
||||
if(depthWirte)
|
||||
{
|
||||
glDepthMask(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::flush3D()
|
||||
|
|
|
@ -605,7 +605,16 @@ void TextureAtlas::drawNumberOfQuads(ssize_t numberOfQuads, ssize_t start)
|
|||
|
||||
if(!numberOfQuads)
|
||||
return;
|
||||
|
||||
|
||||
//Check depth write
|
||||
GLboolean depthWirte;
|
||||
glGetBooleanv(GL_DEPTH_WRITEMASK, &depthWirte);
|
||||
//Turn depth write off if necessary
|
||||
if(depthWirte)
|
||||
{
|
||||
glDepthMask(false);
|
||||
}
|
||||
|
||||
GL::bindTexture2D(_texture->getName());
|
||||
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
|
@ -686,6 +695,12 @@ void TextureAtlas::drawNumberOfQuads(ssize_t numberOfQuads, ssize_t start)
|
|||
|
||||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,numberOfQuads*6);
|
||||
|
||||
//Turn depth write on if necessary
|
||||
if(depthWirte)
|
||||
{
|
||||
glDepthMask(true);
|
||||
}
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,18 @@
|
|||
-- @function [parent=#ActionTimeline] pause
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- @overload self, int, bool
|
||||
-- @overload self, int
|
||||
-- @overload self, int, int, bool
|
||||
-- @overload self, int, int, int, bool
|
||||
-- @function [parent=#ActionTimeline] gotoFrameAndPlay
|
||||
-- @param self
|
||||
-- @param #int startIndex
|
||||
-- @param #int endIndex
|
||||
-- @param #int currentFrameIndex
|
||||
-- @param #bool loop
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimeline] init
|
||||
|
@ -57,6 +69,13 @@
|
|||
-- @param self
|
||||
-- @return array_table#array_table ret (return value: array_table)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimeline] play
|
||||
-- @param self
|
||||
-- @param #string name
|
||||
-- @param #bool loop
|
||||
|
||||
--------------------------------
|
||||
-- Resume the animation.
|
||||
-- @function [parent=#ActionTimeline] resume
|
||||
|
@ -88,17 +107,11 @@
|
|||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @overload self, int, bool
|
||||
-- @overload self, int
|
||||
-- @overload self, int, int, bool
|
||||
-- @overload self, int, int, int, bool
|
||||
-- @function [parent=#ActionTimeline] gotoFrameAndPlay
|
||||
--
|
||||
-- @function [parent=#ActionTimeline] removeIndexes
|
||||
-- @param self
|
||||
-- @param #int startIndex
|
||||
-- @param #int endIndex
|
||||
-- @param #int currentFrameIndex
|
||||
-- @param #bool loop
|
||||
|
||||
-- @param #string name
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimeline] clearFrameEventCallFunc
|
||||
|
@ -112,6 +125,12 @@
|
|||
-- @param self
|
||||
-- @return int#int ret (return value: int)
|
||||
|
||||
--------------------------------
|
||||
-- Set current frame index, this will cause action plays to this frame.
|
||||
-- @function [parent=#ActionTimeline] setCurrentFrame
|
||||
-- @param self
|
||||
-- @param #int frameIndex
|
||||
|
||||
--------------------------------
|
||||
-- Set the animation speed, this will speed up or slow down the speed.
|
||||
-- @function [parent=#ActionTimeline] setTimeSpeed
|
||||
|
@ -130,10 +149,10 @@
|
|||
-- @param #int duration
|
||||
|
||||
--------------------------------
|
||||
-- Set current frame index, this will cause action plays to this frame.
|
||||
-- @function [parent=#ActionTimeline] setCurrentFrame
|
||||
-- add ActionIndexes
|
||||
-- @function [parent=#ActionTimeline] addIndexes
|
||||
-- @param self
|
||||
-- @param #int frameIndex
|
||||
-- @param #ccs.ActionIndexes indexes
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module ActionTimelineNode
|
||||
-- @extend Node
|
||||
-- @parent_module ccs
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineNode] getRoot
|
||||
-- @param self
|
||||
-- @return Node#Node ret (return value: cc.Node)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineNode] getActionTimeline
|
||||
-- @param self
|
||||
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineNode] setActionTimeline
|
||||
-- @param self
|
||||
-- @param #ccs.ActionTimeline action
|
||||
|
||||
--------------------------------
|
||||
-- @overload self, cc.Node, ccs.ActionTimeline
|
||||
-- @overload self
|
||||
-- @function [parent=#ActionTimelineNode] init
|
||||
-- @param self
|
||||
-- @param #cc.Node root
|
||||
-- @param #ccs.ActionTimeline action
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineNode] setRoot
|
||||
-- @param self
|
||||
-- @param #cc.Node root
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineNode] create
|
||||
-- @param self
|
||||
-- @param #cc.Node root
|
||||
-- @param #ccs.ActionTimeline action
|
||||
-- @return ActionTimelineNode#ActionTimelineNode ret (return value: ccs.ActionTimelineNode)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#ActionTimelineNode] ActionTimelineNode
|
||||
-- @param self
|
||||
|
||||
return nil
|
|
@ -12,12 +12,6 @@
|
|||
-- @param #cc.Bone3D attachBone
|
||||
-- @return AttachNode#AttachNode ret (return value: cc.AttachNode)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#AttachNode] getWorldToNodeTransform
|
||||
-- @param self
|
||||
-- @return mat4_table#mat4_table ret (return value: mat4_table)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#AttachNode] visit
|
||||
|
@ -26,4 +20,16 @@
|
|||
-- @param #mat4_table parentTransform
|
||||
-- @param #unsigned int parentFlags
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#AttachNode] getWorldToNodeTransform
|
||||
-- @param self
|
||||
-- @return mat4_table#mat4_table ret (return value: mat4_table)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#AttachNode] getNodeToWorldTransform
|
||||
-- @param self
|
||||
-- @return mat4_table#mat4_table ret (return value: mat4_table)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -82,12 +82,6 @@
|
|||
-- @param #string filename
|
||||
-- @return Node#Node ret (return value: cc.Node)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] getCsdVersion
|
||||
-- @param self
|
||||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#CSLoader] destroyInstance
|
||||
|
|
|
@ -37,6 +37,13 @@
|
|||
-- @param self
|
||||
-- @return int#int ret (return value: int)
|
||||
|
||||
--------------------------------
|
||||
-- Enable frustum culling
|
||||
-- @function [parent=#Camera] enableFrustumCulling
|
||||
-- @param self
|
||||
-- @param #bool enalbe
|
||||
-- @param #bool clipZ
|
||||
|
||||
--------------------------------
|
||||
-- Creates a view matrix based on the specified input parameters.<br>
|
||||
-- param eyePosition The eye position.<br>
|
||||
|
@ -48,6 +55,13 @@
|
|||
-- @param #vec3_table target
|
||||
-- @param #vec3_table up
|
||||
|
||||
--------------------------------
|
||||
-- Is this aabb visible in frustum
|
||||
-- @function [parent=#Camera] isVisibleInFrustum
|
||||
-- @param self
|
||||
-- @param #cc.AABB aabb
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Camera] setCameraFlag
|
||||
|
|
|
@ -65,6 +65,13 @@
|
|||
-- @param #string frontCrossDisabled
|
||||
-- @param #int texType
|
||||
|
||||
--------------------------------
|
||||
-- brief Return a zoom scale<br>
|
||||
-- since v3.3
|
||||
-- @function [parent=#CheckBox] getZoomScale
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
-- Load backGround texture for checkbox.<br>
|
||||
-- param backGround backGround texture.<br>
|
||||
|
@ -74,6 +81,14 @@
|
|||
-- @param #string backGround
|
||||
-- @param #int type
|
||||
|
||||
--------------------------------
|
||||
-- When user pressed the button, the button will zoom to a scale.<br>
|
||||
-- The final scale of the button equals (button original scale + _zoomScale)<br>
|
||||
-- since v3.3
|
||||
-- @function [parent=#CheckBox] setZoomScale
|
||||
-- @param self
|
||||
-- @param #float scale
|
||||
|
||||
--------------------------------
|
||||
-- Load frontCrossDisabled texture for checkbox.<br>
|
||||
-- param frontCrossDisabled frontCrossDisabled texture.<br>
|
||||
|
@ -86,6 +101,7 @@
|
|||
--------------------------------
|
||||
-- @overload self, string, string, string, string, string, int
|
||||
-- @overload self
|
||||
-- @overload self, string, string, int
|
||||
-- @function [parent=#CheckBox] create
|
||||
-- @param self
|
||||
-- @param #string backGround
|
||||
|
|
|
@ -4,11 +4,6 @@
|
|||
-- @extend Ref
|
||||
-- @parent_module cc
|
||||
|
||||
--------------------------------
|
||||
-- stops the Console. 'stop' will be called at destruction time as well
|
||||
-- @function [parent=#Console] stop
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- starts listening to specifed TCP port
|
||||
-- @function [parent=#Console] listenOnTCP
|
||||
|
@ -16,6 +11,24 @@
|
|||
-- @param #int port
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- log something in the console
|
||||
-- @function [parent=#Console] log
|
||||
-- @param self
|
||||
-- @param #char buf
|
||||
|
||||
--------------------------------
|
||||
-- set bind address<br>
|
||||
-- address : 127.0.0.1
|
||||
-- @function [parent=#Console] setBindAddress
|
||||
-- @param self
|
||||
-- @param #string address
|
||||
|
||||
--------------------------------
|
||||
-- stops the Console. 'stop' will be called at destruction time as well
|
||||
-- @function [parent=#Console] stop
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- starts listening to specifed file descriptor
|
||||
-- @function [parent=#Console] listenOnFileDescriptor
|
||||
|
@ -23,10 +36,4 @@
|
|||
-- @param #int fd
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- log something in the console
|
||||
-- @function [parent=#Console] log
|
||||
-- @param self
|
||||
-- @param #char buf
|
||||
|
||||
return nil
|
||||
|
|
|
@ -172,6 +172,13 @@
|
|||
-- @param self
|
||||
-- @param #cc.Scheduler scheduler
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Director] getMatrix
|
||||
-- @param self
|
||||
-- @param #int type
|
||||
-- @return mat4_table#mat4_table ret (return value: mat4_table)
|
||||
|
||||
--------------------------------
|
||||
-- The main loop is triggered again.<br>
|
||||
-- Call this function only if [stopAnimation] was called earlier<br>
|
||||
|
@ -288,11 +295,9 @@
|
|||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Director] getMatrix
|
||||
-- Restart the director
|
||||
-- @function [parent=#Director] restart
|
||||
-- @param self
|
||||
-- @param #int type
|
||||
-- @return mat4_table#mat4_table ret (return value: mat4_table)
|
||||
|
||||
--------------------------------
|
||||
-- Pops out a scene from the stack.<br>
|
||||
|
|
|
@ -271,6 +271,12 @@
|
|||
-- @param #string relativeFile
|
||||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
-- Set writable/cache path.
|
||||
-- @function [parent=#FileUtils] setWritablePath
|
||||
-- @param self
|
||||
-- @param #string writablePath
|
||||
|
||||
--------------------------------
|
||||
-- Sets/Gets whether to pop-up a message box when failed to load an image.
|
||||
-- @function [parent=#FileUtils] setPopupNotify
|
||||
|
@ -286,6 +292,12 @@
|
|||
-- @param #string dirPath
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- Set default resource root path.
|
||||
-- @function [parent=#FileUtils] setDefaultResourceRootPath
|
||||
-- @param self
|
||||
-- @param #string path
|
||||
|
||||
--------------------------------
|
||||
-- Gets the array that contains the search order of the resources.<br>
|
||||
-- see setSearchResolutionsOrder(const std::vector<std::string>&), fullPathForFilename(const char*).<br>
|
||||
|
|
|
@ -40,4 +40,10 @@
|
|||
-- @param self
|
||||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
-- @brief Get the search paths list related to the Manifest.
|
||||
-- @function [parent=#Manifest] getSearchPaths
|
||||
-- @param self
|
||||
-- @return array_table#array_table ret (return value: array_table)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -525,6 +525,15 @@
|
|||
-- @param #cc.Action action
|
||||
-- @return Action#Action ret (return value: cc.Action)
|
||||
|
||||
--------------------------------
|
||||
-- @overload self
|
||||
-- @overload self, cc.Renderer, mat4_table, unsigned int
|
||||
-- @function [parent=#Node] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #mat4_table parentTransform
|
||||
-- @param #unsigned int parentFlags
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Node] isOpacityModifyRGB
|
||||
|
@ -548,15 +557,6 @@
|
|||
-- @param self
|
||||
-- @return vec2_table#vec2_table ret (return value: vec2_table)
|
||||
|
||||
--------------------------------
|
||||
-- @overload self
|
||||
-- @overload self, cc.Renderer, mat4_table, unsigned int
|
||||
-- @function [parent=#Node] visit
|
||||
-- @param self
|
||||
-- @param #cc.Renderer renderer
|
||||
-- @param #mat4_table parentTransform
|
||||
-- @param #unsigned int parentFlags
|
||||
|
||||
--------------------------------
|
||||
-- Removes a child from the container by tag value. It will also cleanup all running actions depending on the cleanup parameter<br>
|
||||
-- param name A string that identifies a child node<br>
|
||||
|
|
|
@ -33,6 +33,12 @@
|
|||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] setScale9Enabled
|
||||
-- @param self
|
||||
-- @param #bool enabled
|
||||
|
||||
--------------------------------
|
||||
-- Sets whether the widget should be flipped vertically or not.<br>
|
||||
-- param bFlippedY true if the widget should be flipped vertically, flase otherwise.
|
||||
|
@ -48,16 +54,27 @@
|
|||
-- @param #bool flippedX
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] setScale9Enabled
|
||||
-- Creates and returns a new sprite object with the specified cap insets.<br>
|
||||
-- You use this method to add cap insets to a sprite or to change the existing<br>
|
||||
-- cap insets of a sprite. In both cases, you get back a new image and the<br>
|
||||
-- original sprite remains untouched.<br>
|
||||
-- param capInsets The values to use for the cap insets.
|
||||
-- @function [parent=#Scale9Sprite] resizableSpriteWithCapInsets
|
||||
-- @param self
|
||||
-- @param #bool enabled
|
||||
-- @param #rect_table capInsets
|
||||
-- @return Scale9Sprite#Scale9Sprite ret (return value: ccui.Scale9Sprite)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] disableCascadeOpacity
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- since v3.4
|
||||
-- @function [parent=#Scale9Sprite] setState
|
||||
-- @param self
|
||||
-- @param #int state
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] setInsetBottom
|
||||
|
@ -106,12 +123,6 @@
|
|||
-- @param self
|
||||
-- @param #size_table size
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] getInsetRight
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] setSpriteFrame
|
||||
|
@ -126,15 +137,10 @@
|
|||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
-- Creates and returns a new sprite object with the specified cap insets.<br>
|
||||
-- You use this method to add cap insets to a sprite or to change the existing<br>
|
||||
-- cap insets of a sprite. In both cases, you get back a new image and the<br>
|
||||
-- original sprite remains untouched.<br>
|
||||
-- param capInsets The values to use for the cap insets.
|
||||
-- @function [parent=#Scale9Sprite] resizableSpriteWithCapInsets
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] getCapInsets
|
||||
-- @param self
|
||||
-- @param #rect_table capInsets
|
||||
-- @return Scale9Sprite#Scale9Sprite ret (return value: ccui.Scale9Sprite)
|
||||
-- @return rect_table#rect_table ret (return value: rect_table)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
|
@ -144,9 +150,9 @@
|
|||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] getCapInsets
|
||||
-- @function [parent=#Scale9Sprite] getInsetRight
|
||||
-- @param self
|
||||
-- @return rect_table#rect_table ret (return value: rect_table)
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
-- @function [parent=#Slider] loadSlidBallTextureDisabled
|
||||
-- @param self
|
||||
-- @param #string disabled
|
||||
-- @param #int texType
|
||||
-- @param #int resType
|
||||
|
||||
--------------------------------
|
||||
-- Load normal state texture for slider ball.<br>
|
||||
|
@ -27,7 +27,7 @@
|
|||
-- @function [parent=#Slider] loadSlidBallTextureNormal
|
||||
-- @param self
|
||||
-- @param #string normal
|
||||
-- @param #int texType
|
||||
-- @param #int resType
|
||||
|
||||
--------------------------------
|
||||
-- Load texture for slider bar.<br>
|
||||
|
@ -36,7 +36,7 @@
|
|||
-- @function [parent=#Slider] loadBarTexture
|
||||
-- @param self
|
||||
-- @param #string fileName
|
||||
-- @param #int texType
|
||||
-- @param #int resType
|
||||
|
||||
--------------------------------
|
||||
-- Load dark state texture for slider progress bar.<br>
|
||||
|
@ -45,7 +45,7 @@
|
|||
-- @function [parent=#Slider] loadProgressBarTexture
|
||||
-- @param self
|
||||
-- @param #string fileName
|
||||
-- @param #int texType
|
||||
-- @param #int resType
|
||||
|
||||
--------------------------------
|
||||
-- Load textures for slider ball.<br>
|
||||
|
@ -87,6 +87,14 @@
|
|||
-- @param self
|
||||
-- @param #bool able
|
||||
|
||||
--------------------------------
|
||||
-- When user pressed the button, the button will zoom to a scale.<br>
|
||||
-- The final scale of the button equals (button original scale + _zoomScale)<br>
|
||||
-- since v3.3
|
||||
-- @function [parent=#Slider] setZoomScale
|
||||
-- @param self
|
||||
-- @param #float scale
|
||||
|
||||
--------------------------------
|
||||
-- Sets capinsets for slider, if slider is using scale9 renderer.<br>
|
||||
-- param capInsets capinsets for slider
|
||||
|
@ -94,6 +102,13 @@
|
|||
-- @param self
|
||||
-- @param #rect_table capInsets
|
||||
|
||||
--------------------------------
|
||||
-- brief Return a zoom scale<br>
|
||||
-- since v3.3
|
||||
-- @function [parent=#Slider] getZoomScale
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Slider] addEventListener
|
||||
|
@ -107,7 +122,7 @@
|
|||
-- @function [parent=#Slider] loadSlidBallTexturePressed
|
||||
-- @param self
|
||||
-- @param #string pressed
|
||||
-- @param #int texType
|
||||
-- @param #int resType
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
|
@ -129,11 +144,15 @@
|
|||
-- @return int#int ret (return value: int)
|
||||
|
||||
--------------------------------
|
||||
-- Allocates and initializes.
|
||||
-- @function [parent=#Slider] create
|
||||
-- @overload self, string, string, int
|
||||
-- @overload self
|
||||
-- @function [parent=#Slider] create
|
||||
-- @param self
|
||||
-- @param #string barTextureName
|
||||
-- @param #string normalBallTextureName
|
||||
-- @param #int resType
|
||||
-- @return Slider#Slider ret (return value: ccui.Slider)
|
||||
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Slider] createInstance
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
-- Returns whether or not a SpriteFrame is being displayed
|
||||
-- @function [parent=#Sprite] isFrameDisplayed
|
||||
-- @param self
|
||||
-- @param #cc.SpriteFrame pFrame
|
||||
-- @param #cc.SpriteFrame frame
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
|
@ -111,7 +111,7 @@
|
|||
-- Sets the weak reference of the TextureAtlas when the sprite is rendered using via SpriteBatchNode
|
||||
-- @function [parent=#Sprite] setTextureAtlas
|
||||
-- @param self
|
||||
-- @param #cc.TextureAtlas pobTextureAtlas
|
||||
-- @param #cc.TextureAtlas textureAtlas
|
||||
|
||||
--------------------------------
|
||||
-- Returns the current displayed frame.
|
||||
|
|
|
@ -261,4 +261,9 @@
|
|||
-- @field [parent=#ccs] ActionTimeline#ActionTimeline ActionTimeline preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the ccs ActionTimelineNode
|
||||
-- @field [parent=#ccs] ActionTimelineNode#ActionTimelineNode ActionTimelineNode preloaded module
|
||||
|
||||
|
||||
return nil
|
||||
|
|
|
@ -167,52 +167,6 @@ int lua_register_cocos2dx_Ref(lua_State* tolua_S)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int lua_cocos2dx_Console_stop(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Console* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Console",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Console*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Console_stop'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Console_stop'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->stop();
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Console:stop",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Console_stop'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Console_listenOnTCP(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -263,6 +217,150 @@ int lua_cocos2dx_Console_listenOnTCP(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Console_log(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Console* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Console",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Console*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Console_log'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
const char* arg0;
|
||||
|
||||
std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Console:log"); arg0 = arg0_tmp.c_str();
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Console_log'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->log(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Console:log",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Console_log'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Console_setBindAddress(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Console* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Console",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Console*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Console_setBindAddress'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Console:setBindAddress");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Console_setBindAddress'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setBindAddress(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Console:setBindAddress",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Console_setBindAddress'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Console_stop(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Console* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Console",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Console*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Console_stop'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Console_stop'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->stop();
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Console:stop",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Console_stop'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Console_listenOnFileDescriptor(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -313,55 +411,6 @@ int lua_cocos2dx_Console_listenOnFileDescriptor(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Console_log(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Console* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Console",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Console*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Console_log'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
const char* arg0;
|
||||
|
||||
std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Console:log"); arg0 = arg0_tmp.c_str();
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Console_log'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->log(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Console:log",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Console_log'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
static int lua_cocos2dx_Console_finalize(lua_State* tolua_S)
|
||||
{
|
||||
printf("luabindings: finalizing LUA object (Console)");
|
||||
|
@ -374,10 +423,11 @@ int lua_register_cocos2dx_Console(lua_State* tolua_S)
|
|||
tolua_cclass(tolua_S,"Console","cc.Console","cc.Ref",nullptr);
|
||||
|
||||
tolua_beginmodule(tolua_S,"Console");
|
||||
tolua_function(tolua_S,"stop",lua_cocos2dx_Console_stop);
|
||||
tolua_function(tolua_S,"listenOnTCP",lua_cocos2dx_Console_listenOnTCP);
|
||||
tolua_function(tolua_S,"listenOnFileDescriptor",lua_cocos2dx_Console_listenOnFileDescriptor);
|
||||
tolua_function(tolua_S,"log",lua_cocos2dx_Console_log);
|
||||
tolua_function(tolua_S,"setBindAddress",lua_cocos2dx_Console_setBindAddress);
|
||||
tolua_function(tolua_S,"stop",lua_cocos2dx_Console_stop);
|
||||
tolua_function(tolua_S,"listenOnFileDescriptor",lua_cocos2dx_Console_listenOnFileDescriptor);
|
||||
tolua_endmodule(tolua_S);
|
||||
std::string typeName = typeid(cocos2d::Console).name();
|
||||
g_luaType[typeName] = "cc.Console";
|
||||
|
@ -6110,6 +6160,63 @@ int lua_cocos2dx_Node_runAction(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Node_visit(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Node* cobj = nullptr;
|
||||
bool ok = true;
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0);
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_visit'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
do{
|
||||
if (argc == 0) {
|
||||
cobj->visit();
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
do{
|
||||
if (argc == 3) {
|
||||
cocos2d::Renderer* arg0;
|
||||
ok &= luaval_to_object<cocos2d::Renderer>(tolua_S, 2, "cc.Renderer",&arg0);
|
||||
|
||||
if (!ok) { break; }
|
||||
cocos2d::Mat4 arg1;
|
||||
ok &= luaval_to_mat4(tolua_S, 3, &arg1, "cc.Node:visit");
|
||||
|
||||
if (!ok) { break; }
|
||||
unsigned int arg2;
|
||||
ok &= luaval_to_uint32(tolua_S, 4,&arg2, "cc.Node:visit");
|
||||
|
||||
if (!ok) { break; }
|
||||
cobj->visit(arg0, arg1, arg2);
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:visit",argc, 3);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_visit'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Node_isOpacityModifyRGB(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -6251,63 +6358,6 @@ int lua_cocos2dx_Node_getAnchorPointInPoints(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Node_visit(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Node* cobj = nullptr;
|
||||
bool ok = true;
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0);
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_visit'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
do{
|
||||
if (argc == 0) {
|
||||
cobj->visit();
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
do{
|
||||
if (argc == 3) {
|
||||
cocos2d::Renderer* arg0;
|
||||
ok &= luaval_to_object<cocos2d::Renderer>(tolua_S, 2, "cc.Renderer",&arg0);
|
||||
|
||||
if (!ok) { break; }
|
||||
cocos2d::Mat4 arg1;
|
||||
ok &= luaval_to_mat4(tolua_S, 3, &arg1, "cc.Node:visit");
|
||||
|
||||
if (!ok) { break; }
|
||||
unsigned int arg2;
|
||||
ok &= luaval_to_uint32(tolua_S, 4,&arg2, "cc.Node:visit");
|
||||
|
||||
if (!ok) { break; }
|
||||
cobj->visit(arg0, arg1, arg2);
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:visit",argc, 3);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_visit'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Node_removeChildByName(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -9489,10 +9539,10 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"convertToNodeSpaceAR",lua_cocos2dx_Node_convertToNodeSpaceAR);
|
||||
tolua_function(tolua_S,"addComponent",lua_cocos2dx_Node_addComponent);
|
||||
tolua_function(tolua_S,"runAction",lua_cocos2dx_Node_runAction);
|
||||
tolua_function(tolua_S,"visit",lua_cocos2dx_Node_visit);
|
||||
tolua_function(tolua_S,"isOpacityModifyRGB",lua_cocos2dx_Node_isOpacityModifyRGB);
|
||||
tolua_function(tolua_S,"getRotation",lua_cocos2dx_Node_getRotation);
|
||||
tolua_function(tolua_S,"getAnchorPointInPoints",lua_cocos2dx_Node_getAnchorPointInPoints);
|
||||
tolua_function(tolua_S,"visit",lua_cocos2dx_Node_visit);
|
||||
tolua_function(tolua_S,"removeChildByName",lua_cocos2dx_Node_removeChildByName);
|
||||
tolua_function(tolua_S,"getGLProgramState",lua_cocos2dx_Node_getGLProgramState);
|
||||
tolua_function(tolua_S,"setScheduler",lua_cocos2dx_Node_setScheduler);
|
||||
|
@ -12550,6 +12600,56 @@ int lua_cocos2dx_Director_setScheduler(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_getMatrix(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getMatrix'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::MATRIX_STACK_TYPE arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:getMatrix");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Director_getMatrix'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
const cocos2d::Mat4& ret = cobj->getMatrix(arg0);
|
||||
mat4_to_luaval(tolua_S, ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getMatrix",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getMatrix'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_startAnimation(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -13355,7 +13455,7 @@ int lua_cocos2dx_Director_drawScene(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_getMatrix(lua_State* tolua_S)
|
||||
int lua_cocos2dx_Director_restart(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
|
@ -13375,32 +13475,28 @@ int lua_cocos2dx_Director_getMatrix(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getMatrix'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_restart'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
if (argc == 0)
|
||||
{
|
||||
cocos2d::MATRIX_STACK_TYPE arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:getMatrix");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Director_getMatrix'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Director_restart'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
const cocos2d::Mat4& ret = cobj->getMatrix(arg0);
|
||||
mat4_to_luaval(tolua_S, ret);
|
||||
return 1;
|
||||
cobj->restart();
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getMatrix",argc, 1);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:restart",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getMatrix'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_restart'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -14390,6 +14486,7 @@ int lua_register_cocos2dx_Director(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"setDefaultValues",lua_cocos2dx_Director_setDefaultValues);
|
||||
tolua_function(tolua_S,"init",lua_cocos2dx_Director_init);
|
||||
tolua_function(tolua_S,"setScheduler",lua_cocos2dx_Director_setScheduler);
|
||||
tolua_function(tolua_S,"getMatrix",lua_cocos2dx_Director_getMatrix);
|
||||
tolua_function(tolua_S,"startAnimation",lua_cocos2dx_Director_startAnimation);
|
||||
tolua_function(tolua_S,"getOpenGLView",lua_cocos2dx_Director_getOpenGLView);
|
||||
tolua_function(tolua_S,"getRunningScene",lua_cocos2dx_Director_getRunningScene);
|
||||
|
@ -14407,7 +14504,7 @@ int lua_register_cocos2dx_Director(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"runWithScene",lua_cocos2dx_Director_runWithScene);
|
||||
tolua_function(tolua_S,"setNotificationNode",lua_cocos2dx_Director_setNotificationNode);
|
||||
tolua_function(tolua_S,"drawScene",lua_cocos2dx_Director_drawScene);
|
||||
tolua_function(tolua_S,"getMatrix",lua_cocos2dx_Director_getMatrix);
|
||||
tolua_function(tolua_S,"restart",lua_cocos2dx_Director_restart);
|
||||
tolua_function(tolua_S,"popScene",lua_cocos2dx_Director_popScene);
|
||||
tolua_function(tolua_S,"loadIdentityMatrix",lua_cocos2dx_Director_loadIdentityMatrix);
|
||||
tolua_function(tolua_S,"isDisplayStats",lua_cocos2dx_Director_isDisplayStats);
|
||||
|
@ -16038,6 +16135,55 @@ int lua_cocos2dx_FileUtils_fullPathFromRelativeFile(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_FileUtils_setWritablePath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::FileUtils* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_setWritablePath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.FileUtils:setWritablePath");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_FileUtils_setWritablePath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setWritablePath(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.FileUtils:setWritablePath",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_setWritablePath'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_FileUtils_setPopupNotify(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -16137,6 +16283,55 @@ int lua_cocos2dx_FileUtils_isDirectoryExist(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_FileUtils_setDefaultResourceRootPath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::FileUtils* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_setDefaultResourceRootPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.FileUtils:setDefaultResourceRootPath");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_FileUtils_setDefaultResourceRootPath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setDefaultResourceRootPath(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.FileUtils:setDefaultResourceRootPath",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_setDefaultResourceRootPath'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_FileUtils_getSearchResolutionsOrder(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -16382,8 +16577,10 @@ int lua_register_cocos2dx_FileUtils(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"isFileExist",lua_cocos2dx_FileUtils_isFileExist);
|
||||
tolua_function(tolua_S,"purgeCachedEntries",lua_cocos2dx_FileUtils_purgeCachedEntries);
|
||||
tolua_function(tolua_S,"fullPathFromRelativeFile",lua_cocos2dx_FileUtils_fullPathFromRelativeFile);
|
||||
tolua_function(tolua_S,"setWritablePath",lua_cocos2dx_FileUtils_setWritablePath);
|
||||
tolua_function(tolua_S,"setPopupNotify",lua_cocos2dx_FileUtils_setPopupNotify);
|
||||
tolua_function(tolua_S,"isDirectoryExist",lua_cocos2dx_FileUtils_isDirectoryExist);
|
||||
tolua_function(tolua_S,"setDefaultResourceRootPath",lua_cocos2dx_FileUtils_setDefaultResourceRootPath);
|
||||
tolua_function(tolua_S,"getSearchResolutionsOrder",lua_cocos2dx_FileUtils_getSearchResolutionsOrder);
|
||||
tolua_function(tolua_S,"createDirectory",lua_cocos2dx_FileUtils_createDirectory);
|
||||
tolua_function(tolua_S,"getWritablePath",lua_cocos2dx_FileUtils_getWritablePath);
|
||||
|
@ -60854,6 +61051,58 @@ int lua_cocos2dx_Camera_getType(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Camera_enableFrustumCulling(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Camera* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Camera",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Camera*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Camera_enableFrustumCulling'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 2)
|
||||
{
|
||||
bool arg0;
|
||||
bool arg1;
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Camera:enableFrustumCulling");
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.Camera:enableFrustumCulling");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Camera_enableFrustumCulling'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->enableFrustumCulling(arg0, arg1);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Camera:enableFrustumCulling",argc, 2);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_enableFrustumCulling'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Camera_lookAt(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -60906,6 +61155,56 @@ int lua_cocos2dx_Camera_lookAt(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Camera_isVisibleInFrustum(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Camera* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Camera",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Camera*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Camera_isVisibleInFrustum'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
const cocos2d::AABB* arg0;
|
||||
|
||||
ok &= luaval_to_object<const cocos2d::AABB>(tolua_S, 2, "cc.AABB",&arg0);
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Camera_isVisibleInFrustum'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->isVisibleInFrustum(arg0);
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Camera:isVisibleInFrustum",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_isVisibleInFrustum'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Camera_setCameraFlag(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -61124,7 +61423,9 @@ int lua_register_cocos2dx_Camera(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getViewMatrix",lua_cocos2dx_Camera_getViewMatrix);
|
||||
tolua_function(tolua_S,"getCameraFlag",lua_cocos2dx_Camera_getCameraFlag);
|
||||
tolua_function(tolua_S,"getType",lua_cocos2dx_Camera_getType);
|
||||
tolua_function(tolua_S,"enableFrustumCulling",lua_cocos2dx_Camera_enableFrustumCulling);
|
||||
tolua_function(tolua_S,"lookAt",lua_cocos2dx_Camera_lookAt);
|
||||
tolua_function(tolua_S,"isVisibleInFrustum",lua_cocos2dx_Camera_isVisibleInFrustum);
|
||||
tolua_function(tolua_S,"setCameraFlag",lua_cocos2dx_Camera_setCameraFlag);
|
||||
tolua_function(tolua_S,"create", lua_cocos2dx_Camera_create);
|
||||
tolua_function(tolua_S,"createPerspective", lua_cocos2dx_Camera_createPerspective);
|
||||
|
|
|
@ -1616,6 +1616,12 @@ int register_all_cocos2dx(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -598,53 +598,6 @@ int lua_cocos2dx_csloader_CSLoader_createNodeWithFlatBuffersForSimulator(lua_Sta
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_getCsdVersion(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::CSLoader* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_getCsdVersion'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_getCsdVersion'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
std::string ret = cobj->getCsdVersion();
|
||||
tolua_pushcppstring(tolua_S,ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:getCsdVersion",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_getCsdVersion'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_csloader_CSLoader_destroyInstance(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -808,7 +761,6 @@ int lua_register_cocos2dx_csloader_CSLoader(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getJsonPath",lua_cocos2dx_csloader_CSLoader_getJsonPath);
|
||||
tolua_function(tolua_S,"setRecordJsonPath",lua_cocos2dx_csloader_CSLoader_setRecordJsonPath);
|
||||
tolua_function(tolua_S,"createNodeWithFlatBuffersForSimulator",lua_cocos2dx_csloader_CSLoader_createNodeWithFlatBuffersForSimulator);
|
||||
tolua_function(tolua_S,"getCsdVersion",lua_cocos2dx_csloader_CSLoader_getCsdVersion);
|
||||
tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_csloader_CSLoader_destroyInstance);
|
||||
tolua_function(tolua_S,"createNode", lua_cocos2dx_csloader_CSLoader_createNode);
|
||||
tolua_function(tolua_S,"getInstance", lua_cocos2dx_csloader_CSLoader_getInstance);
|
||||
|
|
|
@ -29,5 +29,4 @@ int register_all_cocos2dx_csloader(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
#endif // __cocos2dx_csloader_h__
|
||||
|
|
|
@ -12967,6 +12967,53 @@ int lua_cocos2dx_extension_Manifest_getVersionFileUrl(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_extension_Manifest_getSearchPaths(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::extension::Manifest* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Manifest",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::extension::Manifest*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_extension_Manifest_getSearchPaths'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_extension_Manifest_getSearchPaths'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
std::vector<std::string> ret = cobj->getSearchPaths();
|
||||
ccvector_std_string_to_luaval(tolua_S, ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Manifest:getSearchPaths",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_extension_Manifest_getSearchPaths'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
static int lua_cocos2dx_extension_Manifest_finalize(lua_State* tolua_S)
|
||||
{
|
||||
printf("luabindings: finalizing LUA object (Manifest)");
|
||||
|
@ -12985,6 +13032,7 @@ int lua_register_cocos2dx_extension_Manifest(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getPackageUrl",lua_cocos2dx_extension_Manifest_getPackageUrl);
|
||||
tolua_function(tolua_S,"getVersion",lua_cocos2dx_extension_Manifest_getVersion);
|
||||
tolua_function(tolua_S,"getVersionFileUrl",lua_cocos2dx_extension_Manifest_getVersionFileUrl);
|
||||
tolua_function(tolua_S,"getSearchPaths",lua_cocos2dx_extension_Manifest_getSearchPaths);
|
||||
tolua_endmodule(tolua_S);
|
||||
std::string typeName = typeid(cocos2d::extension::Manifest).name();
|
||||
g_luaType[typeName] = "cc.Manifest";
|
||||
|
|
|
@ -289,6 +289,7 @@ int register_all_cocos2dx_extension(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // __cocos2dx_extension_h__
|
||||
|
|
|
@ -20412,6 +20412,105 @@ int lua_cocos2dx_studio_ActionTimeline_pause(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimeline* cobj = nullptr;
|
||||
bool ok = true;
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
do{
|
||||
if (argc == 2) {
|
||||
int arg0;
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
cobj->gotoFrameAndPlay(arg0, arg1);
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
do{
|
||||
if (argc == 1) {
|
||||
int arg0;
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
cobj->gotoFrameAndPlay(arg0);
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
do{
|
||||
if (argc == 3) {
|
||||
int arg0;
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
int arg1;
|
||||
ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
bool arg2;
|
||||
ok &= luaval_to_boolean(tolua_S, 4,&arg2, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
cobj->gotoFrameAndPlay(arg0, arg1, arg2);
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
do{
|
||||
if (argc == 4) {
|
||||
int arg0;
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
int arg1;
|
||||
ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
int arg2;
|
||||
ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
bool arg3;
|
||||
ok &= luaval_to_boolean(tolua_S, 5,&arg3, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
cobj->gotoFrameAndPlay(arg0, arg1, arg2, arg3);
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:gotoFrameAndPlay",argc, 4);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimeline_init(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -20608,6 +20707,58 @@ int lua_cocos2dx_studio_ActionTimeline_getTimelines(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimeline_play(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimeline* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_play'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 2)
|
||||
{
|
||||
std::string arg0;
|
||||
bool arg1;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.ActionTimeline:play");
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "ccs.ActionTimeline:play");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimeline_play'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->play(arg0, arg1);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:play",argc, 2);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_play'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimeline_resume(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -20844,101 +20995,51 @@ int lua_cocos2dx_studio_ActionTimeline_isPlaying(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(lua_State* tolua_S)
|
||||
int lua_cocos2dx_studio_ActionTimeline_removeIndexes(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimeline* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_removeIndexes'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
do{
|
||||
if (argc == 2) {
|
||||
int arg0;
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
cobj->gotoFrameAndPlay(arg0, arg1);
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.ActionTimeline:removeIndexes");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimeline_removeIndexes'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
do{
|
||||
if (argc == 1) {
|
||||
int arg0;
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
cobj->gotoFrameAndPlay(arg0);
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
do{
|
||||
if (argc == 3) {
|
||||
int arg0;
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
int arg1;
|
||||
ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
bool arg2;
|
||||
ok &= luaval_to_boolean(tolua_S, 4,&arg2, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
cobj->gotoFrameAndPlay(arg0, arg1, arg2);
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
do{
|
||||
if (argc == 4) {
|
||||
int arg0;
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
int arg1;
|
||||
ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
int arg2;
|
||||
ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
bool arg3;
|
||||
ok &= luaval_to_boolean(tolua_S, 5,&arg3, "ccs.ActionTimeline:gotoFrameAndPlay");
|
||||
|
||||
if (!ok) { break; }
|
||||
cobj->gotoFrameAndPlay(arg0, arg1, arg2, arg3);
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:gotoFrameAndPlay",argc, 4);
|
||||
cobj->removeIndexes(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:removeIndexes",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_removeIndexes'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -21036,6 +21137,55 @@ int lua_cocos2dx_studio_ActionTimeline_getEndFrame(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimeline_setCurrentFrame(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimeline* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_setCurrentFrame'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
int arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:setCurrentFrame");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimeline_setCurrentFrame'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setCurrentFrame(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:setCurrentFrame",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_setCurrentFrame'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimeline_setTimeSpeed(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -21180,7 +21330,7 @@ int lua_cocos2dx_studio_ActionTimeline_setDuration(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimeline_setCurrentFrame(lua_State* tolua_S)
|
||||
int lua_cocos2dx_studio_ActionTimeline_addIndexes(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimeline* cobj = nullptr;
|
||||
|
@ -21200,7 +21350,7 @@ int lua_cocos2dx_studio_ActionTimeline_setCurrentFrame(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_setCurrentFrame'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_addIndexes'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -21208,23 +21358,24 @@ int lua_cocos2dx_studio_ActionTimeline_setCurrentFrame(lua_State* tolua_S)
|
|||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
int arg0;
|
||||
cocostudio::timeline::ActionIndexes arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:setCurrentFrame");
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR ActionIndexes
|
||||
ok = false;
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimeline_setCurrentFrame'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimeline_addIndexes'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setCurrentFrame(arg0);
|
||||
cobj->addIndexes(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:setCurrentFrame",argc, 1);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:addIndexes",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_setCurrentFrame'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_addIndexes'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -21318,22 +21469,25 @@ int lua_register_cocos2dx_studio_ActionTimeline(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getCurrentFrame",lua_cocos2dx_studio_ActionTimeline_getCurrentFrame);
|
||||
tolua_function(tolua_S,"getStartFrame",lua_cocos2dx_studio_ActionTimeline_getStartFrame);
|
||||
tolua_function(tolua_S,"pause",lua_cocos2dx_studio_ActionTimeline_pause);
|
||||
tolua_function(tolua_S,"gotoFrameAndPlay",lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay);
|
||||
tolua_function(tolua_S,"init",lua_cocos2dx_studio_ActionTimeline_init);
|
||||
tolua_function(tolua_S,"removeTimeline",lua_cocos2dx_studio_ActionTimeline_removeTimeline);
|
||||
tolua_function(tolua_S,"setLastFrameCallFunc",lua_cocos2dx_studio_ActionTimeline_setLastFrameCallFunc);
|
||||
tolua_function(tolua_S,"getTimelines",lua_cocos2dx_studio_ActionTimeline_getTimelines);
|
||||
tolua_function(tolua_S,"play",lua_cocos2dx_studio_ActionTimeline_play);
|
||||
tolua_function(tolua_S,"resume",lua_cocos2dx_studio_ActionTimeline_resume);
|
||||
tolua_function(tolua_S,"getTimeSpeed",lua_cocos2dx_studio_ActionTimeline_getTimeSpeed);
|
||||
tolua_function(tolua_S,"getDuration",lua_cocos2dx_studio_ActionTimeline_getDuration);
|
||||
tolua_function(tolua_S,"gotoFrameAndPause",lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPause);
|
||||
tolua_function(tolua_S,"isPlaying",lua_cocos2dx_studio_ActionTimeline_isPlaying);
|
||||
tolua_function(tolua_S,"gotoFrameAndPlay",lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay);
|
||||
tolua_function(tolua_S,"removeIndexes",lua_cocos2dx_studio_ActionTimeline_removeIndexes);
|
||||
tolua_function(tolua_S,"clearFrameEventCallFunc",lua_cocos2dx_studio_ActionTimeline_clearFrameEventCallFunc);
|
||||
tolua_function(tolua_S,"getEndFrame",lua_cocos2dx_studio_ActionTimeline_getEndFrame);
|
||||
tolua_function(tolua_S,"setCurrentFrame",lua_cocos2dx_studio_ActionTimeline_setCurrentFrame);
|
||||
tolua_function(tolua_S,"setTimeSpeed",lua_cocos2dx_studio_ActionTimeline_setTimeSpeed);
|
||||
tolua_function(tolua_S,"clearLastFrameCallFunc",lua_cocos2dx_studio_ActionTimeline_clearLastFrameCallFunc);
|
||||
tolua_function(tolua_S,"setDuration",lua_cocos2dx_studio_ActionTimeline_setDuration);
|
||||
tolua_function(tolua_S,"setCurrentFrame",lua_cocos2dx_studio_ActionTimeline_setCurrentFrame);
|
||||
tolua_function(tolua_S,"addIndexes",lua_cocos2dx_studio_ActionTimeline_addIndexes);
|
||||
tolua_function(tolua_S,"create", lua_cocos2dx_studio_ActionTimeline_create);
|
||||
tolua_endmodule(tolua_S);
|
||||
std::string typeName = typeid(cocostudio::timeline::ActionTimeline).name();
|
||||
|
@ -21341,6 +21495,354 @@ int lua_register_cocos2dx_studio_ActionTimeline(lua_State* tolua_S)
|
|||
g_typeCast["ActionTimeline"] = "ccs.ActionTimeline";
|
||||
return 1;
|
||||
}
|
||||
|
||||
int lua_cocos2dx_studio_ActionTimelineNode_getRoot(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineNode* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimelineNode",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimelineNode*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineNode_getRoot'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineNode_getRoot'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocos2d::Node* ret = cobj->getRoot();
|
||||
object_to_luaval<cocos2d::Node>(tolua_S, "cc.Node",(cocos2d::Node*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineNode:getRoot",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineNode_getRoot'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineNode_getActionTimeline(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineNode* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimelineNode",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimelineNode*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineNode_getActionTimeline'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineNode_getActionTimeline'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocostudio::timeline::ActionTimeline* ret = cobj->getActionTimeline();
|
||||
object_to_luaval<cocostudio::timeline::ActionTimeline>(tolua_S, "ccs.ActionTimeline",(cocostudio::timeline::ActionTimeline*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineNode:getActionTimeline",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineNode_getActionTimeline'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineNode_setActionTimeline(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineNode* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimelineNode",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimelineNode*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineNode_setActionTimeline'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocostudio::timeline::ActionTimeline* arg0;
|
||||
|
||||
ok &= luaval_to_object<cocostudio::timeline::ActionTimeline>(tolua_S, 2, "ccs.ActionTimeline",&arg0);
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineNode_setActionTimeline'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setActionTimeline(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineNode:setActionTimeline",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineNode_setActionTimeline'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineNode_init(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineNode* cobj = nullptr;
|
||||
bool ok = true;
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimelineNode",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
cobj = (cocostudio::timeline::ActionTimelineNode*)tolua_tousertype(tolua_S,1,0);
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineNode_init'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
do{
|
||||
if (argc == 2) {
|
||||
cocos2d::Node* arg0;
|
||||
ok &= luaval_to_object<cocos2d::Node>(tolua_S, 2, "cc.Node",&arg0);
|
||||
|
||||
if (!ok) { break; }
|
||||
cocostudio::timeline::ActionTimeline* arg1;
|
||||
ok &= luaval_to_object<cocostudio::timeline::ActionTimeline>(tolua_S, 3, "ccs.ActionTimeline",&arg1);
|
||||
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->init(arg0, arg1);
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
do{
|
||||
if (argc == 0) {
|
||||
bool ret = cobj->init();
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
}while(0);
|
||||
ok = true;
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineNode:init",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineNode_init'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineNode_setRoot(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineNode* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimelineNode",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocostudio::timeline::ActionTimelineNode*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineNode_setRoot'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::Node* arg0;
|
||||
|
||||
ok &= luaval_to_object<cocos2d::Node>(tolua_S, 2, "cc.Node",&arg0);
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineNode_setRoot'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setRoot(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineNode:setRoot",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineNode_setRoot'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineNode_create(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertable(tolua_S,1,"ccs.ActionTimelineNode",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S) - 1;
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
cocos2d::Node* arg0;
|
||||
cocostudio::timeline::ActionTimeline* arg1;
|
||||
ok &= luaval_to_object<cocos2d::Node>(tolua_S, 2, "cc.Node",&arg0);
|
||||
ok &= luaval_to_object<cocostudio::timeline::ActionTimeline>(tolua_S, 3, "ccs.ActionTimeline",&arg1);
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineNode_create'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocostudio::timeline::ActionTimelineNode* ret = cocostudio::timeline::ActionTimelineNode::create(arg0, arg1);
|
||||
object_to_luaval<cocostudio::timeline::ActionTimelineNode>(tolua_S, "ccs.ActionTimelineNode",(cocostudio::timeline::ActionTimelineNode*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccs.ActionTimelineNode:create",argc, 2);
|
||||
return 0;
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineNode_create'.",&tolua_err);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_studio_ActionTimelineNode_constructor(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocostudio::timeline::ActionTimelineNode* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ActionTimelineNode_constructor'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj = new cocostudio::timeline::ActionTimelineNode();
|
||||
cobj->autorelease();
|
||||
int ID = (int)cobj->_ID ;
|
||||
int* luaID = &cobj->_luaID ;
|
||||
toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"ccs.ActionTimelineNode");
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimelineNode:ActionTimelineNode",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineNode_constructor'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_studio_ActionTimelineNode_finalize(lua_State* tolua_S)
|
||||
{
|
||||
printf("luabindings: finalizing LUA object (ActionTimelineNode)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lua_register_cocos2dx_studio_ActionTimelineNode(lua_State* tolua_S)
|
||||
{
|
||||
tolua_usertype(tolua_S,"ccs.ActionTimelineNode");
|
||||
tolua_cclass(tolua_S,"ActionTimelineNode","ccs.ActionTimelineNode","cc.Node",nullptr);
|
||||
|
||||
tolua_beginmodule(tolua_S,"ActionTimelineNode");
|
||||
tolua_function(tolua_S,"new",lua_cocos2dx_studio_ActionTimelineNode_constructor);
|
||||
tolua_function(tolua_S,"getRoot",lua_cocos2dx_studio_ActionTimelineNode_getRoot);
|
||||
tolua_function(tolua_S,"getActionTimeline",lua_cocos2dx_studio_ActionTimelineNode_getActionTimeline);
|
||||
tolua_function(tolua_S,"setActionTimeline",lua_cocos2dx_studio_ActionTimelineNode_setActionTimeline);
|
||||
tolua_function(tolua_S,"init",lua_cocos2dx_studio_ActionTimelineNode_init);
|
||||
tolua_function(tolua_S,"setRoot",lua_cocos2dx_studio_ActionTimelineNode_setRoot);
|
||||
tolua_function(tolua_S,"create", lua_cocos2dx_studio_ActionTimelineNode_create);
|
||||
tolua_endmodule(tolua_S);
|
||||
std::string typeName = typeid(cocostudio::timeline::ActionTimelineNode).name();
|
||||
g_luaType[typeName] = "ccs.ActionTimelineNode";
|
||||
g_typeCast["ActionTimelineNode"] = "ccs.ActionTimelineNode";
|
||||
return 1;
|
||||
}
|
||||
TOLUA_API int register_all_cocos2dx_studio(lua_State* tolua_S)
|
||||
{
|
||||
tolua_open(tolua_S);
|
||||
|
@ -21348,6 +21850,7 @@ TOLUA_API int register_all_cocos2dx_studio(lua_State* tolua_S)
|
|||
tolua_module(tolua_S,"ccs",0);
|
||||
tolua_beginmodule(tolua_S,"ccs");
|
||||
|
||||
lua_register_cocos2dx_studio_ActionTimelineNode(tolua_S);
|
||||
lua_register_cocos2dx_studio_ActionFrame(tolua_S);
|
||||
lua_register_cocos2dx_studio_ActionRotationFrame(tolua_S);
|
||||
lua_register_cocos2dx_studio_Frame(tolua_S);
|
||||
|
|
|
@ -478,6 +478,17 @@ int register_all_cocos2dx_studio(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7135,7 +7135,7 @@ int lua_cocos2dx_ui_Button_getTitleColor(lua_State* tolua_S)
|
|||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Button_getTitleColor'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
const cocos2d::Color3B& ret = cobj->getTitleColor();
|
||||
cocos2d::Color3B ret = cobj->getTitleColor();
|
||||
color3b_to_luaval(tolua_S, ret);
|
||||
return 1;
|
||||
}
|
||||
|
@ -7900,6 +7900,53 @@ int lua_cocos2dx_ui_CheckBox_loadTextures(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_CheckBox_getZoomScale(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::CheckBox* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.CheckBox",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::CheckBox*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_CheckBox_getZoomScale'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_CheckBox_getZoomScale'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
double ret = cobj->getZoomScale();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.CheckBox:getZoomScale",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_CheckBox_getZoomScale'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_CheckBox_loadTextureBackGround(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -7965,6 +8012,55 @@ int lua_cocos2dx_ui_CheckBox_loadTextureBackGround(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_CheckBox_setZoomScale(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::CheckBox* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.CheckBox",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::CheckBox*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_CheckBox_setZoomScale'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
double arg0;
|
||||
|
||||
ok &= luaval_to_number(tolua_S, 2,&arg0, "ccui.CheckBox:setZoomScale");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_CheckBox_setZoomScale'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setZoomScale(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.CheckBox:setZoomScale",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_CheckBox_setZoomScale'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -8107,7 +8203,42 @@ int lua_cocos2dx_ui_CheckBox_create(lua_State* tolua_S)
|
|||
}
|
||||
} while (0);
|
||||
ok = true;
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "ccui.CheckBox:create",argc, 0);
|
||||
do
|
||||
{
|
||||
if (argc == 2)
|
||||
{
|
||||
std::string arg0;
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.CheckBox:create");
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "ccui.CheckBox:create");
|
||||
if (!ok) { break; }
|
||||
cocos2d::ui::CheckBox* ret = cocos2d::ui::CheckBox::create(arg0, arg1);
|
||||
object_to_luaval<cocos2d::ui::CheckBox>(tolua_S, "ccui.CheckBox",(cocos2d::ui::CheckBox*)ret);
|
||||
return 1;
|
||||
}
|
||||
} while (0);
|
||||
ok = true;
|
||||
do
|
||||
{
|
||||
if (argc == 3)
|
||||
{
|
||||
std::string arg0;
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.CheckBox:create");
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "ccui.CheckBox:create");
|
||||
if (!ok) { break; }
|
||||
cocos2d::ui::Widget::TextureResType arg2;
|
||||
ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "ccui.CheckBox:create");
|
||||
if (!ok) { break; }
|
||||
cocos2d::ui::CheckBox* ret = cocos2d::ui::CheckBox::create(arg0, arg1, arg2);
|
||||
object_to_luaval<cocos2d::ui::CheckBox>(tolua_S, "ccui.CheckBox",(cocos2d::ui::CheckBox*)ret);
|
||||
return 1;
|
||||
}
|
||||
} while (0);
|
||||
ok = true;
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "ccui.CheckBox:create",argc, 2);
|
||||
return 0;
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
|
@ -8206,7 +8337,9 @@ int lua_register_cocos2dx_ui_CheckBox(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"loadTextureFrontCross",lua_cocos2dx_ui_CheckBox_loadTextureFrontCross);
|
||||
tolua_function(tolua_S,"isSelected",lua_cocos2dx_ui_CheckBox_isSelected);
|
||||
tolua_function(tolua_S,"loadTextures",lua_cocos2dx_ui_CheckBox_loadTextures);
|
||||
tolua_function(tolua_S,"getZoomScale",lua_cocos2dx_ui_CheckBox_getZoomScale);
|
||||
tolua_function(tolua_S,"loadTextureBackGround",lua_cocos2dx_ui_CheckBox_loadTextureBackGround);
|
||||
tolua_function(tolua_S,"setZoomScale",lua_cocos2dx_ui_CheckBox_setZoomScale);
|
||||
tolua_function(tolua_S,"loadTextureFrontCrossDisabled",lua_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled);
|
||||
tolua_function(tolua_S,"create", lua_cocos2dx_ui_CheckBox_create);
|
||||
tolua_function(tolua_S,"createInstance", lua_cocos2dx_ui_CheckBox_createInstance);
|
||||
|
@ -14153,6 +14286,35 @@ int lua_cocos2dx_ui_Slider_loadSlidBallTextures(lua_State* tolua_S)
|
|||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadSlidBallTextures");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadSlidBallTextures'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->loadSlidBallTextures(arg0);
|
||||
return 0;
|
||||
}
|
||||
if (argc == 2)
|
||||
{
|
||||
std::string arg0;
|
||||
std::string arg1;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadSlidBallTextures");
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "ccui.Slider:loadSlidBallTextures");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadSlidBallTextures'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->loadSlidBallTextures(arg0, arg1);
|
||||
return 0;
|
||||
}
|
||||
if (argc == 3)
|
||||
{
|
||||
std::string arg0;
|
||||
|
@ -14194,7 +14356,7 @@ int lua_cocos2dx_ui_Slider_loadSlidBallTextures(lua_State* tolua_S)
|
|||
cobj->loadSlidBallTextures(arg0, arg1, arg2, arg3);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:loadSlidBallTextures",argc, 3);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:loadSlidBallTextures",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
|
@ -14398,6 +14560,55 @@ int lua_cocos2dx_ui_Slider_setScale9Enabled(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Slider_setZoomScale(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Slider* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_setZoomScale'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
double arg0;
|
||||
|
||||
ok &= luaval_to_number(tolua_S, 2,&arg0, "ccui.Slider:setZoomScale");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_setZoomScale'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setZoomScale(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:setZoomScale",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_setZoomScale'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Slider_setCapInsets(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -14447,6 +14658,53 @@ int lua_cocos2dx_ui_Slider_setCapInsets(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Slider_getZoomScale(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Slider* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getZoomScale'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getZoomScale'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
double ret = cobj->getZoomScale();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getZoomScale",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getZoomScale'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Slider_addEventListener(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -14710,7 +14968,6 @@ int lua_cocos2dx_ui_Slider_create(lua_State* tolua_S)
|
|||
{
|
||||
int argc = 0;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
@ -14719,20 +14976,54 @@ int lua_cocos2dx_ui_Slider_create(lua_State* tolua_S)
|
|||
if (!tolua_isusertable(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S) - 1;
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
|
||||
if (argc == 0)
|
||||
do
|
||||
{
|
||||
if(!ok)
|
||||
if (argc == 2)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_create'", nullptr);
|
||||
return 0;
|
||||
std::string arg0;
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:create");
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "ccui.Slider:create");
|
||||
if (!ok) { break; }
|
||||
cocos2d::ui::Slider* ret = cocos2d::ui::Slider::create(arg0, arg1);
|
||||
object_to_luaval<cocos2d::ui::Slider>(tolua_S, "ccui.Slider",(cocos2d::ui::Slider*)ret);
|
||||
return 1;
|
||||
}
|
||||
cocos2d::ui::Slider* ret = cocos2d::ui::Slider::create();
|
||||
object_to_luaval<cocos2d::ui::Slider>(tolua_S, "ccui.Slider",(cocos2d::ui::Slider*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccui.Slider:create",argc, 0);
|
||||
} while (0);
|
||||
ok = true;
|
||||
do
|
||||
{
|
||||
if (argc == 3)
|
||||
{
|
||||
std::string arg0;
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:create");
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "ccui.Slider:create");
|
||||
if (!ok) { break; }
|
||||
cocos2d::ui::Widget::TextureResType arg2;
|
||||
ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "ccui.Slider:create");
|
||||
if (!ok) { break; }
|
||||
cocos2d::ui::Slider* ret = cocos2d::ui::Slider::create(arg0, arg1, arg2);
|
||||
object_to_luaval<cocos2d::ui::Slider>(tolua_S, "ccui.Slider",(cocos2d::ui::Slider*)ret);
|
||||
return 1;
|
||||
}
|
||||
} while (0);
|
||||
ok = true;
|
||||
do
|
||||
{
|
||||
if (argc == 0)
|
||||
{
|
||||
cocos2d::ui::Slider* ret = cocos2d::ui::Slider::create();
|
||||
object_to_luaval<cocos2d::ui::Slider>(tolua_S, "ccui.Slider",(cocos2d::ui::Slider*)ret);
|
||||
return 1;
|
||||
}
|
||||
} while (0);
|
||||
ok = true;
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "ccui.Slider:create",argc, 0);
|
||||
return 0;
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
|
@ -14834,7 +15125,9 @@ int lua_register_cocos2dx_ui_Slider(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"setCapInsetsBarRenderer",lua_cocos2dx_ui_Slider_setCapInsetsBarRenderer);
|
||||
tolua_function(tolua_S,"getCapInsetsProgressBarRebderer",lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer);
|
||||
tolua_function(tolua_S,"setScale9Enabled",lua_cocos2dx_ui_Slider_setScale9Enabled);
|
||||
tolua_function(tolua_S,"setZoomScale",lua_cocos2dx_ui_Slider_setZoomScale);
|
||||
tolua_function(tolua_S,"setCapInsets",lua_cocos2dx_ui_Slider_setCapInsets);
|
||||
tolua_function(tolua_S,"getZoomScale",lua_cocos2dx_ui_Slider_getZoomScale);
|
||||
tolua_function(tolua_S,"addEventListener",lua_cocos2dx_ui_Slider_addEventListener);
|
||||
tolua_function(tolua_S,"loadSlidBallTexturePressed",lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed);
|
||||
tolua_function(tolua_S,"isScale9Enabled",lua_cocos2dx_ui_Slider_isScale9Enabled);
|
||||
|
@ -19910,6 +20203,55 @@ int lua_cocos2dx_ui_Scale9Sprite_isFlippedX(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Scale9Sprite_setScale9Enabled(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Scale9Sprite* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.Scale9Sprite",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::Scale9Sprite*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_setScale9Enabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
bool arg0;
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccui.Scale9Sprite:setScale9Enabled");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_setScale9Enabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setScale9Enabled(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:setScale9Enabled",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_setScale9Enabled'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Scale9Sprite_setFlippedY(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -20008,7 +20350,7 @@ int lua_cocos2dx_ui_Scale9Sprite_setFlippedX(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Scale9Sprite_setScale9Enabled(lua_State* tolua_S)
|
||||
int lua_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Scale9Sprite* cobj = nullptr;
|
||||
|
@ -20028,7 +20370,7 @@ int lua_cocos2dx_ui_Scale9Sprite_setScale9Enabled(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_setScale9Enabled'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -20036,23 +20378,24 @@ int lua_cocos2dx_ui_Scale9Sprite_setScale9Enabled(lua_State* tolua_S)
|
|||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
bool arg0;
|
||||
cocos2d::Rect arg0;
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccui.Scale9Sprite:setScale9Enabled");
|
||||
ok &= luaval_to_rect(tolua_S, 2, &arg0, "ccui.Scale9Sprite:resizableSpriteWithCapInsets");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_setScale9Enabled'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setScale9Enabled(arg0);
|
||||
return 0;
|
||||
cocos2d::ui::Scale9Sprite* ret = cobj->resizableSpriteWithCapInsets(arg0);
|
||||
object_to_luaval<cocos2d::ui::Scale9Sprite>(tolua_S, "ccui.Scale9Sprite",(cocos2d::ui::Scale9Sprite*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:setScale9Enabled",argc, 1);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:resizableSpriteWithCapInsets",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_setScale9Enabled'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -20103,6 +20446,55 @@ int lua_cocos2dx_ui_Scale9Sprite_disableCascadeOpacity(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Scale9Sprite_setState(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Scale9Sprite* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.Scale9Sprite",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::Scale9Sprite*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_setState'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::ui::Scale9Sprite::State arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.Scale9Sprite:setState");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_setState'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setState(arg0);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:setState",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_setState'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Scale9Sprite_setInsetBottom(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -20471,53 +20863,6 @@ int lua_cocos2dx_ui_Scale9Sprite_setPreferredSize(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Scale9Sprite_getInsetRight(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Scale9Sprite* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.Scale9Sprite",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::Scale9Sprite*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_getInsetRight'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_getInsetRight'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
double ret = cobj->getInsetRight();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:getInsetRight",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_getInsetRight'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Scale9Sprite_setSpriteFrame(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -20630,7 +20975,7 @@ int lua_cocos2dx_ui_Scale9Sprite_getInsetBottom(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets(lua_State* tolua_S)
|
||||
int lua_cocos2dx_ui_Scale9Sprite_getCapInsets(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Scale9Sprite* cobj = nullptr;
|
||||
|
@ -20650,32 +20995,29 @@ int lua_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets(lua_State* tolua_S
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_getCapInsets'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
if (argc == 0)
|
||||
{
|
||||
cocos2d::Rect arg0;
|
||||
|
||||
ok &= luaval_to_rect(tolua_S, 2, &arg0, "ccui.Scale9Sprite:resizableSpriteWithCapInsets");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_getCapInsets'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocos2d::ui::Scale9Sprite* ret = cobj->resizableSpriteWithCapInsets(arg0);
|
||||
object_to_luaval<cocos2d::ui::Scale9Sprite>(tolua_S, "ccui.Scale9Sprite",(cocos2d::ui::Scale9Sprite*)ret);
|
||||
cocos2d::Rect ret = cobj->getCapInsets();
|
||||
rect_to_luaval(tolua_S, ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:resizableSpriteWithCapInsets",argc, 1);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:getCapInsets",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_getCapInsets'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -20727,7 +21069,7 @@ int lua_cocos2dx_ui_Scale9Sprite_isScale9Enabled(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_Scale9Sprite_getCapInsets(lua_State* tolua_S)
|
||||
int lua_cocos2dx_ui_Scale9Sprite_getInsetRight(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::Scale9Sprite* cobj = nullptr;
|
||||
|
@ -20747,7 +21089,7 @@ int lua_cocos2dx_ui_Scale9Sprite_getCapInsets(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_getCapInsets'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_getInsetRight'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -20757,19 +21099,19 @@ int lua_cocos2dx_ui_Scale9Sprite_getCapInsets(lua_State* tolua_S)
|
|||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_getCapInsets'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_getInsetRight'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocos2d::Rect ret = cobj->getCapInsets();
|
||||
rect_to_luaval(tolua_S, ret);
|
||||
double ret = cobj->getInsetRight();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:getCapInsets",argc, 0);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:getInsetRight",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_getCapInsets'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_getInsetRight'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -21561,22 +21903,23 @@ int lua_register_cocos2dx_ui_Scale9Sprite(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"disableCascadeColor",lua_cocos2dx_ui_Scale9Sprite_disableCascadeColor);
|
||||
tolua_function(tolua_S,"updateWithSprite",lua_cocos2dx_ui_Scale9Sprite_updateWithSprite);
|
||||
tolua_function(tolua_S,"isFlippedX",lua_cocos2dx_ui_Scale9Sprite_isFlippedX);
|
||||
tolua_function(tolua_S,"setScale9Enabled",lua_cocos2dx_ui_Scale9Sprite_setScale9Enabled);
|
||||
tolua_function(tolua_S,"setFlippedY",lua_cocos2dx_ui_Scale9Sprite_setFlippedY);
|
||||
tolua_function(tolua_S,"setFlippedX",lua_cocos2dx_ui_Scale9Sprite_setFlippedX);
|
||||
tolua_function(tolua_S,"setScale9Enabled",lua_cocos2dx_ui_Scale9Sprite_setScale9Enabled);
|
||||
tolua_function(tolua_S,"resizableSpriteWithCapInsets",lua_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets);
|
||||
tolua_function(tolua_S,"disableCascadeOpacity",lua_cocos2dx_ui_Scale9Sprite_disableCascadeOpacity);
|
||||
tolua_function(tolua_S,"setState",lua_cocos2dx_ui_Scale9Sprite_setState);
|
||||
tolua_function(tolua_S,"setInsetBottom",lua_cocos2dx_ui_Scale9Sprite_setInsetBottom);
|
||||
tolua_function(tolua_S,"initWithSpriteFrameName",lua_cocos2dx_ui_Scale9Sprite_initWithSpriteFrameName);
|
||||
tolua_function(tolua_S,"getSprite",lua_cocos2dx_ui_Scale9Sprite_getSprite);
|
||||
tolua_function(tolua_S,"setInsetTop",lua_cocos2dx_ui_Scale9Sprite_setInsetTop);
|
||||
tolua_function(tolua_S,"init",lua_cocos2dx_ui_Scale9Sprite_init);
|
||||
tolua_function(tolua_S,"setPreferredSize",lua_cocos2dx_ui_Scale9Sprite_setPreferredSize);
|
||||
tolua_function(tolua_S,"getInsetRight",lua_cocos2dx_ui_Scale9Sprite_getInsetRight);
|
||||
tolua_function(tolua_S,"setSpriteFrame",lua_cocos2dx_ui_Scale9Sprite_setSpriteFrame);
|
||||
tolua_function(tolua_S,"getInsetBottom",lua_cocos2dx_ui_Scale9Sprite_getInsetBottom);
|
||||
tolua_function(tolua_S,"resizableSpriteWithCapInsets",lua_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets);
|
||||
tolua_function(tolua_S,"isScale9Enabled",lua_cocos2dx_ui_Scale9Sprite_isScale9Enabled);
|
||||
tolua_function(tolua_S,"getCapInsets",lua_cocos2dx_ui_Scale9Sprite_getCapInsets);
|
||||
tolua_function(tolua_S,"isScale9Enabled",lua_cocos2dx_ui_Scale9Sprite_isScale9Enabled);
|
||||
tolua_function(tolua_S,"getInsetRight",lua_cocos2dx_ui_Scale9Sprite_getInsetRight);
|
||||
tolua_function(tolua_S,"getOriginalSize",lua_cocos2dx_ui_Scale9Sprite_getOriginalSize);
|
||||
tolua_function(tolua_S,"initWithFile",lua_cocos2dx_ui_Scale9Sprite_initWithFile);
|
||||
tolua_function(tolua_S,"getInsetTop",lua_cocos2dx_ui_Scale9Sprite_getInsetTop);
|
||||
|
|
|
@ -486,6 +486,11 @@ int register_all_cocos2dx_ui(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2328,6 +2328,49 @@ tolua_lerror:
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lua_cocos2dx_Node_setRotationQuat(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Node* cobj = nullptr;
|
||||
bool ok = true;
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0);
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_setRotationQuat'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
do{
|
||||
if (argc == 1) {
|
||||
cocos2d::Quaternion arg0;
|
||||
ok &= luaval_to_quaternion(tolua_S, 2, &arg0, "cc.Node:setRotationQuat");
|
||||
|
||||
if (!ok) { break; }
|
||||
cobj->setRotationQuat(arg0);
|
||||
return 0;
|
||||
}
|
||||
}while(0);
|
||||
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setRotationQuat",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_setRotationQuat'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_cocos2d_Spawn_create(lua_State* tolua_S)
|
||||
{
|
||||
if (NULL == tolua_S)
|
||||
|
@ -4403,6 +4446,9 @@ static void extendNode(lua_State* tolua_S)
|
|||
lua_pushstring(tolua_S, "setAdditionalTransform");
|
||||
lua_pushcfunction(tolua_S, lua_cocos2dx_Node_setAdditionalTransform);
|
||||
lua_rawset(tolua_S, -3);
|
||||
lua_pushstring(tolua_S, "setRotationQuat");
|
||||
lua_pushcfunction(tolua_S, lua_cocos2dx_Node_setRotationQuat);
|
||||
lua_rawset(tolua_S, -3);
|
||||
}
|
||||
lua_pop(tolua_S, 1);
|
||||
}
|
||||
|
|
|
@ -289,6 +289,55 @@ 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 }
|
||||
|
|
|
@ -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
|
|
@ -1,93 +0,0 @@
|
|||
|
||||
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 new_table = {}
|
||||
lookup_table[object] = new_table
|
||||
for key, value in pairs(object) do
|
||||
new_table[_copy(key)] = _copy(value)
|
||||
end
|
||||
return setmetatable(new_table, getmetatable(object))
|
||||
end
|
||||
return _copy(object)
|
||||
end
|
||||
|
||||
--Create an class.
|
||||
function class(classname, super)
|
||||
local superType = type(super)
|
||||
local cls
|
||||
|
||||
if superType ~= "function" and superType ~= "table" then
|
||||
superType = nil
|
||||
super = nil
|
||||
end
|
||||
|
||||
if superType == "function" or (super and super.__ctype == 1) then
|
||||
-- inherited from native C++ Object
|
||||
cls = {}
|
||||
|
||||
if superType == "table" then
|
||||
-- copy fields from super
|
||||
for k,v in pairs(super) do cls[k] = v end
|
||||
cls.__create = super.__create
|
||||
cls.super = super
|
||||
else
|
||||
cls.__create = super
|
||||
end
|
||||
|
||||
cls.ctor = function() end
|
||||
cls.__cname = classname
|
||||
cls.__ctype = 1
|
||||
|
||||
function cls.new(...)
|
||||
local instance = cls.__create(...)
|
||||
-- copy fields from class to native object
|
||||
for k,v in pairs(cls) do instance[k] = v end
|
||||
instance.class = cls
|
||||
instance:ctor(...)
|
||||
return instance
|
||||
end
|
||||
|
||||
else
|
||||
-- inherited from Lua Object
|
||||
if super then
|
||||
cls = clone(super)
|
||||
cls.super = super
|
||||
else
|
||||
cls = {ctor = function() end}
|
||||
end
|
||||
|
||||
cls.__cname = classname
|
||||
cls.__ctype = 2 -- lua
|
||||
cls.__index = cls
|
||||
|
||||
function cls.new(...)
|
||||
local instance = setmetatable({}, cls)
|
||||
instance.class = cls
|
||||
instance:ctor(...)
|
||||
return instance
|
||||
end
|
||||
end
|
||||
|
||||
return cls
|
||||
end
|
||||
|
||||
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
|
|
@ -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 "<var>"
|
||||
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", "<br />")
|
||||
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
|
|
@ -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
|
|
@ -0,0 +1,155 @@
|
|||
|
||||
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:addEventListener(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
|
||||
|
||||
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
|
|
@ -0,0 +1,104 @@
|
|||
--[[
|
||||
|
||||
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 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
|
|
@ -0,0 +1,534 @@
|
|||
--[[
|
||||
|
||||
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
|
||||
elseif r.autoscale == "FIXED_HEIGHT" then
|
||||
width = framesize.width / scaleY
|
||||
height = framesize.height / scaleY
|
||||
else
|
||||
printError(string.format("display - invalid r.autoscale \"%s\"", r.autoscale))
|
||||
end
|
||||
view:setDesignResolutionSize(width, height, cc.ResolutionPolicy.NO_BORDER)
|
||||
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 "<unknown-scene>", 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.TEXTURE2D_PIXEL_FORMAT_RGBA8888)
|
||||
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(souce) == 35 then -- first char is #
|
||||
souce = string.sub(souce, 2)
|
||||
end
|
||||
frame = spriteFrameCache:getSpriteFrame(souce)
|
||||
if not frame then
|
||||
error(string.format("display.newSpriteFrame() - invalid frame name \"%s\"", tostring(souce)), 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.TEXTURE2D_PIXEL_FORMAT_RGBA8888)
|
||||
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
|
|
@ -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
|
||||
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
|
|
@ -1,7 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
--[[
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
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
|
||||
|
@ -20,14 +19,13 @@ 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.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __SIMULATOR_WINDOW_H_
|
||||
#define __SIMULATOR_WINDOW_H_
|
||||
]]
|
||||
|
||||
/************************
|
||||
@brief create Simulator
|
||||
*********************************/
|
||||
void createSimulator(const char* viewName, float width, float height,bool isLandscape = true,float frameZoomFactor = 1.0f);
|
||||
local Menu = cc.Menu
|
||||
local MenuItem = cc.MenuItem
|
||||
|
||||
#endif /* __PROJECT_CONFIG_H_ */
|
||||
function MenuItem:onClicked(callback)
|
||||
self:registerScriptTapHandler(callback)
|
||||
return self
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue