mirror of https://github.com/axmolengine/axmol.git
Merge remote-tracking branch 'upstream/develop' into fix-console-windows-crash
This commit is contained in:
commit
115d3e4a3b
8
AUTHORS
8
AUTHORS
|
@ -763,7 +763,13 @@ Developers:
|
|||
s3tc compressed textures with no mipmaps fail to be loaded.
|
||||
|
||||
floatinghotpot
|
||||
Fix a bug that no callback is invoked when websocket connection fails
|
||||
Fixed a bug that no callback is invoked when websocket connection fails
|
||||
|
||||
Linghui
|
||||
Updated README of template: fix wrong platform java path.
|
||||
|
||||
seemk
|
||||
Fixed crash if invoking Director::end() on WINDOWS.
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
|
|
18
CHANGELOG
18
CHANGELOG
|
@ -1,12 +1,20 @@
|
|||
cocos2d-x-3.0rc0 Feb.?? 2014
|
||||
[All]
|
||||
[NEW] Adds more console commands: director resume|pause|stopanimation|startanimation.
|
||||
[NEW] Adds Dutch Language support.
|
||||
[NEW] Action: RotateBy supports 3D rotations
|
||||
[NEW] Bindings: Using python to automatically generate script bindings
|
||||
[NEW] Bindings: Added JS bindings support for Linux
|
||||
[NEW] Console: Added 'resolution', 'projection' commands. Improved API
|
||||
[NEW] Console: Added more commands: director resume|pause|stopanimation|startanimation.
|
||||
[NEW] Director: Displays 'Vertices drawn' in the stats. Useful to measure performance.
|
||||
[NEW] Using python to automatically generate script bindings codes.
|
||||
[NEW] Linux javascript bindings support.
|
||||
|
||||
[NEW] Node: Added set/get Position3D() and set/get Rotation3D()
|
||||
Node: Calculates rotation X and Y correctly.
|
||||
Node: set/get VertexZ() -> set/get PositionZ()
|
||||
Node: setRotationX() -> setRotationSkewX()
|
||||
Node: setRotationY() -> setRotationSkewY()
|
||||
[NEW] Language: Added Dutch support.
|
||||
[NEW] Sprite: Added auto-culling support
|
||||
|
||||
[FIX] Crash if invoking Director::end() on WINDOWS.
|
||||
[FIX] Character would not be aligned on the baseline when label using distance field.
|
||||
[FIX] Adds a macro to disable inserting script binding relevant codes.
|
||||
[FIX] Removing child from TMXLayer may cause crash.
|
||||
|
|
|
@ -1 +1 @@
|
|||
e3331b31586222de318fe42b3d7d9a22c23f2d1f
|
||||
96ebe58c64783ed2e976ff504db835a397475f00
|
|
@ -747,7 +747,7 @@ void RotateTo::startWithTarget(Node *target)
|
|||
ActionInterval::startWithTarget(target);
|
||||
|
||||
// Calculate X
|
||||
_startAngleX = target->getRotationX();
|
||||
_startAngleX = target->getRotationSkewX();
|
||||
if (_startAngleX > 0)
|
||||
{
|
||||
_startAngleX = fmodf(_startAngleX, 360.0f);
|
||||
|
@ -768,7 +768,7 @@ void RotateTo::startWithTarget(Node *target)
|
|||
}
|
||||
|
||||
//Calculate Y: It's duplicated from calculating X since the rotation wrap should be the same
|
||||
_startAngleY = _target->getRotationY();
|
||||
_startAngleY = _target->getRotationSkewY();
|
||||
|
||||
if (_startAngleY > 0)
|
||||
{
|
||||
|
@ -795,8 +795,8 @@ void RotateTo::update(float time)
|
|||
{
|
||||
if (_target)
|
||||
{
|
||||
_target->setRotationX(_startAngleX + _diffAngleX * time);
|
||||
_target->setRotationY(_startAngleY + _diffAngleY * time);
|
||||
_target->setRotationSkewX(_startAngleX + _diffAngleX * time);
|
||||
_target->setRotationSkewY(_startAngleY + _diffAngleY * time);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -819,17 +819,6 @@ RotateBy* RotateBy::create(float duration, float deltaAngle)
|
|||
return rotateBy;
|
||||
}
|
||||
|
||||
bool RotateBy::initWithDuration(float duration, float deltaAngle)
|
||||
{
|
||||
if (ActionInterval::initWithDuration(duration))
|
||||
{
|
||||
_angleX = _angleY = deltaAngle;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
RotateBy* RotateBy::create(float duration, float deltaAngleX, float deltaAngleY)
|
||||
{
|
||||
RotateBy *rotateBy = new RotateBy();
|
||||
|
@ -839,23 +828,64 @@ RotateBy* RotateBy::create(float duration, float deltaAngleX, float deltaAngleY)
|
|||
return rotateBy;
|
||||
}
|
||||
|
||||
RotateBy* RotateBy::create(float duration, const Vertex3F& deltaAngle3D)
|
||||
{
|
||||
RotateBy *rotateBy = new RotateBy();
|
||||
rotateBy->initWithDuration(duration, deltaAngle3D);
|
||||
rotateBy->autorelease();
|
||||
|
||||
return rotateBy;
|
||||
}
|
||||
|
||||
RotateBy::RotateBy()
|
||||
: _is3D(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool RotateBy::initWithDuration(float duration, float deltaAngle)
|
||||
{
|
||||
if (ActionInterval::initWithDuration(duration))
|
||||
{
|
||||
_angleZ_X = _angleZ_Y = deltaAngle;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RotateBy::initWithDuration(float duration, float deltaAngleX, float deltaAngleY)
|
||||
{
|
||||
if (ActionInterval::initWithDuration(duration))
|
||||
{
|
||||
_angleX = deltaAngleX;
|
||||
_angleY = deltaAngleY;
|
||||
_angleZ_X = deltaAngleX;
|
||||
_angleZ_Y = deltaAngleY;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RotateBy::initWithDuration(float duration, const Vertex3F& deltaAngle3D)
|
||||
{
|
||||
if (ActionInterval::initWithDuration(duration))
|
||||
{
|
||||
_angle3D = deltaAngle3D;
|
||||
_is3D = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
RotateBy* RotateBy::clone(void) const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new RotateBy();
|
||||
a->initWithDuration(_duration, _angleX, _angleY);
|
||||
if(_is3D)
|
||||
a->initWithDuration(_duration, _angle3D);
|
||||
else
|
||||
a->initWithDuration(_duration, _angleZ_X, _angleZ_Y);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -863,8 +893,15 @@ RotateBy* RotateBy::clone(void) const
|
|||
void RotateBy::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(target);
|
||||
_startAngleX = target->getRotationX();
|
||||
_startAngleY = target->getRotationY();
|
||||
if(_is3D)
|
||||
{
|
||||
_startAngle3D = target->getRotation3D();
|
||||
}
|
||||
else
|
||||
{
|
||||
_startAngleZ_X = target->getRotationSkewX();
|
||||
_startAngleZ_Y = target->getRotationSkewY();
|
||||
}
|
||||
}
|
||||
|
||||
void RotateBy::update(float time)
|
||||
|
@ -872,14 +909,33 @@ void RotateBy::update(float time)
|
|||
// XXX: shall I add % 360
|
||||
if (_target)
|
||||
{
|
||||
_target->setRotationX(_startAngleX + _angleX * time);
|
||||
_target->setRotationY(_startAngleY + _angleY * time);
|
||||
if(_is3D)
|
||||
{
|
||||
Vertex3F v;
|
||||
v.x = _startAngle3D.x + _angle3D.x * time;
|
||||
v.y = _startAngle3D.y + _angle3D.y * time;
|
||||
v.z = _startAngle3D.z + _angle3D.z * time;
|
||||
_target->setRotation3D(v);
|
||||
}
|
||||
else
|
||||
{
|
||||
_target->setRotationSkewX(_startAngleZ_X + _angleZ_X * time);
|
||||
_target->setRotationSkewY(_startAngleZ_Y + _angleZ_Y * time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RotateBy* RotateBy::reverse() const
|
||||
{
|
||||
return RotateBy::create(_duration, -_angleX, -_angleY);
|
||||
if(_is3D)
|
||||
{
|
||||
Vertex3F v;
|
||||
v.x = - _angle3D.x;
|
||||
v.y = - _angle3D.y;
|
||||
v.z = - _angle3D.z;
|
||||
return RotateBy::create(_duration, v);
|
||||
}
|
||||
return RotateBy::create(_duration, -_angleZ_X, -_angleZ_Y);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -322,7 +322,8 @@ class CC_DLL RotateBy : public ActionInterval
|
|||
public:
|
||||
/** creates the action */
|
||||
static RotateBy* create(float duration, float deltaAngle);
|
||||
static RotateBy* create(float duration, float deltaAngleX, float deltaAngleY);
|
||||
static RotateBy* create(float duration, float deltaAngleZ_X, float deltaAngleZ_Y);
|
||||
static RotateBy* create(float duration, const Vertex3F& deltaAngle3D);
|
||||
|
||||
//
|
||||
// Override
|
||||
|
@ -333,16 +334,21 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
RotateBy() {}
|
||||
RotateBy();
|
||||
virtual ~RotateBy() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, float deltaAngle);
|
||||
bool initWithDuration(float duration, float deltaAngleX, float deltaAngleY);
|
||||
bool initWithDuration(float duration, float deltaAngleZ_X, float deltaAngleZ_Y);
|
||||
bool initWithDuration(float duration, const Vertex3F& deltaAngle3D);
|
||||
|
||||
float _angleX;
|
||||
float _startAngleX;
|
||||
float _angleY;
|
||||
float _startAngleY;
|
||||
float _angleZ_X;
|
||||
float _startAngleZ_X;
|
||||
float _angleZ_Y;
|
||||
float _startAngleZ_Y;
|
||||
|
||||
bool _is3D;
|
||||
Vertex3F _angle3D;
|
||||
Vertex3F _startAngle3D;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(RotateBy);
|
||||
|
|
|
@ -134,8 +134,6 @@ bool Director::init(void)
|
|||
|
||||
_openGLView = nullptr;
|
||||
|
||||
_cullingFrustum = new Frustum();
|
||||
|
||||
_contentScaleFactor = 1.0f;
|
||||
|
||||
// scheduler
|
||||
|
@ -277,16 +275,6 @@ void Director::drawScene()
|
|||
|
||||
kmGLPushMatrix();
|
||||
|
||||
//construct the frustum
|
||||
{
|
||||
kmMat4 view;
|
||||
kmMat4 projection;
|
||||
kmGLGetMatrix(KM_GL_PROJECTION, &projection);
|
||||
kmGLGetMatrix(KM_GL_MODELVIEW, &view);
|
||||
|
||||
_cullingFrustum->setupFromMatrix(view, projection);
|
||||
}
|
||||
|
||||
// draw the scene
|
||||
if (_runningScene)
|
||||
{
|
||||
|
@ -459,19 +447,20 @@ void Director::setProjection(Projection projection)
|
|||
kmGLLoadIdentity();
|
||||
|
||||
// issue #1334
|
||||
kmMat4PerspectiveProjection(&matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, zeye*2);
|
||||
// kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, 1500);
|
||||
kmMat4PerspectiveProjection(&matrixPerspective, 60, (GLfloat)size.width/size.height, 10, zeye+size.height/2);
|
||||
// kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, 1500);
|
||||
|
||||
kmGLMultMatrix(&matrixPerspective);
|
||||
|
||||
kmGLMatrixMode(KM_GL_MODELVIEW);
|
||||
kmGLLoadIdentity();
|
||||
kmVec3 eye, center, up;
|
||||
kmVec3Fill(&eye, size.width/2, size.height/2, zeye);
|
||||
kmVec3Fill(¢er, size.width/2, size.height/2, 0.0f);
|
||||
kmVec3Fill(&up, 0.0f, 1.0f, 0.0f);
|
||||
kmMat4LookAt(&matrixLookup, &eye, ¢er, &up);
|
||||
kmGLMultMatrix(&matrixLookup);
|
||||
|
||||
kmGLMatrixMode(KM_GL_MODELVIEW);
|
||||
kmGLLoadIdentity();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -743,7 +732,6 @@ void Director::purgeDirector()
|
|||
CC_SAFE_RELEASE_NULL(_FPSLabel);
|
||||
CC_SAFE_RELEASE_NULL(_drawnBatchesLabel);
|
||||
CC_SAFE_RELEASE_NULL(_drawnVerticesLabel);
|
||||
CC_SAFE_DELETE(_cullingFrustum);
|
||||
|
||||
// purge bitmap cache
|
||||
FontFNT::purgeCachedData();
|
||||
|
|
|
@ -58,7 +58,6 @@ class EventDispatcher;
|
|||
class EventCustom;
|
||||
class EventListenerCustom;
|
||||
class TextureCache;
|
||||
class Frustum;
|
||||
class Renderer;
|
||||
class Console;
|
||||
|
||||
|
@ -330,12 +329,6 @@ public:
|
|||
*/
|
||||
void setContentScaleFactor(float scaleFactor);
|
||||
float getContentScaleFactor() const { return _contentScaleFactor; }
|
||||
|
||||
/**
|
||||
Get the Culling Frustum
|
||||
*/
|
||||
|
||||
Frustum* getFrustum() const { return _cullingFrustum; }
|
||||
|
||||
/** Gets the Scheduler associated with this director
|
||||
@since v2.0
|
||||
|
@ -450,8 +443,6 @@ protected:
|
|||
unsigned int _frames;
|
||||
float _secondsPerFrame;
|
||||
|
||||
Frustum *_cullingFrustum;
|
||||
|
||||
/* The running scene */
|
||||
Scene *_runningScene;
|
||||
|
||||
|
|
|
@ -590,7 +590,7 @@ void LayerColor::draw()
|
|||
for(int i = 0; i < 4; ++i)
|
||||
{
|
||||
kmVec3 pos;
|
||||
pos.x = _squareVertices[i].x; pos.y = _squareVertices[i].y; pos.z = _vertexZ;
|
||||
pos.x = _squareVertices[i].x; pos.y = _squareVertices[i].y; pos.z = _positionZ;
|
||||
kmVec3TransformCoord(&pos, &pos, &_modelViewTransform);
|
||||
_noMVPVertices[i] = Vertex3F(pos.x,pos.y,pos.z);
|
||||
}
|
||||
|
|
|
@ -77,9 +77,12 @@ static int s_globalOrderOfArrival = 1;
|
|||
Node::Node(void)
|
||||
: _rotationX(0.0f)
|
||||
, _rotationY(0.0f)
|
||||
, _rotationZ_X(0.0f)
|
||||
, _rotationZ_Y(0.0f)
|
||||
, _scaleX(1.0f)
|
||||
, _scaleY(1.0f)
|
||||
, _vertexZ(0.0f)
|
||||
, _scaleZ(1.0f)
|
||||
, _positionZ(0.0f)
|
||||
, _position(Point::ZERO)
|
||||
, _skewX(0.0f)
|
||||
, _skewY(0.0f)
|
||||
|
@ -230,32 +233,17 @@ void Node::setGlobalZOrder(float globalZOrder)
|
|||
}
|
||||
}
|
||||
|
||||
/// vertexZ getter
|
||||
float Node::getVertexZ() const
|
||||
{
|
||||
return _vertexZ;
|
||||
}
|
||||
|
||||
|
||||
/// vertexZ setter
|
||||
void Node::setVertexZ(float zOrder)
|
||||
{
|
||||
_vertexZ = zOrder;
|
||||
setGlobalZOrder(zOrder);
|
||||
}
|
||||
|
||||
|
||||
/// rotation getter
|
||||
float Node::getRotation() const
|
||||
{
|
||||
CCASSERT(_rotationX == _rotationY, "CCNode#rotation. RotationX != RotationY. Don't know which one to return");
|
||||
return _rotationX;
|
||||
CCASSERT(_rotationZ_X == _rotationZ_Y, "CCNode#rotation. RotationX != RotationY. Don't know which one to return");
|
||||
return _rotationZ_X;
|
||||
}
|
||||
|
||||
/// rotation setter
|
||||
void Node::setRotation(float newRotation)
|
||||
{
|
||||
_rotationX = _rotationY = newRotation;
|
||||
_rotationZ_X = _rotationZ_Y = newRotation;
|
||||
_transformDirty = _inverseDirty = true;
|
||||
|
||||
#if CC_USE_PHYSICS
|
||||
|
@ -266,25 +254,51 @@ void Node::setRotation(float newRotation)
|
|||
#endif
|
||||
}
|
||||
|
||||
float Node::getRotationX() const
|
||||
float Node::getRotationSkewX() const
|
||||
{
|
||||
return _rotationX;
|
||||
return _rotationZ_X;
|
||||
}
|
||||
|
||||
void Node::setRotationX(float fRotationX)
|
||||
void Node::setRotation3D(const Vertex3F& rotation)
|
||||
{
|
||||
_rotationX = fRotationX;
|
||||
_transformDirty = _inverseDirty = true;
|
||||
|
||||
_rotationX = rotation.x;
|
||||
_rotationY = rotation.y;
|
||||
|
||||
// rotation Z is decomposed in 2 to simulate Skew for Flash animations
|
||||
_rotationZ_Y = _rotationZ_X = rotation.z;
|
||||
|
||||
#if CC_USE_PHYSICS
|
||||
if (_physicsBody)
|
||||
{
|
||||
_physicsBody->setRotation(_rotationZ_X);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Vertex3F Node::getRotation3D() const
|
||||
{
|
||||
// rotation Z is decomposed in 2 to simulate Skew for Flash animations
|
||||
CCASSERT(_rotationZ_X == _rotationZ_Y, "_rotationZ_X != _rotationZ_Y");
|
||||
|
||||
return Vertex3F(_rotationX,_rotationY,_rotationZ_X);
|
||||
}
|
||||
|
||||
void Node::setRotationSkewX(float fRotationX)
|
||||
{
|
||||
_rotationZ_X = fRotationX;
|
||||
_transformDirty = _inverseDirty = true;
|
||||
}
|
||||
|
||||
float Node::getRotationY() const
|
||||
float Node::getRotationSkewY() const
|
||||
{
|
||||
return _rotationY;
|
||||
return _rotationZ_Y;
|
||||
}
|
||||
|
||||
void Node::setRotationY(float rotationY)
|
||||
void Node::setRotationSkewY(float rotationY)
|
||||
{
|
||||
_rotationY = rotationY;
|
||||
_rotationZ_Y = rotationY;
|
||||
_transformDirty = _inverseDirty = true;
|
||||
}
|
||||
|
||||
|
@ -329,6 +343,19 @@ float Node::getScaleY() const
|
|||
return _scaleY;
|
||||
}
|
||||
|
||||
/// scaleY setter
|
||||
void Node::setScaleZ(float newScaleZ)
|
||||
{
|
||||
_scaleZ = newScaleZ;
|
||||
_transformDirty = _inverseDirty = true;
|
||||
}
|
||||
|
||||
/// scaleY getter
|
||||
float Node::getScaleZ() const
|
||||
{
|
||||
return _scaleZ;
|
||||
}
|
||||
|
||||
/// scaleY setter
|
||||
void Node::setScaleY(float newScaleY)
|
||||
{
|
||||
|
@ -336,6 +363,7 @@ void Node::setScaleY(float newScaleY)
|
|||
_transformDirty = _inverseDirty = true;
|
||||
}
|
||||
|
||||
|
||||
/// position getter
|
||||
const Point& Node::getPosition() const
|
||||
{
|
||||
|
@ -367,26 +395,72 @@ void Node::setPosition(float x, float y)
|
|||
setPosition(Point(x, y));
|
||||
}
|
||||
|
||||
void Node::setPosition3D(const Vertex3F& position)
|
||||
{
|
||||
_positionZ = position.z;
|
||||
setPosition(Point(position.x, position.y));
|
||||
}
|
||||
|
||||
Vertex3F Node::getPosition3D() const
|
||||
{
|
||||
Vertex3F ret;
|
||||
ret.x = _position.x;
|
||||
ret.y = _position.y;
|
||||
ret.z = _positionZ;
|
||||
return ret;
|
||||
}
|
||||
|
||||
float Node::getPositionX() const
|
||||
{
|
||||
return _position.x;
|
||||
}
|
||||
|
||||
float Node::getPositionY() const
|
||||
{
|
||||
return _position.y;
|
||||
}
|
||||
|
||||
void Node::setPositionX(float x)
|
||||
{
|
||||
setPosition(Point(x, _position.y));
|
||||
}
|
||||
|
||||
float Node::getPositionY() const
|
||||
{
|
||||
return _position.y;
|
||||
}
|
||||
|
||||
void Node::setPositionY(float y)
|
||||
{
|
||||
setPosition(Point(_position.x, y));
|
||||
}
|
||||
|
||||
float Node::getPositionZ() const
|
||||
{
|
||||
return _positionZ;
|
||||
}
|
||||
|
||||
void Node::setPositionZ(float positionZ)
|
||||
{
|
||||
_transformDirty = _inverseDirty = true;
|
||||
|
||||
_positionZ = positionZ;
|
||||
|
||||
// XXX BUG
|
||||
// Global Z Order should based on the modelViewTransform
|
||||
setGlobalZOrder(positionZ);
|
||||
}
|
||||
|
||||
void Node::setNormalizedPosition(const cocos2d::Point &position)
|
||||
{
|
||||
_normalizedPosition = position;
|
||||
Size s = Director::getInstance()->getVisibleSize();
|
||||
Point p;
|
||||
p.x = s.width * position.x;
|
||||
p.y = s.height * position.y;
|
||||
setPosition(p);
|
||||
}
|
||||
|
||||
const Point& Node::getNormalizedPosition() const
|
||||
{
|
||||
return _normalizedPosition;
|
||||
}
|
||||
|
||||
ssize_t Node::getChildrenCount() const
|
||||
{
|
||||
return _children.size();
|
||||
|
@ -1139,6 +1213,7 @@ const kmMat4& Node::getNodeToParentTransform() const
|
|||
// Translate values
|
||||
float x = _position.x;
|
||||
float y = _position.y;
|
||||
float z = _positionZ;
|
||||
|
||||
if (_ignoreAnchorPointForPosition)
|
||||
{
|
||||
|
@ -1150,10 +1225,10 @@ const kmMat4& Node::getNodeToParentTransform() const
|
|||
// 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 (_rotationX || _rotationY)
|
||||
if (_rotationZ_X || _rotationZ_Y)
|
||||
{
|
||||
float radiansX = -CC_DEGREES_TO_RADIANS(_rotationX);
|
||||
float radiansY = -CC_DEGREES_TO_RADIANS(_rotationY);
|
||||
float radiansX = -CC_DEGREES_TO_RADIANS(_rotationZ_X);
|
||||
float radiansY = -CC_DEGREES_TO_RADIANS(_rotationZ_Y);
|
||||
cx = cosf(radiansX);
|
||||
sx = sinf(radiansX);
|
||||
cy = cosf(radiansY);
|
||||
|
@ -1175,13 +1250,28 @@ const kmMat4& Node::getNodeToParentTransform() const
|
|||
|
||||
// Build Transform Matrix
|
||||
// Adjusted transform calculation for rotational skew
|
||||
kmScalar mat[] = { cy * _scaleX, sy * _scaleX, 0, 0,
|
||||
-sx * _scaleY, cx * _scaleY, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
x, y, 0, 1 };
|
||||
kmScalar mat[] = {
|
||||
cy * _scaleX, sy * _scaleX, 0, 0,
|
||||
-sx * _scaleY, cx * _scaleY, 0, 0,
|
||||
0, 0, _scaleZ, 0,
|
||||
x, y, z, 1 };
|
||||
|
||||
kmMat4Fill(&_transform, mat);
|
||||
|
||||
// XXX
|
||||
// FIX ME: Expensive operation.
|
||||
// FIX ME: It should be done together with the rotationZ
|
||||
if(_rotationY) {
|
||||
kmMat4 rotY;
|
||||
kmMat4RotationY(&rotY,CC_DEGREES_TO_RADIANS(_rotationY));
|
||||
kmMat4Multiply(&_transform, &_transform, &rotY);
|
||||
}
|
||||
if(_rotationX) {
|
||||
kmMat4 rotX;
|
||||
kmMat4RotationX(&rotX,CC_DEGREES_TO_RADIANS(_rotationX));
|
||||
kmMat4Multiply(&_transform, &_transform, &rotX);
|
||||
}
|
||||
|
||||
// XXX: Try to inline skew
|
||||
// If skew is needed, apply skew and then anchor point
|
||||
if (needsSkewMatrix)
|
||||
|
@ -1203,9 +1293,6 @@ const kmMat4& Node::getNodeToParentTransform() const
|
|||
}
|
||||
}
|
||||
|
||||
// vertex Z
|
||||
_transform.mat[14] = _vertexZ;
|
||||
|
||||
if (_useAdditionalTransform)
|
||||
{
|
||||
kmMat4Multiply(&_transform, &_transform, &_additionalTransform);
|
||||
|
@ -1348,7 +1435,7 @@ bool Node::updatePhysicsTransform()
|
|||
if (_physicsBody != nullptr && _physicsBody->getWorld() != nullptr && !_physicsBody->isResting())
|
||||
{
|
||||
_position = _physicsBody->getPosition();
|
||||
_rotationX = _rotationY = _physicsBody->getRotation();
|
||||
_rotationZ_X = _rotationZ_Y = _physicsBody->getRotation();
|
||||
_transformDirty = _inverseDirty = true;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "CCGL.h"
|
||||
#include "ccGLStateCache.h"
|
||||
#include "CCGLProgram.h"
|
||||
#include "kazmath/kazmath.h"
|
||||
#include "CCScriptSupport.h"
|
||||
#include "CCProtocols.h"
|
||||
#include "CCEventDispatcher.h"
|
||||
|
@ -214,29 +213,6 @@ public:
|
|||
*/
|
||||
virtual float getGlobalZOrder() const { return _globalZOrder; }
|
||||
|
||||
/**
|
||||
* Sets the 'z' value in the OpenGL Depth Buffer.
|
||||
*
|
||||
* The OpenGL depth buffer and depth testing are disabled by default. You need to turn them on
|
||||
* in order to use this property correctly.
|
||||
*
|
||||
* `setVertexZ()` also sets the `setGlobalZValue()` with the vertexZ value.
|
||||
*
|
||||
* @see `setGlobalZValue()`
|
||||
*
|
||||
* @param vertexZ OpenGL Z vertex of this node.
|
||||
*/
|
||||
virtual void setVertexZ(float vertexZ);
|
||||
/**
|
||||
* Gets OpenGL Z vertex of this node.
|
||||
*
|
||||
* @see setVertexZ(float)
|
||||
*
|
||||
* @return OpenGL Z vertex of this node
|
||||
*/
|
||||
virtual float getVertexZ() const;
|
||||
|
||||
|
||||
/**
|
||||
* Changes the scale factor on X axis of this node
|
||||
*
|
||||
|
@ -272,6 +248,23 @@ public:
|
|||
*/
|
||||
virtual float getScaleY() const;
|
||||
|
||||
/**
|
||||
* Changes the scale factor on Z axis of this node
|
||||
*
|
||||
* The Default value is 1.0 if you haven't changed it before.
|
||||
*
|
||||
* @param scaleY The scale factor on Y axis.
|
||||
*/
|
||||
virtual void setScaleZ(float scaleZ);
|
||||
/**
|
||||
* Returns the scale factor on Z axis of this node
|
||||
*
|
||||
* @see `setScaleZ(float)`
|
||||
*
|
||||
* @return The scale factor on Z axis.
|
||||
*/
|
||||
virtual float getScaleZ() const;
|
||||
|
||||
|
||||
/**
|
||||
* Changes both X and Y scale factor of the node.
|
||||
|
@ -359,17 +352,62 @@ public:
|
|||
virtual void setPositionY(float y);
|
||||
virtual float getPositionY(void) const;
|
||||
|
||||
/**
|
||||
* Sets the X, Y, and Z axis position
|
||||
*/
|
||||
virtual void setPosition3D(const Vertex3F& position);
|
||||
/**
|
||||
* returns the X, Y and Z axis position
|
||||
*/
|
||||
virtual Vertex3F getPosition3D() const;
|
||||
|
||||
/**
|
||||
* Sets the 'z' axis in the position. It is the OpenGL Z vertex value.
|
||||
*
|
||||
* The OpenGL depth buffer and depth testing are disabled by default. You need to turn them on
|
||||
* in order to use this property correctly.
|
||||
*
|
||||
* `setPositionZ()` also sets the `setGlobalZValue()` with the positionZ as value.
|
||||
*
|
||||
* @see `setGlobalZValue()`
|
||||
*
|
||||
* @param vertexZ OpenGL Z vertex of this node.
|
||||
*/
|
||||
virtual void setPositionZ(float positionZ);
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void setVertexZ(float vertexZ) { setPositionZ(vertexZ); }
|
||||
|
||||
/**
|
||||
* Gets position Z axis of this node.
|
||||
*
|
||||
* @see setPositionZ(float)
|
||||
*
|
||||
* @return the position Z axis of this node.
|
||||
*/
|
||||
virtual float getPositionZ() const;
|
||||
CC_DEPRECATED_ATTRIBUTE virtual float getVertexZ() const { return getPositionZ(); }
|
||||
|
||||
/** Sets the position using normalized coordinates.
|
||||
- (0,0) means bottom,left corner
|
||||
- (1,1) means top,right corner
|
||||
- (0.5,0.5) means center
|
||||
*/
|
||||
virtual void setNormalizedPosition(const Point& position);
|
||||
/** returns the normalized position */
|
||||
const Point& getNormalizedPosition() const;
|
||||
|
||||
/**
|
||||
* Changes the X skew angle of the node in degrees.
|
||||
*
|
||||
* The difference between `setRotationalSkew()` and `setSkew()` is that the first one simulate Flash's skew functionality
|
||||
* while the second one uses the real skew funciton.
|
||||
*
|
||||
* This angle describes the shear distortion in the X direction.
|
||||
* Thus, it is the angle between the Y axis and the left edge of the shape
|
||||
* The default skewX angle is 0. Positive values distort the node in a CW direction.
|
||||
*
|
||||
* @param fSkewX The X skew angle of the node in degrees.
|
||||
* @param skewX The X skew angle of the node in degrees.
|
||||
*/
|
||||
virtual void setSkewX(float fSkewX);
|
||||
virtual void setSkewX(float skewX);
|
||||
/**
|
||||
* Returns the X skew angle of the node in degrees.
|
||||
*
|
||||
|
@ -383,13 +421,16 @@ public:
|
|||
/**
|
||||
* Changes the Y skew angle of the node in degrees.
|
||||
*
|
||||
* The difference between `setRotationalSkew()` and `setSkew()` is that the first one simulate Flash's skew functionality
|
||||
* while the second one uses the real skew funciton.
|
||||
*
|
||||
* This angle describes the shear distortion in the Y direction.
|
||||
* Thus, it is the angle between the X axis and the bottom edge of the shape
|
||||
* The default skewY angle is 0. Positive values distort the node in a CCW direction.
|
||||
*
|
||||
* @param fSkewY The Y skew angle of the node in degrees.
|
||||
* @param skewY The Y skew angle of the node in degrees.
|
||||
*/
|
||||
virtual void setSkewY(float fSkewY);
|
||||
virtual void setSkewY(float skewY);
|
||||
/**
|
||||
* Returns the Y skew angle of the node in degrees.
|
||||
*
|
||||
|
@ -486,44 +527,63 @@ public:
|
|||
*/
|
||||
virtual float getRotation() const;
|
||||
|
||||
/**
|
||||
* Sets the X, Y and Z axis rotation
|
||||
* Useful for 3d rotations
|
||||
*/
|
||||
virtual void setRotation3D(const Vertex3F& rotation);
|
||||
/**
|
||||
* returns the X, Y and Z axis rotation
|
||||
*/
|
||||
virtual Vertex3F getRotation3D() const;
|
||||
|
||||
/**
|
||||
* Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew.
|
||||
*
|
||||
* The difference between setRotationalSkew() and setSkew() is that the first one simulate Flash's skew functionality
|
||||
* while the second one uses the real skew funciton.
|
||||
*
|
||||
* 0 is the default rotation angle.
|
||||
* Positive values rotate node clockwise, and negative values for anti-clockwise.
|
||||
*
|
||||
* @param rotationX The X rotation in degrees which performs a horizontal rotational skew.
|
||||
*/
|
||||
virtual void setRotationX(float rotationX);
|
||||
virtual void setRotationSkewX(float rotationX);
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void setRotationX(float rotationX) { return setRotationSkewX(rotationX); }
|
||||
|
||||
/**
|
||||
* Gets the X rotation (angle) of the node in degrees which performs a horizontal rotation skew.
|
||||
*
|
||||
* @see `setRotationX(float)`
|
||||
* @see `setRotationSkewX(float)`
|
||||
*
|
||||
* @return The X rotation in degrees.
|
||||
*/
|
||||
virtual float getRotationX() const;
|
||||
|
||||
virtual float getRotationSkewX() const;
|
||||
CC_DEPRECATED_ATTRIBUTE virtual float getRotationX() const { return getRotationSkewX(); }
|
||||
|
||||
/**
|
||||
* Sets the Y rotation (angle) of the node in degrees which performs a vertical rotational skew.
|
||||
*
|
||||
* The difference between setRotationalSkew() and setSkew() is that the first one simulate Flash's skew functionality
|
||||
* while the second one uses the real skew funciton.
|
||||
*
|
||||
* 0 is the default rotation angle.
|
||||
* Positive values rotate node clockwise, and negative values for anti-clockwise.
|
||||
*
|
||||
* @param rotationY The Y rotation in degrees.
|
||||
*/
|
||||
virtual void setRotationY(float rotationY);
|
||||
virtual void setRotationSkewY(float rotationY);
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void setRotationY(float rotationY) { return setRotationSkewY(rotationY); }
|
||||
|
||||
/**
|
||||
* Gets the Y rotation (angle) of the node in degrees which performs a vertical rotational skew.
|
||||
*
|
||||
* @see `setRotationY(float)`
|
||||
* @see `setRotationSkewY(float)`
|
||||
*
|
||||
* @return The Y rotation in degrees.
|
||||
*/
|
||||
virtual float getRotationY() const;
|
||||
|
||||
virtual float getRotationSkewY() const;
|
||||
CC_DEPRECATED_ATTRIBUTE virtual float getRotationY() const { return getRotationSkewY(); }
|
||||
|
||||
/**
|
||||
* Sets the arrival order when this node has a same ZOrder with other children.
|
||||
|
@ -1429,18 +1489,23 @@ protected:
|
|||
virtual void disableCascadeColor();
|
||||
virtual void updateColor() {}
|
||||
|
||||
float _rotationX; ///< rotation on the X-axis
|
||||
float _rotationY; ///< rotation on the Y-axis
|
||||
|
||||
float _rotationX; ///< rotation angle on x-axis
|
||||
float _rotationY; ///< rotation angle on y-axis
|
||||
// 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
|
||||
|
||||
float _scaleX; ///< scaling factor on x-axis
|
||||
float _scaleY; ///< scaling factor on y-axis
|
||||
float _scaleX; ///< scaling factor on x-axis
|
||||
float _scaleY; ///< scaling factor on y-axis
|
||||
float _scaleZ; ///< scaling factor on z-axis
|
||||
|
||||
Point _position; ///< position of the node
|
||||
float _positionZ; ///< OpenGL real Z position
|
||||
Point _normalizedPosition; ///< position in normalized coordinates
|
||||
|
||||
Point _position; ///< position of the node
|
||||
|
||||
float _skewX; ///< skew angle on x-axis
|
||||
float _skewY; ///< skew angle on y-axis
|
||||
float _skewX; ///< skew angle on x-axis
|
||||
float _skewY; ///< skew angle on y-axis
|
||||
|
||||
Point _anchorPointInPoints; ///< anchor point in points
|
||||
Point _anchorPoint; ///< anchor point normalized (NOT in points)
|
||||
|
@ -1460,8 +1525,6 @@ protected:
|
|||
|
||||
int _localZOrder; ///< Local order (relative to its siblings) used to sort the node
|
||||
float _globalZOrder; ///< Global order used to sort the node
|
||||
float _vertexZ; ///< OpenGL real Z vertex
|
||||
|
||||
|
||||
Vector<Node*> _children; ///< array of children nodes
|
||||
Node *_parent; ///< weak reference to parent node
|
||||
|
|
|
@ -45,12 +45,14 @@ THE SOFTWARE.
|
|||
#include "CCAffineTransform.h"
|
||||
#include "TransformUtils.h"
|
||||
#include "CCProfiling.h"
|
||||
#include "CCDirector.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
#include "renderer/CCQuadCommand.h"
|
||||
#include "renderer/CCFrustum.h"
|
||||
|
||||
// external
|
||||
#include "kazmath/GL/matrix.h"
|
||||
#include "kazmath/kazmath.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
@ -563,10 +565,10 @@ void Sprite::updateTransform(void)
|
|||
float dx = x1 * cr - y2 * sr2 + x;
|
||||
float dy = x1 * sr + y2 * cr2 + y;
|
||||
|
||||
_quad.bl.vertices = Vertex3F( RENDER_IN_SUBPIXEL(ax), RENDER_IN_SUBPIXEL(ay), _vertexZ );
|
||||
_quad.br.vertices = Vertex3F( RENDER_IN_SUBPIXEL(bx), RENDER_IN_SUBPIXEL(by), _vertexZ );
|
||||
_quad.tl.vertices = Vertex3F( RENDER_IN_SUBPIXEL(dx), RENDER_IN_SUBPIXEL(dy), _vertexZ );
|
||||
_quad.tr.vertices = Vertex3F( RENDER_IN_SUBPIXEL(cx), RENDER_IN_SUBPIXEL(cy), _vertexZ );
|
||||
_quad.bl.vertices = Vertex3F( RENDER_IN_SUBPIXEL(ax), RENDER_IN_SUBPIXEL(ay), _positionZ );
|
||||
_quad.br.vertices = Vertex3F( RENDER_IN_SUBPIXEL(bx), RENDER_IN_SUBPIXEL(by), _positionZ );
|
||||
_quad.tl.vertices = Vertex3F( RENDER_IN_SUBPIXEL(dx), RENDER_IN_SUBPIXEL(dy), _positionZ );
|
||||
_quad.tr.vertices = Vertex3F( RENDER_IN_SUBPIXEL(cx), RENDER_IN_SUBPIXEL(cy), _positionZ );
|
||||
}
|
||||
|
||||
// MARMALADE CHANGE: ADDED CHECK FOR nullptr, TO PERMIT SPRITES WITH NO BATCH NODE / TEXTURE ATLAS
|
||||
|
@ -597,7 +599,7 @@ void Sprite::updateTransform(void)
|
|||
Point( _quad.tr.vertices.x, _quad.tr.vertices.y ),
|
||||
Point( _quad.tl.vertices.x, _quad.tl.vertices.y ),
|
||||
};
|
||||
ccDrawPoly(vertices, 4, true);
|
||||
DrawPrimitives::drawPoly(vertices, 4, true);
|
||||
#endif // CC_SPRITE_DEBUG_DRAW
|
||||
}
|
||||
|
||||
|
@ -605,83 +607,48 @@ void Sprite::updateTransform(void)
|
|||
|
||||
void Sprite::draw(void)
|
||||
{
|
||||
//TODO implement z order
|
||||
_quadCommand.init(_globalZOrder, _texture->getName(), _shaderProgram, _blendFunc, &_quad, 1, _modelViewTransform);
|
||||
|
||||
// if(culling())
|
||||
if(culling())
|
||||
{
|
||||
_quadCommand.init(_globalZOrder, _texture->getName(), _shaderProgram, _blendFunc, &_quad, 1, _modelViewTransform);
|
||||
Director::getInstance()->getRenderer()->addCommand(&_quadCommand);
|
||||
}
|
||||
}
|
||||
|
||||
// Culling function from cocos2d-iphone CCSprite.m file
|
||||
bool Sprite::culling() const
|
||||
{
|
||||
Frustum* frustum = Director::getInstance()->getFrustum();
|
||||
//TODO optimize this transformation, should use parent's transformation instead
|
||||
kmMat4 worldTM = getNodeToWorldTransform();
|
||||
//generate aabb
|
||||
// half size of the screen
|
||||
Size screen_half = Director::getInstance()->getWinSize();
|
||||
screen_half.width /= 2;
|
||||
screen_half.height /= 2;
|
||||
|
||||
//
|
||||
// calculate the Quad based on the Affine Matrix
|
||||
//
|
||||
Rect newRect = RectApplyTransform(_rect, worldTM);
|
||||
float hcsx = _contentSize.width / 2;
|
||||
float hcsy = _contentSize.height / 2;
|
||||
|
||||
kmVec3 point = {newRect.getMinX(), newRect.getMinY(), _vertexZ};
|
||||
|
||||
AABB aabb(point,point);
|
||||
kmVec3Fill(&point,newRect.getMaxX(), newRect.getMinY(), _vertexZ);
|
||||
aabb.expand(point);
|
||||
kmVec3Fill(&point,newRect.getMinX(), newRect.getMaxY(), _vertexZ);
|
||||
aabb.expand(point);
|
||||
kmVec3Fill(&point,newRect.getMaxX(), newRect.getMaxY(), _vertexZ);
|
||||
aabb.expand(point);
|
||||
// convert to world coordinates
|
||||
float x = hcsx * _modelViewTransform.mat[0] + hcsy * _modelViewTransform.mat[4] + _modelViewTransform.mat[12];
|
||||
float y = hcsx * _modelViewTransform.mat[1] + hcsy * _modelViewTransform.mat[5] + _modelViewTransform.mat[13];
|
||||
|
||||
return Frustum::IntersectResult::OUTSIDE !=frustum->intersectAABB(aabb);
|
||||
}
|
||||
// center of screen is (0,0)
|
||||
x -= screen_half.width;
|
||||
y -= screen_half.height;
|
||||
|
||||
void Sprite::updateQuadVertices()
|
||||
{
|
||||
#if CC_USE_PHYSICS
|
||||
updatePhysicsTransform();
|
||||
setDirty(true);
|
||||
// convert content size to world coordinates
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
||||
float wchw = hcsx * std::max(fabsf(_modelViewTransform.mat[0] + _modelViewTransform.mat[4]), fabsf(_modelViewTransform.mat[0] - _modelViewTransform.mat[4]));
|
||||
float wchh = hcsy * std::max(fabsf(_modelViewTransform.mat[1] + _modelViewTransform.mat[5]), fabsf(_modelViewTransform.mat[1] - _modelViewTransform.mat[5]));
|
||||
#else
|
||||
float wchw = hcsx * fmaxf(fabsf(_modelViewTransform.mat[0] + _modelViewTransform.mat[4]), fabsf(_modelViewTransform.mat[0] - _modelViewTransform.mat[4]));
|
||||
float wchh = hcsy * fmaxf(fabsf(_modelViewTransform.mat[1] + _modelViewTransform.mat[5]), fabsf(_modelViewTransform.mat[1] - _modelViewTransform.mat[5]));
|
||||
#endif
|
||||
|
||||
//TODO optimize the performance cache affineTransformation
|
||||
|
||||
// recalculate matrix only if it is dirty
|
||||
if(isDirty())
|
||||
{
|
||||
|
||||
// if( ! _parent || _parent == (Node*)_batchNode )
|
||||
// {
|
||||
// _transformToBatch = getNodeToParentTransform();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// CCASSERT( dynamic_cast<Sprite*>(_parent), "Logic error in Sprite. Parent must be a Sprite");
|
||||
// _transformToBatch = AffineTransformConcat( getNodeToParentTransform() , static_cast<Sprite*>(_parent)->_transformToBatch );
|
||||
// }
|
||||
|
||||
//TODO optimize this transformation, should use parent's transformation instead
|
||||
_transformToBatch = getNodeToWorldTransform();
|
||||
|
||||
//
|
||||
// calculate the Quad based on the Affine Matrix
|
||||
//
|
||||
Rect newRect = RectApplyTransform(_rect, _transformToBatch);
|
||||
|
||||
_quad.bl.vertices = Vertex3F( RENDER_IN_SUBPIXEL(newRect.getMinX()), RENDER_IN_SUBPIXEL(newRect.getMinY()), _vertexZ );
|
||||
_quad.br.vertices = Vertex3F( RENDER_IN_SUBPIXEL(newRect.getMaxX()), RENDER_IN_SUBPIXEL(newRect.getMinY()), _vertexZ );
|
||||
_quad.tl.vertices = Vertex3F( RENDER_IN_SUBPIXEL(newRect.getMinX()), RENDER_IN_SUBPIXEL(newRect.getMaxY()), _vertexZ );
|
||||
_quad.tr.vertices = Vertex3F( RENDER_IN_SUBPIXEL(newRect.getMaxX()), RENDER_IN_SUBPIXEL(newRect.getMaxY()), _vertexZ );
|
||||
|
||||
_recursiveDirty = false;
|
||||
setDirty(false);
|
||||
}
|
||||
// compare if it in the positive quarter of the screen
|
||||
float tmpx = (fabsf(x)-wchw);
|
||||
float tmpy = (fabsf(y)-wchh);
|
||||
return (tmpx < screen_half.width && tmpy < screen_half.height);
|
||||
}
|
||||
|
||||
// Node overrides
|
||||
|
||||
void Sprite::addChild(Node *child, int zOrder, int tag)
|
||||
{
|
||||
CCASSERT(child != nullptr, "Argument must be non-nullptr");
|
||||
|
@ -847,15 +814,15 @@ void Sprite::setRotation(float rotation)
|
|||
SET_DIRTY_RECURSIVELY();
|
||||
}
|
||||
|
||||
void Sprite::setRotationX(float fRotationX)
|
||||
void Sprite::setRotationSkewX(float fRotationX)
|
||||
{
|
||||
Node::setRotationX(fRotationX);
|
||||
Node::setRotationSkewX(fRotationX);
|
||||
SET_DIRTY_RECURSIVELY();
|
||||
}
|
||||
|
||||
void Sprite::setRotationY(float fRotationY)
|
||||
void Sprite::setRotationSkewY(float fRotationY)
|
||||
{
|
||||
Node::setRotationY(fRotationY);
|
||||
Node::setRotationSkewY(fRotationY);
|
||||
SET_DIRTY_RECURSIVELY();
|
||||
}
|
||||
|
||||
|
@ -895,9 +862,9 @@ void Sprite::setScale(float scaleX, float scaleY)
|
|||
SET_DIRTY_RECURSIVELY();
|
||||
}
|
||||
|
||||
void Sprite::setVertexZ(float fVertexZ)
|
||||
void Sprite::setPositionZ(float fVertexZ)
|
||||
{
|
||||
Node::setVertexZ(fVertexZ);
|
||||
Node::setPositionZ(fVertexZ);
|
||||
SET_DIRTY_RECURSIVELY();
|
||||
}
|
||||
|
||||
|
|
|
@ -408,8 +408,8 @@ public:
|
|||
virtual void setPosition(const Point& pos) override;
|
||||
virtual void setPosition(float x, float y) override;
|
||||
virtual void setRotation(float rotation) override;
|
||||
virtual void setRotationX(float rotationX) override;
|
||||
virtual void setRotationY(float rotationY) override;
|
||||
virtual void setRotationSkewX(float rotationX) override;
|
||||
virtual void setRotationSkewY(float rotationY) override;
|
||||
virtual void setSkewX(float sx) override;
|
||||
virtual void setSkewY(float sy) override;
|
||||
virtual void removeChild(Node* child, bool cleanup) override;
|
||||
|
@ -419,11 +419,10 @@ public:
|
|||
virtual void addChild(Node *child, int zOrder, int tag) override;
|
||||
virtual void sortAllChildren() override;
|
||||
virtual void setScale(float scale) override;
|
||||
virtual void setVertexZ(float vertexZ) override;
|
||||
virtual void setPositionZ(float positionZ) override;
|
||||
virtual void setAnchorPoint(const Point& anchor) override;
|
||||
virtual void ignoreAnchorPointForPosition(bool value) override;
|
||||
virtual void setVisible(bool bVisible) override;
|
||||
virtual void updateQuadVertices();
|
||||
virtual void draw(void) override;
|
||||
virtual void setOpacityModifyRGB(bool modify) override;
|
||||
virtual bool isOpacityModifyRGB(void) const override;
|
||||
|
|
|
@ -486,7 +486,11 @@ bool GLView::isOpenGLReady()
|
|||
void GLView::end()
|
||||
{
|
||||
if(_mainWindow)
|
||||
{
|
||||
glfwSetWindowShouldClose(_mainWindow,1);
|
||||
_mainWindow = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GLView::swapBuffers()
|
||||
|
|
|
@ -94,13 +94,13 @@ int Application::run()
|
|||
}
|
||||
}
|
||||
|
||||
/* Only work on Desktop
|
||||
* Director::mainLoop is really one frame logic
|
||||
* when we want to close the window, we should call Director::end();
|
||||
* then call Director::mainLoop to do release of internal resources
|
||||
*/
|
||||
director->end();
|
||||
director->mainLoop();
|
||||
// Director should still do a cleanup if the window was closed manually.
|
||||
if (glview->isOpenGLReady())
|
||||
{
|
||||
director->end();
|
||||
director->mainLoop();
|
||||
director = nullptr;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,10 +188,10 @@ void Skin::updateTransform()
|
|||
float dx = x1 * cr - y2 * sr2 + x;
|
||||
float dy = x1 * sr + y2 * cr2 + y;
|
||||
|
||||
SET_VERTEX3F( _quad.bl.vertices, RENDER_IN_SUBPIXEL(ax), RENDER_IN_SUBPIXEL(ay), _vertexZ );
|
||||
SET_VERTEX3F( _quad.br.vertices, RENDER_IN_SUBPIXEL(bx), RENDER_IN_SUBPIXEL(by), _vertexZ );
|
||||
SET_VERTEX3F( _quad.tl.vertices, RENDER_IN_SUBPIXEL(dx), RENDER_IN_SUBPIXEL(dy), _vertexZ );
|
||||
SET_VERTEX3F( _quad.tr.vertices, RENDER_IN_SUBPIXEL(cx), RENDER_IN_SUBPIXEL(cy), _vertexZ );
|
||||
SET_VERTEX3F( _quad.bl.vertices, RENDER_IN_SUBPIXEL(ax), RENDER_IN_SUBPIXEL(ay), _positionZ );
|
||||
SET_VERTEX3F( _quad.br.vertices, RENDER_IN_SUBPIXEL(bx), RENDER_IN_SUBPIXEL(by), _positionZ );
|
||||
SET_VERTEX3F( _quad.tl.vertices, RENDER_IN_SUBPIXEL(dx), RENDER_IN_SUBPIXEL(dy), _positionZ );
|
||||
SET_VERTEX3F( _quad.tr.vertices, RENDER_IN_SUBPIXEL(cx), RENDER_IN_SUBPIXEL(cy), _positionZ );
|
||||
}
|
||||
|
||||
// MARMALADE CHANGE: ADDED CHECK FOR nullptr, TO PERMIT SPRITES WITH NO BATCH NODE / TEXTURE ATLAS
|
||||
|
|
|
@ -28,6 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "vec2.h"
|
||||
#include "vec3.h"
|
||||
#include "vec4.h"
|
||||
#include "mat3.h"
|
||||
#include "mat4.h"
|
||||
#include "utility.h"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 55b366484cd48e5ddd3467dae0376a28fef36ab6
|
||||
Subproject commit 42d96e2c6b04d0d75c12e3fdf1cc24a160160e89
|
|
@ -5,7 +5,7 @@ set(LUABINDING_SRC
|
|||
../auto-generated/lua-bindings/lua_cocos2dx_gui_auto.cpp
|
||||
../auto-generated/lua-bindings/lua_cocos2dx_spine_auto.cpp
|
||||
../auto-generated/lua-bindings/lua_cocos2dx_physics_auto.cpp
|
||||
bindings/tolua_fix.c
|
||||
bindings/tolua_fix.cpp
|
||||
bindings/CCLuaBridge.cpp
|
||||
bindings/CCLuaEngine.cpp
|
||||
bindings/CCLuaStack.cpp
|
||||
|
|
|
@ -37,7 +37,7 @@ LOCAL_SRC_FILES := CCLuaBridge.cpp \
|
|||
../../../../external/lua/tolua/tolua_map.c \
|
||||
../../../../external/lua/tolua/tolua_push.c \
|
||||
../../../../external/lua/tolua/tolua_to.c \
|
||||
tolua_fix.c \
|
||||
tolua_fix.cpp \
|
||||
socket/auxiliar.c \
|
||||
socket/luasocket_buffer.c \
|
||||
socket/except.c \
|
||||
|
|
|
@ -167,7 +167,7 @@ int LuaEngine::executeEvent(int nHandler, const char* pEventName, Ref* pEventSou
|
|||
_stack->pushString(pEventName);
|
||||
if (pEventSource)
|
||||
{
|
||||
_stack->pushObject(pEventSource, pEventSourceClassName ? pEventSourceClassName : "cc.Object");
|
||||
_stack->pushObject(pEventSource, pEventSourceClassName ? pEventSourceClassName : "cc.Ref");
|
||||
}
|
||||
int ret = _stack->executeFunctionByHandler(nHandler, pEventSource ? 2 : 1);
|
||||
_stack->clean();
|
||||
|
@ -447,7 +447,7 @@ int LuaEngine::handleCommonEvent(void* data)
|
|||
}
|
||||
else
|
||||
{
|
||||
_stack->pushObject(commonInfo->eventSource, "cc.Object");
|
||||
_stack->pushObject(commonInfo->eventSource, "cc.Ref");
|
||||
}
|
||||
}
|
||||
int ret = _stack->executeFunctionByHandler(commonInfo->handler, commonInfo->eventSource ? 2 : 1);
|
||||
|
@ -585,7 +585,7 @@ int LuaEngine::handlerControlEvent(void* data)
|
|||
|
||||
if (0 != handler)
|
||||
{
|
||||
_stack->pushObject((Ref*)basicScriptData->nativeObject, "cc.Object");
|
||||
_stack->pushObject((Ref*)basicScriptData->nativeObject, "cc.Ref");
|
||||
_stack->pushInt(controlEvents);
|
||||
ret = _stack->executeFunctionByHandler(handler, 2);
|
||||
_stack->clean();
|
||||
|
@ -1013,7 +1013,7 @@ int LuaEngine::handleStudioEventListener(ScriptHandlerMgr::HandlerType type,void
|
|||
if (0 == handler)
|
||||
return 0;
|
||||
|
||||
_stack->pushObject(listenerData->objTarget, "cc.Object");
|
||||
_stack->pushObject(listenerData->objTarget, "cc.Ref");
|
||||
_stack->pushInt(listenerData->eventType);
|
||||
|
||||
_stack->executeFunctionByHandler(handler, 2);
|
||||
|
|
|
@ -24,13 +24,12 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCLuaStack.h"
|
||||
|
||||
#include "tolua_fix.h"
|
||||
extern "C" {
|
||||
#include "lua.h"
|
||||
#include "tolua++.h"
|
||||
#include "lualib.h"
|
||||
#include "lauxlib.h"
|
||||
#include "tolua_fix.h"
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
#include "lua_extensions.h"
|
||||
#endif
|
||||
|
|
|
@ -23,14 +23,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "LuaBasicConversions.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "tolua_fix.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "tolua_fix.h"
|
||||
|
||||
std::unordered_map<std::string, std::string> g_luaType;
|
||||
std::unordered_map<std::string, std::string> g_typeCast;
|
||||
|
@ -1071,7 +1064,7 @@ bool luavals_variadic_to_array(lua_State* L,int argc, Array** ret)
|
|||
else if (lua_isuserdata(L, i + 2))
|
||||
{
|
||||
tolua_Error err;
|
||||
if (!tolua_isusertype(L, i + 2, "cc.Object", 0, &err))
|
||||
if (!tolua_isusertype(L, i + 2, "cc.Ref", 0, &err))
|
||||
{
|
||||
#if COCOS2D_DEBUG >=1
|
||||
luaval_to_native_err(L,"#ferror:",&err);
|
||||
|
@ -1596,18 +1589,9 @@ void physics_raycastinfo_to_luaval(lua_State* L, const PhysicsRayCastInfo& info)
|
|||
lua_pushnil(L);
|
||||
}else
|
||||
{
|
||||
std::string hashName = typeid(*shape).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "PhysicsShape";
|
||||
}
|
||||
|
||||
int ID = (int)(shape->_ID);
|
||||
int* luaID = &(shape->_luaID);
|
||||
toluafix_pushusertype_ccobject(L, ID, luaID, (void*)shape,className.c_str());
|
||||
toluafix_pushusertype_ccobject(L, ID, luaID, (void*)shape,"cc.PhysicsShape");
|
||||
}
|
||||
lua_rawset(L, -3); /* table[key] = value, L: table */
|
||||
|
||||
|
|
|
@ -27,9 +27,8 @@
|
|||
extern "C" {
|
||||
#include "lua.h"
|
||||
#include "tolua++.h"
|
||||
#include "tolua_fix.h"
|
||||
}
|
||||
|
||||
#include "tolua_fix.h"
|
||||
#include "cocos2d.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
@ -87,8 +86,8 @@ bool luavals_variadic_to_ccvector( lua_State* L, int argc, cocos2d::Vector<T>* r
|
|||
if (lua_isuserdata(L, i + 2))
|
||||
{
|
||||
tolua_Error err;
|
||||
//Undo check
|
||||
if (!tolua_isusertype(L, i + 2, "cc.Object", 0, &err))
|
||||
|
||||
if (!tolua_isusertype(L, i + 2, "cc.Ref", 0, &err))
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
|
@ -294,36 +293,46 @@ void ccvaluemap_to_luaval(lua_State* L,const cocos2d::ValueMap& inValue);
|
|||
void ccvaluemapintkey_to_luaval(lua_State* L, const cocos2d::ValueMapIntKey& inValue);
|
||||
void ccvaluevector_to_luaval(lua_State* L, const cocos2d::ValueVector& inValue);
|
||||
|
||||
/**
|
||||
Because all override functions wouldn't be bound,so we must use `typeid` to get the real class name
|
||||
*/
|
||||
template <class T>
|
||||
const char* getLuaTypeName(T* ret,const char* type)
|
||||
{
|
||||
if (nullptr != ret)
|
||||
{
|
||||
std::string hashName = typeid(*ret).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
if(g_luaType.end() != iter)
|
||||
{
|
||||
return iter->second.c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void object_to_luaval(lua_State* L,const char* type, T* ret)
|
||||
{
|
||||
if(nullptr != ret)
|
||||
{
|
||||
/**
|
||||
Because all override functions wouldn't be bound,so we must use `typeid` to get the real class name
|
||||
*/
|
||||
std::string hashName = typeid(*ret).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(g_luaType.end() != iter)
|
||||
{
|
||||
className = iter->second.c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
className = type;
|
||||
}
|
||||
|
||||
|
||||
cocos2d::Ref* dynObject = dynamic_cast<cocos2d::Ref *>(ret);
|
||||
|
||||
if (nullptr != dynObject)
|
||||
{
|
||||
int ID = (int)(dynObject->_ID) ;
|
||||
int* luaID = &(dynObject->_luaID);
|
||||
toluafix_pushusertype_ccobject(L,ID, luaID, (void*)ret,className.c_str());
|
||||
toluafix_pushusertype_ccobject(L,ID, luaID, (void*)ret,type);
|
||||
}
|
||||
else
|
||||
{
|
||||
tolua_pushusertype(L,(void*)ret,className.c_str());
|
||||
tolua_pushusertype(L,(void*)ret,getLuaTypeName(ret, type));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1 +1 @@
|
|||
79a0d9662a9a7c45ff5d17c60a855b7144b91d1f
|
||||
ac3ec208ccad60f34c9f194d1815f0129fe711dc
|
|
@ -21,17 +21,10 @@
|
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "tolua_fix.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "LuaScriptHandlerMgr.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "LuaScriptHandlerMgr.h"
|
||||
#include "tolua_fix.h"
|
||||
#include "cocos2d.h"
|
||||
#include "extensions/cocos-ext.h"
|
||||
#include "CCLuaStack.h"
|
||||
|
@ -282,7 +275,7 @@ static int tolua_Cocos2d_ScriptHandlerMgr_registerScriptHandler00(lua_State* tol
|
|||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(tolua_S,1,"ScriptHandlerMgr",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S, 2, "cc.Object", 0, &tolua_err) ||
|
||||
!tolua_isusertype(tolua_S, 2, "cc.Ref", 0, &tolua_err) ||
|
||||
!toluafix_isfunction(tolua_S, 3, "LUA_FUNCTION", 0, &tolua_err) ||
|
||||
!tolua_isnumber(tolua_S, 4, 0, &tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,5,&tolua_err) )
|
||||
|
@ -316,7 +309,7 @@ static int tolua_Cocos2d_ScriptHandlerMgr_unregisterScriptHandler00(lua_State* t
|
|||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(tolua_S,1,"ScriptHandlerMgr",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S, 2, "cc.Object", 0, &tolua_err) ||
|
||||
!tolua_isusertype(tolua_S, 2, "cc.Ref", 0, &tolua_err) ||
|
||||
!tolua_isnumber(tolua_S, 3, 0, &tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,4,&tolua_err) )
|
||||
goto tolua_lerror;
|
||||
|
@ -348,7 +341,7 @@ static int tolua_Cocos2d_ScriptHandlerMgr_removeObjectAllHandlers00(lua_State* t
|
|||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(tolua_S,1,"ScriptHandlerMgr",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S, 2, "cc.Object", 0, &tolua_err) ||
|
||||
!tolua_isusertype(tolua_S, 2, "cc.Ref", 0, &tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err) )
|
||||
goto tolua_lerror;
|
||||
else
|
||||
|
|
|
@ -23,18 +23,10 @@
|
|||
****************************************************************************/
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "tolua_fix.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "Lua_web_socket.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "Lua_web_socket.h"
|
||||
#include "tolua_fix.h"
|
||||
#include "cocos2d.h"
|
||||
#include "CCLuaStack.h"
|
||||
#include "CCLuaValue.h"
|
||||
|
|
|
@ -22,16 +22,8 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "lua_cocos2dx_coco_studio_manual.hpp"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "tolua_fix.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "tolua_fix.h"
|
||||
#include "LuaBasicConversions.h"
|
||||
#include "LuaScriptHandlerMgr.h"
|
||||
#include "CCLuaValue.h"
|
||||
|
|
|
@ -22,16 +22,8 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "lua_cocos2dx_deprecated.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "tolua_fix.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "tolua_fix.h"
|
||||
#include "LuaBasicConversions.h"
|
||||
#include "LuaScriptHandlerMgr.h"
|
||||
#include "CCLuaValue.h"
|
||||
|
@ -518,7 +510,7 @@ static int tolua_Cocos2d_CCArray_createWithObject00(lua_State* tolua_S)
|
|||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertable(tolua_S,1,"CCArray",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"Object",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"cc.Ref",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
|
@ -709,7 +701,7 @@ static int tolua_Cocos2d_CCArray_indexOfObject00(lua_State* tolua_S)
|
|||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCArray",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"Object",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"cc.Ref",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
|
@ -759,7 +751,7 @@ static int tolua_Cocos2d_CCArray_objectAtIndex00(lua_State* tolua_S)
|
|||
Ref* tolua_ret = (Ref*) self->getObjectAtIndex(index);
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"Object");
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Ref");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -793,7 +785,7 @@ static int tolua_Cocos2d_CCArray_lastObject00(lua_State* tolua_S)
|
|||
Ref* tolua_ret = (Ref*) self->getLastObject();
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"Object");
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Ref");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -827,7 +819,7 @@ static int tolua_Cocos2d_CCArray_randomObject00(lua_State* tolua_S)
|
|||
Ref* tolua_ret = (Ref*) self->getRandomObject();
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"Object");
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Ref");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -881,7 +873,7 @@ static int tolua_Cocos2d_CCArray_containsObject00(lua_State* tolua_S)
|
|||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCArray",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"Object",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"cc.Ref",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
|
@ -915,7 +907,7 @@ static int tolua_Cocos2d_CCArray_addObject00(lua_State* tolua_S)
|
|||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCArray",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"Object",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"cc.Ref",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
|
@ -980,7 +972,7 @@ static int tolua_Cocos2d_CCArray_insertObject00(lua_State* tolua_S)
|
|||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCArray",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"Object",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"cc.Ref",0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,4,&tolua_err)
|
||||
)
|
||||
|
@ -1047,7 +1039,7 @@ static int tolua_Cocos2d_CCArray_removeObject00(lua_State* tolua_S)
|
|||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCArray",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"Object",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"cc.Ref",0,&tolua_err) ||
|
||||
!tolua_isboolean(tolua_S,3,1,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,4,&tolua_err)
|
||||
)
|
||||
|
@ -1178,7 +1170,7 @@ static int tolua_Cocos2d_CCArray_fastRemoveObject00(lua_State* tolua_S)
|
|||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCArray",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"Object",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"cc.Ref",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
|
@ -1243,8 +1235,8 @@ static int tolua_Cocos2d_CCArray_exchangeObject00(lua_State* tolua_S)
|
|||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCArray",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"Object",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,3,"Object",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,2,"cc.Ref",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,3,"cc.Ref",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,4,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
|
@ -1375,7 +1367,7 @@ static int tolua_Cocos2d_CCArray_replaceObjectAtIndex00(lua_State* tolua_S)
|
|||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCArray",0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,3,"Object",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,3,"cc.Ref",0,&tolua_err) ||
|
||||
!tolua_isboolean(tolua_S,4,1,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,5,&tolua_err)
|
||||
)
|
||||
|
@ -1909,7 +1901,7 @@ tolua_lerror:
|
|||
static int register_cocos2dx_deprecated_String(lua_State* tolua_S)
|
||||
{
|
||||
tolua_usertype(tolua_S, "CCString");
|
||||
tolua_cclass(tolua_S,"CCString","CCString","Object",NULL);
|
||||
tolua_cclass(tolua_S,"CCString","CCString","cc.Ref",NULL);
|
||||
tolua_beginmodule(tolua_S,"CCString");
|
||||
tolua_function(tolua_S,"intValue",tolua_Cocos2d_CCString_intValue00);
|
||||
tolua_function(tolua_S,"uintValue",tolua_Cocos2d_CCString_uintValue00);
|
||||
|
@ -1968,7 +1960,7 @@ static int tolua_cocos2d_Animation_createWithSpriteFrames_deprecated00(lua_State
|
|||
cocos2d::Animation* tolua_ret = (cocos2d::Animation*) cocos2d::Animation::createWithSpriteFrames(vec,delay);
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"Animation");
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Animation");
|
||||
|
||||
}
|
||||
return 1;
|
||||
|
@ -1993,7 +1985,7 @@ static int tolua_cocos2d_Animation_createWithSpriteFrames_deprecated01(lua_State
|
|||
cocos2d::Animation* tolua_ret = (cocos2d::Animation*) cocos2d::Animation::createWithSpriteFrames(vec);
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"Animation");
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Animation");
|
||||
|
||||
}
|
||||
return 1;
|
||||
|
@ -2037,7 +2029,7 @@ static int tolua_cocos2d_Sequence_createWithTwoActions(lua_State* tolua_S)
|
|||
Sequence* tolua_ret = (Sequence*) Sequence::createWithTwoActions(pActionOne,pActionTwo);
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"Sequence");
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Sequence");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -2066,7 +2058,7 @@ static int tolua_Cocos2d_Sequence_create_deprecated00(lua_State* tolua_S)
|
|||
Sequence* tolua_ret = (Sequence*) Sequence::create(vec);
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"Sequence");
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Sequence");
|
||||
}
|
||||
return 1;
|
||||
tolua_lerror:
|
||||
|
@ -2174,7 +2166,7 @@ static int tolua_cocos2d_Spawn_createWithTwoActions_deprcated00(lua_State* tolua
|
|||
Spawn* tolua_ret = (Spawn*) Spawn::createWithTwoActions(pAction1,pAction2);
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"Spawn");
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Spawn");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -2217,7 +2209,7 @@ static int tolua_cocos2d_Menu_createWithArray00(lua_State* tolua_S)
|
|||
Menu* tolua_ret = (Menu*) Menu::createWithArray(vec);
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"Menu");
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Menu");
|
||||
}
|
||||
return 1;
|
||||
#ifndef TOLUA_RELEASE
|
||||
|
@ -2321,7 +2313,7 @@ static int tolua_cocos2d_LayerMultiplex_createWithArray00(lua_State* tolua_S)
|
|||
LayerMultiplex* tolua_ret = (LayerMultiplex*) LayerMultiplex::createWithArray(vec);
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"LayerMultiplex");
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.LayerMultiplex");
|
||||
|
||||
}
|
||||
return 1;
|
||||
|
|
|
@ -22,16 +22,8 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "lua_cocos2dx_extension_manual.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "tolua_fix.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "tolua_fix.h"
|
||||
#include "LuaBasicConversions.h"
|
||||
#include "CCLuaValue.h"
|
||||
#include "cocos-ext.h"
|
||||
|
@ -766,7 +758,7 @@ static int tolua_cocos2d_CCBReader_load(lua_State* tolua_S)
|
|||
}
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S, 3, "cc.Object", 0, &tolua_err))
|
||||
if (!tolua_isusertype(tolua_S, 3, "cc.Ref", 0, &tolua_err))
|
||||
goto tolua_lerror;
|
||||
#endif
|
||||
Ref* owner = static_cast<Ref*>(tolua_tousertype(tolua_S, 3, 0));
|
||||
|
|
|
@ -22,16 +22,8 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "lua_cocos2dx_gui_manual.hpp"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "tolua_fix.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "tolua_fix.h"
|
||||
#include "LuaBasicConversions.h"
|
||||
#include "LuaScriptHandlerMgr.h"
|
||||
#include "CCLuaValue.h"
|
||||
|
|
|
@ -1 +1 @@
|
|||
29bde887dbd41a72f33704fb57cbab230d1a1688
|
||||
6b4a49b88aacb735030875a6da6af87086f85628
|
|
@ -1,15 +1,7 @@
|
|||
#include "lua_cocos2dx_manual.hpp"
|
||||
|
||||
#if CC_USE_PHYSICS
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "tolua_fix.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "tolua_fix.h"
|
||||
#include "LuaBasicConversions.h"
|
||||
#include "CCLuaValue.h"
|
||||
#include "CCLuaEngine.h"
|
||||
|
@ -63,21 +55,12 @@ int lua_cocos2dx_physics_PhysicsBody_getJoints(lua_State* tolua_S)
|
|||
if (nullptr == *iter)
|
||||
continue;
|
||||
|
||||
std::string hashName = typeid(*iter).name();
|
||||
auto name = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(name != g_luaType.end()){
|
||||
className = name->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsJoint";
|
||||
}
|
||||
|
||||
lua_pushnumber(tolua_S, (lua_Number)indexTable);
|
||||
tolua_pushusertype(tolua_S,(void*)(*iter), className.c_str());
|
||||
tolua_pushusertype(tolua_S,(void*)(*iter), getLuaTypeName(*iter, "cc.PhysicsJoint"));
|
||||
lua_rawset(tolua_S, -3);
|
||||
++indexTable;
|
||||
}
|
||||
} while (0);
|
||||
} while (0);
|
||||
return 1;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getJoints",argc, 0);
|
||||
|
@ -184,21 +167,12 @@ int lua_cocos2dx_physics_PhysicsWorld_rayCast(lua_State* tolua_S)
|
|||
LUA_FUNCTION handler = toluafix_ref_function(tolua_S, 2, 0);
|
||||
do {
|
||||
arg0 = [handler, tolua_S](cocos2d::PhysicsWorld &world, const cocos2d::PhysicsRayCastInfo &info, void * data) -> bool
|
||||
{
|
||||
std::string hashName = typeid(&world).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsWorld";
|
||||
}
|
||||
|
||||
tolua_pushusertype(tolua_S, (void*)(&world), className.c_str());
|
||||
{
|
||||
tolua_pushusertype(tolua_S, (void*)(&world), getLuaTypeName(&world, "cc.PhysicsWorld"));
|
||||
physics_raycastinfo_to_luaval(tolua_S, info);
|
||||
return LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
|
||||
};
|
||||
} while(0);
|
||||
} while(0);
|
||||
|
||||
ok &= luaval_to_point(tolua_S, 3, &arg1);
|
||||
ok &= luaval_to_point(tolua_S, 4, &arg2);
|
||||
|
@ -251,29 +225,11 @@ int lua_cocos2dx_physics_PhysicsWorld_queryRect(lua_State* tolua_S)
|
|||
do {
|
||||
arg0 = [handler, tolua_S](cocos2d::PhysicsWorld &world, cocos2d::PhysicsShape &shape, void * data) -> bool
|
||||
{
|
||||
std::string hashName = typeid(&world).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsWorld";
|
||||
}
|
||||
|
||||
tolua_pushusertype(tolua_S, (void*)(&world), className.c_str());
|
||||
|
||||
hashName = typeid(&shape).name();
|
||||
iter = g_luaType.find(hashName);
|
||||
className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsShape";
|
||||
}
|
||||
toluafix_pushusertype_ccobject(tolua_S, shape._ID, &shape._luaID, (void*)(&shape), className.c_str());
|
||||
tolua_pushusertype(tolua_S, (void*)(&world), getLuaTypeName(&world, "cc.PhysicsWorld"));
|
||||
toluafix_pushusertype_ccobject(tolua_S, shape._ID, &shape._luaID, (void*)(&shape), "cc.PhysicsShape");
|
||||
return LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
|
||||
};
|
||||
} while(0);
|
||||
} while(0);
|
||||
|
||||
ok &= luaval_to_rect(tolua_S, 3, &arg1);
|
||||
if(!ok)
|
||||
|
@ -326,31 +282,13 @@ int lua_cocos2dx_physics_PhysicsWorld_queryPoint(lua_State* tolua_S)
|
|||
LUA_FUNCTION handler = toluafix_ref_function(tolua_S, 2, 0);
|
||||
do {
|
||||
arg0 = [handler, tolua_S](cocos2d::PhysicsWorld &world, cocos2d::PhysicsShape &shape, void * data) -> bool
|
||||
{
|
||||
std::string hashName = typeid(&world).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsWorld";
|
||||
}
|
||||
|
||||
tolua_pushusertype(tolua_S, (void*)(&world), className.c_str());
|
||||
|
||||
hashName = typeid(&shape).name();
|
||||
iter = g_luaType.find(hashName);
|
||||
className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsShape";
|
||||
}
|
||||
toluafix_pushusertype_ccobject(tolua_S, shape._ID, &shape._luaID, (void*)(&shape), className.c_str());
|
||||
{
|
||||
tolua_pushusertype(tolua_S, (void*)(&world), getLuaTypeName(&world, "cc.PhysicsWorld"));
|
||||
toluafix_pushusertype_ccobject(tolua_S, shape._ID, &shape._luaID, (void*)(&shape), "cc.PhysicsShape");
|
||||
return LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
|
||||
};
|
||||
assert(false);
|
||||
} while(0)
|
||||
assert(false);
|
||||
} while(0)
|
||||
;
|
||||
ok &= luaval_to_point(tolua_S, 3, &arg1);
|
||||
if(!ok)
|
||||
|
@ -402,26 +340,17 @@ int lua_cocos2dx_physics_PhysicsBody_createPolygon(lua_State* tolua_S)
|
|||
cocos2d::PhysicsBody* ret = cocos2d::PhysicsBody::createPolygon(arg0, arg1);
|
||||
CC_SAFE_FREE(arg0);
|
||||
do {
|
||||
if (NULL != ret){
|
||||
std::string hashName = typeid(*ret).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsBody";
|
||||
}
|
||||
cocos2d::Ref *dynObject = dynamic_cast<cocos2d::Ref *>((cocos2d::PhysicsBody*)ret);
|
||||
if (NULL != dynObject) {
|
||||
int ID = ret ? (int)(dynObject->_ID) : -1;
|
||||
int* luaID = ret ? &(dynObject->_luaID) : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret,className.c_str());
|
||||
} else {
|
||||
tolua_pushusertype(tolua_S,(void*)ret,className.c_str());
|
||||
}} else {
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
if (nullptr != ret)
|
||||
{
|
||||
int ID = ret->_ID;
|
||||
int* luaID = &ret->_luaID;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret, "cc.PhysicsBody");
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
return 1;
|
||||
}
|
||||
if (argc == 2)
|
||||
|
@ -443,26 +372,18 @@ int lua_cocos2dx_physics_PhysicsBody_createPolygon(lua_State* tolua_S)
|
|||
cocos2d::PhysicsBody* ret = cocos2d::PhysicsBody::createPolygon(arg0, arg1, arg2);
|
||||
CC_SAFE_FREE(arg0);
|
||||
do {
|
||||
if (NULL != ret){
|
||||
std::string hashName = typeid(*ret).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsBody";
|
||||
}
|
||||
cocos2d::Ref *dynObject = dynamic_cast<cocos2d::Ref *>((cocos2d::PhysicsBody*)ret);
|
||||
if (NULL != dynObject) {
|
||||
int ID = ret ? (int)(dynObject->_ID) : -1;
|
||||
int* luaID = ret ? &(dynObject->_luaID) : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret,className.c_str());
|
||||
} else {
|
||||
tolua_pushusertype(tolua_S,(void*)ret,className.c_str());
|
||||
}} else {
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
if (nullptr != ret)
|
||||
{
|
||||
int ID = ret->_ID;
|
||||
int* luaID = &ret->_luaID;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret, "cc.PhysicsBody");
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
return 1;
|
||||
}
|
||||
if (argc == 3)
|
||||
|
@ -486,26 +407,17 @@ int lua_cocos2dx_physics_PhysicsBody_createPolygon(lua_State* tolua_S)
|
|||
cocos2d::PhysicsBody* ret = cocos2d::PhysicsBody::createPolygon(arg0, arg1, arg2, arg3);
|
||||
CC_SAFE_FREE(arg0);
|
||||
do {
|
||||
if (NULL != ret){
|
||||
std::string hashName = typeid(*ret).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsBody";
|
||||
}
|
||||
cocos2d::Ref *dynObject = dynamic_cast<cocos2d::Ref *>((cocos2d::PhysicsBody*)ret);
|
||||
if (NULL != dynObject) {
|
||||
int ID = ret ? (int)(dynObject->_ID) : -1;
|
||||
int* luaID = ret ? &(dynObject->_luaID) : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret,className.c_str());
|
||||
} else {
|
||||
tolua_pushusertype(tolua_S,(void*)ret,className.c_str());
|
||||
}} else {
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
if (nullptr != ret)
|
||||
{
|
||||
int ID = ret->_ID;
|
||||
int* luaID = &ret->_luaID;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret, "cc.PhysicsBody");
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
return 1;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "createPolygon",argc, 2);
|
||||
|
@ -549,26 +461,17 @@ int lua_cocos2dx_physics_PhysicsBody_createEdgePolygon(lua_State* tolua_S)
|
|||
cocos2d::PhysicsBody* ret = cocos2d::PhysicsBody::createEdgePolygon(arg0, arg1);
|
||||
CC_SAFE_FREE(arg0);
|
||||
do {
|
||||
if (NULL != ret){
|
||||
std::string hashName = typeid(*ret).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsBody";
|
||||
}
|
||||
cocos2d::Ref *dynObject = dynamic_cast<cocos2d::Ref *>((cocos2d::PhysicsBody*)ret);
|
||||
if (NULL != dynObject) {
|
||||
int ID = ret ? (int)(dynObject->_ID) : -1;
|
||||
int* luaID = ret ? &(dynObject->_luaID) : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret,className.c_str());
|
||||
} else {
|
||||
tolua_pushusertype(tolua_S,(void*)ret,className.c_str());
|
||||
}} else {
|
||||
if (nullptr != ret)
|
||||
{
|
||||
int ID = ret->_ID;
|
||||
int* luaID = &ret->_luaID;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret, "cc.PhysicsBody");
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
} while (0);
|
||||
return 1;
|
||||
}
|
||||
if (argc == 2)
|
||||
|
@ -590,26 +493,17 @@ int lua_cocos2dx_physics_PhysicsBody_createEdgePolygon(lua_State* tolua_S)
|
|||
cocos2d::PhysicsBody* ret = cocos2d::PhysicsBody::createEdgePolygon(arg0, arg1, arg2);
|
||||
CC_SAFE_FREE(arg0);
|
||||
do {
|
||||
if (NULL != ret){
|
||||
std::string hashName = typeid(*ret).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsBody";
|
||||
}
|
||||
cocos2d::Ref *dynObject = dynamic_cast<cocos2d::Ref *>((cocos2d::PhysicsBody*)ret);
|
||||
if (NULL != dynObject) {
|
||||
int ID = ret ? (int)(dynObject->_ID) : -1;
|
||||
int* luaID = ret ? &(dynObject->_luaID) : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret,className.c_str());
|
||||
} else {
|
||||
tolua_pushusertype(tolua_S,(void*)ret,className.c_str());
|
||||
}} else {
|
||||
if (nullptr != ret)
|
||||
{
|
||||
int ID = ret->_ID;
|
||||
int* luaID = &ret->_luaID;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret, "cc.PhysicsBody");
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
} while (0);
|
||||
return 1;
|
||||
}
|
||||
if (argc == 3)
|
||||
|
@ -633,26 +527,17 @@ int lua_cocos2dx_physics_PhysicsBody_createEdgePolygon(lua_State* tolua_S)
|
|||
cocos2d::PhysicsBody* ret = cocos2d::PhysicsBody::createEdgePolygon(arg0, arg1, arg2, arg3);
|
||||
CC_SAFE_FREE(arg0);
|
||||
do {
|
||||
if (NULL != ret){
|
||||
std::string hashName = typeid(*ret).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsBody";
|
||||
}
|
||||
cocos2d::Ref *dynObject = dynamic_cast<cocos2d::Ref *>((cocos2d::PhysicsBody*)ret);
|
||||
if (NULL != dynObject) {
|
||||
int ID = ret ? (int)(dynObject->_ID) : -1;
|
||||
int* luaID = ret ? &(dynObject->_luaID) : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret,className.c_str());
|
||||
} else {
|
||||
tolua_pushusertype(tolua_S,(void*)ret,className.c_str());
|
||||
}} else {
|
||||
if (nullptr != ret)
|
||||
{
|
||||
int ID = ret->_ID;
|
||||
int* luaID = &ret->_luaID;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret, "cc.PhysicsBody");
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
} while (0);
|
||||
return 1;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "createEdgePolygon",argc, 2);
|
||||
|
@ -696,26 +581,17 @@ int lua_cocos2dx_physics_PhysicsBody_createEdgeChain(lua_State* tolua_S)
|
|||
cocos2d::PhysicsBody* ret = cocos2d::PhysicsBody::createEdgeChain(arg0, arg1);
|
||||
CC_SAFE_FREE(arg0);
|
||||
do {
|
||||
if (NULL != ret){
|
||||
std::string hashName = typeid(*ret).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsBody";
|
||||
}
|
||||
cocos2d::Ref *dynObject = dynamic_cast<cocos2d::Ref *>((cocos2d::PhysicsBody*)ret);
|
||||
if (NULL != dynObject) {
|
||||
int ID = ret ? (int)(dynObject->_ID) : -1;
|
||||
int* luaID = ret ? &(dynObject->_luaID) : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret,className.c_str());
|
||||
} else {
|
||||
tolua_pushusertype(tolua_S,(void*)ret,className.c_str());
|
||||
}} else {
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
if (nullptr != ret)
|
||||
{
|
||||
int ID = ret->_ID;
|
||||
int* luaID = &ret->_luaID;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret, "cc.PhysicsBody");
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
return 1;
|
||||
}
|
||||
if (argc == 2)
|
||||
|
@ -737,26 +613,17 @@ int lua_cocos2dx_physics_PhysicsBody_createEdgeChain(lua_State* tolua_S)
|
|||
cocos2d::PhysicsBody* ret = cocos2d::PhysicsBody::createEdgeChain(arg0, arg1, arg2);
|
||||
CC_SAFE_FREE(arg0);
|
||||
do {
|
||||
if (NULL != ret){
|
||||
std::string hashName = typeid(*ret).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsBody";
|
||||
}
|
||||
cocos2d::Ref *dynObject = dynamic_cast<cocos2d::Ref *>((cocos2d::PhysicsBody*)ret);
|
||||
if (NULL != dynObject) {
|
||||
int ID = ret ? (int)(dynObject->_ID) : -1;
|
||||
int* luaID = ret ? &(dynObject->_luaID) : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret,className.c_str());
|
||||
} else {
|
||||
tolua_pushusertype(tolua_S,(void*)ret,className.c_str());
|
||||
}} else {
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
if (nullptr != ret)
|
||||
{
|
||||
int ID = ret->_ID;
|
||||
int* luaID = &ret->_luaID;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret, "cc.PhysicsBody");
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
return 1;
|
||||
}
|
||||
if (argc == 3)
|
||||
|
@ -780,26 +647,17 @@ int lua_cocos2dx_physics_PhysicsBody_createEdgeChain(lua_State* tolua_S)
|
|||
cocos2d::PhysicsBody* ret = cocos2d::PhysicsBody::createEdgeChain(arg0, arg1, arg2, arg3);
|
||||
CC_SAFE_FREE(arg0);
|
||||
do {
|
||||
if (NULL != ret){
|
||||
std::string hashName = typeid(*ret).name();
|
||||
auto iter = g_luaType.find(hashName);
|
||||
std::string className = "";
|
||||
if(iter != g_luaType.end()){
|
||||
className = iter->second.c_str();
|
||||
} else {
|
||||
className = "cc.PhysicsBody";
|
||||
}
|
||||
cocos2d::Ref *dynObject = dynamic_cast<cocos2d::Ref *>((cocos2d::PhysicsBody*)ret);
|
||||
if (NULL != dynObject) {
|
||||
int ID = ret ? (int)(dynObject->_ID) : -1;
|
||||
int* luaID = ret ? &(dynObject->_luaID) : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret,className.c_str());
|
||||
} else {
|
||||
tolua_pushusertype(tolua_S,(void*)ret,className.c_str());
|
||||
}} else {
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
if (nullptr != ret)
|
||||
{
|
||||
int ID = ret->_ID;
|
||||
int* luaID = &ret->_luaID;
|
||||
toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret, "cc.PhysicsBody");
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pushnil(tolua_S);
|
||||
}
|
||||
} while (0);
|
||||
return 1;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "createEdgeChain",argc, 2);
|
||||
|
@ -1152,9 +1010,9 @@ static int tolua_cocos2dx_EventListenerPhysicsContact_registerScriptHandler(lua_
|
|||
self = static_cast<EventListenerPhysicsContact*>(tolua_tousertype(tolua_S,1,0));
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (nullptr == self) {
|
||||
tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_EventListenerPhysicsContact_registerScriptHandler'\n", nullptr);
|
||||
return 0;
|
||||
}
|
||||
tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_EventListenerPhysicsContact_registerScriptHandler'\n", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
argc = lua_gettop(tolua_S) - 1;
|
||||
|
||||
|
|
|
@ -22,16 +22,8 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "lua_cocos2dx_spine_manual.hpp"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "tolua_fix.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "tolua_fix.h"
|
||||
#include "LuaBasicConversions.h"
|
||||
#include "LuaScriptHandlerMgr.h"
|
||||
#include "CCLuaValue.h"
|
||||
|
|
|
@ -22,13 +22,8 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "lua_xml_http_request.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "tolua_fix.h"
|
||||
}
|
||||
|
||||
#include <string>
|
||||
#include "tolua_fix.h"
|
||||
#include "CCLuaStack.h"
|
||||
#include "CCLuaValue.h"
|
||||
#include "CCLuaEngine.h"
|
||||
|
@ -1084,7 +1079,7 @@ TOLUA_API int register_xml_http_request(lua_State* L)
|
|||
lua_reg_xml_http_request(L);
|
||||
tolua_module(L,"cc",0);
|
||||
tolua_beginmodule(L,"cc");
|
||||
tolua_cclass(L,"XMLHttpRequest","cc.XMLHttpRequest","cc.Object",lua_collect_xml_http_request);
|
||||
tolua_cclass(L,"XMLHttpRequest","cc.XMLHttpRequest","cc.Ref",lua_collect_xml_http_request);
|
||||
tolua_beginmodule(L,"XMLHttpRequest");
|
||||
tolua_variable(L, "responseType", lua_get_XMLHttpRequest_responseType, lua_set_XMLHttpRequest_responseType);
|
||||
tolua_variable(L, "withCredentials", lua_get_XMLHttpRequest_withCredentials, lua_set_XMLHttpRequest_withCredentials);
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
|
||||
#include "tolua_fix.h"
|
||||
#include "CCRef.h"
|
||||
#include "LuaBasicConversions.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
static int s_function_ref_id = 0;
|
||||
|
||||
TOLUA_API void toluafix_open(lua_State* L)
|
||||
|
@ -30,6 +34,9 @@ TOLUA_API int toluafix_pushusertype_ccobject(lua_State* L,
|
|||
lua_pushnil(L);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Ref* vPtr = static_cast<Ref*>(ptr);
|
||||
const char* vType = getLuaTypeName(vPtr, type);
|
||||
|
||||
if (*p_refid == 0)
|
||||
{
|
||||
|
@ -38,7 +45,7 @@ TOLUA_API int toluafix_pushusertype_ccobject(lua_State* L,
|
|||
lua_pushstring(L, TOLUA_REFID_PTR_MAPPING);
|
||||
lua_rawget(L, LUA_REGISTRYINDEX); /* stack: refid_ptr */
|
||||
lua_pushinteger(L, refid); /* stack: refid_ptr refid */
|
||||
lua_pushlightuserdata(L, ptr); /* stack: refid_ptr refid ptr */
|
||||
lua_pushlightuserdata(L, vPtr); /* stack: refid_ptr refid ptr */
|
||||
|
||||
lua_rawset(L, -3); /* refid_ptr[refid] = ptr, stack: refid_ptr */
|
||||
lua_pop(L, 1); /* stack: - */
|
||||
|
@ -46,14 +53,14 @@ TOLUA_API int toluafix_pushusertype_ccobject(lua_State* L,
|
|||
lua_pushstring(L, TOLUA_REFID_TYPE_MAPPING);
|
||||
lua_rawget(L, LUA_REGISTRYINDEX); /* stack: refid_type */
|
||||
lua_pushinteger(L, refid); /* stack: refid_type refid */
|
||||
lua_pushstring(L, type); /* stack: refid_type refid type */
|
||||
lua_pushstring(L, vType); /* stack: refid_type refid type */
|
||||
lua_rawset(L, -3); /* refid_type[refid] = type, stack: refid_type */
|
||||
lua_pop(L, 1); /* stack: - */
|
||||
|
||||
//printf("[LUA] push CCObject OK - refid: %d, ptr: %x, type: %s\n", *p_refid, (int)ptr, type);
|
||||
}
|
||||
|
||||
tolua_pushusertype_and_addtoroot(L, ptr, type);
|
||||
tolua_pushusertype_and_addtoroot(L, vPtr, vType);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -3,11 +3,6 @@
|
|||
#define __TOLUA_FIX_H_
|
||||
|
||||
#include "tolua++.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define TOLUA_REFID_PTR_MAPPING "toluafix_refid_ptr_mapping"
|
||||
#define TOLUA_REFID_TYPE_MAPPING "toluafix_refid_type_mapping"
|
||||
|
@ -27,9 +22,5 @@ TOLUA_API int toluafix_isfunction(lua_State* L, int lo, const char* type, int de
|
|||
TOLUA_API int toluafix_totable(lua_State* L, int lo, int def);
|
||||
TOLUA_API int toluafix_istable(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
|
||||
TOLUA_API void toluafix_stack_dump(lua_State* L, const char* label);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // __TOLUA_FIX_H_
|
||||
|
|
|
@ -129,8 +129,8 @@ _G["CCJumpBy"] = DeprecatedClass.CCJumpBy()
|
|||
|
||||
--CCObject class will be Deprecated,begin
|
||||
function DeprecatedClass.CCObject()
|
||||
deprecatedTip("CCObject","cc.Object")
|
||||
return cc.Object
|
||||
deprecatedTip("CCObject","cc.Ref")
|
||||
return cc.Ref
|
||||
end
|
||||
_G["CCObject"] = DeprecatedClass.CCObject()
|
||||
--CCObject class will be Deprecated,end
|
||||
|
@ -2187,4 +2187,12 @@ end
|
|||
_G["cc.EGLView"] = DeprecatedClass.EGLView()
|
||||
--EGLView class will be Deprecated,end
|
||||
|
||||
--cc.Object class will be Deprecated,begin
|
||||
function DeprecatedClass.Object()
|
||||
deprecatedTip("cc.Object","cc.Ref")
|
||||
return cc.Ref
|
||||
end
|
||||
_G["cc.Object"] = DeprecatedClass.Object()
|
||||
--cc.Object class will be Deprecated,end
|
||||
|
||||
|
||||
|
|
|
@ -84,4 +84,4 @@ If the last command results in sdk.dir missing error then do:
|
|||
|
||||
$ android list target
|
||||
$ android update project -p . -t (id from step 6)
|
||||
$ android update project -p cocos2d-x/cocos2dx/platform/android/java/ -t (id from step 6)
|
||||
$ android update project -p cocos2d/cocos/2d/platform/android/java/ -t (id from step 6)
|
||||
|
|
|
@ -33,9 +33,12 @@
|
|||
|
||||
static std::function<Layer*()> createFunctions[] = {
|
||||
|
||||
CL(ActionRotateBy3D),
|
||||
|
||||
CL(ActionManual),
|
||||
CL(ActionMove),
|
||||
CL(ActionRotate),
|
||||
CL(ActionRotateBy3D),
|
||||
CL(ActionScale),
|
||||
CL(ActionSkew),
|
||||
CL(ActionRotationalSkew),
|
||||
|
@ -501,6 +504,31 @@ std::string ActionRotate::subtitle() const
|
|||
return "RotateTo / RotateBy";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// ActionRotateBy3D
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
void ActionRotateBy3D::onEnter()
|
||||
{
|
||||
ActionsDemo::onEnter();
|
||||
|
||||
centerSprites(3);
|
||||
|
||||
auto actionBy1 = RotateBy::create(4, Vertex3F(360, 0, 0));
|
||||
auto actionBy2 = RotateBy::create(4, Vertex3F(0, 360, 0));
|
||||
auto actionBy3 = RotateBy::create(4 ,Vertex3F(0, 0, 360));
|
||||
|
||||
_tamara->runAction( Sequence::create(actionBy1, actionBy1->reverse(), nullptr));
|
||||
_grossini->runAction( Sequence::create(actionBy2, actionBy2->reverse(), nullptr));
|
||||
_kathia->runAction( Sequence::create(actionBy3, actionBy3->reverse(), nullptr));
|
||||
}
|
||||
|
||||
std::string ActionRotateBy3D::subtitle() const
|
||||
{
|
||||
return "RotateBy in 3D";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// ActionJump
|
||||
|
|
|
@ -49,7 +49,7 @@ protected:
|
|||
Sprite* _tamara;
|
||||
Sprite* _kathia;
|
||||
public:
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual void onExit();
|
||||
|
||||
void centerSprites(unsigned int numberOfSprites);
|
||||
|
@ -67,7 +67,7 @@ class ActionManual : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionManual);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -76,7 +76,7 @@ class ActionMove : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionMove);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -85,7 +85,7 @@ class ActionScale : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionScale);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -94,7 +94,7 @@ class ActionSkew : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionSkew);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -103,7 +103,7 @@ class ActionRotationalSkew : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionRotationalSkew);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -112,7 +112,7 @@ class ActionRotationalSkewVSStandardSkew : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionRotationalSkewVSStandardSkew);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -121,7 +121,7 @@ class ActionSkewRotateScale : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionSkewRotateScale);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -130,7 +130,16 @@ class ActionRotate : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionRotate);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class ActionRotateBy3D : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionRotateBy3D);
|
||||
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -139,7 +148,7 @@ class ActionJump : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionJump);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -148,7 +157,7 @@ class ActionBezier : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionBezier);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -157,7 +166,7 @@ class ActionBlink : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionBlink);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -166,7 +175,7 @@ class ActionFade : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionFade);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -175,7 +184,7 @@ class ActionTint : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionTint);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -184,7 +193,7 @@ class ActionAnimate : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionAnimate);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual void onExit();
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
@ -195,7 +204,7 @@ class ActionSequence : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionSequence);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -204,7 +213,7 @@ class ActionSequence2 : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionSequence2);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
void callback1();
|
||||
|
@ -217,7 +226,7 @@ class ActionSpawn : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionSpawn);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -226,7 +235,7 @@ class ActionReverse : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionReverse);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -235,7 +244,7 @@ class ActionRepeat : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionRepeat);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -244,7 +253,7 @@ class ActionDelayTime : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionDelayTime);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -253,7 +262,7 @@ class ActionReverseSequence : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionReverseSequence);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -262,7 +271,7 @@ class ActionReverseSequence2 : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionReverseSequence2);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -271,7 +280,7 @@ class ActionOrbit : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionOrbit);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -280,7 +289,7 @@ class ActionRemoveSelf : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionRemoveSelf);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -289,7 +298,7 @@ class ActionRepeatForever : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionRepeatForever);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
void repeatForever(Node* pTarget);
|
||||
|
@ -300,7 +309,7 @@ class ActionRotateToRepeat : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionRotateToRepeat);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -309,7 +318,7 @@ class ActionRotateJerk : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionRotateJerk);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
@ -318,7 +327,7 @@ class ActionCallFuncN : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionCallFuncN);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
void callback(Node* sender);
|
||||
|
@ -329,7 +338,7 @@ class ActionCallFuncND : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionCallFuncND);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
void doRemoveFromParentAndCleanup(Node* sender, bool cleanup);
|
||||
|
@ -340,7 +349,7 @@ class ActionCallFuncO : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionCallFuncO);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
void callback(Node* object, bool cleanup);
|
||||
|
@ -351,7 +360,7 @@ class ActionCallFunction : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionCallFunction);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
void callback1();
|
||||
|
@ -365,7 +374,7 @@ class ActionFollow : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionFollow);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual void draw();
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
|
@ -381,7 +390,7 @@ class ActionTargeted : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionTargeted);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
@ -391,7 +400,7 @@ class ActionTargetedReverse : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionTargetedReverse);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
@ -401,7 +410,7 @@ class ActionStacked : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(ActionStacked);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
virtual void addNewSpriteWithCoords(Point p);
|
||||
|
@ -443,7 +452,7 @@ public:
|
|||
|
||||
virtual ~ActionCatmullRomStacked();
|
||||
virtual void draw();
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
protected:
|
||||
|
@ -464,7 +473,7 @@ public:
|
|||
|
||||
virtual ~ActionCardinalSplineStacked();
|
||||
virtual void draw();
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
private:
|
||||
|
@ -481,7 +490,7 @@ class Issue1305 : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(Issue1305);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual void onExit();
|
||||
void log(Node* sender);
|
||||
void addSprite(float dt);
|
||||
|
@ -496,7 +505,7 @@ class Issue1305_2 : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(Issue1305_2);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
void printLog1();
|
||||
void printLog2();
|
||||
void printLog3();
|
||||
|
@ -510,7 +519,7 @@ class Issue1288 : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(Issue1288);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
@ -520,7 +529,7 @@ class Issue1288_2 : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(Issue1288_2);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
@ -530,7 +539,7 @@ class Issue1327 : public ActionsDemo
|
|||
public:
|
||||
CREATE_FUNC(Issue1327);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
virtual std::string title() const override;
|
||||
void logSprRotation(Sprite* sender);
|
||||
|
@ -543,7 +552,7 @@ public:
|
|||
|
||||
void incrementInteger();
|
||||
void incrementIntegerCallback(void* data);
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
virtual std::string title() const override;
|
||||
private:
|
||||
|
@ -557,7 +566,7 @@ public:
|
|||
|
||||
~ActionCatmullRom();
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual void draw();
|
||||
virtual std::string subtitle() const override;
|
||||
virtual std::string title() const override;
|
||||
|
@ -578,7 +587,7 @@ public:
|
|||
|
||||
~ActionCardinalSpline();
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual void draw();
|
||||
virtual std::string subtitle() const override;
|
||||
virtual std::string title() const override;
|
||||
|
@ -598,7 +607,7 @@ public:
|
|||
|
||||
PauseResumeActions();
|
||||
virtual ~PauseResumeActions();
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string subtitle() const override;
|
||||
virtual std::string title() const override;
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
dc22a9c6f7fee22f731cfe145212770b9a43b393
|
||||
d381f5336bd2e06ba65eb51a5204c12eebe49c4e
|
|
@ -731,6 +731,24 @@ public:
|
|||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class SpriteCullTest1 : public SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(SpriteCullTest1);
|
||||
SpriteCullTest1();
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class SpriteCullTest2 : public SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(SpriteCullTest2);
|
||||
SpriteCullTest2();
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class SpriteTestScene : public TestScene
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
#include "lua_assetsmanager_test_sample.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "tolua_fix.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "tolua_fix.h"
|
||||
#include "cocos2d.h"
|
||||
#include "cocos-ext.h"
|
||||
|
||||
|
|
|
@ -425,10 +425,10 @@ local function SpeedTest()
|
|||
local spawn = cc.Spawn:create(seq3_1, seq3_2)
|
||||
SpeedTest_action1 = cc.Speed:create(cc.RepeatForever:create(spawn), 1.0)
|
||||
|
||||
local spawn2 = tolua.cast(spawn:clone(), "cc.Spawn")
|
||||
local spawn2 = spawn:clone()
|
||||
SpeedTest_action2 = cc.Speed:create(cc.RepeatForever:create(spawn2), 1.0)
|
||||
|
||||
local spawn3 = tolua.cast(spawn:clone(), "cc.Spawn")
|
||||
local spawn3 = spawn:clone()
|
||||
SpeedTest_action3 = cc.Speed:create(cc.RepeatForever:create(spawn3), 1.0)
|
||||
|
||||
grossini:runAction(SpeedTest_action2)
|
||||
|
|
|
@ -550,8 +550,8 @@ local function ActionAnimate()
|
|||
tamara:runAction(cc.Sequence:create(action2, action2:reverse()))
|
||||
|
||||
local animation3 = animation2:clone()
|
||||
-- problem
|
||||
tolua.cast(animation3,"cc.Animation"):setLoops(4)
|
||||
|
||||
animation3:setLoops(4)
|
||||
|
||||
local action3 = cc.Animate:create(animation3)
|
||||
kathia:runAction(action3)
|
||||
|
@ -740,7 +740,7 @@ local function ActionRotateToRepeat()
|
|||
local act2 = cc.RotateTo:create(1, 0)
|
||||
local seq = cc.Sequence:create(act1, act2)
|
||||
local rep1 = cc.RepeatForever:create(seq)
|
||||
local rep2 = cc.Repeat:create(tolua.cast(seq:clone(), "cc.Sequence"), 10)
|
||||
local rep2 = cc.Repeat:create(seq:clone(), 10)
|
||||
|
||||
tamara:runAction(rep1)
|
||||
kathia:runAction(rep2)
|
||||
|
@ -931,8 +931,8 @@ local function ActionOrbit()
|
|||
local seq = cc.Sequence:create(move, move_back)
|
||||
local rfe = cc.RepeatForever:create(seq)
|
||||
kathia:runAction(rfe)
|
||||
tamara:runAction(tolua.cast(rfe:clone(), "cc.ActionInterval"))
|
||||
grossini:runAction(tolua.cast(rfe:clone(), "cc.ActionInterval"))
|
||||
tamara:runAction(rfe:clone())
|
||||
grossini:runAction(rfe:clone())
|
||||
|
||||
|
||||
Helper.subtitleLabel:setString("OrbitCamera action")
|
||||
|
|
|
@ -428,7 +428,7 @@ end
|
|||
|
||||
function TestPerformance:refreshTitle()
|
||||
local subTitleInfo = ArmatureTestLayer.subTitle(5) .. self._armatureCount
|
||||
local label = tolua.cast(self:getChildByTag(10001),"cc.LabelTTF")
|
||||
local label = self:getChildByTag(10001)
|
||||
label:setString(subTitleInfo)
|
||||
end
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
09ed3c488f6d182685c416c291f8f325fb5cc2d2
|
||||
55c597addccd9586d927093004a96fc08902b860
|
|
@ -193,9 +193,9 @@ function SpriteComponentTest:createGameScene()
|
|||
local action1 = cc.Blink:create(2, 10)
|
||||
local action2 = cc.Blink:create(2, 5)
|
||||
|
||||
local sister1 = tolua.cast(node:getChildByTag(10003):getComponent("CCSprite"),"ccs.ComRender")
|
||||
local sister1 = node:getChildByTag(10003):getComponent("CCSprite")
|
||||
sister1:getNode():runAction(action1)
|
||||
local sister2 = tolua.cast(node:getChildByTag(10004):getComponent("CCSprite"),"ccs.ComRender")
|
||||
local sister2 = node:getChildByTag(10004):getComponent("CCSprite")
|
||||
sister2:getNode():runAction(action2)
|
||||
end
|
||||
|
||||
|
@ -245,10 +245,10 @@ end
|
|||
function ArmatureComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/ArmatureComponentTest/ArmatureComponentTest.json")
|
||||
if nil ~= node then
|
||||
local blowFish = tolua.cast(node:getChildByTag(10007):getComponent("CCArmature"),"ccs.ComRender")
|
||||
local blowFish = node:getChildByTag(10007):getComponent("CCArmature")
|
||||
blowFish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
|
||||
local butterflyfish = tolua.cast(node:getChildByTag(10008):getComponent("CCArmature"),"ccs.ComRender")
|
||||
local butterflyfish = node:getChildByTag(10008):getComponent("CCArmature")
|
||||
butterflyfish:getNode():runAction(CCMoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
end
|
||||
|
||||
|
@ -298,15 +298,15 @@ end
|
|||
function UIComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/UIComponentTest/UIComponentTest.json")
|
||||
if nil ~= node then
|
||||
local render = tolua.cast(node:getChildByTag(10025):getComponent("GUIComponent"),"ccs.ComRender")
|
||||
local widget = tolua.cast(render:getNode(), "ccui.Widget")
|
||||
local button = tolua.cast(widget:getChildByName("Button_156"),"ccui.Button")
|
||||
local render = node:getChildByTag(10025):getComponent("GUIComponent")
|
||||
local widget = render:getNode()
|
||||
local button = widget:getChildByName("Button_156")
|
||||
local function onTouch(sender, eventType)
|
||||
if eventType == ccui.TouchEventType.began then
|
||||
local blowFish = tolua.cast(node:getChildByTag(10010):getComponent("CCArmature"), "ccs.ComRender")
|
||||
local blowFish = node:getChildByTag(10010):getComponent("CCArmature")
|
||||
blowFish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
|
||||
local butterflyfish = tolua.cast(node:getChildByTag(10011):getComponent("CCArmature"), "ccs.ComRender")
|
||||
local butterflyfish = node:getChildByTag(10011):getComponent("CCArmature")
|
||||
butterflyfish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
end
|
||||
end
|
||||
|
@ -360,7 +360,7 @@ end
|
|||
function TmxMapComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/TmxMapComponentTest/TmxMapComponentTest.json")
|
||||
if nil ~= node then
|
||||
local tmxMap = tolua.cast(node:getChildByTag(10015):getComponent("CCTMXTiledMap"),"ccs.ComRender")
|
||||
local tmxMap = node:getChildByTag(10015):getComponent("CCTMXTiledMap")
|
||||
local actionTo = cc.SkewTo:create(2, 0.0, 2.0)
|
||||
local rotateTo = cc.RotateTo:create(2, 61.0)
|
||||
local actionScaleTo = cc.ScaleTo:create(2, -0.44, 0.47)
|
||||
|
@ -420,7 +420,7 @@ end
|
|||
function ParticleComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/ParticleComponentTest/ParticleComponentTest.json")
|
||||
if nil ~= node then
|
||||
local particle = tolua.cast(node:getChildByTag(10020):getComponent("CCParticleSystemQuad"),"ccs.ComRender")
|
||||
local particle = node:getChildByTag(10020):getComponent("CCParticleSystemQuad")
|
||||
local jump = cc.JumpBy:create(5, cc.p(-500,0), 50, 4)
|
||||
local action = cc.Sequence:create( jump, jump:reverse())
|
||||
particle:getNode():runAction(action)
|
||||
|
@ -472,13 +472,13 @@ end
|
|||
function EffectComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/EffectComponentTest/EffectComponentTest.json")
|
||||
if nil ~= node then
|
||||
local render = tolua.cast(node:getChildByTag(10015):getComponent("CCArmature"),"ccs.ComRender")
|
||||
local armature = tolua.cast(render:getNode(),"ccs.Armature")
|
||||
local render = node:getChildByTag(10015):getComponent("CCArmature")
|
||||
local armature = render:getNode()
|
||||
local function animationEvent(armatureBack,movementType,movementID)
|
||||
local id = movementID
|
||||
if movementType == ccs.MovementEventType.loopComplete then
|
||||
if id == "Fire" then
|
||||
local audio = tolua.cast(node:getChildByTag(10015):getComponent("CCComAudio"), "ccs.ComAudio")
|
||||
local audio = node:getChildByTag(10015):getComponent("CCComAudio")
|
||||
audio:playEffect()
|
||||
end
|
||||
end
|
||||
|
@ -533,7 +533,7 @@ end
|
|||
function BackgroundComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/BackgroundComponentTest/BackgroundComponentTest.json")
|
||||
if nil ~= node then
|
||||
local audio = tolua.cast(node:getComponent("CCBackgroundAudio"),"ccs.ComAudio")
|
||||
local audio = node:getComponent("CCBackgroundAudio")
|
||||
audio:playBackgroundMusic()
|
||||
end
|
||||
|
||||
|
@ -582,7 +582,7 @@ end
|
|||
|
||||
function AttributeComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/AttributeComponentTest/AttributeComponentTest.json")
|
||||
local attribute = tolua.cast(node:getChildByTag(10015):getComponent("CCComAttribute"), "ccs.ComAttribute")
|
||||
local attribute = node:getChildByTag(10015):getComponent("CCComAttribute")
|
||||
print(string.format("Name: %s, HP: %f, MP: %f", attribute:getString("name"), attribute:getFloat("maxHP"), attribute:getFloat("maxMP")))
|
||||
return node
|
||||
end
|
||||
|
|
|
@ -95,7 +95,7 @@ local function Effect2()
|
|||
|
||||
local delay = cc.DelayTime:create(1)
|
||||
|
||||
target:runAction(cc.Sequence:create(shaky, delay ,reuse, shuffle, tolua.cast(delay:clone(), "cc.Action"), turnoff, turnon))
|
||||
target:runAction(cc.Sequence:create(shaky, delay ,reuse, shuffle, delay:clone(), turnoff, turnon))
|
||||
return ret
|
||||
end
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ ccb["TestScrollViewsLayer"] = TestScrollViewsLayer
|
|||
|
||||
local function onMenuItemAClicked()
|
||||
if nil ~= TestMenusLayer["mMenuItemStatusLabelBMFont"] then
|
||||
local labelBmFt = tolua.cast(TestMenusLayer["mMenuItemStatusLabelBMFont"],"cc.LabelBMFont")
|
||||
local labelBmFt = TestMenusLayer["mMenuItemStatusLabelBMFont"]
|
||||
if nil ~= labelBmFt then
|
||||
labelBmFt:setString("Menu Item A clicked.");
|
||||
end
|
||||
|
@ -39,7 +39,7 @@ end
|
|||
|
||||
local function onMenuItemBClicked()
|
||||
if nil ~= TestMenusLayer["mMenuItemStatusLabelBMFont"] then
|
||||
local labelBmFt = tolua.cast(TestMenusLayer["mMenuItemStatusLabelBMFont"],"cc.LabelBMFont")
|
||||
local labelBmFt = TestMenusLayer["mMenuItemStatusLabelBMFont"]
|
||||
if nil ~= labelBmFt then
|
||||
labelBmFt:setString("Menu Item B clicked.");
|
||||
end
|
||||
|
@ -48,7 +48,7 @@ end
|
|||
|
||||
local function pressedC( ... )
|
||||
if nil ~= TestMenusLayer["mMenuItemStatusLabelBMFont"] then
|
||||
local labelBmFt = tolua.cast(TestMenusLayer["mMenuItemStatusLabelBMFont"],"cc.LabelBMFont")
|
||||
local labelBmFt = TestMenusLayer["mMenuItemStatusLabelBMFont"]
|
||||
if nil ~= labelBmFt then
|
||||
labelBmFt:setString("Menu Item C clicked.");
|
||||
end
|
||||
|
@ -59,9 +59,9 @@ local function onMenuTestClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestMenus.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestMenus.ccbi")
|
||||
end
|
||||
|
@ -88,9 +88,9 @@ local function onSpriteTestClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestSprites.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestSprites.ccbi")
|
||||
end
|
||||
|
@ -107,9 +107,9 @@ local function onButtonTestClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestButtons.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestButtons.ccbi")
|
||||
end
|
||||
|
@ -122,7 +122,7 @@ local function onButtonTestClicked()
|
|||
end
|
||||
|
||||
local function onCCControlButtonClicked(sender,controlEvent)
|
||||
local labelTTF = tolua.cast(TestButtonsLayer["mCCControlEventLabel"],"cc.LabelBMFont")
|
||||
local labelTTF = TestButtonsLayer["mCCControlEventLabel"]
|
||||
|
||||
if nil == labelTTF then
|
||||
return
|
||||
|
@ -158,9 +158,9 @@ local function onAnimationsTestClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestAnimations.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestAnimations.ccbi")
|
||||
end
|
||||
|
@ -177,9 +177,9 @@ local function onParticleSystemTestClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestParticleSystems.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestParticleSystems.ccbi")
|
||||
end
|
||||
|
@ -193,7 +193,7 @@ end
|
|||
|
||||
local function onCCControlButtonIdleClicked()
|
||||
if nil ~= TestAnimationsLayer["mAnimationManager"] then
|
||||
local animationMgr = tolua.cast(TestAnimationsLayer["mAnimationManager"],"cc.CCBAnimationManager")
|
||||
local animationMgr = TestAnimationsLayer["mAnimationManager"]
|
||||
if nil ~= animationMgr then
|
||||
animationMgr:runAnimationsForSequenceNamedTweenDuration("Idle", 0.3)
|
||||
end
|
||||
|
@ -202,7 +202,7 @@ end
|
|||
|
||||
local function onCCControlButtonWaveClicked()
|
||||
if nil ~= TestAnimationsLayer["mAnimationManager"] then
|
||||
local animationMgr = tolua.cast(TestAnimationsLayer["mAnimationManager"],"cc.CCBAnimationManager")
|
||||
local animationMgr = TestAnimationsLayer["mAnimationManager"]
|
||||
if nil ~= animationMgr then
|
||||
animationMgr:runAnimationsForSequenceNamedTweenDuration("Wave", 0.3)
|
||||
end
|
||||
|
@ -211,7 +211,7 @@ end
|
|||
|
||||
local function onCCControlButtonJumpClicked()
|
||||
if nil ~= TestAnimationsLayer["mAnimationManager"] then
|
||||
local animationMgr = tolua.cast(TestAnimationsLayer["mAnimationManager"],"cc.CCBAnimationManager")
|
||||
local animationMgr = TestAnimationsLayer["mAnimationManager"]
|
||||
if nil ~= animationMgr then
|
||||
animationMgr:runAnimationsForSequenceNamedTweenDuration("Jump", 0.3)
|
||||
end
|
||||
|
@ -220,7 +220,7 @@ end
|
|||
|
||||
local function onCCControlButtonFunkyClicked()
|
||||
if nil ~= TestAnimationsLayer["mAnimationManager"] then
|
||||
local animationMgr = tolua.cast(TestAnimationsLayer["mAnimationManager"],"cc.CCBAnimationManager")
|
||||
local animationMgr = TestAnimationsLayer["mAnimationManager"]
|
||||
if nil ~= animationMgr then
|
||||
animationMgr:runAnimationsForSequenceNamedTweenDuration("Funky", 0.3)
|
||||
end
|
||||
|
@ -237,9 +237,9 @@ local function onScrollViewTestClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestScrollViews.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestScrollViews.ccbi")
|
||||
end
|
||||
|
@ -256,9 +256,9 @@ local function onTimelineCallbackSoundClicked()
|
|||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestTimelineCallback.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
local ccLabelTTF = HelloCocosBuilderLayer["mTestTitleLabelTTF"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestTimelineCallback.ccbi")
|
||||
end
|
||||
|
@ -272,7 +272,7 @@ end
|
|||
|
||||
function onCallback1()
|
||||
if nil ~= TestTimelineLayer["helloLabel"] then
|
||||
local ccLabelTTF = tolua.cast(TestTimelineLayer["helloLabel"],"cc.LabelTTF")
|
||||
local ccLabelTTF = TestTimelineLayer["helloLabel"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:runAction(cc.RotateBy:create(1, 360))
|
||||
ccLabelTTF:setString("Callback 1");
|
||||
|
@ -282,7 +282,7 @@ end
|
|||
|
||||
function onCallback2()
|
||||
if nil ~= TestTimelineLayer["helloLabel"] then
|
||||
local ccLabelTTF = tolua.cast(TestTimelineLayer["helloLabel"],"cc.LabelTTF")
|
||||
local ccLabelTTF = TestTimelineLayer["helloLabel"]
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:runAction(cc.RotateBy:create(2, 360))
|
||||
ccLabelTTF:setString("Callback 2");
|
||||
|
@ -306,7 +306,7 @@ local function HelloCCBTestMainLayer()
|
|||
print(type(cc.Scene))
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/HelloCocosBuilder.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
local layer = node
|
||||
return layer
|
||||
end
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ local function runNotificationCenterTest()
|
|||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local function toggleSwitch(tag,menuItem)
|
||||
local toggleItem = tolua.cast(menuItem,"cc.MenuItemToggle")
|
||||
local toggleItem = menuItem
|
||||
local nIndex = toggleItem:getSelectedIndex()
|
||||
local selectedItem = toggleItem:getSelectedItem()
|
||||
if 0 == nIndex then
|
||||
|
@ -155,7 +155,7 @@ local function runNotificationCenterTest()
|
|||
connectitem:setTag(NotificationCenterParam.kTagConnect+i)
|
||||
|
||||
local function connectToSwitch(tag,menuItem)
|
||||
local connectMenuitem = tolua.cast(menuItem,"cc.MenuItemToggle")
|
||||
local connectMenuitem = menuItem
|
||||
local bConnected = true
|
||||
if connectMenuitem:getSelectedIndex() == 0 then
|
||||
bConnected = false
|
||||
|
@ -376,7 +376,7 @@ local function runCCControlTest()
|
|||
if nil == pSender or nil == pDisplayValueLabel then
|
||||
return
|
||||
end
|
||||
local pControl = tolua.cast(pSender,"cc.ControlSlider")
|
||||
local pControl = pSender
|
||||
local strFmt = nil
|
||||
if pControl:getTag() == 1 then
|
||||
strFmt = string.format("Upper slider value = %.02f",pControl:getValue())
|
||||
|
@ -434,7 +434,7 @@ local function runCCControlTest()
|
|||
return
|
||||
end
|
||||
|
||||
local pPicker = tolua.cast(pSender,"cc.ControlColourPicker")
|
||||
local pPicker = pSender
|
||||
local strFmt = string.format("#%02X%02X%02X",pPicker:getColor().r, pPicker:getColor().g, pPicker:getColor().b)
|
||||
pColorLabel:setString(strFmt)
|
||||
end
|
||||
|
@ -499,7 +499,7 @@ local function runCCControlTest()
|
|||
return
|
||||
end
|
||||
|
||||
local pControl = tolua.cast(pSender,"cc.ControlSwitch")
|
||||
local pControl = pSender
|
||||
if pControl:isOn() then
|
||||
pDisplayValueLabel:setString("On")
|
||||
else
|
||||
|
@ -774,7 +774,7 @@ local function runCCControlTest()
|
|||
return
|
||||
end
|
||||
|
||||
local pControl = tolua.cast(pSender,"cc.ControlPotentiometer")
|
||||
local pControl = pSender
|
||||
local strFmt = string.format("%0.2f",pControl:getValue())
|
||||
pDisplayValueLabel:setString(strFmt )
|
||||
end
|
||||
|
@ -831,7 +831,7 @@ local function runCCControlTest()
|
|||
return
|
||||
end
|
||||
|
||||
local pControl = tolua.cast(pSender,"cc.ControlStepper")
|
||||
local pControl = pSender
|
||||
local strFmt = string.format("%0.02f",pControl:getValue() )
|
||||
pDisplayValueLabel:setString(strFmt )
|
||||
end
|
||||
|
@ -917,7 +917,7 @@ local function runEditBoxTest()
|
|||
local EditEmail = nil
|
||||
|
||||
local function editBoxTextEventHandle(strEventName,pSender)
|
||||
local edit = tolua.cast(pSender,"cc.EditBox")
|
||||
local edit = pSender
|
||||
local strFmt
|
||||
if strEventName == "began" then
|
||||
strFmt = string.format("editBox %p DidBegin !", edit)
|
||||
|
@ -1038,7 +1038,7 @@ function TableViewTestLayer.tableCellAtIndex(table, idx)
|
|||
label:setTag(123)
|
||||
cell:addChild(label)
|
||||
else
|
||||
label = tolua.cast(cell:getChildByTag(123),"cc.LabelTTF")
|
||||
label = cell:getChildByTag(123)
|
||||
if nil ~= label then
|
||||
label:setString(strValue)
|
||||
end
|
||||
|
|
|
@ -32,11 +32,11 @@ function LabelAtlasTest.step(dt)
|
|||
local string = string.format("%2.2f Test", m_time)
|
||||
|
||||
local label1_origin = LabelAtlasTest.layer:getChildByTag(kTagSprite1)
|
||||
local label1 = tolua.cast(label1_origin, "cc.LabelAtlas")
|
||||
local label1 = label1_origin
|
||||
label1:setString(string) --
|
||||
|
||||
local label2_origin = LabelAtlasTest.layer:getChildByTag(kTagSprite2)
|
||||
local label2 = tolua.cast(label2_origin, "cc.LabelAtlas")
|
||||
local label2 = label2_origin
|
||||
string = string.format("%d", m_time)
|
||||
|
||||
label2:setString(string)
|
||||
|
@ -88,11 +88,11 @@ function LabelAtlasColorTest.step(dt)
|
|||
m_time = m_time + dt
|
||||
local string = string.format("%2.2f Test", m_time)
|
||||
local label1_origin = LabelAtlasColorTest.layer:getChildByTag(kTagSprite1)
|
||||
local label1 = tolua.cast(label1_origin, "cc.LabelAtlas")
|
||||
local label1 = label1_origin
|
||||
label1:setString(string)
|
||||
|
||||
local label2_origin = LabelAtlasColorTest.layer:getChildByTag(kTagSprite2)
|
||||
local label2 = tolua.cast(label2_origin, "cc.LabelAtlas")
|
||||
local label2 = label2_origin
|
||||
string = string.format("%d", m_time)
|
||||
|
||||
label2:setString(string)
|
||||
|
@ -199,7 +199,7 @@ function Atlas3.create()
|
|||
label2:setColor(cc.c3b(255, 0, 0 ))
|
||||
layer:addChild(label2, 0, kTagBitmapAtlas2)
|
||||
|
||||
label2:runAction( tolua.cast(repeatAction:clone(), "cc.Action") )
|
||||
label2:runAction( repeatAction:clone())
|
||||
|
||||
local label3 = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest2.fnt")
|
||||
-- testing anchors
|
||||
|
@ -223,13 +223,13 @@ function Atlas3.step(dt)
|
|||
m_time = m_time + dt
|
||||
local string = string.format("%2.2f Test j", m_time)
|
||||
|
||||
local label1 = tolua.cast(Atlas3.layer:getChildByTag(kTagBitmapAtlas1), "cc.LabelBMFont")
|
||||
local label1 = Atlas3.layer:getChildByTag(kTagBitmapAtlas1)
|
||||
label1:setString(string)
|
||||
|
||||
local label2 = tolua.cast(Atlas3.layer:getChildByTag(kTagBitmapAtlas2), "cc.LabelBMFont")
|
||||
local label2 = Atlas3.layer:getChildByTag(kTagBitmapAtlas2)
|
||||
label2:setString(string)
|
||||
|
||||
local label3 = tolua.cast(Atlas3.layer:getChildByTag(kTagBitmapAtlas3), "cc.LabelBMFont")
|
||||
local label3 = Atlas3.layer:getChildByTag(kTagBitmapAtlas3)
|
||||
label3:setString(string)
|
||||
end
|
||||
|
||||
|
@ -309,7 +309,7 @@ function Atlas4.create()
|
|||
label2:setPosition( cc.p(s.width/2.0, 80) )
|
||||
|
||||
local lastChar = label2:getChildByTag(3)
|
||||
lastChar:runAction(tolua.cast( rot_4ever:clone(), "cc.Action" ))
|
||||
lastChar:runAction(rot_4ever:clone())
|
||||
|
||||
layer:registerScriptHandler(Atlas4.onNodeEvent)
|
||||
|
||||
|
@ -329,7 +329,7 @@ function Atlas4.step(dt)
|
|||
|
||||
local string = string.format("%04.1f", m_time)
|
||||
|
||||
local label1 = tolua.cast(Atlas4.layer:getChildByTag(kTagBitmapAtlas2), "cc.LabelBMFont")
|
||||
local label1 = Atlas4.layer:getChildByTag(kTagBitmapAtlas2)
|
||||
label1:setString(string)
|
||||
end
|
||||
|
||||
|
@ -592,9 +592,9 @@ function LabelsEmpty.create()
|
|||
end
|
||||
|
||||
function LabelsEmpty.updateStrings(dt)
|
||||
local label1 = tolua.cast(LabelsEmpty.layer:getChildByTag(kTagBitmapAtlas1), "cc.LabelBMFont")
|
||||
local label2 = tolua.cast(LabelsEmpty.layer:getChildByTag(kTagBitmapAtlas2), "cc.LabelTTF")
|
||||
local label3 = tolua.cast(LabelsEmpty.layer:getChildByTag(kTagBitmapAtlas3), "cc.LabelAtlas")
|
||||
local label1 = LabelsEmpty.layer:getChildByTag(kTagBitmapAtlas1)
|
||||
local label2 = LabelsEmpty.layer:getChildByTag(kTagBitmapAtlas2)
|
||||
local label3 = LabelsEmpty.layer:getChildByTag(kTagBitmapAtlas3)
|
||||
|
||||
if( LabelsEmpty.setEmpty == false) then
|
||||
label1:setString("not empty")
|
||||
|
@ -1118,7 +1118,7 @@ end
|
|||
|
||||
|
||||
function BitmapFontMultiLineAlignment.stringChanged(tag, sender)
|
||||
local item = tolua.cast(sender, "cc.MenuItemFont")
|
||||
local item = sender
|
||||
item:setColor(cc.c3b(255, 0, 0))
|
||||
BitmapFontMultiLineAlignment._pLastAlignmentItem:setColor(cc.c3b(255, 255, 255))
|
||||
BitmapFontMultiLineAlignment._pLastAlignmentItem = item
|
||||
|
@ -1136,7 +1136,7 @@ end
|
|||
|
||||
function BitmapFontMultiLineAlignment.alignmentChanged(tag, sender)
|
||||
-- cclog("BitmapFontMultiLineAlignment.alignmentChanged, tag:"..tag)
|
||||
local item = tolua.cast(sender, "cc.MenuItemFont")
|
||||
local item = sender
|
||||
item:setColor(cc.c3b(255, 0, 0))
|
||||
BitmapFontMultiLineAlignment._pLastAlignmentItem:setColor(cc.c3b(255, 255, 255))
|
||||
BitmapFontMultiLineAlignment._pLastAlignmentItem = item
|
||||
|
|
|
@ -61,7 +61,7 @@ function LabelFNTColorAndOpacity.create()
|
|||
label2:setColor(cc.c3b(255, 0, 0 ))
|
||||
layer:addChild(label2, 0, kTagBitmapAtlas2)
|
||||
|
||||
label2:runAction( tolua.cast(repeatAction:clone(), "cc.Action") )
|
||||
label2:runAction(repeatAction:clone())
|
||||
|
||||
local label3 = cc.Label:createWithBMFont("fonts/bitmapFontTest2.fnt", "Test")
|
||||
-- testing anchors
|
||||
|
@ -85,13 +85,13 @@ function LabelFNTColorAndOpacity.step(dt)
|
|||
m_time = m_time + dt
|
||||
local string = string.format("%2.2f Test j", m_time)
|
||||
|
||||
local label1 = tolua.cast(LabelFNTColorAndOpacity.layer:getChildByTag(kTagBitmapAtlas1), "cc.Label")
|
||||
local label1 = LabelFNTColorAndOpacity.layer:getChildByTag(kTagBitmapAtlas1)
|
||||
label1:setString(string)
|
||||
|
||||
local label2 = tolua.cast(LabelFNTColorAndOpacity.layer:getChildByTag(kTagBitmapAtlas2), "cc.Label")
|
||||
local label2 = LabelFNTColorAndOpacity.layer:getChildByTag(kTagBitmapAtlas2)
|
||||
label2:setString(string)
|
||||
|
||||
local label3 = tolua.cast(LabelFNTColorAndOpacity.layer:getChildByTag(kTagBitmapAtlas3), "cc.Label")
|
||||
local label3 = LabelFNTColorAndOpacity.layer:getChildByTag(kTagBitmapAtlas3)
|
||||
label3:setString(string)
|
||||
end
|
||||
|
||||
|
@ -165,7 +165,7 @@ function LabelFNTSpriteActions.create()
|
|||
label2:setPosition( cc.p(s.width/2.0, 80) )
|
||||
|
||||
local lastChar = label2:getLetter(3)
|
||||
lastChar:runAction(tolua.cast( rot_4ever:clone(), "cc.Action" ))
|
||||
lastChar:runAction(rot_4ever:clone())
|
||||
|
||||
layer:registerScriptHandler(LabelFNTSpriteActions.onNodeEvent)
|
||||
|
||||
|
@ -694,7 +694,7 @@ function LabelFNTMultiLineAlignment.create()
|
|||
|
||||
local labelWidth = math.abs(LabelFNTMultiLineAlignment._pArrowsShouldRetain:getPositionX() - LabelFNTMultiLineAlignment._pLabelShouldRetain:getPositionX()) * 2
|
||||
|
||||
LabelFNTMultiLineAlignment._pLabelShouldRetain:setWidth(labelWidth)
|
||||
LabelFNTMultiLineAlignment._pLabelShouldRetain:setMaxLineWidth(labelWidth)
|
||||
end
|
||||
|
||||
local function onTouchesEnded(touch, event)
|
||||
|
@ -725,7 +725,7 @@ end
|
|||
|
||||
|
||||
function LabelFNTMultiLineAlignment.stringChanged(tag, sender)
|
||||
local item = tolua.cast(sender, "cc.MenuItemFont")
|
||||
local item = sender
|
||||
item:setColor(cc.c3b(255, 0, 0))
|
||||
LabelFNTMultiLineAlignment._pLastAlignmentItem:setColor(cc.c3b(255, 255, 255))
|
||||
LabelFNTMultiLineAlignment._pLastAlignmentItem = item
|
||||
|
@ -743,7 +743,7 @@ end
|
|||
|
||||
function LabelFNTMultiLineAlignment.alignmentChanged(tag, sender)
|
||||
-- cclog("LabelFNTMultiLineAlignment.alignmentChanged, tag:"..tag)
|
||||
local item = tolua.cast(sender, "cc.MenuItemFont")
|
||||
local item = sender
|
||||
item:setColor(cc.c3b(255, 0, 0))
|
||||
LabelFNTMultiLineAlignment._pLastAlignmentItem:setColor(cc.c3b(255, 255, 255))
|
||||
LabelFNTMultiLineAlignment._pLastAlignmentItem = item
|
||||
|
|
|
@ -314,7 +314,7 @@ local function LayerTest1()
|
|||
|
||||
local newSize = cc.size( math.abs(x - s.width/2)*2, math.abs(y - s.height/2)*2)
|
||||
|
||||
local l = tolua.cast(ret:getChildByTag(kTagLayer), "cc.LayerColor")
|
||||
local l = ret:getChildByTag(kTagLayer)
|
||||
|
||||
l:setContentSize( newSize )
|
||||
end
|
||||
|
@ -395,7 +395,7 @@ local function LayerTestBlend()
|
|||
local blend = true
|
||||
|
||||
local function newBlend(dt)
|
||||
local layer = tolua.cast(ret:getChildByTag(kTagLayer), "cc.LayerColor")
|
||||
local layer = ret:getChildByTag(kTagLayer)
|
||||
|
||||
local src = 0
|
||||
local dst = 0
|
||||
|
@ -445,7 +445,7 @@ local function LayerGradient()
|
|||
|
||||
local function toggleItem(sender)
|
||||
-- cclog("toggleItem")
|
||||
local gradient = tolua.cast(ret:getChildByTag(kTagLayer), "cc.LayerGradient")
|
||||
local gradient = ret:getChildByTag(kTagLayer)
|
||||
gradient:setCompressedInterpolation(not gradient:isCompressedInterpolation())
|
||||
end
|
||||
|
||||
|
@ -463,7 +463,7 @@ local function LayerGradient()
|
|||
local diff = cc.p(movingPos.x - start.x, movingPos.y - start.y)
|
||||
diff = cc.pNormalize(diff)
|
||||
|
||||
local gradient = tolua.cast(ret:getChildByTag(1), "cc.LayerGradient")
|
||||
local gradient = ret:getChildByTag(1)
|
||||
gradient:setVector(diff)
|
||||
end
|
||||
|
||||
|
@ -492,7 +492,7 @@ local function LayerIgnoreAnchorPointPos()
|
|||
l:setPosition(cc.p( s.width/2, s.height/2))
|
||||
|
||||
local move = cc.MoveBy:create(2, cc.p(100,2))
|
||||
local back = tolua.cast(move:reverse(), "cc.MoveBy")
|
||||
local back = move:reverse()
|
||||
local seq = cc.Sequence:create(move, back)
|
||||
l:runAction(cc.RepeatForever:create(seq))
|
||||
ret:addChild(l, 0, kLayerIgnoreAnchorPoint)
|
||||
|
@ -569,7 +569,7 @@ local function LayerIgnoreAnchorPointScale()
|
|||
|
||||
|
||||
local scale = cc.ScaleBy:create(2, 2)
|
||||
local back = tolua.cast(scale:reverse(), "cc.ScaleBy")
|
||||
local back = scale:reverse()
|
||||
local seq = cc.Sequence:create(scale, back)
|
||||
|
||||
l:runAction(cc.RepeatForever:create(seq))
|
||||
|
|
|
@ -32,13 +32,13 @@ local function MenuLayerMainMenu()
|
|||
|
||||
local function menuCallback(sender)
|
||||
cclog("menuCallback...")
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(1)
|
||||
ret:getParent():switchTo(1)
|
||||
end
|
||||
|
||||
item1:registerScriptTapHandler(menuCallback)
|
||||
-- Image Item
|
||||
local function menuCallback2(sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(2)
|
||||
ret:getParent():switchTo(2)
|
||||
end
|
||||
|
||||
local item2 = cc.MenuItemImage:create(s_SendScore, s_PressSendScore)
|
||||
|
@ -46,7 +46,7 @@ local function MenuLayerMainMenu()
|
|||
|
||||
|
||||
local schedulerEntry = nil
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
local function allowTouches(dt)
|
||||
local pDirector = cc.Director:getInstance()
|
||||
--pDirector:getTouchDispatcher():setPriority(cc.MENU_HANDLER_PRIORITY +1, ret)
|
||||
|
@ -85,7 +85,7 @@ local function MenuLayerMainMenu()
|
|||
cc.MenuItemFont:setFontName("Marker Felt")
|
||||
|
||||
local function menuCallbackConfig(sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(3)
|
||||
ret:getParent():switchTo(3)
|
||||
end
|
||||
|
||||
-- Label Item (cc.LabelBMFont)
|
||||
|
@ -99,7 +99,7 @@ local function MenuLayerMainMenu()
|
|||
-- Events
|
||||
cc.MenuItemFont:setFontName("Marker Felt")
|
||||
local function menuCallbackBugsTest(pSender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(4)
|
||||
ret:getParent():switchTo(4)
|
||||
end
|
||||
|
||||
-- Bugs Item
|
||||
|
@ -115,7 +115,7 @@ local function MenuLayerMainMenu()
|
|||
item7:registerScriptTapHandler(onQuit)
|
||||
|
||||
local function menuMovingCallback(pSender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(5)
|
||||
ret:getParent():switchTo(5)
|
||||
end
|
||||
|
||||
local item8 = cc.MenuItemFont:create("Remove menu item when moving")
|
||||
|
@ -152,7 +152,7 @@ local function MenuLayerMainMenu()
|
|||
if pObject == nil then
|
||||
break
|
||||
end
|
||||
child = tolua.cast(pObject, "cc.Node")
|
||||
child = pObject
|
||||
local dstPointX, dstPointY = child:getPosition()
|
||||
local offset = s.width/2 + 50
|
||||
if i % 2 == 0 then
|
||||
|
@ -200,7 +200,7 @@ local function MenuLayer2()
|
|||
local function alignMenusH()
|
||||
local i = 0
|
||||
for i=0, 1 do
|
||||
local menu = tolua.cast(ret:getChildByTag(100+i), "cc.Menu")
|
||||
local menu = ret:getChildByTag(100+i)
|
||||
menu:setPosition( m_centeredMenu )
|
||||
if i==0 then
|
||||
-- TIP: if no padding, padding = 5
|
||||
|
@ -219,7 +219,7 @@ local function MenuLayer2()
|
|||
local function alignMenusV()
|
||||
local i = 0
|
||||
for i=0, 1 do
|
||||
local menu = tolua.cast(ret:getChildByTag(100+i), "cc.Menu")
|
||||
local menu = ret:getChildByTag(100+i)
|
||||
menu:setPosition( m_centeredMenu )
|
||||
if i==0 then
|
||||
-- TIP: if no padding, padding = 5
|
||||
|
@ -236,11 +236,11 @@ local function MenuLayer2()
|
|||
end
|
||||
|
||||
local function menuCallback(sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
ret:getParent():switchTo(0)
|
||||
end
|
||||
|
||||
local function menuCallbackOpacity(tag, sender)
|
||||
local menu = tolua.cast(sender:getParent(), "cc.Menu")
|
||||
local menu = sender:getParent()
|
||||
local opacity = menu:getOpacity()
|
||||
if opacity == 128 then
|
||||
menu:setOpacity(255)
|
||||
|
@ -305,7 +305,7 @@ local function MenuLayer3()
|
|||
local m_disabledItem = nil
|
||||
local ret = cc.Layer:create()
|
||||
local function menuCallback(sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
ret:getParent():switchTo(0)
|
||||
end
|
||||
|
||||
local function menuCallback2(sender)
|
||||
|
@ -357,8 +357,8 @@ local function MenuLayer3()
|
|||
item2:runAction( cc.RepeatForever:create(cc.Sequence:create( jump, jump:reverse())))
|
||||
|
||||
local spin1 = cc.RotateBy:create(3, 360)
|
||||
local spin2 = tolua.cast(spin1:clone(), "cc.ActionInterval")
|
||||
local spin3 = tolua.cast(spin1:clone(), "cc.ActionInterval")
|
||||
local spin2 = spin1:clone()
|
||||
local spin3 = spin1:clone()
|
||||
|
||||
item1:runAction( cc.RepeatForever:create(spin1) )
|
||||
item2:runAction( cc.RepeatForever:create(spin2) )
|
||||
|
@ -398,11 +398,11 @@ local function MenuLayer4()
|
|||
local item1 = cc.MenuItemToggle:create(cc.MenuItemFont:create( "On" ))
|
||||
|
||||
local function menuCallback(tag, sender)
|
||||
cclog("selected item: tag: %d, index:%d", tag, tolua.cast(sender, "cc.MenuItemToggle"):getSelectedIndex() )
|
||||
cclog("selected item: tag: %d, index:%d", tag, sender:getSelectedIndex() )
|
||||
end
|
||||
|
||||
local function backCallback(tag, sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
ret:getParent():switchTo(0)
|
||||
end
|
||||
|
||||
item1:registerScriptTapHandler(menuCallback)
|
||||
|
@ -475,21 +475,21 @@ end
|
|||
local function BugsTest()
|
||||
local ret = cc.Layer:create()
|
||||
local function issue1410MenuCallback(tag, pSender)
|
||||
local menu = tolua.cast(pSender:getParent(), "cc.Menu")
|
||||
local menu = pSender:getParent()
|
||||
menu:setEnabled(false)
|
||||
menu:setEnabled(true)
|
||||
cclog("NO CRASHES")
|
||||
end
|
||||
|
||||
local function issue1410v2MenuCallback(tag, pSender)
|
||||
local menu = tolua.cast(pSender:getParent(), "cc.Menu")
|
||||
local menu = pSender:getParent()
|
||||
menu:setEnabled(true)
|
||||
menu:setEnabled(false)
|
||||
cclog("NO CRASHES. AND MENU SHOULD STOP WORKING")
|
||||
end
|
||||
|
||||
local function backMenuCallback(tag, pSender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
ret:getParent():switchTo(0)
|
||||
end
|
||||
|
||||
|
||||
|
@ -526,7 +526,7 @@ local function RemoveMenuItemWhenMove()
|
|||
|
||||
local back = cc.MenuItemFont:create("go back")
|
||||
local function goBack(tag, pSender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
ret:getParent():switchTo(0)
|
||||
end
|
||||
|
||||
back:registerScriptTapHandler(goBack)
|
||||
|
|
|
@ -184,7 +184,7 @@ function TouchableSpriteTest:onEnter()
|
|||
sprite2:addChild(sprite3, 1)
|
||||
|
||||
local function onTouchBegan(touch, event)
|
||||
local target = tolua.cast(event:getCurrentTarget(),"cc.Sprite")
|
||||
local target = event:getCurrentTarget()
|
||||
|
||||
local locationInNode = target:convertToNodeSpace(touch:getLocation())
|
||||
local s = target:getContentSize()
|
||||
|
@ -199,14 +199,14 @@ function TouchableSpriteTest:onEnter()
|
|||
end
|
||||
|
||||
local function onTouchMoved(touch, event)
|
||||
local target = tolua.cast(event:getCurrentTarget(), "cc.Sprite")
|
||||
local target = event:getCurrentTarget()
|
||||
local posX,posY = target:getPosition()
|
||||
local delta = touch:getDelta()
|
||||
target:setPosition(cc.p(posX + delta.x, posY + delta.y))
|
||||
end
|
||||
|
||||
local function onTouchEnded(touch, event)
|
||||
local target = tolua.cast(event:getCurrentTarget(), "cc.Sprite")
|
||||
local target = event:getCurrentTarget()
|
||||
print("sprite onTouchesEnded..")
|
||||
target:setOpacity(255)
|
||||
if target == sprite2 then
|
||||
|
|
|
@ -261,10 +261,10 @@ local function Test6()
|
|||
local rot = cc.RotateBy:create(2, 360)
|
||||
local rot_back = rot:reverse()
|
||||
local forever1 = cc.RepeatForever:create(cc.Sequence:create(rot, rot_back))
|
||||
local forever11 = tolua.cast(forever1:clone(), "cc.RepeatForever")
|
||||
local forever11 = forever1:clone()
|
||||
|
||||
local forever2 = tolua.cast(forever1:clone(), "cc.RepeatForever")
|
||||
local forever21 = tolua.cast(forever1:clone(), "cc.RepeatForever")
|
||||
local forever2 = forever1:clone()
|
||||
local forever21 = forever1:clone()
|
||||
|
||||
Test6_layer:addChild(sp1, 0, kTagSprite1)
|
||||
sp1:addChild(sp11)
|
||||
|
@ -342,7 +342,7 @@ local function shouldNotLeak(dt)
|
|||
scheduler:unscheduleScriptEntry(StressTest2_entry)
|
||||
|
||||
local sublayer = StressTest2_layer:getChildByTag(kTagSprite1)
|
||||
sublayer:removeAllChildrenWithCleanup(true)
|
||||
sublayer:removeAllChildren(true)
|
||||
end
|
||||
|
||||
local function StressTest2_onEnterOrExit(tag)
|
||||
|
@ -370,10 +370,9 @@ local function StressTest2()
|
|||
|
||||
local fire = cc.ParticleFire:create()
|
||||
fire:setTexture(cc.Director:getInstance():getTextureCache():addImage("Images/fire.png"))
|
||||
fire = tolua.cast(fire, "cc.Node")
|
||||
fire:setPosition(80, s.height / 2 - 50)
|
||||
|
||||
local copy_seq3 = tolua.cast(seq3:clone(), "cc.Sequence")
|
||||
local copy_seq3 = seq3:clone()
|
||||
fire:runAction(cc.RepeatForever:create(copy_seq3))
|
||||
sublayer:addChild(fire, 2)
|
||||
|
||||
|
@ -564,7 +563,7 @@ local function ConvertToNode()
|
|||
|
||||
point:setPosition(sprite:getPosition())
|
||||
|
||||
local copy = tolua.cast(action:clone(), "cc.RepeatForever")
|
||||
local copy = action:clone()
|
||||
sprite:runAction(copy)
|
||||
ConvertToNode_layer:addChild(sprite, i)
|
||||
end
|
||||
|
|
|
@ -147,7 +147,7 @@ local function OpenGLTestMainLayer()
|
|||
local i = 0
|
||||
local len = table.getn(children)
|
||||
for i= 0 ,len - 1 do
|
||||
local child = tolua.cast(children[i + 1], "cc.Sprite")
|
||||
local child = children[i + 1]
|
||||
local oldPosX,oldPosY = child:getPosition()
|
||||
child:setPosition(oldPosX,math.sin(accum * 2 + i / 2.0) * 20)
|
||||
local scaleY = math.sin(accum * 2 + i / 2.0 + 0.707)
|
||||
|
@ -558,7 +558,7 @@ local function OpenGLTestMainLayer()
|
|||
|
||||
local function getCurrentResult()
|
||||
local var = {}
|
||||
local glProgam = tolua.cast(sprite:getShaderProgram(),"cc.GLProgram")
|
||||
local glProgam = sprite:getShaderProgram()
|
||||
if nil ~= glProgam then
|
||||
local p = glProgam:getProgram()
|
||||
local aaSize,aaType,aaName = gl.getActiveAttrib(p,0)
|
||||
|
|
|
@ -148,7 +148,7 @@ local function runNodeChildrenTest()
|
|||
local function updateQuantityLabel()
|
||||
if nQuantityOfNodes ~= nLastRenderedCount then
|
||||
-- local pInfoLabel = pNewscene:getChildByTag(NodeChildrenTestParam.kTagInfoLayer)
|
||||
local pInfoLabel = tolua.cast(pNewscene:getChildByTag(NodeChildrenTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local pInfoLabel = pNewscene:getChildByTag(NodeChildrenTestParam.kTagInfoLayer)
|
||||
local strNode = nQuantityOfNodes.." nodes"
|
||||
pInfoLabel:setString(strNode)
|
||||
nLastRenderedCount = nQuantityOfNodes
|
||||
|
@ -167,7 +167,7 @@ local function runNodeChildrenTest()
|
|||
local i = 0
|
||||
local len = table.getn(pChildren)
|
||||
for i = 0, len - 1, 1 do
|
||||
local child = tolua.cast(pChildren[i + 1], "cc.Sprite")
|
||||
local child = pChildren[i + 1]
|
||||
child:setVisible(false)
|
||||
end
|
||||
end
|
||||
|
@ -190,7 +190,7 @@ local function runNodeChildrenTest()
|
|||
end
|
||||
|
||||
for i = 0 , nTotalToAdd - 1 do
|
||||
local pChild = tolua.cast(pSprites[i + 1],"cc.Node")
|
||||
local pChild = pSprites[i + 1]
|
||||
pBatchNode:addChild(pChild, zs[i], NodeChildrenTestParam.kTagBase + i)
|
||||
end
|
||||
|
||||
|
@ -217,7 +217,7 @@ local function runNodeChildrenTest()
|
|||
end
|
||||
-- add them with random Z (very important!)
|
||||
for i=0, nTotalToAdd - 1 do
|
||||
local pChild = tolua.cast(pSprites[i + 1],"cc.Node")
|
||||
local pChild = pSprites[i + 1]
|
||||
pBatchNode:addChild(pChild, math.random(-1,1) * 50, NodeChildrenTestParam.kTagBase + i)
|
||||
end
|
||||
|
||||
|
@ -245,7 +245,7 @@ local function runNodeChildrenTest()
|
|||
|
||||
--dd them with random Z (very important!)
|
||||
for i = 0, nTotalToAdd - 1 do
|
||||
local pChild = tolua.cast(pSprites[i + 1] ,"cc.Node")
|
||||
local pChild = pSprites[i + 1]
|
||||
pBatchNode:addChild(pChild, math.random(-1,1) * 50, NodeChildrenTestParam.kTagBase + i)
|
||||
end
|
||||
|
||||
|
@ -253,7 +253,7 @@ local function runNodeChildrenTest()
|
|||
|
||||
-- reorder them
|
||||
for i = 0, nTotalToAdd - 1 do
|
||||
local pNode = tolua.cast(pSprites[i + 1],"cc.Node")
|
||||
local pNode = pSprites[i + 1]
|
||||
pBatchNode:reorderChild(pNode, math.random(-1,1) * 50)
|
||||
end
|
||||
pBatchNode:sortAllChildren()
|
||||
|
@ -509,7 +509,7 @@ local function runParticleTest()
|
|||
|
||||
local function UpdateQuantityLabel()
|
||||
if nQuantityParticles ~= nLastRenderedCount then
|
||||
local pInfoLabel = tolua.cast(pNewScene:getChildByTag(ParticleTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local pInfoLabel = pNewScene:getChildByTag(ParticleTestParam.kTagInfoLayer)
|
||||
local strInfo = string.format("%u particles", nQuantityParticles)
|
||||
pInfoLabel:setString(strInfo)
|
||||
|
||||
|
@ -519,7 +519,7 @@ local function runParticleTest()
|
|||
|
||||
local function doTest()
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local pParticleSystem = tolua.cast(pNewScene:getChildByTag(ParticleTestParam.kTagParticleSystem),"cc.ParticleSystem")
|
||||
local pParticleSystem = pNewScene:getChildByTag(ParticleTestParam.kTagParticleSystem)
|
||||
if nil == pParticleSystem then
|
||||
return
|
||||
end
|
||||
|
@ -764,8 +764,8 @@ local function runParticleTest()
|
|||
end
|
||||
|
||||
local function step(t)
|
||||
local pAtlas = tolua.cast(pNewScene:getChildByTag(ParticleTestParam.kTagLabelAtlas),"cc.LabelAtlas")
|
||||
local pEmitter = tolua.cast(pNewScene:getChildByTag(ParticleTestParam.kTagParticleSystem),"cc.ParticleSystem")
|
||||
local pAtlas = pNewScene:getChildByTag(ParticleTestParam.kTagLabelAtlas)
|
||||
local pEmitter = pNewScene:getChildByTag(ParticleTestParam.kTagParticleSystem)
|
||||
local strInfo = string.format("%4d",pEmitter:getParticleCount())
|
||||
pAtlas:setString(strInfo)
|
||||
end
|
||||
|
@ -990,7 +990,7 @@ local function runSpriteTest()
|
|||
|
||||
local function UpdateNodes()
|
||||
if nQuantityNodes ~= nLastRenderedCount then
|
||||
local pInfoLabel = tolua.cast(pNewScene:getChildByTag(SpriteTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local pInfoLabel = pNewScene:getChildByTag(SpriteTestParam.kTagInfoLayer)
|
||||
local strInfo = string.format("%u nodes", nQuantityNodes)
|
||||
pInfoLabel:setString(strInfo)
|
||||
nLastRenderedCount = nQuantityNodes
|
||||
|
@ -1701,14 +1701,14 @@ local function runFuncRelateWithTable()
|
|||
if quantityOfNodes == 0 then
|
||||
quantityOfNodes = 100
|
||||
end
|
||||
local numLabel = tolua.cast(layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local numLabel = layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer)
|
||||
local strNum = string.format("%d", quantityOfNodes)
|
||||
numLabel:setString(strNum)
|
||||
end
|
||||
|
||||
local function onIncrease()
|
||||
quantityOfNodes = quantityOfNodes + 100
|
||||
local numLabel = tolua.cast(layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local numLabel = layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer)
|
||||
local strNum = string.format("%d", quantityOfNodes)
|
||||
numLabel:setString(strNum)
|
||||
end
|
||||
|
|
|
@ -446,7 +446,7 @@ function SpriteAnchorPoint.initLayer(layer)
|
|||
end
|
||||
point:setPosition( sprite:getPosition() )
|
||||
|
||||
local copy = tolua.cast(action:clone(), "cc.Action")
|
||||
local copy = action:clone()
|
||||
sprite:runAction(copy)
|
||||
layer:addChild(sprite, i)
|
||||
end
|
||||
|
@ -499,7 +499,7 @@ function SpriteBatchNodeAnchorPoint.initLayer(layer)
|
|||
|
||||
point:setPosition( cc.p(sprite:getPosition()) )
|
||||
|
||||
local copy = tolua.cast(action:clone(), "cc.Action")
|
||||
local copy = action:clone()
|
||||
sprite:runAction(copy)
|
||||
batch:addChild(sprite, i)
|
||||
end
|
||||
|
|
|
@ -110,7 +110,7 @@ local function TextureMipMap()
|
|||
local scale1 = cc.EaseOut:create(cc.ScaleBy:create(4, 0.01), 3)
|
||||
local sc_back = scale1:reverse()
|
||||
|
||||
local scale2 = tolua.cast(scale1:clone(), "cc.EaseOut")
|
||||
local scale2 = scale1:clone()
|
||||
local sc_back2 = scale2:reverse()
|
||||
|
||||
img0:runAction(cc.RepeatForever:create(cc.Sequence:create(scale1, sc_back)))
|
||||
|
@ -148,7 +148,7 @@ local function TexturePVRMipMap()
|
|||
local scale1 = cc.EaseOut:create(cc.ScaleBy:create(4, 0.01), 3)
|
||||
local sc_back = scale1:reverse()
|
||||
|
||||
local scale2 = tolua.cast(scale1:clone(), "cc.EaseOut")
|
||||
local scale2 = scale1:clone()
|
||||
local sc_back2 = scale2:reverse()
|
||||
|
||||
imgMipMap:runAction(cc.RepeatForever:create(cc.Sequence:create(scale1, sc_back)))
|
||||
|
@ -182,7 +182,7 @@ local function TexturePVRMipMap2()
|
|||
local scale1 = cc.EaseOut:create(cc.ScaleBy:create(4, 0.01), 3)
|
||||
local sc_back = scale1:reverse()
|
||||
|
||||
local scale2 = tolua.cast(scale1:clone(), "cc.EaseOut")
|
||||
local scale2 = scale1:clone()
|
||||
local sc_back2 = scale2:reverse()
|
||||
|
||||
imgMipMap:runAction(cc.RepeatForever:create(cc.Sequence:create(scale1, sc_back)))
|
||||
|
@ -803,9 +803,9 @@ local function TextureAlias()
|
|||
|
||||
-- scale them to show
|
||||
local sc = cc.ScaleBy:create(3, 8.0)
|
||||
local sc_back = tolua.cast(sc:reverse(), "cc.ScaleBy")
|
||||
local sc_back = sc:reverse()
|
||||
local scaleforever = cc.RepeatForever:create(cc.Sequence:create(sc, sc_back))
|
||||
local scaleToo = tolua.cast(scaleforever:clone(), "cc.RepeatForever")
|
||||
local scaleToo = scaleforever:clone()
|
||||
|
||||
sprite2:runAction(scaleforever)
|
||||
sprite:runAction(scaleToo)
|
||||
|
@ -829,7 +829,7 @@ local function TexturePixelFormat()
|
|||
-- 3- 16-bit RGB5A1
|
||||
-- 4- 16-bit RGB565
|
||||
|
||||
local label = tolua.cast(ret:getChildByTag(kTagLabel), "cc.LabelTTF")
|
||||
local label = ret:getChildByTag(kTagLabel)
|
||||
label:setColor(cc.c3b(16,16,255))
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
@ -895,10 +895,10 @@ local function TexturePixelFormat()
|
|||
local fadein = cc.FadeIn:create(2)
|
||||
local seq = cc.Sequence:create(cc.DelayTime:create(2), fadeout, fadein)
|
||||
local seq_4ever = cc.RepeatForever:create(seq)
|
||||
local seq_4ever2 = tolua.cast(seq_4ever:clone(), "cc.RepeatForever")
|
||||
local seq_4ever3 = tolua.cast(seq_4ever:clone(), "cc.RepeatForever")
|
||||
local seq_4ever4 = tolua.cast(seq_4ever:clone(), "cc.RepeatForever")
|
||||
local seq_4ever5 = tolua.cast(seq_4ever:clone(), "cc.RepeatForever")
|
||||
local seq_4ever2 = seq_4ever:clone()
|
||||
local seq_4ever3 = seq_4ever:clone()
|
||||
local seq_4ever4 = seq_4ever:clone()
|
||||
local seq_4ever5 = seq_4ever:clone()
|
||||
|
||||
sprite1:runAction(seq_4ever)
|
||||
sprite2:runAction(seq_4ever2)
|
||||
|
@ -964,12 +964,12 @@ local function TextureAsync()
|
|||
ret:addChild(label, 10)
|
||||
|
||||
local scale = cc.ScaleBy:create(0.3, 2)
|
||||
local scale_back = tolua.cast(scale:reverse(), "cc.ScaleBy")
|
||||
local scale_back = scale:reverse()
|
||||
local seq = cc.Sequence:create(scale, scale_back)
|
||||
label:runAction(cc.RepeatForever:create(seq))
|
||||
|
||||
local function imageLoaded(pObj)
|
||||
local tex = tolua.cast(pObj, "cc.Texture2D")
|
||||
local tex = pObj
|
||||
local director = cc.Director:getInstance()
|
||||
|
||||
--cc.ASSERT( [NSThread currentThread] == [director runningThread], @"FAIL. Callback should be on cocos2d thread")
|
||||
|
@ -1043,7 +1043,7 @@ local function TextureGlClamp()
|
|||
local rotate = cc.RotateBy:create(4, 360)
|
||||
sprite:runAction(rotate)
|
||||
local scale = cc.ScaleBy:create(2, 0.04)
|
||||
local scaleBack = tolua.cast(scale:reverse(), "cc.ScaleBy")
|
||||
local scaleBack = scale:reverse()
|
||||
local seq = cc.Sequence:create(scale, scaleBack)
|
||||
sprite:runAction(seq)
|
||||
local function onNodeEvent(event)
|
||||
|
@ -1077,7 +1077,7 @@ local function TextureGlRepeat()
|
|||
local rotate = cc.RotateBy:create(4, 360)
|
||||
sprite:runAction(rotate)
|
||||
local scale = cc.ScaleBy:create(2, 0.04)
|
||||
local scaleBack = tolua.cast(scale:reverse(), "cc.ScaleBy")
|
||||
local scaleBack = scale:reverse()
|
||||
local seq = cc.Sequence:create(scale, scaleBack)
|
||||
sprite:runAction(seq)
|
||||
local function onNodeEvent(event)
|
||||
|
@ -1338,7 +1338,7 @@ local function TexturePVRv3Premult()
|
|||
local function transformSprite(sprite)
|
||||
local fade = cc.FadeOut:create(2)
|
||||
local dl = cc.DelayTime:create(2)
|
||||
local fadein = tolua.cast(fade:reverse(), "cc.FadeOut")
|
||||
local fadein = fade:reverse()
|
||||
local seq = cc.Sequence:create(fade, fadein, dl)
|
||||
local repeatAction = cc.RepeatForever:create(seq)
|
||||
sprite:runAction(repeatAction)
|
||||
|
|
|
@ -82,7 +82,7 @@ local function TileMapEditTest()
|
|||
-- The only limitation is that you cannot change an empty, or assign an empty tile to a tile
|
||||
-- The value 0 not rendered so don't assign or change a tile with value 0
|
||||
|
||||
local tilemap = tolua.cast(layer:getChildByTag(kTagTileMap), "cc.TileMapAtlas")
|
||||
local tilemap = layer:getChildByTag(kTagTileMap)
|
||||
|
||||
--
|
||||
-- For example you can iterate over all the tiles
|
||||
|
@ -157,7 +157,7 @@ local function TMXOrthoTest()
|
|||
local len = table.getn(pChildrenArray)
|
||||
for i = 0, len-1, 1 do
|
||||
pObject = pChildrenArray[i + 1]
|
||||
child = tolua.cast(pObject, "cc.SpriteBatchNode")
|
||||
child = pObject
|
||||
|
||||
if child == nil then
|
||||
break
|
||||
|
@ -211,7 +211,7 @@ local function TMXOrthoTest2()
|
|||
local len = table.getn(pChildrenArray)
|
||||
|
||||
for i = 0, len-1, 1 do
|
||||
child = tolua.cast(pChildrenArray[i + 1], "cc.SpriteBatchNode")
|
||||
child = pChildrenArray[i + 1]
|
||||
|
||||
if child == nil then
|
||||
break
|
||||
|
@ -243,7 +243,7 @@ local function TMXOrthoTest3()
|
|||
local len = table.getn(pChildrenArray)
|
||||
|
||||
for i = 0, len-1, 1 do
|
||||
child = tolua.cast(pChildrenArray[i + 1], "cc.SpriteBatchNode")
|
||||
child = pChildrenArray[i + 1]
|
||||
|
||||
if child == nil then
|
||||
break
|
||||
|
@ -277,7 +277,7 @@ local function TMXOrthoTest4()
|
|||
local len = table.getn(pChildrenArray)
|
||||
|
||||
for i = 0, len-1, 1 do
|
||||
child = tolua.cast(pChildrenArray[i + 1], "cc.SpriteBatchNode")
|
||||
child = pChildrenArray[i + 1]
|
||||
|
||||
if child == nil then
|
||||
break
|
||||
|
@ -304,7 +304,7 @@ local function TMXOrthoTest4()
|
|||
local function removeSprite(dt)
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry)
|
||||
schedulerEntry = nil
|
||||
local map = tolua.cast(ret:getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
||||
local map = ret:getChildByTag(kTagTileMap)
|
||||
local layer0 = map:getLayer("Layer 0")
|
||||
local s = layer0:getLayerSize()
|
||||
|
||||
|
@ -368,7 +368,7 @@ local function TMXReadWriteTest()
|
|||
|
||||
local function removeSprite(sender)
|
||||
--------cclog("removing tile: %x", sender)
|
||||
local node = tolua.cast(sender, "cc.Node")
|
||||
local node = sender
|
||||
if nil == node then
|
||||
print("Errro node is nil")
|
||||
end
|
||||
|
@ -382,9 +382,9 @@ local function TMXReadWriteTest()
|
|||
|
||||
local finish = cc.CallFunc:create(removeSprite)
|
||||
local seq0 = cc.Sequence:create(move, rotate, scale, opacity, fadein, scaleback, finish)
|
||||
local seq1 = tolua.cast(seq0:clone(), "cc.Action")
|
||||
local seq2 = tolua.cast(seq0:clone(), "cc.Action")
|
||||
local seq3 = tolua.cast(seq0:clone(), "cc.Action")
|
||||
local seq1 = seq0:clone()
|
||||
local seq2 = seq0:clone()
|
||||
local seq3 = seq0:clone()
|
||||
|
||||
tile0:runAction(seq0)
|
||||
tile1:runAction(seq1)
|
||||
|
@ -400,8 +400,8 @@ local function TMXReadWriteTest()
|
|||
|
||||
local function updateCol(dt)
|
||||
|
||||
local map = tolua.cast(ret:getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
||||
local layer = tolua.cast(map:getChildByTag(0), "cc.TMXLayer")
|
||||
local map = ret:getChildByTag(kTagTileMap)
|
||||
local layer = map:getChildByTag(0)
|
||||
|
||||
--------cclog("++++atlas quantity: %d", layer:textureAtlas():getTotalQuads())
|
||||
--------cclog("++++children: %d", layer:getChildren():count() )
|
||||
|
@ -418,8 +418,8 @@ local function TMXReadWriteTest()
|
|||
|
||||
local function repaintWithGID(dt)
|
||||
-- unschedule:_cmd)
|
||||
local map = tolua.cast(ret:getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
||||
local layer = tolua.cast(map:getChildByTag(0), "cc.TMXLayer")
|
||||
local map = ret:getChildByTag(kTagTileMap)
|
||||
local layer = map:getChildByTag(0)
|
||||
|
||||
local s = layer:getLayerSize()
|
||||
local x = 0
|
||||
|
@ -433,8 +433,8 @@ local function TMXReadWriteTest()
|
|||
local function removeTiles(dt)
|
||||
scheduler:unscheduleScriptEntry(removeTilesScheduler)
|
||||
removeTilesScheduler = nil
|
||||
local map = tolua.cast(ret:getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
||||
local layer = tolua.cast(map:getChildByTag(0), "cc.TMXLayer")
|
||||
local map = ret:getChildByTag(kTagTileMap)
|
||||
local layer = map:getChildByTag(0)
|
||||
local s = layer:getLayerSize()
|
||||
local y = 0
|
||||
for y=0, s.height-1, 1 do
|
||||
|
@ -580,7 +580,7 @@ local function TMXUncompressedTest()
|
|||
local i = 0
|
||||
local len = table.getn(pChildrenArray)
|
||||
for i = 0, len-1, 1 do
|
||||
layer = tolua.cast(pChildrenArray[i + 1], "cc.TMXLayer")
|
||||
layer = pChildrenArray[i + 1]
|
||||
if layer == nil then
|
||||
break
|
||||
end
|
||||
|
@ -648,43 +648,6 @@ local function TMXOrthoObjectsTest()
|
|||
--------cclog("platform: %x", platform)
|
||||
return ret
|
||||
end
|
||||
|
||||
local function draw()
|
||||
|
||||
local map = tolua.cast(getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
||||
local group = map:getObjectGroup("Object Group 1")
|
||||
|
||||
local objects = group:getObjects()
|
||||
local dict = nil
|
||||
local i = 0
|
||||
local len = table.getn(objects)
|
||||
for i = 0, len-1, 1 do
|
||||
dict = objects[i + 1]
|
||||
|
||||
if dict == nil then
|
||||
break
|
||||
end
|
||||
|
||||
local key = "x"
|
||||
local x = dict["x"]
|
||||
key = "y"
|
||||
local y = dict["y"]--dynamic_cast<NSNumber*>(dict:objectForKey("y")):getNumber()
|
||||
key = "width"
|
||||
local width = dict["width"]--dynamic_cast<NSNumber*>(dict:objectForKey("width")):getNumber()
|
||||
key = "height"
|
||||
local height = dict["height"]--dynamic_cast<NSNumber*>(dict:objectForKey("height")):getNumber()
|
||||
|
||||
glLineWidth(3)
|
||||
|
||||
cc.DrawPrimitives.drawLine( cc.p(x, y), cc.p((x+width), y) )
|
||||
cc.DrawPrimitives.drawLine( cc.p((x+width), y), cc.p((x+width), (y+height)) )
|
||||
cc.DrawPrimitives.drawLine( cc.p((x+width), (y+height)), cc.p(x, (y+height)) )
|
||||
cc.DrawPrimitives.drawLine( cc.p(x, (y+height)), cc.p(x, y) )
|
||||
|
||||
glLineWidth(1)
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- TMXIsoObjectsTest
|
||||
|
@ -704,56 +667,9 @@ local function TMXIsoObjectsTest()
|
|||
--UxMutableArray* objects = group:objects()
|
||||
local objects = group:getObjects()
|
||||
--UxMutableDictionary<std:string>* dict
|
||||
local dict = nil
|
||||
local i = 0
|
||||
local len = table.getn(objects)
|
||||
for i = 0, len-1, 1 do
|
||||
dict = tolua.cast(objects[i + 1], "cc.Dictionary")
|
||||
|
||||
if dict == nil then
|
||||
break
|
||||
end
|
||||
--------cclog("object: %x", dict)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
local function draw()
|
||||
|
||||
local map = tolua.cast(getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
||||
local group = map:getObjectGroup("Object Group 1")
|
||||
|
||||
local objects = group:getObjects()
|
||||
local dict = nil
|
||||
local i = 0
|
||||
local len = table.getn(objects)
|
||||
for i = 0, len-1, 1 do
|
||||
dict = tolua.cast(objects[i + 1], "cc.Dictionary")
|
||||
|
||||
if dict == nil then
|
||||
break
|
||||
end
|
||||
|
||||
local key = "x"
|
||||
local x = (tolua.cast(dict:objectForKey(key), "cc.String")):intValue()--dynamic_cast<NSNumber*>(dict:objectForKey("x")):getNumber()
|
||||
key = "y"
|
||||
local y = (tolua.cast(dict:objectForKey(key), "cc.String")):intValue()--dynamic_cast<NSNumber*>(dict:objectForKey("y")):getNumber()
|
||||
key = "width"
|
||||
local width = (tolua.cast(dict:objectForKey(key), "cc.String")):intValue()--dynamic_cast<NSNumber*>(dict:objectForKey("width")):getNumber()
|
||||
key = "height"
|
||||
local height = (tolua.cast(dict:objectForKey(key), "cc.String")):intValue()--dynamic_cast<NSNumber*>(dict:objectForKey("height")):getNumber()
|
||||
|
||||
glLineWidth(3)
|
||||
|
||||
cc.DrawPrimitives.drawLine( cc.p(x,y), cc.p(x+width,y) )
|
||||
cc.DrawPrimitives.drawLine( cc.p(x+width,y), cc.p(x+width,y+height) )
|
||||
cc.DrawPrimitives.drawLine( cc.p(x+width,y+height), cc.p(x,y+height) )
|
||||
cc.DrawPrimitives.drawLine( cc.p(x,y+height), cc.p(x,y) )
|
||||
|
||||
glLineWidth(1)
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- TMXResizeTest
|
||||
|
@ -1073,7 +989,7 @@ local function TMXOrthoFlipTest()
|
|||
|
||||
local i = 0
|
||||
for i = 0, table.getn(map:getChildren())-1, 1 do
|
||||
local child = tolua.cast(map:getChildren()[i + 1], "cc.SpriteBatchNode")
|
||||
local child = map:getChildren()[i + 1]
|
||||
child:getTexture():setAntiAliasTexParameters()
|
||||
end
|
||||
|
||||
|
@ -1098,7 +1014,7 @@ local function TMXOrthoFlipRunTimeTest()
|
|||
|
||||
local i = 0
|
||||
for i = 0, table.getn(map:getChildren())-1, 1 do
|
||||
local child = tolua.cast(map:getChildren()[i + 1], "cc.SpriteBatchNode")
|
||||
local child = map:getChildren()[i + 1]
|
||||
child:getTexture():setAntiAliasTexParameters()
|
||||
end
|
||||
|
||||
|
@ -1178,7 +1094,7 @@ local function TMXOrthoFromXMLTest()
|
|||
local i = 0
|
||||
local len = table.getn(map:getChildren())
|
||||
for i = 0, len-1, 1 do
|
||||
local child = tolua.cast(map:getChildren()[i + 1], "cc.SpriteBatchNode")
|
||||
local child = map:getChildren()[i + 1]
|
||||
child:getTexture():setAntiAliasTexParameters()
|
||||
end
|
||||
|
||||
|
@ -1206,7 +1122,7 @@ local function TMXBug987()
|
|||
local len = table.getn(childs)
|
||||
local pNode = nil
|
||||
for i = 0, len-1, 1 do
|
||||
pNode = tolua.cast(childs[i + 1], "cc.TMXLayer")
|
||||
pNode = childs[i + 1]
|
||||
if pNode == nil then
|
||||
break
|
||||
end
|
||||
|
|
|
@ -1 +1 @@
|
|||
4424247ae9eeee1aa36e04fe3b2ece70024a8987
|
||||
11ebf82464dc9b20c1ca271619f8b29cefafa691
|
Loading…
Reference in New Issue