mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
Merge pull request #113 from pandamicro/master
Sync changes needed in creator to master
This commit is contained in:
@@ -107,20 +107,10 @@ bool MotionStreak::initWithFade(float fade, float minSeg, float stroke, const Co
|
||||
|
||||
_positionR.setZero();
|
||||
_fastMode = true;
|
||||
_minSeg = (minSeg == -1.0f) ? stroke/5.0f : minSeg;
|
||||
_minSeg *= _minSeg;
|
||||
|
||||
_stroke = stroke;
|
||||
_fadeDelta = 1.0f/fade;
|
||||
|
||||
_maxPoints = (int)(fade*60.0f)+2;
|
||||
_nuPoints = 0;
|
||||
_pointState = (float *)malloc(sizeof(float) * _maxPoints);
|
||||
_pointVertexes = (Vec2*)malloc(sizeof(Vec2) * _maxPoints);
|
||||
|
||||
_vertices = (Vec2*)malloc(sizeof(Vec2) * _maxPoints * 2);
|
||||
_texCoords = (Tex2F*)malloc(sizeof(Tex2F) * _maxPoints * 2);
|
||||
_colorPointer = (GLubyte*)malloc(sizeof(GLubyte) * _maxPoints * 2 * 4);
|
||||
setMinSeg(minSeg);
|
||||
setFadeTime(fade);
|
||||
|
||||
// Set blend mode
|
||||
_blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;
|
||||
@@ -220,6 +210,32 @@ void MotionStreak::setTexture(Texture2D *texture)
|
||||
}
|
||||
}
|
||||
|
||||
void MotionStreak::setFadeTime(float fade)
|
||||
{
|
||||
CC_SAFE_FREE(_pointState);
|
||||
CC_SAFE_FREE(_pointVertexes);
|
||||
CC_SAFE_FREE(_vertices);
|
||||
CC_SAFE_FREE(_colorPointer);
|
||||
CC_SAFE_FREE(_texCoords);
|
||||
|
||||
_fadeDelta = 1.0f / fade;
|
||||
|
||||
_maxPoints = (int)(fade * 60.0f) + 2;
|
||||
_nuPoints = 0;
|
||||
_pointState = (float *)malloc(sizeof(float) * _maxPoints);
|
||||
_pointVertexes = (Vec2*)malloc(sizeof(Vec2) * _maxPoints);
|
||||
|
||||
_vertices = (Vec2*)malloc(sizeof(Vec2) * _maxPoints * 2);
|
||||
_texCoords = (Tex2F*)malloc(sizeof(Tex2F) * _maxPoints * 2);
|
||||
_colorPointer = (GLubyte*)malloc(sizeof(GLubyte) * _maxPoints * 2 * 4);
|
||||
}
|
||||
|
||||
void MotionStreak::setMinSeg(float minSeg)
|
||||
{
|
||||
_minSeg = (minSeg == -1.0f) ? _stroke / 5.0f : minSeg;
|
||||
_minSeg *= _minSeg;
|
||||
}
|
||||
|
||||
void MotionStreak::setBlendFunc(const BlendFunc &blendFunc)
|
||||
{
|
||||
_blendFunc = blendFunc;
|
||||
@@ -232,12 +248,12 @@ const BlendFunc& MotionStreak::getBlendFunc() const
|
||||
|
||||
void MotionStreak::setOpacity(GLubyte opacity)
|
||||
{
|
||||
CCASSERT(false, "Set opacity no supported");
|
||||
CCLOG("Set opacity no supported");
|
||||
}
|
||||
|
||||
GLubyte MotionStreak::getOpacity() const
|
||||
{
|
||||
CCASSERT(false, "Opacity no supported");
|
||||
CCLOG("Opacity no supported");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -404,4 +420,3 @@ void MotionStreak::draw(Renderer *renderer, const Mat4 &transform, uint32_t flag
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
|
||||
@@ -76,6 +76,26 @@ public:
|
||||
*/
|
||||
void reset();
|
||||
|
||||
/** Get trail fragment fade time, in seconds.
|
||||
*
|
||||
* @return float fadeTime.
|
||||
*/
|
||||
inline float getFadeTime() const { return 1.0 / _fadeDelta; }
|
||||
/** Sets trail fragment fade time, in seconds.
|
||||
*
|
||||
* @param fade.
|
||||
*/
|
||||
void setFadeTime(float fade);
|
||||
/** Get minimum segment size.
|
||||
*
|
||||
* @return float minSeg.
|
||||
*/
|
||||
inline float getMinSeg() const { return _minSeg; }
|
||||
/** Sets minimum segment size.
|
||||
*
|
||||
* @param minSeg.
|
||||
*/
|
||||
void setMinSeg(float minSeg);
|
||||
/** When fast mode is enabled, new points are added faster but with lower precision.
|
||||
*
|
||||
* @return True if fast mode is enabled.
|
||||
|
||||
@@ -923,7 +923,7 @@ void FileUtils::setWritablePath(const std::string& writablePath)
|
||||
|
||||
void FileUtils::setDefaultResourceRootPath(const std::string& resRootPath)
|
||||
{
|
||||
if (_defaultResRootPath == resRootPath)
|
||||
if (resRootPath.empty() || _defaultResRootPath == resRootPath)
|
||||
return;
|
||||
|
||||
if (!_searchPathArray.empty() && !_defaultResRootPath.empty())
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,510 +0,0 @@
|
||||
/**
|
||||
* @module cocos2dx_3d_extension
|
||||
*/
|
||||
var jsb = jsb || {};
|
||||
|
||||
/**
|
||||
* @class ParticleSystem3D
|
||||
*/
|
||||
jsb.ParticleSystem3D = {
|
||||
|
||||
/**
|
||||
* @method resumeParticleSystem
|
||||
*/
|
||||
resumeParticleSystem : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method startParticleSystem
|
||||
*/
|
||||
startParticleSystem : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isEnabled
|
||||
* @return {bool}
|
||||
*/
|
||||
isEnabled : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isKeepLocal
|
||||
* @return {bool}
|
||||
*/
|
||||
isKeepLocal : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setEnabled
|
||||
* @param {bool} arg0
|
||||
*/
|
||||
setEnabled : function (
|
||||
bool
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getParticleQuota
|
||||
* @return {unsigned int}
|
||||
*/
|
||||
getParticleQuota : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getBlendFunc
|
||||
* @return {cc.BlendFunc}
|
||||
*/
|
||||
getBlendFunc : function (
|
||||
)
|
||||
{
|
||||
return cc.BlendFunc;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method pauseParticleSystem
|
||||
*/
|
||||
pauseParticleSystem : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getState
|
||||
* @return {cc.ParticleSystem3D::State}
|
||||
*/
|
||||
getState : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getAliveParticleCount
|
||||
* @return {int}
|
||||
*/
|
||||
getAliveParticleCount : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setParticleQuota
|
||||
* @param {unsigned int} arg0
|
||||
*/
|
||||
setParticleQuota : function (
|
||||
int
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setBlendFunc
|
||||
* @param {cc.BlendFunc} arg0
|
||||
*/
|
||||
setBlendFunc : function (
|
||||
blendfunc
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method stopParticleSystem
|
||||
*/
|
||||
stopParticleSystem : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setKeepLocal
|
||||
* @param {bool} arg0
|
||||
*/
|
||||
setKeepLocal : function (
|
||||
bool
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method ParticleSystem3D
|
||||
* @constructor
|
||||
*/
|
||||
ParticleSystem3D : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @class PUParticleSystem3D
|
||||
*/
|
||||
jsb.PUParticleSystem3D = {
|
||||
|
||||
/**
|
||||
* @method initWithFilePath
|
||||
* @param {String} arg0
|
||||
* @return {bool}
|
||||
*/
|
||||
initWithFilePath : function (
|
||||
str
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getParticleSystemScaleVelocity
|
||||
* @return {float}
|
||||
*/
|
||||
getParticleSystemScaleVelocity : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setEmittedSystemQuota
|
||||
* @param {unsigned int} arg0
|
||||
*/
|
||||
setEmittedSystemQuota : function (
|
||||
int
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getDefaultDepth
|
||||
* @return {float}
|
||||
*/
|
||||
getDefaultDepth : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getEmittedSystemQuota
|
||||
* @return {unsigned int}
|
||||
*/
|
||||
getEmittedSystemQuota : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method initWithFilePathAndMaterialPath
|
||||
* @param {String} arg0
|
||||
* @param {String} arg1
|
||||
* @return {bool}
|
||||
*/
|
||||
initWithFilePathAndMaterialPath : function (
|
||||
str,
|
||||
str
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method clearAllParticles
|
||||
*/
|
||||
clearAllParticles : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getMaterialName
|
||||
* @return {String}
|
||||
*/
|
||||
getMaterialName : function (
|
||||
)
|
||||
{
|
||||
return ;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method calulateRotationOffset
|
||||
*/
|
||||
calulateRotationOffset : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getMaxVelocity
|
||||
* @return {float}
|
||||
*/
|
||||
getMaxVelocity : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method forceUpdate
|
||||
* @param {float} arg0
|
||||
*/
|
||||
forceUpdate : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getTimeElapsedSinceStart
|
||||
* @return {float}
|
||||
*/
|
||||
getTimeElapsedSinceStart : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getEmittedEmitterQuota
|
||||
* @return {unsigned int}
|
||||
*/
|
||||
getEmittedEmitterQuota : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isMarkedForEmission
|
||||
* @return {bool}
|
||||
*/
|
||||
isMarkedForEmission : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getDefaultWidth
|
||||
* @return {float}
|
||||
*/
|
||||
getDefaultWidth : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setEmittedEmitterQuota
|
||||
* @param {unsigned int} arg0
|
||||
*/
|
||||
setEmittedEmitterQuota : function (
|
||||
int
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setMarkedForEmission
|
||||
* @param {bool} arg0
|
||||
*/
|
||||
setMarkedForEmission : function (
|
||||
bool
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method clone
|
||||
* @return {cc.PUParticleSystem3D}
|
||||
*/
|
||||
clone : function (
|
||||
)
|
||||
{
|
||||
return cc.PUParticleSystem3D;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setDefaultWidth
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setDefaultWidth : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method copyAttributesTo
|
||||
* @param {cc.PUParticleSystem3D} arg0
|
||||
*/
|
||||
copyAttributesTo : function (
|
||||
puparticlesystem3d
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setMaterialName
|
||||
* @param {String} arg0
|
||||
*/
|
||||
setMaterialName : function (
|
||||
str
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getParentParticleSystem
|
||||
* @return {cc.PUParticleSystem3D}
|
||||
*/
|
||||
getParentParticleSystem : function (
|
||||
)
|
||||
{
|
||||
return cc.PUParticleSystem3D;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setMaxVelocity
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setMaxVelocity : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getDefaultHeight
|
||||
* @return {float}
|
||||
*/
|
||||
getDefaultHeight : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getDerivedPosition
|
||||
* @return {vec3_object}
|
||||
*/
|
||||
getDerivedPosition : function (
|
||||
)
|
||||
{
|
||||
return cc.Vec3;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method rotationOffset
|
||||
* @param {vec3_object} arg0
|
||||
*/
|
||||
rotationOffset : function (
|
||||
vec3
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getDerivedOrientation
|
||||
* @return {cc.Quaternion}
|
||||
*/
|
||||
getDerivedOrientation : function (
|
||||
)
|
||||
{
|
||||
return cc.Quaternion;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method removeAllEmitter
|
||||
*/
|
||||
removeAllEmitter : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setParticleSystemScaleVelocity
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setParticleSystemScaleVelocity : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getDerivedScale
|
||||
* @return {vec3_object}
|
||||
*/
|
||||
getDerivedScale : function (
|
||||
)
|
||||
{
|
||||
return cc.Vec3;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setDefaultHeight
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setDefaultHeight : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method removeAllListener
|
||||
*/
|
||||
removeAllListener : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setDefaultDepth
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setDefaultDepth : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method create
|
||||
* @param {String|String} str
|
||||
* @param {String} str
|
||||
* @return {cc.PUParticleSystem3D|cc.PUParticleSystem3D|cc.PUParticleSystem3D}
|
||||
*/
|
||||
create : function(
|
||||
str,
|
||||
str
|
||||
)
|
||||
{
|
||||
return cc.PUParticleSystem3D;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method PUParticleSystem3D
|
||||
* @constructor
|
||||
*/
|
||||
PUParticleSystem3D : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
};
|
||||
@@ -2385,16 +2385,6 @@ pause : function (
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isPurgeDirectorInNextLoop
|
||||
* @return {bool}
|
||||
*/
|
||||
isPurgeDirectorInNextLoop : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setEventDispatcher
|
||||
* @param {cc.EventDispatcher} arg0
|
||||
@@ -3005,6 +2995,16 @@ getActionManager : function (
|
||||
return cc.ActionManager;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isPurgeDirectorInNextLoop
|
||||
* @return {bool}
|
||||
*/
|
||||
isPurgeDirectorInNextLoop : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getInstance
|
||||
* @return {cc.Director}
|
||||
@@ -13435,6 +13435,16 @@ texture2d
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setMinSeg
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setMinSeg : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getTexture
|
||||
* @return {cc.Texture2D}
|
||||
@@ -13455,6 +13465,16 @@ color3b
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getMinSeg
|
||||
* @return {float}
|
||||
*/
|
||||
getMinSeg : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setBlendFunc
|
||||
* @param {cc.BlendFunc} arg0
|
||||
@@ -13465,6 +13485,16 @@ blendfunc
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setFadeTime
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setFadeTime : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setStartingPositionInitialized
|
||||
* @param {bool} arg0
|
||||
@@ -13475,6 +13505,16 @@ bool
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getFadeTime
|
||||
* @return {float}
|
||||
*/
|
||||
getFadeTime : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getBlendFunc
|
||||
* @return {cc.BlendFunc}
|
||||
|
||||
@@ -1,520 +0,0 @@
|
||||
/**
|
||||
* @module cocos2dx_navmesh
|
||||
*/
|
||||
var jsb = jsb || {};
|
||||
|
||||
/**
|
||||
* @class NavMeshAgent
|
||||
*/
|
||||
jsb.NavMeshAgent = {
|
||||
|
||||
/**
|
||||
* @method setMaxSpeed
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setMaxSpeed : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method syncToNode
|
||||
*/
|
||||
syncToNode : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method completeOffMeshLink
|
||||
*/
|
||||
completeOffMeshLink : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getSeparationWeight
|
||||
* @return {float}
|
||||
*/
|
||||
getSeparationWeight : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setAutoTraverseOffMeshLink
|
||||
* @param {bool} arg0
|
||||
*/
|
||||
setAutoTraverseOffMeshLink : function (
|
||||
bool
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getCurrentVelocity
|
||||
* @return {vec3_object}
|
||||
*/
|
||||
getCurrentVelocity : function (
|
||||
)
|
||||
{
|
||||
return cc.Vec3;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method syncToAgent
|
||||
*/
|
||||
syncToAgent : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isOnOffMeshLink
|
||||
* @return {bool}
|
||||
*/
|
||||
isOnOffMeshLink : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setSeparationWeight
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setSeparationWeight : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method pause
|
||||
*/
|
||||
pause : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setAutoOrientation
|
||||
* @param {bool} arg0
|
||||
*/
|
||||
setAutoOrientation : function (
|
||||
bool
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getHeight
|
||||
* @return {float}
|
||||
*/
|
||||
getHeight : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getMaxSpeed
|
||||
* @return {float}
|
||||
*/
|
||||
getMaxSpeed : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getCurrentOffMeshLinkData
|
||||
* @return {cc.OffMeshLinkData}
|
||||
*/
|
||||
getCurrentOffMeshLinkData : function (
|
||||
)
|
||||
{
|
||||
return cc.OffMeshLinkData;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getRadius
|
||||
* @return {float}
|
||||
*/
|
||||
getRadius : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setSyncFlag
|
||||
* @param {cc.NavMeshAgent::NavMeshAgentSyncFlag} arg0
|
||||
*/
|
||||
setSyncFlag : function (
|
||||
navmeshagentsyncflag
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getSyncFlag
|
||||
* @return {cc.NavMeshAgent::NavMeshAgentSyncFlag}
|
||||
*/
|
||||
getSyncFlag : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method resume
|
||||
*/
|
||||
resume : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method stop
|
||||
*/
|
||||
stop : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setMaxAcceleration
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setMaxAcceleration : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setOrientationRefAxes
|
||||
* @param {vec3_object} arg0
|
||||
*/
|
||||
setOrientationRefAxes : function (
|
||||
vec3
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getMaxAcceleration
|
||||
* @return {float}
|
||||
*/
|
||||
getMaxAcceleration : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setHeight
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setHeight : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getObstacleAvoidanceType
|
||||
* @return {unsigned char}
|
||||
*/
|
||||
getObstacleAvoidanceType : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getVelocity
|
||||
* @return {vec3_object}
|
||||
*/
|
||||
getVelocity : function (
|
||||
)
|
||||
{
|
||||
return cc.Vec3;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setRadius
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setRadius : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setObstacleAvoidanceType
|
||||
* @param {unsigned char} arg0
|
||||
*/
|
||||
setObstacleAvoidanceType : function (
|
||||
char
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getNavMeshAgentComponentName
|
||||
* @return {String}
|
||||
*/
|
||||
getNavMeshAgentComponentName : function (
|
||||
)
|
||||
{
|
||||
return ;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method create
|
||||
* @param {cc.NavMeshAgentParam} arg0
|
||||
* @return {cc.NavMeshAgent}
|
||||
*/
|
||||
create : function (
|
||||
navmeshagentparam
|
||||
)
|
||||
{
|
||||
return cc.NavMeshAgent;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method NavMeshAgent
|
||||
* @constructor
|
||||
*/
|
||||
NavMeshAgent : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @class NavMeshObstacle
|
||||
*/
|
||||
jsb.NavMeshObstacle = {
|
||||
|
||||
/**
|
||||
* @method getSyncFlag
|
||||
* @return {cc.NavMeshObstacle::NavMeshObstacleSyncFlag}
|
||||
*/
|
||||
getSyncFlag : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method initWith
|
||||
* @param {float} arg0
|
||||
* @param {float} arg1
|
||||
* @return {bool}
|
||||
*/
|
||||
initWith : function (
|
||||
float,
|
||||
float
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method syncToObstacle
|
||||
*/
|
||||
syncToObstacle : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method syncToNode
|
||||
*/
|
||||
syncToNode : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getHeight
|
||||
* @return {float}
|
||||
*/
|
||||
getHeight : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setSyncFlag
|
||||
* @param {cc.NavMeshObstacle::NavMeshObstacleSyncFlag} arg0
|
||||
*/
|
||||
setSyncFlag : function (
|
||||
navmeshobstaclesyncflag
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getRadius
|
||||
* @return {float}
|
||||
*/
|
||||
getRadius : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method create
|
||||
* @param {float} arg0
|
||||
* @param {float} arg1
|
||||
* @return {cc.NavMeshObstacle}
|
||||
*/
|
||||
create : function (
|
||||
float,
|
||||
float
|
||||
)
|
||||
{
|
||||
return cc.NavMeshObstacle;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getNavMeshObstacleComponentName
|
||||
* @return {String}
|
||||
*/
|
||||
getNavMeshObstacleComponentName : function (
|
||||
)
|
||||
{
|
||||
return ;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method NavMeshObstacle
|
||||
* @constructor
|
||||
*/
|
||||
NavMeshObstacle : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @class NavMesh
|
||||
*/
|
||||
jsb.NavMesh = {
|
||||
|
||||
/**
|
||||
* @method removeNavMeshObstacle
|
||||
* @param {cc.NavMeshObstacle} arg0
|
||||
*/
|
||||
removeNavMeshObstacle : function (
|
||||
navmeshobstacle
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method removeNavMeshAgent
|
||||
* @param {cc.NavMeshAgent} arg0
|
||||
*/
|
||||
removeNavMeshAgent : function (
|
||||
navmeshagent
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method update
|
||||
* @param {float} arg0
|
||||
*/
|
||||
update : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isDebugDrawEnabled
|
||||
* @return {bool}
|
||||
*/
|
||||
isDebugDrawEnabled : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method addNavMeshAgent
|
||||
* @param {cc.NavMeshAgent} arg0
|
||||
*/
|
||||
addNavMeshAgent : function (
|
||||
navmeshagent
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method addNavMeshObstacle
|
||||
* @param {cc.NavMeshObstacle} arg0
|
||||
*/
|
||||
addNavMeshObstacle : function (
|
||||
navmeshobstacle
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setDebugDrawEnable
|
||||
* @param {bool} arg0
|
||||
*/
|
||||
setDebugDrawEnable : function (
|
||||
bool
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method debugDraw
|
||||
* @param {cc.Renderer} arg0
|
||||
*/
|
||||
debugDraw : function (
|
||||
renderer
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method create
|
||||
* @param {String} arg0
|
||||
* @param {String} arg1
|
||||
* @return {cc.NavMesh}
|
||||
*/
|
||||
create : function (
|
||||
str,
|
||||
str
|
||||
)
|
||||
{
|
||||
return cc.NavMesh;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method NavMesh
|
||||
* @constructor
|
||||
*/
|
||||
NavMesh : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6076,24 +6076,6 @@ bool js_cocos2dx_Director_pause(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
JS_ReportError(cx, "js_cocos2dx_Director_pause : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Director_isPurgeDirectorInNextLoop(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_isPurgeDirectorInNextLoop : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
bool ret = cobj->isPurgeDirectorInNextLoop();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Director_isPurgeDirectorInNextLoop : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Director_setEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -7371,6 +7353,19 @@ bool js_cocos2dx_Director_getActionManager(JSContext *cx, uint32_t argc, jsval *
|
||||
JS_ReportError(cx, "js_cocos2dx_Director_getActionManager : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Director_isPurgeDirectorInNextLoop(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
if (argc == 0) {
|
||||
bool ret = cocos2d::Director::isPurgeDirectorInNextLoop();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
JS_ReportError(cx, "js_cocos2dx_Director_isPurgeDirectorInNextLoop : wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Director_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -7415,7 +7410,6 @@ void js_register_cocos2dx_Director(JSContext *cx, JS::HandleObject global) {
|
||||
|
||||
static JSFunctionSpec funcs[] = {
|
||||
JS_FN("pause", js_cocos2dx_Director_pause, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isPurgeDirectorInNextLoop", js_cocos2dx_Director_isPurgeDirectorInNextLoop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setEventDispatcher", js_cocos2dx_Director_setEventDispatcher, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setContentScaleFactor", js_cocos2dx_Director_setContentScaleFactor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getContentScaleFactor", js_cocos2dx_Director_getContentScaleFactor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
@@ -7483,6 +7477,7 @@ void js_register_cocos2dx_Director(JSContext *cx, JS::HandleObject global) {
|
||||
};
|
||||
|
||||
static JSFunctionSpec st_funcs[] = {
|
||||
JS_FN("isPurgeDirectorInNextLoop", js_cocos2dx_Director_isPurgeDirectorInNextLoop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getInstance", js_cocos2dx_Director_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
};
|
||||
@@ -40184,6 +40179,26 @@ bool js_cocos2dx_MotionStreak_setTexture(JSContext *cx, uint32_t argc, jsval *vp
|
||||
JS_ReportError(cx, "js_cocos2dx_MotionStreak_setTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_MotionStreak_setMinSeg(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_setMinSeg : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
double arg0 = 0;
|
||||
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MotionStreak_setMinSeg : Error processing arguments");
|
||||
cobj->setMinSeg(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_MotionStreak_setMinSeg : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_MotionStreak_getTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -40229,6 +40244,24 @@ bool js_cocos2dx_MotionStreak_tintWithColor(JSContext *cx, uint32_t argc, jsval
|
||||
JS_ReportError(cx, "js_cocos2dx_MotionStreak_tintWithColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_MotionStreak_getMinSeg(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_getMinSeg : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
double ret = cobj->getMinSeg();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_MotionStreak_getMinSeg : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_MotionStreak_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -40249,6 +40282,26 @@ bool js_cocos2dx_MotionStreak_setBlendFunc(JSContext *cx, uint32_t argc, jsval *
|
||||
JS_ReportError(cx, "js_cocos2dx_MotionStreak_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_MotionStreak_setFadeTime(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_setFadeTime : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
double arg0 = 0;
|
||||
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MotionStreak_setFadeTime : Error processing arguments");
|
||||
cobj->setFadeTime(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_MotionStreak_setFadeTime : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_MotionStreak_setStartingPositionInitialized(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -40269,6 +40322,24 @@ bool js_cocos2dx_MotionStreak_setStartingPositionInitialized(JSContext *cx, uint
|
||||
JS_ReportError(cx, "js_cocos2dx_MotionStreak_setStartingPositionInitialized : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_MotionStreak_getFadeTime(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_getFadeTime : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
double ret = cobj->getFadeTime();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_MotionStreak_getFadeTime : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_MotionStreak_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -40620,10 +40691,14 @@ void js_register_cocos2dx_MotionStreak(JSContext *cx, JS::HandleObject global) {
|
||||
static JSFunctionSpec funcs[] = {
|
||||
JS_FN("reset", js_cocos2dx_MotionStreak_reset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setTexture", js_cocos2dx_MotionStreak_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setMinSeg", js_cocos2dx_MotionStreak_setMinSeg, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getTexture", js_cocos2dx_MotionStreak_getTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("tintWithColor", js_cocos2dx_MotionStreak_tintWithColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getMinSeg", js_cocos2dx_MotionStreak_getMinSeg, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setBlendFunc", js_cocos2dx_MotionStreak_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setFadeTime", js_cocos2dx_MotionStreak_setFadeTime, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setStartingPositionInitialized", js_cocos2dx_MotionStreak_setStartingPositionInitialized, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getFadeTime", js_cocos2dx_MotionStreak_getFadeTime, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getBlendFunc", js_cocos2dx_MotionStreak_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isStartingPositionInitialized", js_cocos2dx_MotionStreak_isStartingPositionInitialized, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isFastMode", js_cocos2dx_MotionStreak_isFastMode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
||||
@@ -307,7 +307,6 @@ void js_cocos2dx_Director_finalize(JSContext *cx, JSObject *obj);
|
||||
void js_register_cocos2dx_Director(JSContext *cx, JS::HandleObject global);
|
||||
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_Director_pause(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_isPurgeDirectorInNextLoop(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_setEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_setContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_getContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -371,6 +370,7 @@ bool js_cocos2dx_Director_getEventDispatcher(JSContext *cx, uint32_t argc, jsval
|
||||
bool js_cocos2dx_Director_replaceScene(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_setAnimationInterval(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_getActionManager(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_isPurgeDirectorInNextLoop(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_getInstance(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
extern JSClass *jsb_cocos2d_Scheduler_class;
|
||||
@@ -2454,10 +2454,14 @@ void js_register_cocos2dx_MotionStreak(JSContext *cx, JS::HandleObject global);
|
||||
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_MotionStreak_reset(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_MotionStreak_setTexture(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_MotionStreak_setMinSeg(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_MotionStreak_getTexture(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_MotionStreak_tintWithColor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_MotionStreak_getMinSeg(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_MotionStreak_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_MotionStreak_setFadeTime(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_MotionStreak_setStartingPositionInitialized(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_MotionStreak_getFadeTime(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_MotionStreak_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_MotionStreak_isStartingPositionInitialized(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_MotionStreak_isFastMode(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
@@ -415,7 +415,7 @@ void registerDefaultClasses(JSContext* cx, JS::HandleObject global) {
|
||||
|
||||
// register some global functions
|
||||
JS_DefineFunction(cx, global, "require", ScriptingCore::executeScript, 1, JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, global, "log", ScriptingCore::log, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, global, "log", ScriptingCore::log, 0, JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, global, "executeScript", ScriptingCore::executeScript, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, global, "forceGC", ScriptingCore::forceGC, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
|
||||
@@ -3069,392 +3069,6 @@ bool js_cocos2dx_ccGLEnableVertexAttribs(JSContext *cx, uint32_t argc, jsval *vp
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool js_cocos2dx_ccpAdd(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
if (argc == 2) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
cocos2d::Point arg1;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(1), &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
Point ret = arg0 + arg1;
|
||||
|
||||
jsval jsret = ccpoint_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpDistanceSQ(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
if (argc == 2) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
cocos2d::Point arg1;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(1), &arg1);
|
||||
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
float ret = arg0.getDistanceSq(arg1);
|
||||
|
||||
jsval jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpDistance(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
if (argc == 2) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
cocos2d::Point arg1;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(1), &arg1);
|
||||
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
float ret = arg0.getDistance(arg1);
|
||||
|
||||
jsval jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpClamp(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
cocos2d::Point arg1;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(1), &arg1);
|
||||
cocos2d::Point arg2;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(2), &arg2);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
Point ret = arg0.getClampPoint(arg1, arg2);
|
||||
|
||||
jsval jsret = ccpoint_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpLengthSQ(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
float ret = arg0.getLengthSq();
|
||||
|
||||
jsval jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpLength(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
float ret = arg0.getLength();
|
||||
|
||||
jsval jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpNeg(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
Point ret = -arg0;
|
||||
|
||||
jsval jsret = ccpoint_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpSub(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
cocos2d::Point arg1;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(1), &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
Point ret = arg0 - arg1;
|
||||
|
||||
jsval jsret = ccpoint_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpMult(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
|
||||
double arg1;
|
||||
ok &= JS::ToNumber(cx, args.get(1), &arg1);
|
||||
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
Point ret = arg0 * arg1;
|
||||
|
||||
jsval jsret = ccpoint_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpMidpoint(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
cocos2d::Point arg1;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(1), &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
Point ret = arg0.getMidpoint(arg1);
|
||||
|
||||
jsval jsret = ccpoint_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool js_cocos2dx_ccpDot(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
cocos2d::Point arg1;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(1), &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
float ret = arg0.dot(arg1);
|
||||
|
||||
jsval jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpCross(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
cocos2d::Point arg1;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(1), &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
float ret = arg0.cross(arg1);
|
||||
|
||||
jsval jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpPerp(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
Point ret = arg0.getPerp();
|
||||
|
||||
jsval jsret = ccpoint_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool js_cocos2dx_ccpRPerp(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
Point ret = arg0.getRPerp();
|
||||
|
||||
jsval jsret = ccpoint_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool js_cocos2dx_ccpProject(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
cocos2d::Point arg1;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(1), &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
Point ret = arg0.project(arg1);
|
||||
|
||||
jsval jsret = ccpoint_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpRotate(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
cocos2d::Point arg1;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(1), &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
Point ret = arg0.rotate(arg1);
|
||||
|
||||
jsval jsret = ccpoint_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccpNormalize(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::Vec2 ret;
|
||||
ok &= jsval_to_vector2(cx, args.get(0), &ret);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
ret.normalize();
|
||||
|
||||
jsval jsret = ccpoint_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ccmat4CreateTranslation(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -5581,24 +5195,6 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
|
||||
JS_DefineFunction(cx, tmpObj, "getScriptObject", js_cocos2dx_ComponentJS_getScriptObject, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, ccObj, "glEnableVertexAttribs", js_cocos2dx_ccGLEnableVertexAttribs, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pAdd", js_cocos2dx_ccpAdd, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pDistanceSQ", js_cocos2dx_ccpDistanceSQ, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pDistance", js_cocos2dx_ccpDistance, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pSub", js_cocos2dx_ccpSub, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pNeg", js_cocos2dx_ccpNeg, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pMult", js_cocos2dx_ccpMult, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pMidpoint", js_cocos2dx_ccpMidpoint, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pDot", js_cocos2dx_ccpDot, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pCross", js_cocos2dx_ccpCross, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pPerp", js_cocos2dx_ccpPerp, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pRPerp", js_cocos2dx_ccpRPerp, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pProject", js_cocos2dx_ccpProject, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pRotate", js_cocos2dx_ccpRotate, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pNormalize", js_cocos2dx_ccpNormalize, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pClamp", js_cocos2dx_ccpClamp, 2, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pLengthSQ", js_cocos2dx_ccpLengthSQ, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "pLength", js_cocos2dx_ccpLength, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
|
||||
JS_DefineFunction(cx, ccObj, "registerTargetedDelegate", js_cocos2dx_JSTouchDelegate_registerTargetedDelegate, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, ccObj, "registerStandardDelegate", js_cocos2dx_JSTouchDelegate_registerStandardDelegate, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
@@ -41,8 +41,15 @@ bool js_EventListenerTouchOneByOne_create(JSContext *cx, uint32_t argc, jsval *v
|
||||
if (!ok)
|
||||
return false;
|
||||
|
||||
CCASSERT(jsret.isBoolean(), "the return value of onTouchBegan isn't boolean");
|
||||
return jsret.toBoolean();
|
||||
// Solve the crash when there is no return value of onTouchBegan.
|
||||
// related issue : https://github.com/cocos-creator/fireball/issues/2557
|
||||
// CCASSERT(jsret.isBoolean(), "the return value of onTouchBegan isn't boolean");
|
||||
// return jsret.toBoolean();
|
||||
if (jsret.isBoolean()) {
|
||||
return jsret.toBoolean();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
ret->onTouchMoved = [ret](Touch* touch, Event* event) {
|
||||
|
||||
@@ -792,6 +792,180 @@ cc.pRotateByAngle = function (v, pivot, angle) {
|
||||
return r;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates sum of two points.
|
||||
* @method pAdd
|
||||
* @param {Vec2} v1
|
||||
* @param {Vec2} v2
|
||||
* @return {Vec2}
|
||||
*/
|
||||
cc.pAdd = function (v1, v2) {
|
||||
return cc.p(v1.x + v2.x, v1.y + v2.y);
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the square distance between two points (not calling sqrt() ).
|
||||
* @method pDistanceSQ
|
||||
* @param {Vec2} point1
|
||||
* @param {Vec2} point2
|
||||
* @return {Number}
|
||||
*/
|
||||
cc.pDistanceSQ = function(point1, point2){
|
||||
return cc.pLengthSQ(cc.pSub(point1,point2));
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the distance between two points.
|
||||
* @method pDistance
|
||||
* @param {Vec2} v1
|
||||
* @param {Vec2} v2
|
||||
* @return {Number}
|
||||
*/
|
||||
cc.pDistance = function (v1, v2) {
|
||||
return cc.pLength(cc.pSub(v1, v2));
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates difference of two points.
|
||||
* @method pSub
|
||||
* @param {Vec2} v1
|
||||
* @param {Vec2} v2
|
||||
* @return {Vec2}
|
||||
*/
|
||||
cc.pSub = function (v1, v2) {
|
||||
return cc.p(v1.x - v2.x, v1.y - v2.y);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns opposite of Vec2.
|
||||
* @method pNeg
|
||||
* @param {Vec2} point
|
||||
* @return {Vec2}
|
||||
*/
|
||||
cc.pNeg = function (point) {
|
||||
return cc.p(-point.x, -point.y);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns point multiplied by given factor.
|
||||
* @method pMult
|
||||
* @param {Vec2} point
|
||||
* @param {Number} floatVar
|
||||
* @return {Vec2}
|
||||
*/
|
||||
cc.pMult = function (point, floatVar) {
|
||||
return cc.p(point.x * floatVar, point.y * floatVar);
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates midpoint between two points.
|
||||
* @method pMidpoint
|
||||
* @param {Vec2} v1
|
||||
* @param {Vec2} v2
|
||||
* @return {Vec2}
|
||||
*/
|
||||
cc.pMidpoint = function (v1, v2) {
|
||||
return cc.pMult(cc.pAdd(v1, v2), 0.5);
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates dot product of two points.
|
||||
* @method pDot
|
||||
* @param {Vec2} v1
|
||||
* @param {Vec2} v2
|
||||
* @return {Number}
|
||||
*/
|
||||
cc.pDot = function (v1, v2) {
|
||||
return v1.x * v2.x + v1.y * v2.y;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates cross product of two points.
|
||||
* @method pCross
|
||||
* @param {Vec2} v1
|
||||
* @param {Vec2} v2
|
||||
* @return {Number}
|
||||
*/
|
||||
cc.pCross = function (v1, v2) {
|
||||
return v1.x * v2.y - v1.y * v2.x;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates perpendicular of v,
|
||||
* rotated 90 degrees counter-clockwise -- cross(v, perp(v)) greater than 0.
|
||||
* @method pPerp
|
||||
* @param {Vec2} point
|
||||
* @return {Vec2}
|
||||
*/
|
||||
cc.pPerp = function (point) {
|
||||
return cc.p(-point.y, point.x);
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates perpendicular of v,
|
||||
* rotated 90 degrees clockwise -- cross(v, rperp(v)) smaller than 0.
|
||||
* @method pRPerp
|
||||
* @param {Vec2} point
|
||||
* @return {Vec2}
|
||||
*/
|
||||
cc.pRPerp = function (point) {
|
||||
return cc.p(point.y, -point.x);
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the projection of v1 over v2.
|
||||
* @method pProject
|
||||
* @param {Vec2} v1
|
||||
* @param {Vec2} v2
|
||||
* @return {Vec2}
|
||||
*/
|
||||
cc.pProject = function (v1, v2) {
|
||||
return cc.pMult(v2, cc.pDot(v1, v2) / cc.pDot(v2, v2));
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns this vector with a magnitude of 1.
|
||||
* @method pNormalize
|
||||
* @param {Vec2} v
|
||||
* @return {Vec2}
|
||||
*/
|
||||
cc.pNormalize = function (v) {
|
||||
var n = cc.pLength(v);
|
||||
return n === 0 ? cc.p(v) : cc.pMult(v, 1.0 / n);
|
||||
};
|
||||
|
||||
/**
|
||||
* Clamp a point between from and to.
|
||||
* @method pClamp
|
||||
* @param {Vec2} p
|
||||
* @param {Vec2} min_inclusive
|
||||
* @param {Vec2} max_inclusive
|
||||
* @return {Vec2}
|
||||
*/
|
||||
cc.pClamp = function (p, min_inclusive, max_inclusive) {
|
||||
return cc.p(cc.clampf(p.x, min_inclusive.x, max_inclusive.x), cc.clampf(p.y, min_inclusive.y, max_inclusive.y));
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the square length of a cc.Vec2 (not calling sqrt() ).
|
||||
* @method pLengthSQ
|
||||
* @param {Vec2} v
|
||||
* @return {Number}
|
||||
*/
|
||||
cc.pLengthSQ = function (v) {
|
||||
return cc.pDot(v, v);
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates distance between point an origin.
|
||||
* @method pLength
|
||||
* @param {Vec2} v
|
||||
* @return {Number}
|
||||
*/
|
||||
cc.pLength = function (v) {
|
||||
return Math.sqrt(cc.pLengthSQ(v));
|
||||
};
|
||||
|
||||
/**
|
||||
* A general line-line intersection test
|
||||
* @param {cc.Point} A A is the startpoint for the first line P1 = (p1 - p2).
|
||||
@@ -1896,11 +2070,19 @@ cc.DrawNode = cc._DrawNode.extend({
|
||||
},
|
||||
|
||||
drawPoly:function (verts, fillColor, borderWidth, borderColor) {
|
||||
borderWidth = borderWidth || this._lineWidth;
|
||||
borderColor = borderColor || this._drawColor;
|
||||
if (fillColor)
|
||||
cc._DrawNode.prototype.drawPoly.call(this, verts, fillColor, borderWidth, borderColor);
|
||||
else {
|
||||
verts.push(verts[0]);
|
||||
var first = verts[0];
|
||||
var last = verts[verts.length - 1];
|
||||
|
||||
if (first.x !== last.x || first.y !== last.y) {
|
||||
verts = verts.slice(0, verts.length);
|
||||
verts.push(verts[0]);
|
||||
}
|
||||
|
||||
var drawSeg = cc._DrawNode.prototype.drawSegment;
|
||||
for (var i = 0, len = verts.length; i < len - 1; i++)
|
||||
drawSeg.call(this, verts[i], verts[i + 1], borderWidth, borderColor);
|
||||
|
||||
@@ -97,14 +97,20 @@ bool localStorageGetItem( const std::string& key, std::string *outItem )
|
||||
jstring jret = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID, jkey);
|
||||
if (jret == nullptr)
|
||||
{
|
||||
t.env->DeleteLocalRef(jret);
|
||||
t.env->DeleteLocalRef(jkey);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
return false;
|
||||
}
|
||||
auto value = JniHelper::jstring2string(jret);
|
||||
outItem->assign(value);
|
||||
t.env->DeleteLocalRef(jret);
|
||||
t.env->DeleteLocalRef(jkey);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
return true;
|
||||
else
|
||||
{
|
||||
auto value = JniHelper::jstring2string(jret);
|
||||
outItem->assign(value);
|
||||
t.env->DeleteLocalRef(jret);
|
||||
t.env->DeleteLocalRef(jkey);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user