Merge pull request #14758 from pandamicro/v3

Sync v3.10 to v3
This commit is contained in:
pandamicro 2015-12-20 23:47:07 +08:00
commit 4ff9ed0ffe
153 changed files with 3308 additions and 1729 deletions

View File

@ -37,4 +37,4 @@ before_install:
# whitelist
branches:
only:
- v3
- v3.10

View File

@ -38,7 +38,7 @@ endif()
project (Cocos2d-X)
# The version number
set(COCOS2D_X_VERSION 3.9)
set(COCOS2D_X_VERSION 3.10)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules/")
include(CocosBuildHelpers)

View File

@ -67,6 +67,7 @@ ClippingNode::~ClippingNode()
_stencil->stopAllActions();
_stencil->release();
}
CC_SAFE_DELETE(_stencilStateManager);
}
ClippingNode* ClippingNode::create()

View File

@ -606,9 +606,7 @@ bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& ima
FontFNT *bmFont = (FontFNT*)newAtlas->getFont();
if (bmFont) {
float originalFontSize = bmFont->getOriginalFontSize();
if(fabs(_bmFontSize+1) < FLT_EPSILON){
_bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR();
}
_bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR();
}
}
@ -1037,10 +1035,10 @@ void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = -1 */
_effectColorF.g = outlineColor.g / 255.f;
_effectColorF.b = outlineColor.b / 255.f;
_effectColorF.a = outlineColor.a / 255.f;
_outlineSize = outlineSize;
_currLabelEffect = LabelEffect::OUTLINE;
_contentDirty = true;
}
_outlineSize = outlineSize;
}
}

View File

@ -349,6 +349,41 @@ public:
*/
virtual void disableEffect(LabelEffect effect);
/**
* Return whether the shadow effect is enabled.
*/
bool isShadowEnabled() const { return _shadowEnabled; }
/**
* Return shadow effect offset value.
*/
Size getShadowOffset() const { return _shadowOffset; }
/**
* Return the shadow effect blur radius.
*/
float getShadowBlurRadius() const { return _shadowBlurRadius; }
/**
* Return the shadow effect color value.
*/
Color4F getShadowColor() const { return _shadowColor4F; }
/**
* Return the outline effect size value.
*/
int getOutlineSize() const { return _outlineSize; }
/**
* Return current effect type.
*/
LabelEffect getLabelEffectType() const { return _currLabelEffect; }
/**
* Return current effect color vlaue.
*/
Color4F getEffectColor() const { return _effectColorF; }
/** Sets the Label's text horizontal alignment.*/
void setAlignment(TextHAlignment hAlignment) { setAlignment(hAlignment,_vAlignment);}

View File

@ -104,14 +104,6 @@ void MenuItem::activate()
{
_callback(this);
}
#if CC_ENABLE_SCRIPT_BINDING
if (kScriptTypeNone != _scriptType)
{
BasicScriptData data(this);
ScriptEvent scriptEvent(kMenuClickedEvent,&data);
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
}
#endif
}
}

View File

@ -133,7 +133,6 @@ Mesh::Mesh()
, _blendDirty(true)
, _force2DQueue(false)
, _texFile("")
, _enableCheckTexture(false)
{
}
@ -282,7 +281,7 @@ void Mesh::setTexture(Texture2D* tex)
setTexture(tex, NTextureData::Usage::Diffuse);
}
void Mesh::setTexture(Texture2D* tex, NTextureData::Usage usage)
void Mesh::setTexture(Texture2D* tex, NTextureData::Usage usage, bool cacheFileName)
{
// Texture must be saved for future use
// it doesn't matter if the material is already set or not
@ -307,7 +306,8 @@ void Mesh::setTexture(Texture2D* tex, NTextureData::Usage usage)
}
bindMeshCommand();
_texFile = tex->getPath();
if (cacheFileName)
_texFile = tex->getPath();
}
else if (usage == NTextureData::Usage::Normal) // currently only diffuse and normal are supported
{
@ -382,9 +382,6 @@ void Mesh::draw(Renderer* renderer, float globalZOrder, const Mat4& transform, u
if (isTransparent)
flags |= Node::FLAGS_RENDER_AS_3D;
if (_enableCheckTexture)
this->checkTexture();
_meshCommand.init(globalZ,
_material,
getVertexBuffer(),
@ -706,39 +703,4 @@ GLuint Mesh::getIndexBuffer() const
{
return _meshIndexData->getIndexBuffer()->getVBO();
}
void Mesh::checkTexture()
{
Texture2D* cacheTex = nullptr;
auto& texture = _textures[NTextureData::Usage::Diffuse];
if (Director::getInstance()->getTextureCache()->isDirty())
{
cacheTex = Director::getInstance()->getTextureCache()->getTextureForKey(_texFile);
if (cacheTex == nullptr)
{
cacheTex = getDummyTexture();
}
}
else if (texture != nullptr && !texture->isValid())
{
cacheTex = getDummyTexture();
}
if (cacheTex != nullptr && texture != cacheTex)
{
CC_SAFE_RETAIN(cacheTex);
CC_SAFE_RELEASE(texture);
texture = cacheTex;
if (_material) {
auto technique = _material->_currentTechnique;
for (auto& pass : technique->_passes)
{
pass->setTexture(texture);
}
}
bindMeshCommand();
}
}
NS_CC_END

View File

@ -109,8 +109,9 @@ public:
* set texture
* @param tex texture to be set
* @param usage Usage of this texture
* @param whether refresh the cache file name
*/
void setTexture(Texture2D* tex, NTextureData::Usage usage);
void setTexture(Texture2D* tex, NTextureData::Usage usage,bool cacheFileName = true);
/**
* set texture
* @param texPath texture path
@ -224,19 +225,7 @@ public:
*/
void setForce2DQueue(bool force2D) { _force2DQueue = force2D; }
/**
* check texture
*/
void checkTexture();
/**
* set enable check texture, check texture each frame if enable is true. It is false by default
*/
void setEnableCheckTexture(bool enableCheckTexture) { _enableCheckTexture = enableCheckTexture; }
/**
* check texture each frame?
*/
bool enableCheckTexture() const { return _enableCheckTexture; }
std::string getTextureFileName(){ return _texFile; }
CC_CONSTRUCTOR_ACCESS:
@ -280,7 +269,6 @@ protected:
std::vector<float> _spotLightUniformRangeInverseValues;
std::string _texFile;
bool _enableCheckTexture;
};
// end of 3d group

View File

@ -328,9 +328,6 @@ void Director::drawScene()
{
calculateMPF();
}
if (_textureCache != nullptr)
_textureCache->setDirty(false);
}
void Director::calculateDeltaTime()

View File

@ -50,6 +50,7 @@ Ref::Ref()
, _scriptObject(nullptr)
, _rooted(false)
, _scriptOwned(false)
,_referenceCountAtRootTime(0)
#endif
{
#if CC_ENABLE_SCRIPT_BINDING
@ -64,7 +65,7 @@ Ref::Ref()
Ref::~Ref()
{
#if CC_ENABLE_SCRIPT_BINDING
#if CC_ENABLE_SCRIPT_BINDING && not CC_ENABLE_GC_FOR_NATIVE_OBJECTS
// if the object is referenced by Lua engine, remove it
if (_luaID)
{
@ -93,13 +94,13 @@ void Ref::retain()
++_referenceCount;
#if CC_ENABLE_SCRIPT_BINDING && CC_ENABLE_GC_FOR_NATIVE_OBJECTS
if (!_rooted && _scriptOwned)
if (_scriptOwned && !_rooted)
{
auto scriptMgr = ScriptEngineManager::getInstance()->getScriptEngine();
if (scriptMgr && scriptMgr->getScriptType() == kScriptTypeJavascript)
{
_referenceCountAtRootTime = _referenceCount-1;
scriptMgr->rootObject(this);
_rooted = true;
}
}
#endif // CC_ENABLE_SCRIPT_BINDING
@ -111,13 +112,12 @@ void Ref::release()
--_referenceCount;
#if CC_ENABLE_SCRIPT_BINDING && CC_ENABLE_GC_FOR_NATIVE_OBJECTS
if (_scriptOwned && _referenceCount==1 && _rooted)
if (_scriptOwned && _rooted && _referenceCount==/*_referenceCountAtRootTime*/ 1)
{
auto scriptMgr = ScriptEngineManager::getInstance()->getScriptEngine();
if (scriptMgr && scriptMgr->getScriptType() == kScriptTypeJavascript)
{
scriptMgr->unrootObject(this);
_rooted = false;
}
}
#endif // CC_ENABLE_SCRIPT_BINDING

View File

@ -161,6 +161,7 @@ public:
When true, it means that the object was already rooted.
*/
bool _rooted;
unsigned int _referenceCountAtRootTime;
/**
* The life of the object is scrolled by the scripting engine.

View File

@ -30,7 +30,7 @@ THE SOFTWARE.
// 0x00 HI ME LO
// 00 03 08 00
#define COCOS2D_VERSION 0x00030900
#define COCOS2D_VERSION 0x00031000
//
// all cocos2d include files

View File

@ -11,7 +11,7 @@ WebSocket.cpp \
CCDownloader.cpp \
CCDownloader-android.cpp
LOCAL_EXPORT_C_INCLUDES :=
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../external/curl/include/android \
$(LOCAL_PATH)/../../external/websockets/include/android

View File

@ -25,6 +25,7 @@
#include "network/CCDownloader-apple.h"
#include "network/CCDownloader.h"
#include "CCString.h"
#include <queue>
////////////////////////////////////////////////////////////////////////////////
@ -388,7 +389,8 @@ namespace cocos2d { namespace network {
if(_outer)
{
if(error) {
if(error)
{
std::vector<unsigned char> buf; // just a placeholder
_outer->onTaskFinish(*[wrapper get],
cocos2d::network::DownloadTask::ERROR_IMPL_INTERNAL,
@ -396,24 +398,41 @@ namespace cocos2d { namespace network {
[error.localizedDescription cStringUsingEncoding:NSUTF8StringEncoding],
buf);
}
else if(![wrapper get]->storagePath.length()) {
else if (![wrapper get]->storagePath.length())
{
// call onTaskFinish for a data task
// (for a file download task, callback is called in didFinishDownloadingToURL)
std::string errorString;
const int64_t buflen = [wrapper totalBytesReceived];
char buf[buflen];
[wrapper transferDataToBuffer:buf lengthOfBuffer:buflen];
std::vector<unsigned char> data(buf, buf + buflen);
_outer->onTaskFinish(*[wrapper get],
cocos2d::network::DownloadTask::ERROR_NO_ERROR,
0,
0,
errorString,
data);
}
else
{
NSInteger statusCode = ((NSHTTPURLResponse*)task.response).statusCode;
// Check for error status code
if (statusCode >= 400)
{
std::vector<unsigned char> buf; // just a placeholder
const char *orignalURL = [task.originalRequest.URL.absoluteString cStringUsingEncoding:NSUTF8StringEncoding];
std::string errorMessage = cocos2d::StringUtils::format("Downloader: Failed to download %s with status code (%d)", orignalURL, (int)statusCode);
_outer->onTaskFinish(*[wrapper get],
cocos2d::network::DownloadTask::ERROR_IMPL_INTERNAL,
0,
errorMessage,
buf);
}
}
}
[self.taskDict removeObjectForKey:task];
[wrapper release];
@ -510,12 +529,21 @@ namespace cocos2d { namespace network {
return;
}
// On iOS 9 a response with status code 4xx(Client Error) or 5xx(Server Error)
// might end up calling this delegate method, saving the error message to the storage path
// and treating this download task as a successful one, so we need to check the status code here
NSInteger statusCode = ((NSHTTPURLResponse*)downloadTask.response).statusCode;
if (statusCode >= 400)
{
return;
}
DownloadTaskWrapper *wrapper = [self.taskDict objectForKey:downloadTask];
const char * storagePath = [wrapper get]->storagePath.c_str();
NSString *destPath = [NSString stringWithUTF8String:storagePath];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *destURL = nil;
do
{
if ([destPath hasPrefix:@"file://"])

View File

@ -248,9 +248,12 @@ WebSocket::~WebSocket()
close();
CC_SAFE_RELEASE_NULL(_wsHelper);
for (int i = 0; _wsProtocols[i].callback != nullptr; ++i)
if(_wsProtocols)
{
CC_SAFE_DELETE_ARRAY(_wsProtocols[i].name);
for (int i = 0; _wsProtocols[i].callback != nullptr; ++i)
{
CC_SAFE_DELETE_ARRAY(_wsProtocols[i].name);
}
}
CC_SAFE_DELETE_ARRAY(_wsProtocols);
}

View File

@ -427,8 +427,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
ids[i] = touch;
xs[i] = [touch locationInView: [touch view]].x * self.contentScaleFactor;;
ys[i] = [touch locationInView: [touch view]].y * self.contentScaleFactor;;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 // Use 9.0 or higher SDK to compile
#ifdef __IPHONE_9_0 && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0
// running on iOS 9.0 or higher version
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0f) {
fs[i] = touch.force;

View File

@ -406,10 +406,6 @@ public:
/** Get a shader program from the texture.*/
GLProgram* getGLProgram() const;
/** Set if the texture is valid, when it been set as false, it will display as default "file missing texture" */
void setValid(bool valid) { _valid = valid; }
bool isValid() const { return _valid; }
std::string getPath()const { return _filePath; }
public:

View File

@ -59,7 +59,6 @@ TextureCache::TextureCache()
: _loadingThread(nullptr)
, _needQuit(false)
, _asyncRefCount(0)
, _dirty(false)
{
}
@ -496,8 +495,7 @@ void TextureCache::removeTexture(Texture2D* texture)
for( auto it=_textures.cbegin(); it!=_textures.cend(); /* nothing */ ) {
if( it->second == texture ) {
texture->setValid(false);
texture->autorelease();
it->second->release();
_textures.erase(it++);
break;
} else
@ -516,8 +514,7 @@ void TextureCache::removeTextureForKey(const std::string &textureKeyName)
}
if( it != _textures.end() ) {
it->second->setValid(false);
(it->second)->autorelease();
it->second->release();
_textures.erase(it);
}
}
@ -626,7 +623,6 @@ void TextureCache::renameTextureWithKey(const std::string srcName, const std::st
tex->initWithImage(image);
_textures.insert(std::make_pair(fullpath, tex));
_textures.erase(it);
this->setDirty(true);
}
CC_SAFE_DELETE(image);
}

View File

@ -204,9 +204,6 @@ public:
*/
const std::string getTextureFilePath(Texture2D* texture)const;
void setDirty(bool dirty) { _dirty = dirty; }
bool isDirty() const { return _dirty; }
/** Reload texture from a new file.
* This function is mainly for editor, won't suggest use it in game for performance reason.
*
@ -242,8 +239,6 @@ protected:
int _asyncRefCount;
std::unordered_map<std::string, Texture2D*> _textures;
bool _dirty;
};
#if CC_ENABLE_CACHE_TEXTURE_DATA

View File

@ -448,16 +448,6 @@ getVertexSizeInBytes : function (
return 0;
},
/**
* @method enableCheckTexture
* @return {bool}
*/
enableCheckTexture : function (
)
{
return false;
},
/**
* @method setMaterial
* @param {cc.Material} arg0
@ -558,14 +548,6 @@ str
{
},
/**
* @method checkTexture
*/
checkTexture : function (
)
{
},
/**
* @method getIndexCount
* @return {long}
@ -636,16 +618,6 @@ meshskin
{
},
/**
* @method setEnableCheckTexture
* @param {bool} arg0
*/
setEnableCheckTexture : function (
bool
)
{
},
/**
* @method isVisible
* @return {bool}

View File

@ -34,6 +34,16 @@ isEnabled : function (
return false;
},
/**
* @method getRender
* @return {cc.Particle3DRender}
*/
getRender : function (
)
{
return cc.Particle3DRender;
},
/**
* @method isKeepLocal
* @return {bool}

View File

@ -120,16 +120,6 @@ getPixelsHigh : function (
return 0;
},
/**
* @method setValid
* @param {bool} arg0
*/
setValid : function (
bool
)
{
},
/**
* @method getBitsPerPixelForFormat
* @param {cc.Texture2D::PixelFormat} pixelformat
@ -214,16 +204,6 @@ getContentSize : function (
return cc.Size;
},
/**
* @method isValid
* @return {bool}
*/
isValid : function (
)
{
return false;
},
/**
* @method setAliasTexParameters
*/
@ -12011,6 +11991,16 @@ float
{
},
/**
* @method getWidth
* @return {float}
*/
getWidth : function (
)
{
return 0;
},
/**
* @method getString
* @return {String}
@ -12081,6 +12071,16 @@ float
{
},
/**
* @method getAdditionalKerning
* @return {float}
*/
getAdditionalKerning : function (
)
{
return 0;
},
/**
* @method getBMFontSize
* @return {float}
@ -12111,6 +12111,16 @@ getHorizontalAlignment : function (
return 0;
},
/**
* @method getShadowOffset
* @return {size_object}
*/
getShadowOffset : function (
)
{
return cc.Size;
},
/**
* @method setClipMarginEnabled
* @param {bool} arg0
@ -12141,6 +12151,16 @@ str
{
},
/**
* @method getOutlineSize
* @return {int}
*/
getOutlineSize : function (
)
{
return 0;
},
/**
* @method setBMFontFilePath
* @param {String} arg0
@ -12270,15 +12290,25 @@ int
},
/**
* @method getAdditionalKerning
* @method getShadowBlurRadius
* @return {float}
*/
getAdditionalKerning : function (
getShadowBlurRadius : function (
)
{
return 0;
},
/**
* @method getEffectColor
* @return {color4f_object}
*/
getEffectColor : function (
)
{
return cc.Color4F;
},
/**
* @method removeAllChildrenWithCleanup
* @param {bool} arg0
@ -12367,6 +12397,16 @@ getLineHeight : function (
return 0;
},
/**
* @method getShadowColor
* @return {color4f_object}
*/
getShadowColor : function (
)
{
return cc.Color4F;
},
/**
* @method getTTFConfig
* @return {cc._ttfConfig}
@ -12420,13 +12460,13 @@ float
},
/**
* @method getWidth
* @return {float}
* @method isShadowEnabled
* @return {bool}
*/
getWidth : function (
isShadowEnabled : function (
)
{
return 0;
return false;
},
/**
@ -12519,6 +12559,16 @@ isWrapEnabled : function (
return false;
},
/**
* @method getLabelEffectType
* @return {cc.LabelEffect}
*/
getLabelEffectType : function (
)
{
return 0;
},
/**
* @method setAlignment
* @param {cc.TextHAlignment|cc.TextHAlignment} texthalignment
@ -21102,16 +21152,6 @@ texture2d
return ;
},
/**
* @method setDirty
* @param {bool} arg0
*/
setDirty : function (
bool
)
{
},
/**
* @method renameTextureWithKey
* @param {String} arg0
@ -21132,16 +21172,6 @@ removeUnusedTextures : function (
{
},
/**
* @method isDirty
* @return {bool}
*/
isDirty : function (
)
{
return false;
},
/**
* @method removeTexture
* @param {cc.Texture2D} arg0
@ -23463,27 +23493,4 @@ getInstance : function (
*/
cc.ComponentJS = {
/**
* @method create
* @param {String} arg0
* @return {cc.ComponentJS}
*/
create : function (
str
)
{
return cc.ComponentJS;
},
/**
* @method ComponentJS
* @constructor
* @param {String} arg0
*/
ComponentJS : function (
str
)
{
},
};

View File

@ -548,11 +548,13 @@ getCurrentTitle : function(
* @method initWithLabelAndBackgroundSprite
* @param {cc.Node} arg0
* @param {ccui.Scale9Sprite} arg1
* @param {bool} arg2
* @return {bool}
*/
initWithLabelAndBackgroundSprite : function (
node,
scale9sprite
scale9sprite,
bool
)
{
return false;
@ -582,15 +584,15 @@ state
/**
* @method create
* @param {ccui.Scale9Sprite|cc.Node|String} scale9sprite
* @param {ccui.Scale9Sprite|String} scale9sprite
* @param {float} float
* @return {cc.ControlButton|cc.ControlButton|cc.ControlButton|cc.ControlButton}
* @param {ccui.Scale9Sprite|cc.Node|String|cc.Node} scale9sprite
* @param {ccui.Scale9Sprite|String|ccui.Scale9Sprite} scale9sprite
* @param {float|bool} float
* @return {cc.ControlButton|cc.ControlButton|cc.ControlButton|cc.ControlButton|cc.ControlButton}
*/
create : function(
str,
str,
float
node,
scale9sprite,
bool
)
{
return cc.ControlButton;

View File

@ -2383,6 +2383,16 @@ labeleffect
{
},
/**
* @method getLabelEffectType
* @return {cc.LabelEffect}
*/
getLabelEffectType : function (
)
{
return 0;
},
/**
* @method getTextColor
* @return {color4b_object}
@ -2423,6 +2433,16 @@ bool
{
},
/**
* @method getShadowOffset
* @return {size_object}
*/
getShadowOffset : function (
)
{
return cc.Size;
},
/**
* @method setString
* @param {String} arg0
@ -2433,6 +2453,16 @@ str
{
},
/**
* @method getOutlineSize
* @return {int}
*/
getOutlineSize : function (
)
{
return 0;
},
/**
* @method init
* @param {String} arg0
@ -2449,6 +2479,16 @@ float
return false;
},
/**
* @method getShadowBlurRadius
* @return {float}
*/
getShadowBlurRadius : function (
)
{
return 0;
},
/**
* @method isTouchScaleChangeEnabled
* @return {bool}
@ -2511,6 +2551,16 @@ int
{
},
/**
* @method getEffectColor
* @return {color4b_object}
*/
getEffectColor : function (
)
{
return cc.Color4B;
},
/**
* @method getType
* @return {ccui.Text::Type}
@ -2531,6 +2581,16 @@ getTextHorizontalAlignment : function (
return 0;
},
/**
* @method isShadowEnabled
* @return {bool}
*/
isShadowEnabled : function (
)
{
return false;
},
/**
* @method setFontSize
* @param {float} arg0
@ -2541,6 +2601,16 @@ float
{
},
/**
* @method getShadowColor
* @return {color4b_object}
*/
getShadowColor : function (
)
{
return cc.Color4B;
},
/**
* @method setTextColor
* @param {color4b_object} arg0
@ -3803,16 +3873,6 @@ getBallNormalFile : function (
return cc.ResourceData;
},
/**
* @method getCapInsetsProgressBarRebderer
* @return {rect_object}
*/
getCapInsetsProgressBarRebderer : function (
)
{
return cc.Rect;
},
/**
* @method setScale9Enabled
* @param {bool} arg0
@ -3843,6 +3903,16 @@ getZoomScale : function (
return 0;
},
/**
* @method setCapInsetProgressBarRenderer
* @param {rect_object} arg0
*/
setCapInsetProgressBarRenderer : function (
rect
)
{
},
/**
* @method loadSlidBallTextures
* @param {String} arg0
@ -3911,6 +3981,16 @@ getCapInsetsBarRenderer : function (
return cc.Rect;
},
/**
* @method getCapInsetsProgressBarRenderer
* @return {rect_object}
*/
getCapInsetsProgressBarRenderer : function (
)
{
return cc.Rect;
},
/**
* @method loadSlidBallTexturePressed
* @param {String} arg0
@ -3953,16 +4033,6 @@ getBallDisabledFile : function (
return cc.ResourceData;
},
/**
* @method setCapInsetProgressBarRebderer
* @param {rect_object} arg0
*/
setCapInsetProgressBarRebderer : function (
rect
)
{
},
/**
* @method setCapInsetsBarRenderer
* @param {rect_object} arg0

View File

@ -1232,24 +1232,6 @@ bool js_cocos2dx_3d_Mesh_getVertexSizeInBytes(JSContext *cx, uint32_t argc, jsva
JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getVertexSizeInBytes : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_3d_Mesh_enableCheckTexture(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_enableCheckTexture : Invalid Native Object");
if (argc == 0) {
bool ret = cobj->enableCheckTexture();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_3d_Mesh_enableCheckTexture : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_3d_Mesh_setMaterial(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -1452,22 +1434,6 @@ bool js_cocos2dx_3d_Mesh_setName(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setName : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_3d_Mesh_checkTexture(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_checkTexture : Invalid Native Object");
if (argc == 0) {
cobj->checkTexture();
args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_3d_Mesh_checkTexture : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_3d_Mesh_getIndexCount(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -1618,26 +1584,6 @@ bool js_cocos2dx_3d_Mesh_setSkin(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setSkin : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_3d_Mesh_setEnableCheckTexture(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setEnableCheckTexture : Invalid Native Object");
if (argc == 1) {
bool arg0;
arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Mesh_setEnableCheckTexture : Error processing arguments");
cobj->setEnableCheckTexture(arg0);
args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setEnableCheckTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_3d_Mesh_isVisible(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -1761,7 +1707,6 @@ void js_register_cocos2dx_3d_Mesh(JSContext *cx, JS::HandleObject global) {
JS_FN("getSkin", js_cocos2dx_3d_Mesh_getSkin, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getMaterial", js_cocos2dx_3d_Mesh_getMaterial, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getVertexSizeInBytes", js_cocos2dx_3d_Mesh_getVertexSizeInBytes, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("enableCheckTexture", js_cocos2dx_3d_Mesh_enableCheckTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setMaterial", js_cocos2dx_3d_Mesh_setMaterial, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getName", js_cocos2dx_3d_Mesh_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getIndexFormat", js_cocos2dx_3d_Mesh_getIndexFormat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@ -1772,7 +1717,6 @@ void js_register_cocos2dx_3d_Mesh(JSContext *cx, JS::HandleObject global) {
JS_FN("getBlendFunc", js_cocos2dx_3d_Mesh_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getMeshIndexData", js_cocos2dx_3d_Mesh_getMeshIndexData, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setName", js_cocos2dx_3d_Mesh_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("checkTexture", js_cocos2dx_3d_Mesh_checkTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getIndexCount", js_cocos2dx_3d_Mesh_getIndexCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setMeshIndexData", js_cocos2dx_3d_Mesh_setMeshIndexData, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getMeshVertexAttribCount", js_cocos2dx_3d_Mesh_getMeshVertexAttribCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@ -1780,7 +1724,6 @@ void js_register_cocos2dx_3d_Mesh(JSContext *cx, JS::HandleObject global) {
JS_FN("setForce2DQueue", js_cocos2dx_3d_Mesh_setForce2DQueue, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPrimitiveType", js_cocos2dx_3d_Mesh_getPrimitiveType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setSkin", js_cocos2dx_3d_Mesh_setSkin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setEnableCheckTexture", js_cocos2dx_3d_Mesh_setEnableCheckTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isVisible", js_cocos2dx_3d_Mesh_isVisible, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getIndexBuffer", js_cocos2dx_3d_Mesh_getIndexBuffer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setGLProgramState", js_cocos2dx_3d_Mesh_setGLProgramState, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),

View File

@ -87,7 +87,6 @@ void register_all_cocos2dx_3d(JSContext* cx, JS::HandleObject obj);
bool js_cocos2dx_3d_Mesh_getSkin(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_getMaterial(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_getVertexSizeInBytes(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_enableCheckTexture(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_setMaterial(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_getName(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_getIndexFormat(JSContext *cx, uint32_t argc, jsval *vp);
@ -98,7 +97,6 @@ bool js_cocos2dx_3d_Mesh_hasVertexAttrib(JSContext *cx, uint32_t argc, jsval *vp
bool js_cocos2dx_3d_Mesh_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_getMeshIndexData(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_setName(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_checkTexture(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_getIndexCount(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_setMeshIndexData(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_getMeshVertexAttribCount(JSContext *cx, uint32_t argc, jsval *vp);
@ -106,7 +104,6 @@ bool js_cocos2dx_3d_Mesh_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_setForce2DQueue(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_getPrimitiveType(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_setSkin(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_setEnableCheckTexture(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_isVisible(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_getIndexBuffer(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_Mesh_setGLProgramState(JSContext *cx, uint32_t argc, jsval *vp);

View File

@ -72,6 +72,28 @@ bool js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled(JSContext *cx, uint32_t
JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_3d_extension_ParticleSystem3D_getRender(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_getRender : Invalid Native Object");
if (argc == 0) {
cocos2d::Particle3DRender* ret = cobj->getRender();
jsval jsret = JSVAL_NULL;
if (ret) {
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Particle3DRender>(cx, (cocos2d::Particle3DRender*)ret));
} else {
jsret = JSVAL_NULL;
};
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_getRender : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_3d_extension_ParticleSystem3D_isKeepLocal(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -315,6 +337,7 @@ void js_register_cocos2dx_3d_extension_ParticleSystem3D(JSContext *cx, JS::Handl
JS_FN("resumeParticleSystem", js_cocos2dx_3d_extension_ParticleSystem3D_resumeParticleSystem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("startParticleSystem", js_cocos2dx_3d_extension_ParticleSystem3D_startParticleSystem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isEnabled", js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getRender", js_cocos2dx_3d_extension_ParticleSystem3D_getRender, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isKeepLocal", js_cocos2dx_3d_extension_ParticleSystem3D_isKeepLocal, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setEnabled", js_cocos2dx_3d_extension_ParticleSystem3D_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getParticleQuota", js_cocos2dx_3d_extension_ParticleSystem3D_getParticleQuota, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),

View File

@ -15,6 +15,7 @@ void register_all_cocos2dx_3d_extension(JSContext* cx, JS::HandleObject obj);
bool js_cocos2dx_3d_extension_ParticleSystem3D_resumeParticleSystem(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_extension_ParticleSystem3D_startParticleSystem(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_extension_ParticleSystem3D_getRender(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_extension_ParticleSystem3D_isKeepLocal(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_extension_ParticleSystem3D_setEnabled(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_3d_extension_ParticleSystem3D_getParticleQuota(JSContext *cx, uint32_t argc, jsval *vp);

View File

@ -272,26 +272,6 @@ bool js_cocos2dx_Texture2D_getPixelsHigh(JSContext *cx, uint32_t argc, jsval *vp
JS_ReportError(cx, "js_cocos2dx_Texture2D_getPixelsHigh : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Texture2D_setValid(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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setValid : Invalid Native Object");
if (argc == 1) {
bool arg0;
arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setValid : Error processing arguments");
cobj->setValid(arg0);
args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Texture2D_setValid : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_Texture2D_getBitsPerPixelForFormat(JSContext *cx, uint32_t argc, jsval *vp)
{
bool ok = true;
@ -547,24 +527,6 @@ bool js_cocos2dx_Texture2D_getContentSize(JSContext *cx, uint32_t argc, jsval *v
JS_ReportError(cx, "js_cocos2dx_Texture2D_getContentSize : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Texture2D_isValid(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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_isValid : Invalid Native Object");
if (argc == 0) {
bool ret = cobj->isValid();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Texture2D_isValid : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Texture2D_setAliasTexParameters(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -820,7 +782,6 @@ void js_register_cocos2dx_Texture2D(JSContext *cx, JS::HandleObject global) {
JS_FN("hasPremultipliedAlpha", js_cocos2dx_Texture2D_hasPremultipliedAlpha, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("initWithMipmaps", js_cocos2dx_Texture2D_initWithMipmaps, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPixelsHigh", js_cocos2dx_Texture2D_getPixelsHigh, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setValid", js_cocos2dx_Texture2D_setValid, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getBitsPerPixelForFormat", js_cocos2dx_Texture2D_getBitsPerPixelForFormat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getName", js_cocos2dx_Texture2D_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("initWithString", js_cocos2dx_Texture2D_initWithString, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@ -828,7 +789,6 @@ void js_register_cocos2dx_Texture2D(JSContext *cx, JS::HandleObject global) {
JS_FN("getPath", js_cocos2dx_Texture2D_getPath, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("drawInRect", js_cocos2dx_Texture2D_drawInRect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getContentSize", js_cocos2dx_Texture2D_getContentSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isValid", js_cocos2dx_Texture2D_isValid, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setAliasTexParameters", js_cocos2dx_Texture2D_setAliasTexParameters, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setAntiAliasTexParameters", js_cocos2dx_Texture2D_setAntiAliasTexParameters, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("generateMipmap", js_cocos2dx_Texture2D_generateMipmap, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@ -32872,6 +32832,24 @@ bool js_cocos2dx_Label_setDimensions(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_Label_setDimensions : wrong number of arguments: %d, was expecting %d", argc, 2);
return false;
}
bool js_cocos2dx_Label_getWidth(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getWidth : Invalid Native Object");
if (argc == 0) {
double ret = cobj->getWidth();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Label_getWidth : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Label_getString(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -33017,6 +32995,24 @@ bool js_cocos2dx_Label_setWidth(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_Label_setWidth : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_Label_getAdditionalKerning(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getAdditionalKerning : Invalid Native Object");
if (argc == 0) {
double ret = cobj->getAdditionalKerning();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Label_getAdditionalKerning : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Label_getBMFontSize(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -33071,6 +33067,24 @@ bool js_cocos2dx_Label_getHorizontalAlignment(JSContext *cx, uint32_t argc, jsva
JS_ReportError(cx, "js_cocos2dx_Label_getHorizontalAlignment : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Label_getShadowOffset(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getShadowOffset : Invalid Native Object");
if (argc == 0) {
cocos2d::Size ret = cobj->getShadowOffset();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Label_getShadowOffset : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Label_setClipMarginEnabled(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -33131,6 +33145,24 @@ bool js_cocos2dx_Label_setSystemFontName(JSContext *cx, uint32_t argc, jsval *vp
JS_ReportError(cx, "js_cocos2dx_Label_setSystemFontName : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_Label_getOutlineSize(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getOutlineSize : Invalid Native Object");
if (argc == 0) {
int ret = cobj->getOutlineSize();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Label_getOutlineSize : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Label_setBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -33527,22 +33559,40 @@ bool js_cocos2dx_Label_enableOutline(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_Label_enableOutline : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_Label_getAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Label_getShadowBlurRadius(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getAdditionalKerning : Invalid Native Object");
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getShadowBlurRadius : Invalid Native Object");
if (argc == 0) {
double ret = cobj->getAdditionalKerning();
double ret = cobj->getShadowBlurRadius();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Label_getAdditionalKerning : wrong number of arguments: %d, was expecting %d", argc, 0);
JS_ReportError(cx, "js_cocos2dx_Label_getShadowBlurRadius : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Label_getEffectColor(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getEffectColor : Invalid Native Object");
if (argc == 0) {
cocos2d::Color4F ret = cobj->getEffectColor();
jsval jsret = JSVAL_NULL;
jsret = cccolor4f_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Label_getEffectColor : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Label_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp)
@ -33758,6 +33808,24 @@ bool js_cocos2dx_Label_getLineHeight(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_Label_getLineHeight : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Label_getShadowColor(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getShadowColor : Invalid Native Object");
if (argc == 0) {
cocos2d::Color4F ret = cobj->getShadowColor();
jsval jsret = JSVAL_NULL;
jsret = cccolor4f_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Label_getShadowColor : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Label_getTTFConfig(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -33860,22 +33928,22 @@ bool js_cocos2dx_Label_setHeight(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_Label_setHeight : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_Label_getWidth(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Label_isShadowEnabled(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getWidth : Invalid Native Object");
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_isShadowEnabled : Invalid Native Object");
if (argc == 0) {
double ret = cobj->getWidth();
bool ret = cobj->isShadowEnabled();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
jsret = BOOLEAN_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Label_getWidth : wrong number of arguments: %d, was expecting %d", argc, 0);
JS_ReportError(cx, "js_cocos2dx_Label_isShadowEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Label_enableGlow(JSContext *cx, uint32_t argc, jsval *vp)
@ -34048,6 +34116,24 @@ bool js_cocos2dx_Label_isWrapEnabled(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_Label_isWrapEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Label_getLabelEffectType(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getLabelEffectType : Invalid Native Object");
if (argc == 0) {
int ret = (int)cobj->getLabelEffectType();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Label_getLabelEffectType : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Label_setAlignment(JSContext *cx, uint32_t argc, jsval *vp)
{
bool ok = true;
@ -34429,6 +34515,7 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) {
JS_FN("isClipMarginEnabled", js_cocos2dx_Label_isClipMarginEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("enableShadow", js_cocos2dx_Label_enableShadow, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDimensions", js_cocos2dx_Label_setDimensions, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getWidth", js_cocos2dx_Label_getWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getString", js_cocos2dx_Label_getString, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getHeight", js_cocos2dx_Label_getHeight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("disableEffect", js_cocos2dx_Label_disableEffect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@ -34436,12 +34523,15 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) {
JS_FN("getBlendFunc", js_cocos2dx_Label_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("enableWrap", js_cocos2dx_Label_enableWrap, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setWidth", js_cocos2dx_Label_setWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getAdditionalKerning", js_cocos2dx_Label_getAdditionalKerning, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getBMFontSize", js_cocos2dx_Label_getBMFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getMaxLineWidth", js_cocos2dx_Label_getMaxLineWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getHorizontalAlignment", js_cocos2dx_Label_getHorizontalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getShadowOffset", js_cocos2dx_Label_getShadowOffset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setClipMarginEnabled", js_cocos2dx_Label_setClipMarginEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setString", js_cocos2dx_Label_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setSystemFontName", js_cocos2dx_Label_setSystemFontName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getOutlineSize", js_cocos2dx_Label_getOutlineSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setBMFontFilePath", js_cocos2dx_Label_setBMFontFilePath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("initWithTTF", js_cocos2dx_Label_initWithTTF, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setLineHeight", js_cocos2dx_Label_setLineHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@ -34453,7 +34543,8 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) {
JS_FN("setLineBreakWithoutSpace", js_cocos2dx_Label_setLineBreakWithoutSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getStringNumLines", js_cocos2dx_Label_getStringNumLines, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("enableOutline", js_cocos2dx_Label_enableOutline, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getAdditionalKerning", js_cocos2dx_Label_getAdditionalKerning, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getShadowBlurRadius", js_cocos2dx_Label_getShadowBlurRadius, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getEffectColor", js_cocos2dx_Label_getEffectColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("removeAllChildrenWithCleanup", js_cocos2dx_Label_removeAllChildrenWithCleanup, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setCharMap", js_cocos2dx_Label_setCharMap, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getDimensions", js_cocos2dx_Label_getDimensions, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@ -34462,12 +34553,13 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) {
JS_FN("setVerticalAlignment", js_cocos2dx_Label_setVerticalAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setLineSpacing", js_cocos2dx_Label_setLineSpacing, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getLineHeight", js_cocos2dx_Label_getLineHeight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getShadowColor", js_cocos2dx_Label_getShadowColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTTFConfig", js_cocos2dx_Label_getTTFConfig, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getVerticalAlignment", js_cocos2dx_Label_getVerticalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setTextColor", js_cocos2dx_Label_setTextColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getLetter", js_cocos2dx_Label_getLetter, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setHeight", js_cocos2dx_Label_setHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getWidth", js_cocos2dx_Label_getWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isShadowEnabled", js_cocos2dx_Label_isShadowEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("enableGlow", js_cocos2dx_Label_enableGlow, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getOverflow", js_cocos2dx_Label_getOverflow, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setAdditionalKerning", js_cocos2dx_Label_setAdditionalKerning, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@ -34477,6 +34569,7 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) {
JS_FN("getBMFontFilePath", js_cocos2dx_Label_getBMFontFilePath, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setHorizontalAlignment", js_cocos2dx_Label_setHorizontalAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isWrapEnabled", js_cocos2dx_Label_isWrapEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getLabelEffectType", js_cocos2dx_Label_getLabelEffectType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setAlignment", js_cocos2dx_Label_setAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("requestSystemFontRefresh", js_cocos2dx_Label_requestSystemFontRefresh, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setBMFontSize", js_cocos2dx_Label_setBMFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@ -57594,26 +57687,6 @@ bool js_cocos2dx_TextureCache_getTextureFilePath(JSContext *cx, uint32_t argc, j
JS_ReportError(cx, "js_cocos2dx_TextureCache_getTextureFilePath : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_TextureCache_setDirty(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::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_setDirty : Invalid Native Object");
if (argc == 1) {
bool arg0;
arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextureCache_setDirty : Error processing arguments");
cobj->setDirty(arg0);
args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_TextureCache_setDirty : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_TextureCache_renameTextureWithKey(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -57652,24 +57725,6 @@ bool js_cocos2dx_TextureCache_removeUnusedTextures(JSContext *cx, uint32_t argc,
JS_ReportError(cx, "js_cocos2dx_TextureCache_removeUnusedTextures : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_TextureCache_isDirty(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::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_isDirty : Invalid Native Object");
if (argc == 0) {
bool ret = cobj->isDirty();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_TextureCache_isDirty : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_TextureCache_removeTexture(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -57761,10 +57816,8 @@ void js_register_cocos2dx_TextureCache(JSContext *cx, JS::HandleObject global) {
JS_FN("unbindImageAsync", js_cocos2dx_TextureCache_unbindImageAsync, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTextureForKey", js_cocos2dx_TextureCache_getTextureForKey, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTextureFilePath", js_cocos2dx_TextureCache_getTextureFilePath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDirty", js_cocos2dx_TextureCache_setDirty, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("renameTextureWithKey", js_cocos2dx_TextureCache_renameTextureWithKey, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("removeUnusedTextures", js_cocos2dx_TextureCache_removeUnusedTextures, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isDirty", js_cocos2dx_TextureCache_isDirty, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("removeTexture", js_cocos2dx_TextureCache_removeTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("waitForQuit", js_cocos2dx_TextureCache_waitForQuit, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
@ -63472,65 +63525,9 @@ void js_register_cocos2dx_SimpleAudioEngine(JSContext *cx, JS::HandleObject glob
JSClass *jsb_cocos2d_ComponentJS_class;
JSObject *jsb_cocos2d_ComponentJS_prototype;
bool js_cocos2dx_ComponentJS_create(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
std::string arg0;
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentJS_create : Error processing arguments");
auto ret = cocos2d::ComponentJS::create(arg0);
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ComponentJS>(ret);
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ComponentJS"));
args.rval().set(OBJECT_TO_JSVAL(jsret));
return true;
}
JS_ReportError(cx, "js_cocos2dx_ComponentJS_create : wrong number of arguments");
return false;
}
bool js_cocos2dx_ComponentJS_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
std::string arg0;
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentJS_constructor : Error processing arguments");
cocos2d::ComponentJS* cobj = new (std::nothrow) cocos2d::ComponentJS(arg0);
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ComponentJS>(cobj);
// link the native object with the javascript object
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ComponentJS"));
args.rval().set(OBJECT_TO_JSVAL(jsobj));
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
return true;
}
static bool js_cocos2dx_ComponentJS_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
bool ok = true;
std::string arg0;
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2d_ComponentJS_ctor : Error processing arguments");
cocos2d::ComponentJS *nobj = new (std::nothrow) cocos2d::ComponentJS(arg0);
auto newproxy = jsb_new_proxy(nobj, obj);
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ComponentJS");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
args.rval().setUndefined();
return true;
}
extern JSObject *jsb_cocos2d_Component_prototype;
void js_register_cocos2dx_ComponentJS(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_ComponentJS_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_ComponentJS_class->name = "ComponentJS";
@ -63550,21 +63547,17 @@ void js_register_cocos2dx_ComponentJS(JSContext *cx, JS::HandleObject global) {
};
static JSFunctionSpec funcs[] = {
JS_FN("ctor", js_cocos2dx_ComponentJS_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
static JSFunctionSpec st_funcs[] = {
JS_FN("create", js_cocos2dx_ComponentJS_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
JSFunctionSpec *st_funcs = NULL;
JS::RootedObject parent_proto(cx, jsb_cocos2d_Component_prototype);
jsb_cocos2d_ComponentJS_prototype = JS_InitClass(
cx, global,
parent_proto,
jsb_cocos2d_ComponentJS_class,
js_cocos2dx_ComponentJS_constructor, 0, // constructor
empty_constructor, 0,
properties,
funcs,
NULL, // no static properties
@ -63573,7 +63566,6 @@ void js_register_cocos2dx_ComponentJS(JSContext *cx, JS::HandleObject global) {
// add the proto and JSClass to the type->js info hash table
JS::RootedObject proto(cx, jsb_cocos2d_ComponentJS_prototype);
jsb_register_class<cocos2d::ComponentJS>(cx, jsb_cocos2d_ComponentJS_class, proto, parent_proto);
anonEvaluate(cx, global, "(function () { cc.ComponentJS.extend = cc.Class.extend; })()");
}
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj) {

View File

@ -22,7 +22,6 @@ bool js_cocos2dx_Texture2D_releaseGLTexture(JSContext *cx, uint32_t argc, jsval
bool js_cocos2dx_Texture2D_hasPremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_initWithMipmaps(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_getPixelsHigh(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_setValid(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_getBitsPerPixelForFormat(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_getName(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *vp);
@ -30,7 +29,6 @@ bool js_cocos2dx_Texture2D_setMaxT(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_getPath(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_drawInRect(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_getContentSize(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_isValid(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_setAliasTexParameters(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_setAntiAliasTexParameters(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Texture2D_generateMipmap(JSContext *cx, uint32_t argc, jsval *vp);
@ -2225,6 +2223,7 @@ void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
bool js_cocos2dx_Label_isClipMarginEnabled(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_enableShadow(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setDimensions(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getWidth(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getString(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getHeight(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_disableEffect(JSContext *cx, uint32_t argc, jsval *vp);
@ -2232,12 +2231,15 @@ bool js_cocos2dx_Label_getTextColor(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_enableWrap(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setWidth(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getBMFontSize(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getMaxLineWidth(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getShadowOffset(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setClipMarginEnabled(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setString(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setSystemFontName(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getOutlineSize(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_initWithTTF(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setLineHeight(JSContext *cx, uint32_t argc, jsval *vp);
@ -2249,7 +2251,8 @@ bool js_cocos2dx_Label_getStringLength(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setLineBreakWithoutSpace(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getStringNumLines(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_enableOutline(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getShadowBlurRadius(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getEffectColor(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setCharMap(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getDimensions(JSContext *cx, uint32_t argc, jsval *vp);
@ -2258,12 +2261,13 @@ bool js_cocos2dx_Label_getSystemFontName(JSContext *cx, uint32_t argc, jsval *vp
bool js_cocos2dx_Label_setVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setLineSpacing(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getLineHeight(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getShadowColor(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getTTFConfig(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setTextColor(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getLetter(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setHeight(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getWidth(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_isShadowEnabled(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_enableGlow(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getOverflow(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp);
@ -2273,6 +2277,7 @@ bool js_cocos2dx_Label_getTextAlignment(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Label_getBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_isWrapEnabled(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_getLabelEffectType(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setAlignment(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_requestSystemFontRefresh(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Label_setBMFontSize(JSContext *cx, uint32_t argc, jsval *vp);
@ -3754,10 +3759,8 @@ bool js_cocos2dx_TextureCache_addImage(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_TextureCache_unbindImageAsync(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_TextureCache_getTextureForKey(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_TextureCache_getTextureFilePath(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_TextureCache_setDirty(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_TextureCache_renameTextureWithKey(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_TextureCache_removeUnusedTextures(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_TextureCache_isDirty(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_TextureCache_removeTexture(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_TextureCache_waitForQuit(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_TextureCache_TextureCache(JSContext *cx, uint32_t argc, jsval *vp);
@ -4100,7 +4103,5 @@ bool js_cocos2dx_ComponentJS_constructor(JSContext *cx, uint32_t argc, jsval *vp
void js_cocos2dx_ComponentJS_finalize(JSContext *cx, JSObject *obj);
void js_register_cocos2dx_ComponentJS(JSContext *cx, JS::HandleObject global);
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
bool js_cocos2dx_ComponentJS_create(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ComponentJS_ComponentJS(JSContext *cx, uint32_t argc, jsval *vp);
#endif // __cocos2dx_h__

View File

@ -1164,9 +1164,10 @@ bool js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite(JSCont
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::extension::ControlButton* cobj = (cocos2d::extension::ControlButton *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite : Invalid Native Object");
if (argc == 2) {
if (argc == 3) {
cocos2d::Node* arg0 = nullptr;
cocos2d::ui::Scale9Sprite* arg1 = nullptr;
bool arg2;
do {
if (args.get(0).isNull()) { arg0 = nullptr; break; }
if (!args.get(0).isObject()) { ok = false; break; }
@ -1185,15 +1186,16 @@ bool js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite(JSCont
arg1 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
} while (0);
arg2 = JS::ToBoolean(args.get(2));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite : Error processing arguments");
bool ret = cobj->initWithLabelAndBackgroundSprite(arg0, arg1);
bool ret = cobj->initWithLabelAndBackgroundSprite(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite : wrong number of arguments: %d, was expecting %d", argc, 2);
JS_ReportError(cx, "js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite : wrong number of arguments: %d, was expecting %d", argc, 3);
return false;
}
bool js_cocos2dx_extension_ControlButton_getZoomOnTouchDown(JSContext *cx, uint32_t argc, jsval *vp)
@ -1338,6 +1340,45 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js
return true;
}
} while (0);
do {
if (argc == 3) {
cocos2d::Node* arg0 = nullptr;
do {
if (args.get(0).isNull()) { arg0 = nullptr; break; }
if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
cocos2d::ui::Scale9Sprite* arg1 = nullptr;
do {
if (args.get(1).isNull()) { arg1 = nullptr; break; }
if (!args.get(1).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
jsProxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
bool arg2;
arg2 = JS::ToBoolean(args.get(2));
if (!ok) { ok = true; break; }
cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
if (ret) {
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::extension::ControlButton>(cx, (cocos2d::extension::ControlButton*)ret));
} else {
jsret = JSVAL_NULL;
};
args.rval().set(jsret);
return true;
}
} while (0);
JS_ReportError(cx, "js_cocos2dx_extension_ControlButton_create : wrong number of arguments");
return false;
}
@ -1428,7 +1469,7 @@ void js_register_cocos2dx_extension_ControlButton(JSContext *cx, JS::HandleObjec
JS_FN("getTitleLabelForState", js_cocos2dx_extension_ControlButton_getTitleLabelForState, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setMargins", js_cocos2dx_extension_ControlButton_setMargins, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getCurrentTitle", js_cocos2dx_extension_ControlButton_getCurrentTitle, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("initWithLabelAndBackgroundSprite", js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("initWithLabelAndBackgroundSprite", js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getZoomOnTouchDown", js_cocos2dx_extension_ControlButton_getZoomOnTouchDown, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTitleForState", js_cocos2dx_extension_ControlButton_getTitleForState, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("ctor", js_cocos2dx_extension_ControlButton_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),

View File

@ -6045,6 +6045,24 @@ bool js_cocos2dx_ui_Text_disableEffect(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_ui_Text_disableEffect : wrong number of arguments");
return false;
}
bool js_cocos2dx_ui_Text_getLabelEffectType(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_getLabelEffectType : Invalid Native Object");
if (argc == 0) {
int ret = (int)cobj->getLabelEffectType();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_Text_getLabelEffectType : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Text_getTextColor(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -6123,6 +6141,24 @@ bool js_cocos2dx_ui_Text_setTouchScaleChangeEnabled(JSContext *cx, uint32_t argc
JS_ReportError(cx, "js_cocos2dx_ui_Text_setTouchScaleChangeEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_ui_Text_getShadowOffset(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_getShadowOffset : Invalid Native Object");
if (argc == 0) {
cocos2d::Size ret = cobj->getShadowOffset();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_Text_getShadowOffset : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Text_setString(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -6143,6 +6179,24 @@ bool js_cocos2dx_ui_Text_setString(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_ui_Text_setString : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_ui_Text_getOutlineSize(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_getOutlineSize : Invalid Native Object");
if (argc == 0) {
int ret = cobj->getOutlineSize();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_Text_getOutlineSize : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Text_init(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -6169,6 +6223,24 @@ bool js_cocos2dx_ui_Text_init(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_ui_Text_init : wrong number of arguments: %d, was expecting %d", argc, 3);
return false;
}
bool js_cocos2dx_ui_Text_getShadowBlurRadius(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_getShadowBlurRadius : Invalid Native Object");
if (argc == 0) {
double ret = cobj->getShadowBlurRadius();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_Text_getShadowBlurRadius : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Text_isTouchScaleChangeEnabled(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -6291,6 +6363,24 @@ bool js_cocos2dx_ui_Text_enableOutline(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_ui_Text_enableOutline : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_ui_Text_getEffectColor(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_getEffectColor : Invalid Native Object");
if (argc == 0) {
cocos2d::Color4B ret = cobj->getEffectColor();
jsval jsret = JSVAL_NULL;
jsret = cccolor4b_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_Text_getEffectColor : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Text_getType(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -6327,6 +6417,24 @@ bool js_cocos2dx_ui_Text_getTextHorizontalAlignment(JSContext *cx, uint32_t argc
JS_ReportError(cx, "js_cocos2dx_ui_Text_getTextHorizontalAlignment : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Text_isShadowEnabled(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_isShadowEnabled : Invalid Native Object");
if (argc == 0) {
bool ret = cobj->isShadowEnabled();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_Text_isShadowEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Text_setFontSize(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -6347,6 +6455,24 @@ bool js_cocos2dx_ui_Text_setFontSize(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_ui_Text_setFontSize : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_ui_Text_getShadowColor(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_getShadowColor : Invalid Native Object");
if (argc == 0) {
cocos2d::Color4B ret = cobj->getShadowColor();
jsval jsret = JSVAL_NULL;
jsret = cccolor4b_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_Text_getShadowColor : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Text_setTextColor(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -6543,21 +6669,28 @@ void js_register_cocos2dx_ui_Text(JSContext *cx, JS::HandleObject global) {
JS_FN("getFontSize", js_cocos2dx_ui_Text_getFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getString", js_cocos2dx_ui_Text_getString, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("disableEffect", js_cocos2dx_ui_Text_disableEffect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getLabelEffectType", js_cocos2dx_ui_Text_getLabelEffectType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTextColor", js_cocos2dx_ui_Text_getTextColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setTextVerticalAlignment", js_cocos2dx_ui_Text_setTextVerticalAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setFontName", js_cocos2dx_ui_Text_setFontName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setTouchScaleChangeEnabled", js_cocos2dx_ui_Text_setTouchScaleChangeEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getShadowOffset", js_cocos2dx_ui_Text_getShadowOffset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setString", js_cocos2dx_ui_Text_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getOutlineSize", js_cocos2dx_ui_Text_getOutlineSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("init", js_cocos2dx_ui_Text_init, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getShadowBlurRadius", js_cocos2dx_ui_Text_getShadowBlurRadius, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isTouchScaleChangeEnabled", js_cocos2dx_ui_Text_isTouchScaleChangeEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getFontName", js_cocos2dx_ui_Text_getFontName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setTextAreaSize", js_cocos2dx_ui_Text_setTextAreaSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getStringLength", js_cocos2dx_ui_Text_getStringLength, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getAutoRenderSize", js_cocos2dx_ui_Text_getAutoRenderSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("enableOutline", js_cocos2dx_ui_Text_enableOutline, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getEffectColor", js_cocos2dx_ui_Text_getEffectColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getType", js_cocos2dx_ui_Text_getType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTextHorizontalAlignment", js_cocos2dx_ui_Text_getTextHorizontalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isShadowEnabled", js_cocos2dx_ui_Text_isShadowEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setFontSize", js_cocos2dx_ui_Text_setFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getShadowColor", js_cocos2dx_ui_Text_getShadowColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setTextColor", js_cocos2dx_ui_Text_setTextColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("enableGlow", js_cocos2dx_ui_Text_enableGlow, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTextVerticalAlignment", js_cocos2dx_ui_Text_getTextVerticalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@ -9349,24 +9482,6 @@ bool js_cocos2dx_ui_Slider_getBallNormalFile(JSContext *cx, uint32_t argc, jsval
JS_ReportError(cx, "js_cocos2dx_ui_Slider_getBallNormalFile : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(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::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer : Invalid Native Object");
if (argc == 0) {
const cocos2d::Rect& ret = cobj->getCapInsetsProgressBarRebderer();
jsval jsret = JSVAL_NULL;
jsret = ccrect_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Slider_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -9423,6 +9538,26 @@ bool js_cocos2dx_ui_Slider_getZoomScale(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_ui_Slider_getZoomScale : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer(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::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer : Invalid Native Object");
if (argc == 1) {
cocos2d::Rect arg0;
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer : Error processing arguments");
cobj->setCapInsetProgressBarRenderer(arg0);
args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_ui_Slider_loadSlidBallTextures(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -9612,6 +9747,24 @@ bool js_cocos2dx_ui_Slider_getCapInsetsBarRenderer(JSContext *cx, uint32_t argc,
JS_ReportError(cx, "js_cocos2dx_ui_Slider_getCapInsetsBarRenderer : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer(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::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer : Invalid Native Object");
if (argc == 0) {
const cocos2d::Rect& ret = cobj->getCapInsetsProgressBarRenderer();
jsval jsret = JSVAL_NULL;
jsret = ccrect_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Slider_loadSlidBallTexturePressed(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -9696,26 +9849,6 @@ bool js_cocos2dx_ui_Slider_getBallDisabledFile(JSContext *cx, uint32_t argc, jsv
JS_ReportError(cx, "js_cocos2dx_ui_Slider_getBallDisabledFile : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer(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::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer : Invalid Native Object");
if (argc == 1) {
cocos2d::Rect arg0;
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer : Error processing arguments");
cobj->setCapInsetProgressBarRebderer(arg0);
args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_ui_Slider_setCapInsetsBarRenderer(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -9944,21 +10077,21 @@ void js_register_cocos2dx_ui_Slider(JSContext *cx, JS::HandleObject global) {
JS_FN("loadSlidBallTextureNormal", js_cocos2dx_ui_Slider_loadSlidBallTextureNormal, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("loadProgressBarTexture", js_cocos2dx_ui_Slider_loadProgressBarTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getBallNormalFile", js_cocos2dx_ui_Slider_getBallNormalFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getCapInsetsProgressBarRebderer", js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setScale9Enabled", js_cocos2dx_ui_Slider_setScale9Enabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getBallPressedFile", js_cocos2dx_ui_Slider_getBallPressedFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getZoomScale", js_cocos2dx_ui_Slider_getZoomScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setCapInsetProgressBarRenderer", js_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("loadSlidBallTextures", js_cocos2dx_ui_Slider_loadSlidBallTextures, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("addEventListener", js_cocos2dx_ui_Slider_addEventListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setMaxPercent", js_cocos2dx_ui_Slider_setMaxPercent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("loadBarTexture", js_cocos2dx_ui_Slider_loadBarTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getProgressBarFile", js_cocos2dx_ui_Slider_getProgressBarFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getCapInsetsBarRenderer", js_cocos2dx_ui_Slider_getCapInsetsBarRenderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getCapInsetsProgressBarRenderer", js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("loadSlidBallTexturePressed", js_cocos2dx_ui_Slider_loadSlidBallTexturePressed, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getBackFile", js_cocos2dx_ui_Slider_getBackFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isScale9Enabled", js_cocos2dx_ui_Slider_isScale9Enabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getBallDisabledFile", js_cocos2dx_ui_Slider_getBallDisabledFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setCapInsetProgressBarRebderer", js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setCapInsetsBarRenderer", js_cocos2dx_ui_Slider_setCapInsetsBarRenderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPercent", js_cocos2dx_ui_Slider_getPercent, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setCapInsets", js_cocos2dx_ui_Slider_setCapInsets, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),

View File

@ -320,21 +320,28 @@ bool js_cocos2dx_ui_Text_enableShadow(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getFontSize(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getString(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_disableEffect(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getLabelEffectType(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getTextColor(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_setTextVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_setFontName(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_setTouchScaleChangeEnabled(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getShadowOffset(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_setString(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getOutlineSize(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_init(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getShadowBlurRadius(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_isTouchScaleChangeEnabled(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getFontName(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_setTextAreaSize(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getStringLength(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getAutoRenderSize(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_enableOutline(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getEffectColor(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getType(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getTextHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_isShadowEnabled(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_setFontSize(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getShadowColor(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_setTextColor(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_enableGlow(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Text_getTextVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
@ -492,21 +499,21 @@ bool js_cocos2dx_ui_Slider_getMaxPercent(JSContext *cx, uint32_t argc, jsval *vp
bool js_cocos2dx_ui_Slider_loadSlidBallTextureNormal(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_loadProgressBarTexture(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_getBallNormalFile(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_getBallPressedFile(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_getZoomScale(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_loadSlidBallTextures(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_addEventListener(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_setMaxPercent(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_loadBarTexture(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_getProgressBarFile(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_getCapInsetsBarRenderer(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_loadSlidBallTexturePressed(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_getBackFile(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_isScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_getBallDisabledFile(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_setCapInsetsBarRenderer(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_getPercent(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Slider_setCapInsets(JSContext *cx, uint32_t argc, jsval *vp);

View File

@ -93,9 +93,12 @@ static uint32_t s_nestedLoopLevel = 0;
// server entry point for the bg thread
static void serverEntryPoint(unsigned int port);
js_proxy_t *_native_js_global_ht = NULL;
js_proxy_t *_js_native_global_ht = NULL;
//js_proxy_t *_native_js_global_ht = NULL;
//js_proxy_t *_js_native_global_ht = NULL;
std::unordered_map<std::string, js_type_class_t*> _js_global_type_map;
static std::unordered_map<void*, js_proxy_t*> _native_js_global_map;
static std::unordered_map<JSObject*, js_proxy_t*> _js_native_global_map;
static char *_js_log_buf = NULL;
@ -212,18 +215,24 @@ static std::string getMouseFuncName(EventMouse::MouseEventType eventType)
return funcName;
}
void removeJSObject(JSContext* cx, void* nativeObj)
static void removeJSObject(JSContext* cx, cocos2d::Ref* nativeObj)
{
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
nproxy = jsb_get_native_proxy(nativeObj);
if (nproxy) {
JS::RootedObject jsobj(cx, nproxy->obj);
jsproxy = jsb_get_js_proxy(jsobj);
RemoveObjectRoot(cx, &jsproxy->obj);
jsb_remove_proxy(nproxy, jsproxy);
auto proxy = jsb_get_native_proxy(nativeObj);
if (proxy)
{
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
// remove the proxy here, since this was a "stack" object, not heap
// when js_finalize will be called, it will fail, but
// the correct solution is to have a new finalize for event
jsb_remove_proxy(proxy);
#else
// only remove when not using GC,
// otherwise finalize won't be able to find the proxy
JS::RemoveObjectRoot(cx, &proxy->obj);
jsb_remove_proxy(proxy);
#endif
}
else CCLOG("removeJSObject: BUG: cannot find native object = %p", nativeObj);
}
void ScriptingCore::executeJSFunctionWithThisObj(JS::HandleValue thisObj, JS::HandleValue callback)
@ -500,16 +509,21 @@ void ScriptingCore::string_report(JS::HandleValue val) {
}
}
bool ScriptingCore::evalString(const char *string, jsval *outVal, const char *filename, JSContext* cx, JSObject* global)
bool ScriptingCore::evalString(const char *string, JS::MutableHandleValue outVal, const char *filename, JSContext* cx, JS::HandleObject global)
{
if (cx == NULL)
cx = _cx;
if (global == NULL)
global = _global.ref().get();
JSAutoCompartment ac(cx, global);
JS::RootedObject jsglobal(cx, global);
return JS_EvaluateScript(cx, jsglobal, string, (unsigned)strlen(string), "ScriptingCore::evalString", 1);
return JS_EvaluateScript(cx, global, string, (unsigned)strlen(string), "ScriptingCore::evalString", 1, outVal);
}
bool ScriptingCore::evalString(const char *string, JS::MutableHandleValue outVal)
{
return evalString(string, outVal, nullptr, _cx, _global.ref());
}
bool ScriptingCore::evalString(const char *string)
{
JS::RootedValue retVal(_cx);
return evalString(string, &retVal);
}
void ScriptingCore::start()
@ -522,19 +536,20 @@ void ScriptingCore::addRegisterCallback(sc_register_sth callback) {
registrationList.push_back(callback);
}
void ScriptingCore::removeAllRoots(JSContext *cx) {
js_proxy_t *current, *tmp;
HASH_ITER(hh, _js_native_global_ht, current, tmp) {
RemoveObjectRoot(cx, &current->obj);
HASH_DEL(_js_native_global_ht, current);
free(current);
void ScriptingCore::removeAllRoots(JSContext *cx)
{
// Native -> JS. No need to free "second"
_native_js_global_map.clear();
// JS -> Native: free "second" and "unroot" it.
auto it_js = _js_native_global_map.begin();
while (it_js != _js_native_global_map.end())
{
JS::RemoveObjectRoot(cx, &it_js->second->obj);
free(it_js->second);
it_js = _js_native_global_map.erase(it_js);
}
HASH_ITER(hh, _native_js_global_ht, current, tmp) {
HASH_DEL(_native_js_global_ht, current);
free(current);
}
HASH_CLEAR(hh, _js_native_global_ht);
HASH_CLEAR(hh, _native_js_global_ht);
_js_native_global_map.clear();
}
// Just a wrapper around JSPrincipals that allows static construction.
@ -861,23 +876,16 @@ bool ScriptingCore::log(JSContext* cx, uint32_t argc, jsval *vp)
}
void ScriptingCore::removeScriptObjectByObject(Ref* pObj)
void ScriptingCore::removeScriptObjectByObject(cocos2d::Ref* nativeObj)
{
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
void *ptr = (void*)pObj;
nproxy = jsb_get_native_proxy(ptr);
if (nproxy)
auto proxy = jsb_get_native_proxy(nativeObj);
if (proxy)
{
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JS::RootedObject jsobj(cx, nproxy->obj);
jsproxy = jsb_get_js_proxy(jsobj);
if (jsproxy)
{
RemoveObjectRoot(cx, &jsproxy->obj);
jsb_remove_proxy(nproxy, jsproxy);
}
JSContext *cx = getGlobalContext();
JS::RemoveObjectRoot(cx, &proxy->obj);
jsb_remove_proxy(proxy);
}
// else CCLOG("removeScriptObjectByObject. BUG: nproxy not found = %p", nproxy);
}
@ -917,8 +925,10 @@ bool ScriptingCore::executeScript(JSContext *cx, uint32_t argc, jsval *vp)
bool ScriptingCore::forceGC(JSContext *cx, uint32_t argc, jsval *vp)
{
#if CC_TARGET_PLATFORM != CC_PLATFORM_WIN32
JSRuntime *rt = JS_GetRuntime(cx);
JS_GC(rt);
#endif
return true;
}
@ -960,7 +970,7 @@ bool ScriptingCore::removeRootJS(JSContext *cx, uint32_t argc, jsval *vp)
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Heap<JSObject*> o(args.get(0).toObjectOrNull());
if (o != nullptr) {
RemoveObjectRoot(cx, &o);
JS::RemoveObjectRoot(cx, &o);
}
return true;
}
@ -1039,6 +1049,8 @@ int ScriptingCore::handleActionEvent(void* data)
js_proxy_t * p = jsb_get_native_proxy(actionObject);
if (!p) return 0;
JSAutoCompartment ac(_cx, _global.ref());
int ret = 0;
JS::RootedValue retval(_cx);
@ -1068,7 +1080,9 @@ int ScriptingCore::handleNodeEvent(void* data)
js_proxy_t * p = jsb_get_native_proxy(node);
if (!p) return 0;
JSAutoCompartment ac(_cx, _global.ref());
int ret = 0;
JS::RootedValue retval(_cx);
jsval dataVal = INT_TO_JSVAL(1);
@ -1132,11 +1146,13 @@ int ScriptingCore::handleComponentEvent(void* data)
js_proxy_t * p = jsb_get_native_proxy(node);
if (!p) return 0;
JSAutoCompartment ac(_cx, _global.ref());
int ret = 0;
JS::RootedValue retval(_cx);
jsval dataVal = INT_TO_JSVAL(1);
JS::RootedValue nodeValue(_cx, OBJECT_TO_JSVAL(p->obj.get()));
JS::RootedValue nodeValue(_cx, OBJECT_TO_JSVAL(p->obj));
if (action == kComponentOnAdd)
{
@ -1172,7 +1188,7 @@ bool ScriptingCore::handleTouchesEvent(void* nativeObj, cocos2d::EventTouch::Eve
bool ScriptingCore::handleTouchesEvent(void* nativeObj, cocos2d::EventTouch::EventCode eventCode, const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event, JS::MutableHandleValue jsvalRet)
{
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JSAutoCompartment ac(_cx, _global.ref());
bool ret = false;
@ -1180,7 +1196,6 @@ bool ScriptingCore::handleTouchesEvent(void* nativeObj, cocos2d::EventTouch::Eve
JS::RootedObject jsretArr(_cx, JS_NewArrayObject(this->_cx, 0));
// AddNamedObjectRoot(this->_cx, &jsretArr, "touchArray");
int count = 0;
js_type_class_t *typeClassEvent = nullptr;
@ -1209,8 +1224,6 @@ bool ScriptingCore::handleTouchesEvent(void* nativeObj, cocos2d::EventTouch::Eve
ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), funcName.c_str(), 2, dataVal, jsvalRet);
}
// JS_RemoveObjectRoot(this->_cx, &jsretArr);
for (auto& touch : touches)
{
removeJSObject(this->_cx, touch);
@ -1229,7 +1242,7 @@ bool ScriptingCore::handleTouchEvent(void* nativeObj, cocos2d::EventTouch::Event
bool ScriptingCore::handleTouchEvent(void* nativeObj, cocos2d::EventTouch::EventCode eventCode, cocos2d::Touch* touch, cocos2d::Event* event, JS::MutableHandleValue jsvalRet)
{
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JSAutoCompartment ac(_cx, _global.ref());
std::string funcName = getTouchFuncName(eventCode);
bool ret = false;
@ -1269,13 +1282,13 @@ bool ScriptingCore::handleMouseEvent(void* nativeObj, cocos2d::EventMouse::Mouse
js_proxy_t * p = jsb_get_native_proxy(nativeObj);
if (p)
{
jsval dataVal[1];
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Event>(event);
dataVal[0] = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(_cx, event, typeClass, "cocos2d::Event"));
ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), funcName.c_str(), 1, dataVal, jsvalRet);
}
jsval dataVal = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(_cx, event, typeClass, "cocos2d::Event"));
ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), funcName.c_str(), 1, &dataVal, jsvalRet);
removeJSObject(_cx, event);
removeJSObject(_cx, event);
}
else CCLOG("ScriptingCore::handleMouseEvent native proxy NOT found");
return ret;
}
@ -1486,7 +1499,7 @@ int ScriptingCore::sendEvent(ScriptEvent* evt)
return 0;
}
JSAutoCompartment ac(_cx, _global.ref().get());
JSAutoCompartment ac(_cx, _global.ref());
switch (evt->type)
{
@ -1557,41 +1570,24 @@ bool ScriptingCore::isObjectValid(JSContext *cx, uint32_t argc, jsval *vp)
void ScriptingCore::rootObject(Ref* ref)
{
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
void *ptr = (void*)ref;
nproxy = jsb_get_native_proxy(ptr);
if (nproxy) {
auto proxy = jsb_get_native_proxy(ref);
if (proxy) {
JSContext *cx = getGlobalContext();
// FIXME: Creating a RootedObject here is not needed.
// it is being created only because jsb_get_js_proxy() requires one
// but only the raw pointer is used in jsb_get_js_proxy()
JS::RootedObject handle(cx, nproxy->obj.get());
jsproxy = jsb_get_js_proxy(handle);
AddObjectRoot(cx, &jsproxy->obj);
CCLOG("Rooting %p - %p: %s", ref, &jsproxy->obj, typeid(*ref).name());
JS::AddNamedObjectRoot(cx, &proxy->obj, typeid(*ref).name());
ref->_rooted = true;
}
else CCLOG("rootObject: BUG. native not found: %p", ref);
}
void ScriptingCore::unrootObject(Ref* ref)
{
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
void *ptr = (void*)ref;
nproxy = jsb_get_native_proxy(ptr);
if (nproxy) {
auto proxy = jsb_get_native_proxy(ref);
if (proxy) {
JSContext *cx = getGlobalContext();
// FIXME: Creating a RootedObject here is not needed.
// it is being created only because jsb_get_js_proxy() requires one
// but only the raw pointer is used in jsb_get_js_proxy()
JS::RootedObject handle(cx, nproxy->obj.get());
jsproxy = jsb_get_js_proxy(handle);
RemoveObjectRoot(cx, &jsproxy->obj);
CCLOG("Unrooting #2 %p - %p: %s", ref, &jsproxy->obj, typeid(*ref).name());
JS::RemoveObjectRoot(cx, &proxy->obj);
ref->_rooted = false;
}
else CCLOG("unrootObject: BUG. native not found: %p", ref);
}
#pragma mark - Debug
@ -1869,14 +1865,14 @@ void ScriptingCore::enableDebugger(unsigned int port)
}
}
JS::HandleObject NewGlobalObject(JSContext* cx, bool debug)
JSObject* NewGlobalObject(JSContext* cx, bool debug)
{
JS::CompartmentOptions options;
options.setVersion(JSVERSION_LATEST);
JS::RootedObject glob(cx, JS_NewGlobalObject(cx, &global_class, &shellTrustedPrincipals, JS::DontFireOnNewGlobalHook, options));
if (!glob) {
return JS::NullPtr();
return nullptr;
}
JSAutoCompartment ac(cx, glob);
bool ok = true;
@ -1886,7 +1882,7 @@ JS::HandleObject NewGlobalObject(JSContext* cx, bool debug)
if (ok && debug)
ok = JS_DefineDebuggerObject(cx, glob);
if (!ok)
return JS::NullPtr();
return nullptr;
JS_FireOnNewGlobalObject(cx, glob);
@ -1917,49 +1913,94 @@ bool jsb_get_reserved_slot(JSObject *obj, uint32_t idx, jsval& ret)
return true;
}
js_proxy_t* jsb_new_proxy(void* nativeObj, JS::HandleObject jsObj)
js_proxy_t* jsb_new_proxy(void* nativeObj, JS::HandleObject jsHandle)
{
js_proxy_t* p = nullptr;
JSObject* ptr = jsObj.get();
do {
p = (js_proxy_t *)malloc(sizeof(js_proxy_t));
assert(p);
js_proxy_t* nativeObjJsObjtmp = NULL;
HASH_FIND_PTR(_native_js_global_ht, &nativeObj, nativeObjJsObjtmp);
assert(!nativeObjJsObjtmp);
p->ptr = nativeObj;
p->obj = ptr;
HASH_ADD_PTR(_native_js_global_ht, ptr, p);
p = (js_proxy_t *)malloc(sizeof(js_proxy_t));
assert(p);
nativeObjJsObjtmp = NULL;
HASH_FIND_PTR(_js_native_global_ht, &ptr, nativeObjJsObjtmp);
assert(!nativeObjJsObjtmp);
p->ptr = nativeObj;
p->obj = ptr;
HASH_ADD_PTR(_js_native_global_ht, obj, p);
} while(0);
return p;
js_proxy_t* proxy = nullptr;
JSObject* jsObj = jsHandle.get();
if (nativeObj && jsObj)
{
// native to JS index
proxy = (js_proxy_t *)malloc(sizeof(js_proxy_t));
CC_ASSERT(proxy && "not enough memory");
#if 0
if (_js_native_global_map.find(jsObj) != _js_native_global_map.end())
{
CCLOG("BUG: old:%s new:%s", JS_GetClass(_js_native_global_map.at(jsObj)->_jsobj)->name, JS_GetClass(jsObj)->name);
}
#endif
CC_ASSERT(_native_js_global_map.find(nativeObj) == _native_js_global_map.end() && "Native Key should not be present");
CC_ASSERT(_js_native_global_map.find(jsObj) == _js_native_global_map.end() && "JS Key should not be present");
proxy->ptr = nativeObj;
proxy->obj = jsObj;
proxy->_jsobj = jsObj;
// One Proxy in two entries
_native_js_global_map[nativeObj] = proxy;
_js_native_global_map[jsObj] = proxy;
}
else CCLOG("jsb_new_proxy: Invalid keys");
return proxy;
}
js_proxy_t* jsb_get_native_proxy(void* nativeObj)
{
js_proxy_t* p = nullptr;
JS_GET_PROXY(p, nativeObj);
return p;
auto search = _native_js_global_map.find(nativeObj);
if(search != _native_js_global_map.end())
return search->second;
return nullptr;
}
js_proxy_t* jsb_get_js_proxy(JS::HandleObject jsObj)
js_proxy_t* jsb_get_js_proxy(JSObject* jsObj)
{
js_proxy_t* p = nullptr;
JSObject* ptr = jsObj.get();
JS_GET_NATIVE_PROXY(p, ptr);
return p;
auto search = _js_native_global_map.find(jsObj);
if(search != _js_native_global_map.end())
return search->second;
return nullptr;
}
void jsb_remove_proxy(js_proxy_t* nativeProxy, js_proxy_t* jsProxy)
{
JS_REMOVE_PROXY(nativeProxy, jsProxy);
js_proxy_t* proxy = nativeProxy ? nativeProxy : jsProxy;
jsb_remove_proxy(proxy);
}
void jsb_remove_proxy(js_proxy_t* proxy)
{
void* nativeKey = proxy->ptr;
JSObject* jsKey = proxy->_jsobj;
CC_ASSERT(nativeKey && "Invalid nativeKey");
CC_ASSERT(jsKey && "Invalid JSKey");
auto it_nat = _native_js_global_map.find(nativeKey);
auto it_js = _js_native_global_map.find(jsKey);
#if 0
// XXX FIXME: sanity check. Remove me once it is tested that it works Ok
if (it_nat != _native_js_global_map.end() && it_js != _js_native_global_map.end())
{
CC_ASSERT(it_nat->second == it_js->second && "BUG. Different enties");
}
#endif
if (it_nat != _native_js_global_map.end())
{
_native_js_global_map.erase(it_nat);
}
else CCLOG("jsb_remove_proxy: failed. Native key not found");
if (it_js != _js_native_global_map.end())
{
// Free it once, since we only have one proxy alloced entry
free(it_js->second);
_js_native_global_map.erase(it_js);
}
else CCLOG("jsb_remove_proxy: failed. JS key not found");
}
//
@ -2001,7 +2042,10 @@ JSObject* jsb_ref_get_or_create_jsobject(JSContext *cx, cocos2d::Ref *ref, js_ty
js_proxy_t* newproxy = jsb_new_proxy(ref, js_obj);
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
CC_UNUSED_PARAM(newproxy);
// don't retain it.
// retain first copy, and before "owning" to prevent it
// from calling "rootObject"
ref->retain();
ref->_scriptOwned = true;
#else
// don't autorelease it
@ -2029,7 +2073,7 @@ void jsb_ref_init(JSContext* cx, JS::Heap<JSObject*> *obj, Ref* ref, const char*
(void)cx;
(void)obj;
ref->_scriptOwned = true;
// don't retain it.
// don't retain it, already retained
#else
// autorelease it
ref->autorelease();
@ -2043,9 +2087,10 @@ void jsb_ref_autoreleased_init(JSContext* cx, JS::Heap<JSObject*> *obj, Ref* ref
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
(void)cx;
(void)obj;
ref->_scriptOwned = true;
// retain it, since the object is autoreleased
// retain first copy, and before "owning" to prevent it
// from calling "rootObject"
ref->retain();
ref->_scriptOwned = true;
#else
// don't autorelease it, since it is already autoreleased
JS::AddNamedObjectRoot(cx, obj, debug);
@ -2056,27 +2101,17 @@ void jsb_ref_autoreleased_init(JSContext* cx, JS::Heap<JSObject*> *obj, Ref* ref
void jsb_ref_finalize(JSFreeOp* fop, JSObject* obj)
{
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
CCLOG("jsb_ref_finalize #1: JSObject address = %p", obj);
JS::RootedObject jsobj(fop->runtime(), obj);
jsproxy = jsb_get_js_proxy(jsobj);
if (jsproxy)
auto proxy = jsb_get_js_proxy(obj);
if (proxy)
{
auto ref = static_cast<cocos2d::Ref*>(jsproxy->ptr);
nproxy = jsb_get_native_proxy(jsproxy->ptr);
auto ref = static_cast<cocos2d::Ref*>(proxy->ptr);
jsb_remove_proxy(proxy);
if (ref)
{
CCLOG("jsb_ref_finalize #2: JSObject address = %p (%s)", obj, typeid(*ref).name());
jsb_remove_proxy(nproxy, jsproxy);
ref->release();
}
else
jsb_remove_proxy(nullptr, jsproxy);
}
else
{
CCLOG("jsb_ref_finalize: BUG: proxy not found for %p (%s)", obj, JS_GetClass(obj)->name);
}
#else
// CCLOG("jsb_ref_finalize: JSObject address = %p", obj);
@ -2084,12 +2119,12 @@ void jsb_ref_finalize(JSFreeOp* fop, JSObject* obj)
}
// rebind
void jsb_ref_rebind(JSContext* cx, JS::HandleObject jsobj, js_proxy_t *js2native_proxy, cocos2d::Ref* oldRef, cocos2d::Ref* newRef, const char* debug)
void jsb_ref_rebind(JSContext* cx, JS::HandleObject jsobj, js_proxy_t *proxy, cocos2d::Ref* oldRef, cocos2d::Ref* newRef, const char* debug)
{
#if not CC_ENABLE_GC_FOR_NATIVE_OBJECTS
JS::RemoveObjectRoot(cx, &js2native_proxy->obj);
JS::RemoveObjectRoot(cx, &proxy->obj);
#endif
jsb_remove_proxy(jsb_get_native_proxy(oldRef), js2native_proxy);
jsb_remove_proxy(proxy);
// Rebind js obj with new action
js_proxy_t* newProxy = jsb_new_proxy(newRef, jsobj);

View File

@ -40,7 +40,7 @@
#include <assert.h>
#include <memory>
#define ENGINE_VERSION "Cocos2d-JS v3.9"
#define ENGINE_VERSION "Cocos2d-JS v3.10"
void js_log(const char *format, ...);
@ -234,7 +234,22 @@ public:
* @param global @~english The js global object
* @return @~english Return true if successfully invoked, otherwise return false.
*/
bool evalString(const char *string, jsval *outVal, const char *filename = NULL, JSContext* cx = NULL, JSObject* global = NULL);
bool evalString(const char *string, JS::MutableHandleValue outVal, const char *filename, JSContext* cx, JS::HandleObject global);
/**@~english
* Evaluate the specified js code string
* @param string @~english The string with the javascript code to be evaluated
* @param outVal @~english The jsval that will hold the return value of the evaluation.
* @return @~english Return true if successfully invoked, otherwise return false.
*/
bool evalString(const char *string, JS::MutableHandleValue outVal);
/**@~english
* Evaluate the specified js code string
* @param string @~english The string with the javascript code to be evaluated
* @return @~english Return true if successfully invoked, otherwise return false.
*/
bool evalString(const char *string);
/**
@brief @~english Get script object for the given path
@ -517,7 +532,7 @@ public:
void restartVM();
};
JS::HandleObject NewGlobalObject(JSContext* cx, bool debug = false);
JSObject* NewGlobalObject(JSContext* cx, bool debug = false);
bool jsb_set_reserved_slot(JSObject *obj, uint32_t idx, jsval value);
bool jsb_get_reserved_slot(JSObject *obj, uint32_t idx, jsval& ret);
@ -547,10 +562,17 @@ js_type_class_t *jsb_register_class(JSContext *cx, JSClass *jsClass, JS::HandleO
return p;
}
/** creates two new proxies: one associaged with the nativeObj,
and another one associated with the JsObj */
js_proxy_t* jsb_new_proxy(void* nativeObj, JS::HandleObject jsObj);
/** returns the proxy associated with the Native* */
js_proxy_t* jsb_get_native_proxy(void* nativeObj);
js_proxy_t* jsb_get_js_proxy(JS::HandleObject jsObj);
/** returns the proxy associated with the JSObject* */
js_proxy_t* jsb_get_js_proxy(JSObject* jsObj);
/** deprecated: use jsb_remove_proxy(js_proxy_t* proxy) instead */
void jsb_remove_proxy(js_proxy_t* nativeProxy, js_proxy_t* jsProxy);
/** removes both the native and js proxies */
void jsb_remove_proxy(js_proxy_t* proxy);
/**
* Generic initialization function for subclasses of Ref
@ -603,7 +625,4 @@ JSObject* jsb_ref_get_or_create_jsobject(JSContext *cx, cocos2d::Ref *ref, js_ty
*/
JSObject* jsb_ref_autoreleased_get_or_create_jsobject(JSContext *cx, cocos2d::Ref *ref, js_type_class_t *typeClass, const char* debug);
void removeJSObject(JSContext* cx, void* nativeObj);
#endif /* __SCRIPTING_CORE_H__ */

View File

@ -70,12 +70,6 @@ JSClass* JSPROXY_CCPhysicsSprite_class = NULL;
JSObject* JSPROXY_CCPhysicsSprite_object = NULL;
// Constructor
// Destructor
void JSPROXY_CCPhysicsSprite_finalize(JSFreeOp *fop, JSObject *obj)
{
CCLOGINFO("jsbindings: finalizing JS object %p (PhysicsSprite)", obj);
}
// Arguments:
// Ret value: BOOL (b)
bool JSPROXY_CCPhysicsSprite_isDirty(JSContext *cx, uint32_t argc, jsval *vp) {
@ -173,12 +167,6 @@ extern JSObject *js_cocos2dx_CCDrawNode_prototype;
// Constructor
// Destructor
void JSB_CCPhysicsDebugNode_finalize(JSFreeOp *fop, JSObject *obj)
{
CCLOGINFO("jsbindings: finalizing JS object %p (PhysicsDebugNode)", obj);
}
// Arguments: cpSpace*
// Ret value: PhysicsDebugNode* (o)
bool JSB_CCPhysicsDebugNode_debugNodeForCPSpace__static(JSContext *cx, uint32_t argc, jsval *vp) {
@ -295,7 +283,7 @@ void JSB_CCPhysicsDebugNode_createClass(JSContext *cx, JS::HandleObject globalOb
JSB_CCPhysicsDebugNode_class->enumerate = JS_EnumerateStub;
JSB_CCPhysicsDebugNode_class->resolve = JS_ResolveStub;
JSB_CCPhysicsDebugNode_class->convert = JS_ConvertStub;
JSB_CCPhysicsDebugNode_class->finalize = JSB_CCPhysicsDebugNode_finalize;
JSB_CCPhysicsDebugNode_class->finalize = jsb_ref_finalize;
JSB_CCPhysicsDebugNode_class->flags = 0;
static JSPropertySpec properties[] = {
@ -442,7 +430,8 @@ bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrame__static(JSContext *cx, uint32
// Arguments: NSString*
// Ret value: PhysicsSprite* (o)
bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrameName__static(JSContext *cx, uint32_t argc, jsval *vp) {
bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrameName__static(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
const char* arg0 = nullptr;
@ -452,27 +441,9 @@ bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrameName__static(JSContext *cx, ui
PhysicsSprite* ret = PhysicsSprite::createWithSpriteFrameName(arg0);
jsval jsret;
do {
if (ret) {
TypeTest<PhysicsSprite> t;
js_type_class_t *typeClass = nullptr;
std::string typeName = t.s_name();
auto typeMapIter = _js_global_type_map.find(typeName);
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
JS::RootedObject proto(cx, typeClass->proto.ref());
JS::RootedObject parentProto(cx, typeClass->parentProto.ref());
JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parentProto));
jsret = OBJECT_TO_JSVAL(obj);
js_proxy_t *p = jsb_new_proxy(ret, obj);
JS::AddNamedObjectRoot(cx, &p->obj, "CCPhysicsSprite");
} else {
jsret = JSVAL_NULL;
}
} while (0);
args.rval().set(jsret);
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::extension::PhysicsSprite>(ret);
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::extension::PhysicsSprite"));
args.rval().set(OBJECT_TO_JSVAL(jsret));
return true;
}
@ -483,27 +454,14 @@ bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrameName__static(JSContext *cx, ui
bool JSPROXY_CCPhysicsSprite_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
PhysicsSprite* cobj = new (std::nothrow) PhysicsSprite();
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
if (_ccobj) {
_ccobj->autorelease();
}
TypeTest<cocos2d::extension::PhysicsSprite> t;
js_type_class_t *typeClass = nullptr;
std::string typeName = t.s_name();
auto typeMapIter = _js_global_type_map.find(typeName);
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
JS::RootedObject proto(cx, typeClass->proto.ref());
JS::RootedObject parentProto(cx, typeClass->parentProto.ref());
JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parentProto));
args.rval().set(OBJECT_TO_JSVAL(obj));
auto cobj = new (std::nothrow) cocos2d::extension::PhysicsSprite;
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::extension::PhysicsSprite>(cobj);
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
JS::AddNamedObjectRoot(cx, &p->obj, "cocos2d::extension::PhysicsSprite");
if (JS_HasProperty(cx, obj, "_ctor", &ok))
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::extension::PhysicsSprite"));
args.rval().set(OBJECT_TO_JSVAL(jsobj));
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
return true;
}
@ -511,14 +469,11 @@ static bool JSPROXY_CCPhysicsSprite_ctor(JSContext *cx, uint32_t argc, jsval *vp
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
PhysicsSprite *nobj = new (std::nothrow) PhysicsSprite();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
JS::AddNamedObjectRoot(cx, &p->obj, "cocos2d::extension::SpriteFrame");
auto nobj = new (std::nothrow) cocos2d::extension::PhysicsSprite;
auto newproxy = jsb_new_proxy(nobj, obj);
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::extension::PhysicsSprite");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound))
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
args.rval().setUndefined();
return true;
@ -535,7 +490,7 @@ void JSPROXY_CCPhysicsSprite_createClass(JSContext *cx, JS::HandleObject globalO
JSPROXY_CCPhysicsSprite_class->enumerate = JS_EnumerateStub;
JSPROXY_CCPhysicsSprite_class->resolve = JS_ResolveStub;
JSPROXY_CCPhysicsSprite_class->convert = JS_ConvertStub;
JSPROXY_CCPhysicsSprite_class->finalize = JSPROXY_CCPhysicsSprite_finalize;
JSPROXY_CCPhysicsSprite_class->finalize = jsb_ref_finalize;
JSPROXY_CCPhysicsSprite_class->flags = 0;
static JSPropertySpec properties[] = {

View File

@ -5142,35 +5142,16 @@ bool js_cocos2dx_EventKeyboard_constructor(JSContext *cx, uint32_t argc, jsval *
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventKeyboard_constructor : Error processing arguments");
cocos2d::EventKeyboard* cobj = new (std::nothrow) cocos2d::EventKeyboard(arg0, arg1);
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
if (_ccobj) {
_ccobj->autorelease();
}
TypeTest<cocos2d::EventKeyboard> t;
js_type_class_t *typeClass = nullptr;
std::string typeName = t.s_name();
auto typeMapIter = _js_global_type_map.find(typeName);
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
JS::RootedObject proto(cx, typeClass->proto.ref());
JS::RootedObject parentProto(cx, typeClass->parentProto.ref());
JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parentProto));
JS::RootedValue objVal(cx, OBJECT_TO_JSVAL(obj));
args.rval().set(objVal);
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
JS::AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventKeyboard");
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventKeyboard>(cobj);
auto jsobj = jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventKeyboard");
args.rval().set(OBJECT_TO_JSVAL(jsobj));
return true;
}
extern JSObject *jsb_cocos2d_Event_prototype;
void js_cocos2d_EventKeyboard_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EventKeyboard)", obj);
}
static bool js_is_native_obj(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -5188,7 +5169,7 @@ void js_register_cocos2dx_EventKeyboard(JSContext *cx, JS::HandleObject global)
jsb_cocos2d_EventKeyboard_class->enumerate = JS_EnumerateStub;
jsb_cocos2d_EventKeyboard_class->resolve = JS_ResolveStub;
jsb_cocos2d_EventKeyboard_class->convert = JS_ConvertStub;
jsb_cocos2d_EventKeyboard_class->finalize = js_cocos2d_EventKeyboard_finalize;
jsb_cocos2d_EventKeyboard_class->finalize = jsb_ref_finalize;
jsb_cocos2d_EventKeyboard_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
@ -5568,20 +5549,15 @@ bool js_cocos2dx_PolygonInfo_constructor(JSContext *cx, uint32_t argc, jsval *vp
void js_cocos2d_PolygonInfo_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (PolygonInfo)", obj);
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JS::RootedObject jsobj(cx, obj);
jsproxy = jsb_get_js_proxy(jsobj);
if (jsproxy)
auto proxy = jsb_get_js_proxy(jsobj);
if (proxy)
{
nproxy = jsb_get_native_proxy(jsproxy->ptr);
cocos2d::PolygonInfo *nobj = static_cast<cocos2d::PolygonInfo *>(nproxy->ptr);
cocos2d::PolygonInfo *nobj = static_cast<cocos2d::PolygonInfo *>(proxy->ptr);
if (nobj)
delete nobj;
jsb_remove_proxy(nproxy, jsproxy);
jsb_remove_proxy(proxy);
}
}
@ -5731,19 +5707,14 @@ bool js_cocos2dx_AutoPolygon_constructor(JSContext *cx, uint32_t argc, jsval *vp
void js_cocos2d_AutoPolygon_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (AutoPolygon)", obj);
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JS::RootedObject jsobj(cx, obj);
jsproxy = jsb_get_js_proxy(jsobj);
if (jsproxy) {
nproxy = jsb_get_native_proxy(jsproxy->ptr);
cocos2d::AutoPolygon *nobj = static_cast<cocos2d::AutoPolygon *>(nproxy->ptr);
auto proxy = jsb_get_js_proxy(jsobj);
if (proxy) {
cocos2d::AutoPolygon *nobj = static_cast<cocos2d::AutoPolygon *>(proxy->ptr);
if (nobj)
delete nobj;
jsb_remove_proxy(nproxy, jsproxy);
jsb_remove_proxy(proxy);
}
}
@ -5789,6 +5760,41 @@ void js_register_cocos2dx_AutoPolygon(JSContext *cx, JS::HandleObject global) {
jsb_register_class<cocos2d::AutoPolygon>(cx, jsb_cocos2d_AutoPolygon_class, proto, JS::NullPtr());
}
// ComponentJS controls the native js proxy itself, must be bound manually
bool js_cocos2dx_ComponentJS_create(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
std::string arg0;
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentJS_create : Error processing arguments");
auto ret = cocos2d::ComponentJS::create(arg0);
JS::RootedObject jsret(cx, static_cast<JSObject*>(ret->getScriptObject()));
args.rval().set(OBJECT_TO_JSVAL(jsret));
return true;
}
JS_ReportError(cx, "js_cocos2dx_ComponentJS_create : wrong number of arguments");
return false;
}
static bool js_cocos2dx_ComponentJS_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
bool ok = true;
std::string arg0;
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2d_ComponentJS_ctor : Error processing arguments");
cocos2d::ComponentJS *nobj = new (std::nothrow) cocos2d::ComponentJS(arg0);
// autorelease it
nobj->autorelease();
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
args.rval().setUndefined();
return true;
}
bool js_cocos2dx_ComponentJS_getScriptObject(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -6053,8 +6059,12 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
tmpObj.set(jsb_cocos2d_ClippingNode_prototype);
JS_DefineFunction(cx, tmpObj, "init", js_cocos2dx_ClippingNode_init, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_GetProperty(cx, ccObj, "ComponentJS", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "create", js_cocos2dx_ComponentJS_create, 1, JSPROP_READONLY | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_ComponentJS_prototype);
JS_DefineFunction(cx, tmpObj, "getScriptObject", js_cocos2dx_ComponentJS_getScriptObject, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "ctor", js_cocos2dx_ComponentJS_ctor, 1, 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);

View File

@ -87,8 +87,7 @@ inline js_type_class_t *js_get_type_from_native(T* native_obj) {
*/
template<class T>
inline js_proxy_t *js_get_or_create_proxy(JSContext *cx, T *native_obj) {
js_proxy_t *proxy;
HASH_FIND_PTR(_native_js_global_ht, &native_obj, proxy);
js_proxy_t *proxy = jsb_get_native_proxy(native_obj);
if (!proxy) {
js_type_class_t *typeProxy = js_get_type_from_native<T>(native_obj);
// Return NULL if can't find its type rather than making an assert.
@ -133,11 +132,8 @@ JSObject* js_get_or_create_jsobject(JSContext *cx, typename std::enable_if<!std:
JS::RootedObject parent(cx, typeClass->parentProto.ref().get());
JS::RootedObject js_obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
proxy = jsb_new_proxy(native_obj, js_obj);
#ifdef DEBUG
AddNamedObjectRoot(cx, &proxy->obj, typeid(*native_obj).name());
#else
AddObjectRoot(cx, &proxy->obj);
#endif
JS::AddNamedObjectRoot(cx, &proxy->obj, typeid(*native_obj).name());
}
return proxy->obj;
}

View File

@ -66,25 +66,15 @@ ComponentJS::ComponentJS(const std::string& scriptFileName)
JS::RootedValue protoValue(cx);
JS_GetProperty(cx, classObj, "prototype", &protoValue);
TypeTest<ComponentJS> t;
js_type_class_t *typeClass = nullptr;
std::string typeName = t.s_name();
auto typeMapIter = _js_global_type_map.find(typeName);
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
mozilla::Maybe<JS::PersistentRootedObject> *jsObj = new (std::nothrow) mozilla::Maybe<JS::PersistentRootedObject>();
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ComponentJS>(this);
JS::RootedObject proto(cx, protoValue.toObjectOrNull());
JS::RootedObject parent(cx, typeClass->proto.ref());
jsObj->construct(cx);
JS::RootedObject obj(cx, JS_NewObject(cx, theClass, proto, parent));
jsObj->ref() = obj;
// Unbind current proxy binding
js_proxy_t* jsproxy = js_get_or_create_proxy<ComponentJS>(cx, this);
JS::RemoveObjectRoot(cx, &jsproxy->obj);
jsb_remove_proxy(jsb_get_native_proxy(this), jsproxy);
// link the native object with the javascript object
jsb_new_proxy(this, jsObj->ref());
@ -95,6 +85,14 @@ ComponentJS::ComponentJS(const std::string& scriptFileName)
ComponentJS::~ComponentJS()
{
mozilla::Maybe<JS::PersistentRootedObject>* jsObj = static_cast<mozilla::Maybe<JS::PersistentRootedObject>*>(_jsObj);
if (jsObj && !jsObj->empty())
{
// Remove proxy
js_proxy_t* proxy = jsb_get_js_proxy(jsObj->ref());
if (proxy)
jsb_remove_proxy(proxy);
}
// Delete rooted object
if (jsObj != nullptr)
{
delete jsObj;
@ -104,7 +102,14 @@ ComponentJS::~ComponentJS()
void* ComponentJS::getScriptObject() const
{
mozilla::Maybe<JS::PersistentRootedObject>* jsObj = static_cast<mozilla::Maybe<JS::PersistentRootedObject>*>(_jsObj);
return jsObj->ref().get();
if (jsObj && !jsObj->empty())
{
return jsObj->ref().get();
}
else
{
return nullptr;
}
}
void ComponentJS::update(float delta)

View File

@ -557,8 +557,7 @@ public:
virtual void onEvent(Ref *controlButton, Control::EventType event)
{
js_proxy_t * p;
JS_GET_PROXY(p, controlButton);
js_proxy_t* p = jsb_get_native_proxy(controlButton);
if (!p)
{
log("Failed to get proxy for control button");

View File

@ -32,31 +32,29 @@ void GLNode::draw(Renderer *renderer, const Mat4& transform, uint32_t flags) {
void GLNode::onDraw(Mat4 &transform, uint32_t flags)
{
js_proxy_t* proxy = NULL;
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
proxy = js_get_or_create_proxy<cocos2d::Node>(cx, this);
if( proxy ) {
// JSObject *jsObj = proxy->obj;
JS::RootedObject jsObj(cx, proxy->obj.get());
if (jsObj) {
bool found = false;
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::GLNode>(this);
JS::RootedObject jsObj(cx, jsb_ref_get_or_create_jsobject(cx, this, typeClass, "cocos2d::GLNode"));
JS_HasProperty(cx, jsObj, "draw", &found);
if (found == true) {
auto director = Director::getInstance();
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
if (jsObj.get())
{
bool found = false;
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JS::RootedValue rval(cx);
JS::RootedValue fval(cx);
JS_GetProperty(cx, jsObj, "draw", &fval);
JS_HasProperty(cx, jsObj, "draw", &found);
if (found) {
auto director = Director::getInstance();
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
JS_CallFunctionValue(cx, jsObj, fval, JS::HandleValueArray::empty(), &rval);
JS::RootedValue rval(cx);
JS::RootedValue fval(cx);
JS_GetProperty(cx, jsObj, "draw", &fval);
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
}
JS_CallFunctionValue(cx, jsObj, fval, JS::HandleValueArray::empty(), &rval);
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
}
}
}
@ -68,32 +66,18 @@ JSObject *js_cocos2dx_GLNode_prototype;
bool js_cocos2dx_GLNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
if (argc == 0) {
cocos2d::GLNode* cobj = new (std::nothrow) cocos2d::GLNode();
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
if (_ccobj) {
_ccobj->autorelease();
}
cocos2d::GLNode* cobj = new (std::nothrow) cocos2d::GLNode;
TypeTest<cocos2d::GLNode> t;
js_type_class_t *typeClass = nullptr;
std::string typeName = t.s_name();
auto typeMapIter = _js_global_type_map.find(typeName);
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::GLNode>(cobj);
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::GLNode"));
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
JS::RootedObject proto(cx, typeClass->proto.ref());
JS::RootedObject parentProto(cx, typeClass->parentProto.ref());
JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parentProto));
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t *p = jsb_new_proxy(cobj, obj);
args.rval().set(OBJECT_TO_JSVAL(jsobj));
JS::AddNamedObjectRoot(cx, &p->obj, "cocos2d::GLNode");
bool ok=false;
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
return true;
}
@ -101,17 +85,16 @@ bool js_cocos2dx_GLNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
return false;
}
void js_cocos2dx_GLNode_finalize(JSFreeOp *fop, JSObject *obj) {
}
static bool js_cocos2dx_GLNode_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::GLNode *nobj = new (std::nothrow) cocos2d::GLNode();
js_proxy_t* p = jsb_new_proxy(nobj, obj);
nobj->autorelease();
JS::AddNamedObjectRoot(cx, &p->obj, "GLNode");
cocos2d::GLNode *nobj = new (std::nothrow) cocos2d::GLNode;
auto newproxy = jsb_new_proxy(nobj, obj);
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::GLNode");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
args.rval().setUndefined();
return true;
}
@ -119,16 +102,16 @@ static bool js_cocos2dx_GLNode_ctor(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_GLNode_create(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
cocos2d::GLNode* ret = new (std::nothrow) cocos2d::GLNode();
jsval jsret;
do {
if (ret) {
js_proxy_t *proxy = js_get_or_create_proxy<cocos2d::GLNode>(cx, ret);
jsret = OBJECT_TO_JSVAL(proxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
cocos2d::GLNode* ret = new (std::nothrow) cocos2d::GLNode;
jsval jsret = JSVAL_NULL;
if (ret) {
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::GLNode>(ret);
auto jsobj = jsb_ref_create_jsobject(cx, ret, typeClass, "cocos2d::GLNode");
jsret = OBJECT_TO_JSVAL(jsobj);
}
args.rval().set(jsret);
return true;
}
@ -145,7 +128,7 @@ void js_register_cocos2dx_GLNode(JSContext *cx, JS::HandleObject global) {
js_cocos2dx_GLNode_class->enumerate = JS_EnumerateStub;
js_cocos2dx_GLNode_class->resolve = JS_ResolveStub;
js_cocos2dx_GLNode_class->convert = JS_ConvertStub;
js_cocos2dx_GLNode_class->finalize = js_cocos2dx_GLNode_finalize;
js_cocos2dx_GLNode_class->finalize = jsb_ref_finalize;
js_cocos2dx_GLNode_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {

View File

@ -119,7 +119,7 @@ bool jsval_to_ray(JSContext *cx, JS::HandleValue vp, cocos2d::Ray* ret);
bool jsval_to_resourcedata(JSContext *cx, JS::HandleValue v, cocos2d::ResourceData* ret);
// forward declaration
CC_JS_DLL js_proxy_t* jsb_get_js_proxy(JS::HandleObject jsObj);
CC_JS_DLL js_proxy_t* jsb_get_js_proxy(JSObject* jsObj);
template <class T>
bool jsvals_variadic_to_ccvector( JSContext *cx, /*jsval *vp, int argc,*/const JS::CallArgs& args, cocos2d::Vector<T>* ret)
@ -280,9 +280,12 @@ jsval meshVertexAttrib_to_jsval(JSContext* cx, const cocos2d::MeshVertexAttrib&
jsval uniform_to_jsval(JSContext* cx, const cocos2d::Uniform* uniform);
jsval resourcedata_to_jsval(JSContext* cx, const cocos2d::ResourceData& v);
template<class T>
js_proxy_t *js_get_or_create_proxy(JSContext *cx, T *native_obj);
// forward declaration
template <class T>
js_type_class_t *js_get_type_from_native(T* native_obj);
// Ref version of ccvector_to_jsval
template <class T>
jsval ccvector_to_jsval(JSContext* cx, const cocos2d::Vector<T>& v)
{
@ -294,9 +297,10 @@ jsval ccvector_to_jsval(JSContext* cx, const cocos2d::Vector<T>& v)
JS::RootedValue arrElement(cx);
//First, check whether object is associated with js object.
js_proxy_t* jsproxy = js_get_or_create_proxy(cx, obj);
if (jsproxy) {
arrElement = OBJECT_TO_JSVAL(jsproxy->obj);
js_type_class_t *typeClass = js_get_type_from_native(obj);
JS::RootedObject jsobject(cx, jsb_ref_get_or_create_jsobject(cx, obj, typeClass, typeid(*obj).name()));
if (jsobject.get()) {
arrElement = OBJECT_TO_JSVAL(jsobject);
}
if (!JS_SetElement(cx, jsretArr, i, arrElement)) {
@ -322,9 +326,11 @@ jsval ccmap_string_key_to_jsval(JSContext* cx, const cocos2d::Map<std::string, T
T obj = iter->second;
//First, check whether object is associated with js object.
js_proxy_t* jsproxy = js_get_or_create_proxy(cx, obj);
if (jsproxy) {
element = OBJECT_TO_JSVAL(jsproxy->obj);
js_type_class_t *typeClass = js_get_type_from_native(obj);
JS::RootedObject jsobject(cx, jsb_ref_get_or_create_jsobject(cx, obj, typeClass, typeid(*obj).name()));
if (jsobject.get()) {
element = OBJECT_TO_JSVAL(jsobject);
}
if (!key.empty())

View File

@ -164,8 +164,7 @@ bool js_cocos2dx_SocketIO_connect(JSContext* cx, uint32_t argc, jsval* vp)
if (ret)
{
// link the native object with the javascript object
js_proxy_t *p;
HASH_FIND_PTR(_native_js_global_ht, &ret, p);
js_proxy_t *p = jsb_get_native_proxy(ret);
if(!p)
{
//previous connection not found, create a new one

View File

@ -139,10 +139,9 @@ public:
jsval args = OBJECT_TO_JSVAL(jsobj);
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate.ref()), "onclose", 1, &args);
JS::RootedObject wsobj(cx, p->obj);
js_proxy_t* jsproxy = jsb_get_js_proxy(wsobj);
JS::RemoveObjectRoot(cx, &jsproxy->obj);
jsb_remove_proxy(p, jsproxy);
auto copy = &p->obj;
jsb_remove_proxy(p);
JS::RemoveObjectRoot(cx, copy);
CC_SAFE_DELETE(ws);
}

View File

@ -46,7 +46,7 @@ JNIEXPORT jint JNICALL Java_org_cocos2dx_lib_Cocos2dxJavascriptJavaBridge_evalSt
CCLOG("Cocos2dxJavascriptJavaBridge_evalString error, invalid string code");
return 0;
}
ScriptingCore::getInstance()->evalString(strValue.c_str(), nullptr);
ScriptingCore::getInstance()->evalString(strValue.c_str());
return 1;
}

View File

@ -25,19 +25,23 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "uthash.h"
#include "mozilla/Maybe.h"
#include <unordered_map>
// Probably we can get rid of this struct, but since a lot of code
// depends on it, we cannot remove it easily
typedef struct js_proxy {
/** the native object. usually a pointer to cocos2d::Ref, but could be a pointer to another object */
void *ptr;
/** the JS object, as a heap object. Required by GC best practices */
JS::Heap<JSObject*> obj;
UT_hash_handle hh;
/** This is the raw pointer. The same as the "obj", but 'raw'. This is needed
because under certain circumstances JS::RemoveRootObject will be called on "obj"
and "obj" will became NULL. Which is not Ok if we need to use "obj" later for other stuff
*/
JSObject* _jsobj;
} js_proxy_t;
extern js_proxy_t *_native_js_global_ht;
extern js_proxy_t *_js_native_global_ht;
typedef struct js_type_class {
JSClass *jsclass;
mozilla::Maybe<JS::PersistentRootedObject> proto;
@ -60,42 +64,6 @@ public:
};
#define JS_NEW_PROXY(p, native_obj, js_obj) \
do { \
p = (js_proxy_t *)malloc(sizeof(js_proxy_t)); \
assert(p); \
js_proxy_t* native_obj##js_obj##tmp = NULL; \
HASH_FIND_PTR(_native_js_global_ht, &native_obj, native_obj##js_obj##tmp); \
assert(!native_obj##js_obj##tmp); \
p->ptr = native_obj; \
p->obj = js_obj; \
HASH_ADD_PTR(_native_js_global_ht, ptr, p); \
p = (js_proxy_t *)malloc(sizeof(js_proxy_t)); \
assert(p); \
native_obj##js_obj##tmp = NULL; \
HASH_FIND_PTR(_js_native_global_ht, &js_obj, native_obj##js_obj##tmp); \
assert(!native_obj##js_obj##tmp); \
p->ptr = native_obj; \
p->obj = js_obj; \
HASH_ADD_PTR(_js_native_global_ht, obj, p); \
} while(0) \
#define JS_GET_PROXY(p, native_obj) \
do { \
HASH_FIND_PTR(_native_js_global_ht, &native_obj, p); \
} while (0)
#define JS_GET_NATIVE_PROXY(p, js_obj) \
do { \
HASH_FIND_PTR(_js_native_global_ht, &js_obj, p); \
} while (0)
#define JS_REMOVE_PROXY(nproxy, jsproxy) \
do { \
if (nproxy) { HASH_DEL(_native_js_global_ht, nproxy); free(nproxy); } \
if (jsproxy) { HASH_DEL(_js_native_global_ht, jsproxy); free(jsproxy); } \
} while (0)
#define TEST_NATIVE_OBJECT(cx, native_obj) \
if (!native_obj) { \
JS_ReportError(cx, "Invalid Native Object"); \

View File

@ -164,6 +164,10 @@
83A5661A18DA878400FC31A0 /* jsb_socketio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83A5661718DA878400FC31A0 /* jsb_socketio.cpp */; };
83A5661B18DA878400FC31A0 /* jsb_socketio.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A5661818DA878400FC31A0 /* jsb_socketio.h */; };
83A5661C18DA878400FC31A0 /* jsb_socketio.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A5661818DA878400FC31A0 /* jsb_socketio.h */; };
ADAC23EE1C2044DC0049A6A2 /* js_module_register.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADD1C0D91C196BDF00733781 /* js_module_register.cpp */; };
ADD1C0DC1C196BDF00733781 /* js_module_register.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADD1C0D91C196BDF00733781 /* js_module_register.cpp */; };
ADD1C0DD1C196BDF00733781 /* js_module_register.h in Headers */ = {isa = PBXBuildFile; fileRef = ADD1C0DA1C196BDF00733781 /* js_module_register.h */; };
ADD1C0DE1C196BDF00733781 /* js-BindingsExport.h in Headers */ = {isa = PBXBuildFile; fileRef = ADD1C0DB1C196BDF00733781 /* js-BindingsExport.h */; };
B38AD56A1B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B38AD5681B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.cpp */; };
B38AD56B1B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = B38AD5691B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.h */; };
B38AD56E1B1D38700057DD7F /* jsb_cocos2dx_experimental_video_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B38AD56C1B1D38700057DD7F /* jsb_cocos2dx_experimental_video_auto.cpp */; };
@ -172,10 +176,10 @@
BA4095C31A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA4095C01A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp */; };
BA4095C41A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = BA4095C11A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h */; };
BA4095C51A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = BA4095C11A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h */; };
BA9FD5D21BAC0A7600996C85 /* CCComponentJS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA9FD5D01BAC0A7600996C85 /* CCComponentJS.cpp */; settings = {ASSET_TAGS = (); }; };
BA9FD5D31BAC0A7600996C85 /* CCComponentJS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA9FD5D01BAC0A7600996C85 /* CCComponentJS.cpp */; settings = {ASSET_TAGS = (); }; };
BA9FD5D41BAC0A7600996C85 /* CCComponentJS.h in Headers */ = {isa = PBXBuildFile; fileRef = BA9FD5D11BAC0A7600996C85 /* CCComponentJS.h */; settings = {ASSET_TAGS = (); }; };
BA9FD5D51BAC0A7600996C85 /* CCComponentJS.h in Headers */ = {isa = PBXBuildFile; fileRef = BA9FD5D11BAC0A7600996C85 /* CCComponentJS.h */; settings = {ASSET_TAGS = (); }; };
BA9FD5D21BAC0A7600996C85 /* CCComponentJS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA9FD5D01BAC0A7600996C85 /* CCComponentJS.cpp */; };
BA9FD5D31BAC0A7600996C85 /* CCComponentJS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA9FD5D01BAC0A7600996C85 /* CCComponentJS.cpp */; };
BA9FD5D41BAC0A7600996C85 /* CCComponentJS.h in Headers */ = {isa = PBXBuildFile; fileRef = BA9FD5D11BAC0A7600996C85 /* CCComponentJS.h */; };
BA9FD5D51BAC0A7600996C85 /* CCComponentJS.h in Headers */ = {isa = PBXBuildFile; fileRef = BA9FD5D11BAC0A7600996C85 /* CCComponentJS.h */; };
BAEE4D711AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */; };
BAEE4D721AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */; };
BAEE4D731AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BAEE4D701AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp */; };
@ -211,7 +215,6 @@
1A119E3C18BDF19200352BAA /* jsb_cocos2dx_spine_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_spine_auto.hpp; sourceTree = "<group>"; };
1A119E3E18BDF19200352BAA /* jsb_cocos2dx_studio_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_studio_auto.cpp; sourceTree = "<group>"; };
1A119E3F18BDF19200352BAA /* jsb_cocos2dx_studio_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_studio_auto.hpp; sourceTree = "<group>"; };
1A119E4318BDF19200352BAA /* Android.mk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Android.mk; sourceTree = "<group>"; };
1A119E4418BDF19200352BAA /* js_bindings_chipmunk_auto_classes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_chipmunk_auto_classes.cpp; sourceTree = "<group>"; };
1A119E4518BDF19200352BAA /* js_bindings_chipmunk_auto_classes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_chipmunk_auto_classes.h; sourceTree = "<group>"; };
1A119E4618BDF19200352BAA /* js_bindings_chipmunk_auto_classes_registration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_chipmunk_auto_classes_registration.h; sourceTree = "<group>"; };
@ -224,7 +227,6 @@
1A119E4D18BDF19200352BAA /* js_bindings_chipmunk_registration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_chipmunk_registration.h; sourceTree = "<group>"; };
1A119E4E18BDF19200352BAA /* cocos2d_specifics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocos2d_specifics.cpp; sourceTree = "<group>"; };
1A119E4F18BDF19200352BAA /* cocos2d_specifics.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocos2d_specifics.hpp; sourceTree = "<group>"; };
1A119E5118BDF19200352BAA /* Android.mk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Android.mk; sourceTree = "<group>"; };
1A119E5218BDF19200352BAA /* cocosbuilder_specifics.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocosbuilder_specifics.hpp; sourceTree = "<group>"; };
1A119E5318BDF19200352BAA /* js_bindings_ccbreader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_ccbreader.cpp; sourceTree = "<group>"; };
1A119E5418BDF19200352BAA /* js_bindings_ccbreader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_ccbreader.h; sourceTree = "<group>"; };
@ -287,6 +289,9 @@
4BE089EA1ADF967400D65D4B /* jsb_cocos2dx_experimental_webView_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_cocos2dx_experimental_webView_manual.h; sourceTree = "<group>"; };
83A5661718DA878400FC31A0 /* jsb_socketio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_socketio.cpp; sourceTree = "<group>"; };
83A5661818DA878400FC31A0 /* jsb_socketio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_socketio.h; sourceTree = "<group>"; };
ADD1C0D91C196BDF00733781 /* js_module_register.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_module_register.cpp; sourceTree = "<group>"; };
ADD1C0DA1C196BDF00733781 /* js_module_register.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_module_register.h; sourceTree = "<group>"; };
ADD1C0DB1C196BDF00733781 /* js-BindingsExport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "js-BindingsExport.h"; sourceTree = "<group>"; };
B38AD5681B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_cocos2dx_experimental_video_manual.cpp; path = experimental/jsb_cocos2dx_experimental_video_manual.cpp; sourceTree = "<group>"; };
B38AD5691B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsb_cocos2dx_experimental_video_manual.h; path = experimental/jsb_cocos2dx_experimental_video_manual.h; sourceTree = "<group>"; };
B38AD56C1B1D38700057DD7F /* jsb_cocos2dx_experimental_video_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_experimental_video_auto.cpp; sourceTree = "<group>"; };
@ -397,6 +402,9 @@
1A119E5018BDF19200352BAA /* cocosbuilder */,
1A119E5518BDF19200352BAA /* cocostudio */,
1A119E5918BDF19200352BAA /* extension */,
ADD1C0D91C196BDF00733781 /* js_module_register.cpp */,
ADD1C0DA1C196BDF00733781 /* js_module_register.h */,
ADD1C0DB1C196BDF00733781 /* js-BindingsExport.h */,
1A119E6118BDF19200352BAA /* js_bindings_config.h */,
1A119E6218BDF19200352BAA /* js_bindings_core.cpp */,
1A119E6318BDF19200352BAA /* js_bindings_core.h */,
@ -428,7 +436,6 @@
1A119E4218BDF19200352BAA /* chipmunk */ = {
isa = PBXGroup;
children = (
1A119E4318BDF19200352BAA /* Android.mk */,
1A119E4418BDF19200352BAA /* js_bindings_chipmunk_auto_classes.cpp */,
1A119E4518BDF19200352BAA /* js_bindings_chipmunk_auto_classes.h */,
1A119E4618BDF19200352BAA /* js_bindings_chipmunk_auto_classes_registration.h */,
@ -446,7 +453,6 @@
1A119E5018BDF19200352BAA /* cocosbuilder */ = {
isa = PBXGroup;
children = (
1A119E5118BDF19200352BAA /* Android.mk */,
1A119E5218BDF19200352BAA /* cocosbuilder_specifics.hpp */,
1A119E5318BDF19200352BAA /* js_bindings_ccbreader.cpp */,
1A119E5418BDF19200352BAA /* js_bindings_ccbreader.h */,
@ -629,6 +635,7 @@
1A119F0318BDF19200352BAA /* spidermonkey_specifics.h in Headers */,
1A119EE718BDF19200352BAA /* jsb_opengl_manual.h in Headers */,
1A119ED518BDF19200352BAA /* js_bindings_core.h in Headers */,
ADD1C0DE1C196BDF00733781 /* js-BindingsExport.h in Headers */,
1A119EC318BDF19200352BAA /* js_bindings_ccbreader.h in Headers */,
1A119EDF18BDF19200352BAA /* jsb_helper.h in Headers */,
1A119ECB18BDF19200352BAA /* jsb_cocos2dx_extension_manual.h in Headers */,
@ -642,6 +649,7 @@
42638FFF1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp in Headers */,
0541A74F1973876100E45470 /* JavaScriptObjCBridge.h in Headers */,
426390061B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h in Headers */,
ADD1C0DD1C196BDF00733781 /* js_module_register.h in Headers */,
1AB5E62D18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.hpp in Headers */,
420BBCF91AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */,
1A119ED918BDF19200352BAA /* js_bindings_opengl.h in Headers */,
@ -803,6 +811,7 @@
BAEE4D711AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */,
1A119EC518BDF19200352BAA /* jsb_cocos2dx_studio_manual.cpp in Sources */,
1A119E8F18BDF19200352BAA /* jsb_cocos2dx_extension_auto.cpp in Sources */,
ADD1C0DC1C196BDF00733781 /* js_module_register.cpp in Sources */,
1A119ED718BDF19200352BAA /* js_bindings_opengl.cpp in Sources */,
1AB5E62B18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.cpp in Sources */,
1A119E9B18BDF19200352BAA /* jsb_cocos2dx_spine_auto.cpp in Sources */,
@ -836,6 +845,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ADAC23EE1C2044DC0049A6A2 /* js_module_register.cpp in Sources */,
0541A75B19738AD200E45470 /* JavaScriptObjCBridge.mm in Sources */,
420BBCF81AA48EE900493976 /* jsb_cocos2dx_3d_manual.cpp in Sources */,
1A119E8A18BDF19200352BAA /* jsb_cocos2dx_builder_auto.cpp in Sources */,

View File

@ -129,7 +129,7 @@
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;_USRJSSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_USRJSSTATIC;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
@ -172,7 +172,7 @@
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_USRJSSTATIC;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
@ -193,7 +193,7 @@
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manua\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_USRJSSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WholeProgramOptimization>false</WholeProgramOptimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>

View File

@ -94,7 +94,7 @@
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(ProjectDir)..\..\..\manual\navmesh;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;_USRJSSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_USRJSSTATIC;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
@ -137,7 +137,7 @@
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(ProjectDir)..\..\..\manual\navmesh;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_USRJSSTATIC;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
@ -158,7 +158,7 @@
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_USRJSSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WholeProgramOptimization>false</WholeProgramOptimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>

View File

@ -521,9 +521,9 @@ ccui.Widget.prototype.addTouchEventListener = function (selector, target) {
function _ui_addEventListener(selector, target) {
if (target === undefined)
this._addTouchEventListener(selector);
this._addEventListener(selector);
else
this._addTouchEventListener(selector.bind(target));
this._addEventListener(selector.bind(target));
}
function _ui_applyEventListener(ctor) {
var proto = ctor.prototype;

View File

@ -32,17 +32,25 @@ jsb.EventListenerAssetsManager.prototype._ctor = function(assetsManager, callbac
cc.ControlButton.prototype._ctor = function(label, backgroundSprite, fontSize){
if(fontSize != undefined)
this.initWithTitleAndFontNameAndFontSize(label, backgroundSprite, fontSize);
else if(backgroundSprite != undefined)
this.initWithLabelAndBackgroundSprite(label, backgroundSprite);
else if(label != undefined)
cc.ControlButton.prototype._ctor = function(label, backgroundSprite, fontSize, fontName, autoSizeWithLabel ){
if (autoSizeWithLabel !== undefined && backgroundSprite) {
this.initWithLabelAndBackgroundSprite(label, backgroundSprite, autoSizeWithLabel);
}
else if(fontName !== undefined && fontSize !== undefined) {
this.initWithTitleAndFontNameAndFontSize(label, fontName, fontSize);
}
else if(backgroundSprite !== undefined) {
this.initWithLabelAndBackgroundSprite(label, backgroundSprite, true);
}
else if(label !== undefined) {
this.initWithBackgroundSprite(label);
else
}
else {
this.init();
}
};
cc.ControlColourPicker.prototype._ctor = function(){
this.init();
};

View File

@ -26,7 +26,7 @@
// CCConfig.js
//
cc.ENGINE_VERSION = "Cocos2d-JS v3.9";
cc.ENGINE_VERSION = "Cocos2d-JS v3.10";
cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0;
cc.DIRECTOR_STATS_POSITION = {x: 0, y: 0};
@ -2771,29 +2771,30 @@ cc.GLProgram.prototype.setUniformLocationWithMatrix2fv = function(){
var tempArray = Array.prototype.slice.call(arguments);
tempArray = Array.prototype.concat.call(tempArray, 2);
this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray);
}
};
cc.GLProgram.prototype.setUniformLocationWithMatrix3fv = function(){
var tempArray = Array.prototype.slice.call(arguments);
tempArray = Array.prototype.concat.call(tempArray, 3);
this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray);
}
};
cc.GLProgram.prototype.setUniformLocationWithMatrix4fv = function(){
var tempArray = Array.prototype.slice.call(arguments);
tempArray = Array.prototype.concat.call(tempArray, 4);
this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray);
}
};
//
// Script Component
//
cc._ComponentJS = cc.ComponentJS;
cc._ComponentJS.extend = cc.Class.extend;
cc.ComponentJS = function (filename) {
var comp = cc._ComponentJS.create(filename);
var res = comp.getScriptObject();
return res;
}
};
cc.ComponentJS.extend = function (prop) {
return cc._ComponentJS.extend(prop);
};

View File

@ -254,7 +254,10 @@ _p._ctor = function(normalImage, selectedImage, three, four, five) {
target = five;
}
callback = callback ? callback.bind(target) : null;
this.initWithNormalSprite(new cc.Sprite(normalImage), new cc.Sprite(selectedImage), disabledImage ? new cc.Sprite(disabledImage) : new cc.Sprite(normalImage), callback);
var normalSprite = new cc.Sprite(normalImage);
var selectedSprite = new cc.Sprite(selectedImage);
var disabledSprite = disabledImage ? new cc.Sprite(disabledImage) : new cc.Sprite(normalImage);
this.initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, callback);
}
};

View File

@ -233,6 +233,7 @@
});
});
load.registerParser("action", "*", parser);
load.registerParser("action", "0.*", parser);
load.registerParser("action", "1.*", parser);
})(ccs._load, ccs._parser);

View File

@ -310,6 +310,6 @@
});
});
load.registerParser("action", "2.*", parser);
load.registerParser("action", "*", parser);
})(ccs._load, ccs._parser);

View File

@ -287,6 +287,7 @@
});
});
load.registerParser("timeline", "*", parser);
load.registerParser("timeline", "0.*", parser);
load.registerParser("timeline", "1.*", parser);
})(ccs._load, ccs._parser);

View File

@ -1777,7 +1777,7 @@
});
load.registerParser("timeline", "2.*", parser);
load.registerParser("timeline", "*", parser);
})(ccs._load, ccs._parser);

View File

@ -286,6 +286,7 @@
-- @param self
-- @param #cc.Node label
-- @param #ccui.Scale9Sprite backgroundSprite
-- @param #bool adjustBackGroundSize
-- @return bool#bool ret (return value: bool)
--------------------------------
@ -309,11 +310,12 @@
-- @overload self
-- @overload self, cc.Node, ccui.Scale9Sprite
-- @overload self, string, string, float
-- @overload self, cc.Node, ccui.Scale9Sprite, bool
-- @function [parent=#ControlButton] create
-- @param self
-- @param #string title
-- @param #string fontName
-- @param #float fontSize
-- @param #cc.Node label
-- @param #ccui.Scale9Sprite backgroundSprite
-- @param #bool adjustBackGroundSize
-- @return ControlButton#ControlButton ret (return value: cc.ControlButton)
--------------------------------

View File

@ -25,6 +25,12 @@
-- @param #float height
-- @return Label#Label self (return value: cc.Label)
--------------------------------
--
-- @function [parent=#Label] getWidth
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Return the text the Label is displaying.
-- @function [parent=#Label] getString
@ -82,6 +88,14 @@
-- @param #float width
-- @return Label#Label self (return value: cc.Label)
--------------------------------
-- Returns the additional kerning of the Label.<br>
-- warning Not support system font.<br>
-- since v3.2.0
-- @function [parent=#Label] getAdditionalKerning
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Return the user define BMFont size.<br>
-- return The BMFont size in float value.
@ -101,6 +115,12 @@
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- Return shadow effect offset value.
-- @function [parent=#Label] getShadowOffset
-- @param self
-- @return size_table#size_table ret (return value: size_table)
--------------------------------
-- Makes the Label to clip upper and lower margin for reduce height of Label.
-- @function [parent=#Label] setClipMarginEnabled
@ -124,6 +144,12 @@
-- @param #string font
-- @return Label#Label self (return value: cc.Label)
--------------------------------
-- Return the outline effect size value.
-- @function [parent=#Label] getOutlineSize
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- Sets a new bitmap font to Label
-- @function [parent=#Label] setBMFontFilePath
@ -220,13 +246,17 @@
-- @return Label#Label self (return value: cc.Label)
--------------------------------
-- Returns the additional kerning of the Label.<br>
-- warning Not support system font.<br>
-- since v3.2.0
-- @function [parent=#Label] getAdditionalKerning
-- Return the shadow effect blur radius.
-- @function [parent=#Label] getShadowBlurRadius
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Return current effect color vlaue.
-- @function [parent=#Label] getEffectColor
-- @param self
-- @return color4f_table#color4f_table ret (return value: color4f_table)
--------------------------------
--
-- @function [parent=#Label] removeAllChildrenWithCleanup
@ -288,6 +318,12 @@
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Return the shadow effect color value.
-- @function [parent=#Label] getShadowColor
-- @param self
-- @return color4f_table#color4f_table ret (return value: color4f_table)
--------------------------------
-- Returns the TTF configuration object used by the Label.<br>
-- see `TTFConfig`
@ -328,10 +364,10 @@
-- @return Label#Label self (return value: cc.Label)
--------------------------------
--
-- @function [parent=#Label] getWidth
-- Return whether the shadow effect is enabled.
-- @function [parent=#Label] isShadowEnabled
-- @param self
-- @return float#float ret (return value: float)
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Enable glow effect to Label.<br>
@ -396,6 +432,12 @@
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Return current effect type.
-- @function [parent=#Label] getLabelEffectType
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @overload self, int, int
-- @overload self, int

View File

@ -16,12 +16,6 @@
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- check texture each frame?
-- @function [parent=#Mesh] enableCheckTexture
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Sets a new Material to the Mesh
-- @function [parent=#Mesh] setMaterial
@ -75,12 +69,6 @@
-- @param #string name
-- @return Mesh#Mesh self (return value: cc.Mesh)
--------------------------------
-- check texture
-- @function [parent=#Mesh] checkTexture
-- @param self
-- @return Mesh#Mesh self (return value: cc.Mesh)
--------------------------------
-- Mesh index data setter
-- @function [parent=#Mesh] setMeshIndexData
@ -115,13 +103,6 @@
-- @param #cc.MeshSkin skin
-- @return Mesh#Mesh self (return value: cc.Mesh)
--------------------------------
-- set enable check texture, check texture each frame if enable is true. It is false by default
-- @function [parent=#Mesh] setEnableCheckTexture
-- @param self
-- @param #bool enableCheckTexture
-- @return Mesh#Mesh self (return value: cc.Mesh)
--------------------------------
--
-- @function [parent=#Mesh] isVisible

View File

@ -42,6 +42,12 @@
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- return particle render
-- @function [parent=#ParticleSystem3D] getRender
-- @param self
-- @return Particle3DRender#Particle3DRender ret (return value: cc.Particle3DRender)
--------------------------------
-- set emitter for particle system, can set your own particle emitter
-- @function [parent=#ParticleSystem3D] setEmitter

View File

@ -37,6 +37,8 @@
--------------------------------
-- brief Toggle 9-slice feature.<br>
-- If Scale9Sprite is 9-slice disabled, the Scale9Sprite will rendered as a normal sprite.<br>
-- warning: Don't use setScale9Enabled(false), use setRenderingType(RenderingType::SIMPLE) instead.<br>
-- The setScale9Enabled(false) is kept only for back back compatibility.<br>
-- param enabled True to enable 9-slice, false otherwise.<br>
-- js NA
-- @function [parent=#Scale9Sprite] setScale9Enabled
@ -388,6 +390,13 @@
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
--
-- @function [parent=#Scale9Sprite] setGlobalZOrder
-- @param self
-- @param #float globalZOrder
-- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite)
--------------------------------
--
-- @function [parent=#Scale9Sprite] setScaleY

View File

@ -46,14 +46,6 @@
-- @param self
-- @return ResourceData#ResourceData ret (return value: cc.ResourceData)
--------------------------------
-- Gets capinsets for progress bar slider, if slider is using scale9 renderer.<br>
-- return Capinsets for progress bar slider.<br>
-- js NA
-- @function [parent=#Slider] getCapInsetsProgressBarRebderer
-- @param self
-- @return rect_table#rect_table ret (return value: rect_table)
--------------------------------
-- Sets if slider is using scale9 renderer.<br>
-- param able True that using scale9 renderer, false otherwise.
@ -75,6 +67,15 @@
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Sets capinsets for progress bar slider, if slider is using scale9 renderer.<br>
-- param capInsets Capinsets for progress bar slider.<br>
-- js NA
-- @function [parent=#Slider] setCapInsetProgressBarRenderer
-- @param self
-- @param #rect_table capInsets
-- @return Slider#Slider self (return value: ccui.Slider)
--------------------------------
-- Load textures for slider ball.<br>
-- param normal Normal state texture.<br>
@ -129,6 +130,14 @@
-- @param self
-- @return rect_table#rect_table ret (return value: rect_table)
--------------------------------
-- Gets capinsets for progress bar slider, if slider is using scale9 renderer.<br>
-- return Capinsets for progress bar slider.<br>
-- js NA
-- @function [parent=#Slider] getCapInsetsProgressBarRenderer
-- @param self
-- @return rect_table#rect_table ret (return value: rect_table)
--------------------------------
-- Load pressed state texture for slider ball.<br>
-- param pressed Pressed state texture.<br>
@ -158,15 +167,6 @@
-- @param self
-- @return ResourceData#ResourceData ret (return value: cc.ResourceData)
--------------------------------
-- Sets capinsets for progress bar slider, if slider is using scale9 renderer.<br>
-- param capInsets Capinsets for progress bar slider.<br>
-- js NA
-- @function [parent=#Slider] setCapInsetProgressBarRebderer
-- @param self
-- @param #rect_table capInsets
-- @return Slider#Slider self (return value: ccui.Slider)
--------------------------------
-- Sets capinsets for bar slider, if slider is using scale9 renderer.<br>
-- param capInsets Capinsets for bar slider.

View File

@ -35,6 +35,12 @@
-- @param #int effect
-- @return Text#Text self (return value: ccui.Text)
--------------------------------
-- Return current effect type.
-- @function [parent=#Text] getLabelEffectType
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- Gets text color.<br>
-- return Text color.
@ -77,6 +83,12 @@
-- @param #bool enabled
-- @return Text#Text self (return value: ccui.Text)
--------------------------------
-- Return shadow effect offset value.
-- @function [parent=#Text] getShadowOffset
-- @param self
-- @return size_table#size_table ret (return value: size_table)
--------------------------------
--
-- @function [parent=#Text] setString
@ -84,6 +96,12 @@
-- @param #string text
-- @return Text#Text self (return value: ccui.Text)
--------------------------------
-- Return the outline effect size value.
-- @function [parent=#Text] getOutlineSize
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
--
-- @function [parent=#Text] init
@ -93,6 +111,12 @@
-- @param #float fontSize
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Return the shadow effect blur radius.
-- @function [parent=#Text] getShadowBlurRadius
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Gets the touch scale enabled of label.<br>
-- return Touch scale enabled of label.
@ -145,6 +169,12 @@
-- @param #int outlineSize
-- @return Text#Text self (return value: ccui.Text)
--------------------------------
-- Return current effect color vlaue.
-- @function [parent=#Text] getEffectColor
-- @param self
-- @return color4b_table#color4b_table ret (return value: color4b_table)
--------------------------------
-- Gets the font type.<br>
-- return The font type.
@ -159,6 +189,12 @@
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- Return whether the shadow effect is enabled.
-- @function [parent=#Text] isShadowEnabled
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Sets the font size of label.<br>
-- param size The font size.
@ -167,6 +203,12 @@
-- @param #float size
-- @return Text#Text self (return value: ccui.Text)
--------------------------------
-- Return the shadow effect color value.
-- @function [parent=#Text] getShadowColor
-- @param self
-- @return color4b_table#color4b_table ret (return value: color4b_table)
--------------------------------
-- Sets text color.<br>
-- param color Text color.

View File

@ -52,13 +52,6 @@
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- Set if the texture is valid, when it been set as false, it will display as default "file missing texture"
-- @function [parent=#Texture2D] setValid
-- @param self
-- @param #bool valid
-- @return Texture2D#Texture2D self (return value: cc.Texture2D)
--------------------------------
-- @overload self, int
-- @overload self
@ -112,12 +105,6 @@
-- @param self
-- @return size_table#size_table ret (return value: size_table)
--------------------------------
--
-- @function [parent=#Texture2D] isValid
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Sets alias texture parameters:<br>
-- - GL_TEXTURE_MIN_FILTER = GL_NEAREST<br>

View File

@ -94,13 +94,6 @@
-- @param #cc.Texture2D texture
-- @return string#string ret (return value: string)
--------------------------------
--
-- @function [parent=#TextureCache] setDirty
-- @param self
-- @param #bool dirty
-- @return TextureCache#TextureCache self (return value: cc.TextureCache)
--------------------------------
-- Reload texture from a new file.<br>
-- This function is mainly for editor, won't suggest use it in game for performance reason.<br>
@ -122,12 +115,6 @@
-- @param self
-- @return TextureCache#TextureCache self (return value: cc.TextureCache)
--------------------------------
--
-- @function [parent=#TextureCache] isDirty
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Deletes a texture from the cache given a texture.
-- @function [parent=#TextureCache] removeTexture

View File

@ -1843,53 +1843,6 @@ int lua_cocos2dx_3d_Mesh_getVertexSizeInBytes(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_3d_Mesh_enableCheckTexture(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Mesh* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Mesh_enableCheckTexture'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Mesh_enableCheckTexture'", nullptr);
return 0;
}
bool ret = cobj->enableCheckTexture();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Mesh:enableCheckTexture",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Mesh_enableCheckTexture'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Mesh_setMaterial(lua_State* tolua_S)
{
int argc = 0;
@ -2249,53 +2202,6 @@ int lua_cocos2dx_3d_Mesh_setName(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_3d_Mesh_checkTexture(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Mesh* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Mesh_checkTexture'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Mesh_checkTexture'", nullptr);
return 0;
}
cobj->checkTexture();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Mesh:checkTexture",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Mesh_checkTexture'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Mesh_setMeshIndexData(lua_State* tolua_S)
{
int argc = 0;
@ -2543,56 +2449,6 @@ int lua_cocos2dx_3d_Mesh_setSkin(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_3d_Mesh_setEnableCheckTexture(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Mesh* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Mesh_setEnableCheckTexture'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Mesh:setEnableCheckTexture");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Mesh_setEnableCheckTexture'", nullptr);
return 0;
}
cobj->setEnableCheckTexture(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Mesh:setEnableCheckTexture",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Mesh_setEnableCheckTexture'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Mesh_isVisible(lua_State* tolua_S)
{
int argc = 0;
@ -2792,7 +2648,6 @@ int lua_register_cocos2dx_3d_Mesh(lua_State* tolua_S)
tolua_function(tolua_S,"new",lua_cocos2dx_3d_Mesh_constructor);
tolua_function(tolua_S,"getMaterial",lua_cocos2dx_3d_Mesh_getMaterial);
tolua_function(tolua_S,"getVertexSizeInBytes",lua_cocos2dx_3d_Mesh_getVertexSizeInBytes);
tolua_function(tolua_S,"enableCheckTexture",lua_cocos2dx_3d_Mesh_enableCheckTexture);
tolua_function(tolua_S,"setMaterial",lua_cocos2dx_3d_Mesh_setMaterial);
tolua_function(tolua_S,"getName",lua_cocos2dx_3d_Mesh_getName);
tolua_function(tolua_S,"getMeshVertexAttribute",lua_cocos2dx_3d_Mesh_getMeshVertexAttribute);
@ -2800,13 +2655,11 @@ int lua_register_cocos2dx_3d_Mesh(lua_State* tolua_S)
tolua_function(tolua_S,"draw",lua_cocos2dx_3d_Mesh_draw);
tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_3d_Mesh_getBlendFunc);
tolua_function(tolua_S,"setName",lua_cocos2dx_3d_Mesh_setName);
tolua_function(tolua_S,"checkTexture",lua_cocos2dx_3d_Mesh_checkTexture);
tolua_function(tolua_S,"setMeshIndexData",lua_cocos2dx_3d_Mesh_setMeshIndexData);
tolua_function(tolua_S,"getMeshVertexAttribCount",lua_cocos2dx_3d_Mesh_getMeshVertexAttribCount);
tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_3d_Mesh_setBlendFunc);
tolua_function(tolua_S,"setForce2DQueue",lua_cocos2dx_3d_Mesh_setForce2DQueue);
tolua_function(tolua_S,"setSkin",lua_cocos2dx_3d_Mesh_setSkin);
tolua_function(tolua_S,"setEnableCheckTexture",lua_cocos2dx_3d_Mesh_setEnableCheckTexture);
tolua_function(tolua_S,"isVisible",lua_cocos2dx_3d_Mesh_isVisible);
tolua_function(tolua_S,"setGLProgramState",lua_cocos2dx_3d_Mesh_setGLProgramState);
tolua_function(tolua_S,"setVisible",lua_cocos2dx_3d_Mesh_setVisible);

View File

@ -146,9 +146,6 @@ int register_all_cocos2dx_3d(lua_State* tolua_S);

View File

@ -782,56 +782,6 @@ int lua_cocos2dx_Texture2D_getPixelsHigh(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Texture2D_setValid(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Texture2D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Texture2D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Texture2D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Texture2D_setValid'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Texture2D:setValid");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Texture2D_setValid'", nullptr);
return 0;
}
cobj->setValid(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Texture2D:setValid",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Texture2D_setValid'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Texture2D_getBitsPerPixelForFormat(lua_State* tolua_S)
{
int argc = 0;
@ -1275,53 +1225,6 @@ int lua_cocos2dx_Texture2D_getContentSize(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Texture2D_isValid(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Texture2D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Texture2D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Texture2D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Texture2D_isValid'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Texture2D_isValid'", nullptr);
return 0;
}
bool ret = cobj->isValid();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Texture2D:isValid",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Texture2D_isValid'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Texture2D_setAliasTexParameters(lua_State* tolua_S)
{
int argc = 0;
@ -2022,7 +1925,6 @@ int lua_register_cocos2dx_Texture2D(lua_State* tolua_S)
tolua_function(tolua_S,"releaseGLTexture",lua_cocos2dx_Texture2D_releaseGLTexture);
tolua_function(tolua_S,"hasPremultipliedAlpha",lua_cocos2dx_Texture2D_hasPremultipliedAlpha);
tolua_function(tolua_S,"getPixelsHigh",lua_cocos2dx_Texture2D_getPixelsHigh);
tolua_function(tolua_S,"setValid",lua_cocos2dx_Texture2D_setValid);
tolua_function(tolua_S,"getBitsPerPixelForFormat",lua_cocos2dx_Texture2D_getBitsPerPixelForFormat);
tolua_function(tolua_S,"getName",lua_cocos2dx_Texture2D_getName);
tolua_function(tolua_S,"initWithString",lua_cocos2dx_Texture2D_initWithString);
@ -2030,7 +1932,6 @@ int lua_register_cocos2dx_Texture2D(lua_State* tolua_S)
tolua_function(tolua_S,"getPath",lua_cocos2dx_Texture2D_getPath);
tolua_function(tolua_S,"drawInRect",lua_cocos2dx_Texture2D_drawInRect);
tolua_function(tolua_S,"getContentSize",lua_cocos2dx_Texture2D_getContentSize);
tolua_function(tolua_S,"isValid",lua_cocos2dx_Texture2D_isValid);
tolua_function(tolua_S,"setAliasTexParameters",lua_cocos2dx_Texture2D_setAliasTexParameters);
tolua_function(tolua_S,"setAntiAliasTexParameters",lua_cocos2dx_Texture2D_setAntiAliasTexParameters);
tolua_function(tolua_S,"generateMipmap",lua_cocos2dx_Texture2D_generateMipmap);
@ -51243,6 +51144,53 @@ int lua_cocos2dx_Label_setDimensions(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Label_getWidth(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Label* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getWidth'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getWidth'", nullptr);
return 0;
}
double ret = cobj->getWidth();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getWidth",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getWidth'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Label_getString(lua_State* tolua_S)
{
int argc = 0;
@ -51632,6 +51580,53 @@ int lua_cocos2dx_Label_setWidth(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Label_getAdditionalKerning(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Label* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getAdditionalKerning'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getAdditionalKerning'", nullptr);
return 0;
}
double ret = cobj->getAdditionalKerning();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getAdditionalKerning",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getAdditionalKerning'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Label_getBMFontSize(lua_State* tolua_S)
{
int argc = 0;
@ -51773,6 +51768,53 @@ int lua_cocos2dx_Label_getHorizontalAlignment(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Label_getShadowOffset(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Label* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getShadowOffset'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getShadowOffset'", nullptr);
return 0;
}
cocos2d::Size ret = cobj->getShadowOffset();
size_to_luaval(tolua_S, ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getShadowOffset",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getShadowOffset'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Label_setClipMarginEnabled(lua_State* tolua_S)
{
int argc = 0;
@ -51923,6 +51965,53 @@ int lua_cocos2dx_Label_setSystemFontName(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Label_getOutlineSize(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Label* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getOutlineSize'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getOutlineSize'", nullptr);
return 0;
}
int ret = cobj->getOutlineSize();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getOutlineSize",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getOutlineSize'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Label_setBMFontFilePath(lua_State* tolua_S)
{
int argc = 0;
@ -52707,7 +52796,7 @@ int lua_cocos2dx_Label_enableOutline(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Label_getAdditionalKerning(lua_State* tolua_S)
int lua_cocos2dx_Label_getShadowBlurRadius(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Label* cobj = nullptr;
@ -52727,7 +52816,7 @@ int lua_cocos2dx_Label_getAdditionalKerning(lua_State* tolua_S)
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getAdditionalKerning'", nullptr);
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getShadowBlurRadius'", nullptr);
return 0;
}
#endif
@ -52737,19 +52826,66 @@ int lua_cocos2dx_Label_getAdditionalKerning(lua_State* tolua_S)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getAdditionalKerning'", nullptr);
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getShadowBlurRadius'", nullptr);
return 0;
}
double ret = cobj->getAdditionalKerning();
double ret = cobj->getShadowBlurRadius();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getAdditionalKerning",argc, 0);
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getShadowBlurRadius",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getAdditionalKerning'.",&tolua_err);
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getShadowBlurRadius'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Label_getEffectColor(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Label* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getEffectColor'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getEffectColor'", nullptr);
return 0;
}
cocos2d::Color4F ret = cobj->getEffectColor();
color4f_to_luaval(tolua_S, ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getEffectColor",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getEffectColor'.",&tolua_err);
#endif
return 0;
@ -53186,6 +53322,53 @@ int lua_cocos2dx_Label_getLineHeight(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Label_getShadowColor(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Label* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getShadowColor'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getShadowColor'", nullptr);
return 0;
}
cocos2d::Color4F ret = cobj->getShadowColor();
color4f_to_luaval(tolua_S, ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getShadowColor",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getShadowColor'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Label_getTTFConfig(lua_State* tolua_S)
{
int argc = 0;
@ -53430,7 +53613,7 @@ int lua_cocos2dx_Label_setHeight(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Label_getWidth(lua_State* tolua_S)
int lua_cocos2dx_Label_isShadowEnabled(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Label* cobj = nullptr;
@ -53450,7 +53633,7 @@ int lua_cocos2dx_Label_getWidth(lua_State* tolua_S)
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getWidth'", nullptr);
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_isShadowEnabled'", nullptr);
return 0;
}
#endif
@ -53460,19 +53643,19 @@ int lua_cocos2dx_Label_getWidth(lua_State* tolua_S)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getWidth'", nullptr);
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_isShadowEnabled'", nullptr);
return 0;
}
double ret = cobj->getWidth();
tolua_pushnumber(tolua_S,(lua_Number)ret);
bool ret = cobj->isShadowEnabled();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getWidth",argc, 0);
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:isShadowEnabled",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getWidth'.",&tolua_err);
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_isShadowEnabled'.",&tolua_err);
#endif
return 0;
@ -53912,6 +54095,53 @@ int lua_cocos2dx_Label_isWrapEnabled(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Label_getLabelEffectType(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Label* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getLabelEffectType'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getLabelEffectType'", nullptr);
return 0;
}
int ret = (int)cobj->getLabelEffectType();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getLabelEffectType",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getLabelEffectType'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Label_setAlignment(lua_State* tolua_S)
{
int argc = 0;
@ -54394,6 +54624,7 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S)
tolua_function(tolua_S,"isClipMarginEnabled",lua_cocos2dx_Label_isClipMarginEnabled);
tolua_function(tolua_S,"enableShadow",lua_cocos2dx_Label_enableShadow);
tolua_function(tolua_S,"setDimensions",lua_cocos2dx_Label_setDimensions);
tolua_function(tolua_S,"getWidth",lua_cocos2dx_Label_getWidth);
tolua_function(tolua_S,"getString",lua_cocos2dx_Label_getString);
tolua_function(tolua_S,"getHeight",lua_cocos2dx_Label_getHeight);
tolua_function(tolua_S,"disableEffect",lua_cocos2dx_Label_disableEffect);
@ -54402,12 +54633,15 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S)
tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_Label_getBlendFunc);
tolua_function(tolua_S,"enableWrap",lua_cocos2dx_Label_enableWrap);
tolua_function(tolua_S,"setWidth",lua_cocos2dx_Label_setWidth);
tolua_function(tolua_S,"getAdditionalKerning",lua_cocos2dx_Label_getAdditionalKerning);
tolua_function(tolua_S,"getBMFontSize",lua_cocos2dx_Label_getBMFontSize);
tolua_function(tolua_S,"getMaxLineWidth",lua_cocos2dx_Label_getMaxLineWidth);
tolua_function(tolua_S,"getHorizontalAlignment",lua_cocos2dx_Label_getHorizontalAlignment);
tolua_function(tolua_S,"getShadowOffset",lua_cocos2dx_Label_getShadowOffset);
tolua_function(tolua_S,"setClipMarginEnabled",lua_cocos2dx_Label_setClipMarginEnabled);
tolua_function(tolua_S,"setString",lua_cocos2dx_Label_setString);
tolua_function(tolua_S,"setSystemFontName",lua_cocos2dx_Label_setSystemFontName);
tolua_function(tolua_S,"getOutlineSize",lua_cocos2dx_Label_getOutlineSize);
tolua_function(tolua_S,"setBMFontFilePath",lua_cocos2dx_Label_setBMFontFilePath);
tolua_function(tolua_S,"initWithTTF",lua_cocos2dx_Label_initWithTTF);
tolua_function(tolua_S,"getFontAtlas",lua_cocos2dx_Label_getFontAtlas);
@ -54420,7 +54654,8 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S)
tolua_function(tolua_S,"setLineBreakWithoutSpace",lua_cocos2dx_Label_setLineBreakWithoutSpace);
tolua_function(tolua_S,"getStringNumLines",lua_cocos2dx_Label_getStringNumLines);
tolua_function(tolua_S,"enableOutline",lua_cocos2dx_Label_enableOutline);
tolua_function(tolua_S,"getAdditionalKerning",lua_cocos2dx_Label_getAdditionalKerning);
tolua_function(tolua_S,"getShadowBlurRadius",lua_cocos2dx_Label_getShadowBlurRadius);
tolua_function(tolua_S,"getEffectColor",lua_cocos2dx_Label_getEffectColor);
tolua_function(tolua_S,"removeAllChildrenWithCleanup",lua_cocos2dx_Label_removeAllChildrenWithCleanup);
tolua_function(tolua_S,"setCharMap",lua_cocos2dx_Label_setCharMap);
tolua_function(tolua_S,"getDimensions",lua_cocos2dx_Label_getDimensions);
@ -54429,12 +54664,13 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S)
tolua_function(tolua_S,"setVerticalAlignment",lua_cocos2dx_Label_setVerticalAlignment);
tolua_function(tolua_S,"setLineSpacing",lua_cocos2dx_Label_setLineSpacing);
tolua_function(tolua_S,"getLineHeight",lua_cocos2dx_Label_getLineHeight);
tolua_function(tolua_S,"getShadowColor",lua_cocos2dx_Label_getShadowColor);
tolua_function(tolua_S,"getTTFConfig",lua_cocos2dx_Label_getTTFConfig);
tolua_function(tolua_S,"getVerticalAlignment",lua_cocos2dx_Label_getVerticalAlignment);
tolua_function(tolua_S,"setTextColor",lua_cocos2dx_Label_setTextColor);
tolua_function(tolua_S,"getLetter",lua_cocos2dx_Label_getLetter);
tolua_function(tolua_S,"setHeight",lua_cocos2dx_Label_setHeight);
tolua_function(tolua_S,"getWidth",lua_cocos2dx_Label_getWidth);
tolua_function(tolua_S,"isShadowEnabled",lua_cocos2dx_Label_isShadowEnabled);
tolua_function(tolua_S,"enableGlow",lua_cocos2dx_Label_enableGlow);
tolua_function(tolua_S,"getOverflow",lua_cocos2dx_Label_getOverflow);
tolua_function(tolua_S,"setAdditionalKerning",lua_cocos2dx_Label_setAdditionalKerning);
@ -54444,6 +54680,7 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S)
tolua_function(tolua_S,"getBMFontFilePath",lua_cocos2dx_Label_getBMFontFilePath);
tolua_function(tolua_S,"setHorizontalAlignment",lua_cocos2dx_Label_setHorizontalAlignment);
tolua_function(tolua_S,"isWrapEnabled",lua_cocos2dx_Label_isWrapEnabled);
tolua_function(tolua_S,"getLabelEffectType",lua_cocos2dx_Label_getLabelEffectType);
tolua_function(tolua_S,"setAlignment",lua_cocos2dx_Label_setAlignment);
tolua_function(tolua_S,"requestSystemFontRefresh",lua_cocos2dx_Label_requestSystemFontRefresh);
tolua_function(tolua_S,"setBMFontSize",lua_cocos2dx_Label_setBMFontSize);
@ -88321,56 +88558,6 @@ int lua_cocos2dx_TextureCache_getTextureFilePath(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_TextureCache_setDirty(lua_State* tolua_S)
{
int argc = 0;
cocos2d::TextureCache* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.TextureCache",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::TextureCache*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TextureCache_setDirty'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.TextureCache:setDirty");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TextureCache_setDirty'", nullptr);
return 0;
}
cobj->setDirty(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TextureCache:setDirty",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TextureCache_setDirty'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_TextureCache_renameTextureWithKey(lua_State* tolua_S)
{
int argc = 0;
@ -88471,53 +88658,6 @@ int lua_cocos2dx_TextureCache_removeUnusedTextures(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_TextureCache_isDirty(lua_State* tolua_S)
{
int argc = 0;
cocos2d::TextureCache* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.TextureCache",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::TextureCache*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TextureCache_isDirty'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TextureCache_isDirty'", nullptr);
return 0;
}
bool ret = cobj->isDirty();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TextureCache:isDirty",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TextureCache_isDirty'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_TextureCache_removeTexture(lua_State* tolua_S)
{
int argc = 0;
@ -88675,10 +88815,8 @@ int lua_register_cocos2dx_TextureCache(lua_State* tolua_S)
tolua_function(tolua_S,"unbindImageAsync",lua_cocos2dx_TextureCache_unbindImageAsync);
tolua_function(tolua_S,"getTextureForKey",lua_cocos2dx_TextureCache_getTextureForKey);
tolua_function(tolua_S,"getTextureFilePath",lua_cocos2dx_TextureCache_getTextureFilePath);
tolua_function(tolua_S,"setDirty",lua_cocos2dx_TextureCache_setDirty);
tolua_function(tolua_S,"renameTextureWithKey",lua_cocos2dx_TextureCache_renameTextureWithKey);
tolua_function(tolua_S,"removeUnusedTextures",lua_cocos2dx_TextureCache_removeUnusedTextures);
tolua_function(tolua_S,"isDirty",lua_cocos2dx_TextureCache_isDirty);
tolua_function(tolua_S,"removeTexture",lua_cocos2dx_TextureCache_removeTexture);
tolua_function(tolua_S,"waitForQuit",lua_cocos2dx_TextureCache_waitForQuit);
tolua_endmodule(tolua_S);

View File

@ -2173,6 +2173,9 @@ int register_all_cocos2dx(lua_State* tolua_S);

View File

@ -2466,24 +2466,27 @@ int lua_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite(lua_St
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 2)
if (argc == 3)
{
cocos2d::Node* arg0;
cocos2d::ui::Scale9Sprite* arg1;
bool arg2;
ok &= luaval_to_object<cocos2d::Node>(tolua_S, 2, "cc.Node",&arg0, "cc.ControlButton:initWithLabelAndBackgroundSprite");
ok &= luaval_to_object<cocos2d::ui::Scale9Sprite>(tolua_S, 3, "ccui.Scale9Sprite",&arg1, "cc.ControlButton:initWithLabelAndBackgroundSprite");
ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.ControlButton:initWithLabelAndBackgroundSprite");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite'", nullptr);
return 0;
}
bool ret = cobj->initWithLabelAndBackgroundSprite(arg0, arg1);
bool ret = cobj->initWithLabelAndBackgroundSprite(arg0, arg1, arg2);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ControlButton:initWithLabelAndBackgroundSprite",argc, 2);
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ControlButton:initWithLabelAndBackgroundSprite",argc, 3);
return 0;
#if COCOS2D_DEBUG >= 1
@ -2662,6 +2665,25 @@ int lua_cocos2dx_extension_ControlButton_create(lua_State* tolua_S)
}
} while (0);
ok = true;
do
{
if (argc == 3)
{
cocos2d::Node* arg0;
ok &= luaval_to_object<cocos2d::Node>(tolua_S, 2, "cc.Node",&arg0, "cc.ControlButton:create");
if (!ok) { break; }
cocos2d::ui::Scale9Sprite* arg1;
ok &= luaval_to_object<cocos2d::ui::Scale9Sprite>(tolua_S, 3, "ccui.Scale9Sprite",&arg1, "cc.ControlButton:create");
if (!ok) { break; }
bool arg2;
ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.ControlButton:create");
if (!ok) { break; }
cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0, arg1, arg2);
object_to_luaval<cocos2d::extension::ControlButton>(tolua_S, "cc.ControlButton",(cocos2d::extension::ControlButton*)ret);
return 1;
}
} while (0);
ok = true;
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.ControlButton:create",argc, 3);
return 0;
#if COCOS2D_DEBUG >= 1
@ -13296,6 +13318,53 @@ int lua_cocos2dx_extension_ParticleSystem3D_isEnabled(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_extension_ParticleSystem3D_getRender(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ParticleSystem3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.ParticleSystem3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ParticleSystem3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_extension_ParticleSystem3D_getRender'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_extension_ParticleSystem3D_getRender'", nullptr);
return 0;
}
cocos2d::Particle3DRender* ret = cobj->getRender();
object_to_luaval<cocos2d::Particle3DRender>(tolua_S, "cc.Particle3DRender",(cocos2d::Particle3DRender*)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ParticleSystem3D:getRender",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_extension_ParticleSystem3D_getRender'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_extension_ParticleSystem3D_setEmitter(lua_State* tolua_S)
{
int argc = 0;
@ -13981,6 +14050,7 @@ int lua_register_cocos2dx_extension_ParticleSystem3D(lua_State* tolua_S)
tolua_function(tolua_S,"addAffector",lua_cocos2dx_extension_ParticleSystem3D_addAffector);
tolua_function(tolua_S,"startParticleSystem",lua_cocos2dx_extension_ParticleSystem3D_startParticleSystem);
tolua_function(tolua_S,"isEnabled",lua_cocos2dx_extension_ParticleSystem3D_isEnabled);
tolua_function(tolua_S,"getRender",lua_cocos2dx_extension_ParticleSystem3D_getRender);
tolua_function(tolua_S,"setEmitter",lua_cocos2dx_extension_ParticleSystem3D_setEmitter);
tolua_function(tolua_S,"isKeepLocal",lua_cocos2dx_extension_ParticleSystem3D_isKeepLocal);
tolua_function(tolua_S,"setEnabled",lua_cocos2dx_extension_ParticleSystem3D_setEnabled);

View File

@ -342,6 +342,7 @@ int register_all_cocos2dx_extension(lua_State* tolua_S);
#endif // __cocos2dx_extension_h__

View File

@ -11530,6 +11530,53 @@ int lua_cocos2dx_ui_Text_disableEffect(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Text_getLabelEffectType(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Text* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_getLabelEffectType'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Text_getLabelEffectType'", nullptr);
return 0;
}
int ret = (int)cobj->getLabelEffectType();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:getLabelEffectType",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_getLabelEffectType'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Text_getTextColor(lua_State* tolua_S)
{
int argc = 0;
@ -11727,6 +11774,53 @@ int lua_cocos2dx_ui_Text_setTouchScaleChangeEnabled(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Text_getShadowOffset(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Text* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_getShadowOffset'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Text_getShadowOffset'", nullptr);
return 0;
}
cocos2d::Size ret = cobj->getShadowOffset();
size_to_luaval(tolua_S, ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:getShadowOffset",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_getShadowOffset'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Text_setString(lua_State* tolua_S)
{
int argc = 0;
@ -11777,6 +11871,53 @@ int lua_cocos2dx_ui_Text_setString(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Text_getOutlineSize(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Text* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_getOutlineSize'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Text_getOutlineSize'", nullptr);
return 0;
}
int ret = cobj->getOutlineSize();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:getOutlineSize",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_getOutlineSize'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Text_init(lua_State* tolua_S)
{
int argc = 0;
@ -11833,6 +11974,53 @@ int lua_cocos2dx_ui_Text_init(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Text_getShadowBlurRadius(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Text* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_getShadowBlurRadius'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Text_getShadowBlurRadius'", nullptr);
return 0;
}
double ret = cobj->getShadowBlurRadius();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:getShadowBlurRadius",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_getShadowBlurRadius'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Text_isTouchScaleChangeEnabled(lua_State* tolua_S)
{
int argc = 0;
@ -12138,6 +12326,53 @@ int lua_cocos2dx_ui_Text_enableOutline(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Text_getEffectColor(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Text* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_getEffectColor'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Text_getEffectColor'", nullptr);
return 0;
}
cocos2d::Color4B ret = cobj->getEffectColor();
color4b_to_luaval(tolua_S, ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:getEffectColor",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_getEffectColor'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Text_getType(lua_State* tolua_S)
{
int argc = 0;
@ -12232,6 +12467,53 @@ int lua_cocos2dx_ui_Text_getTextHorizontalAlignment(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Text_isShadowEnabled(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Text* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_isShadowEnabled'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Text_isShadowEnabled'", nullptr);
return 0;
}
bool ret = cobj->isShadowEnabled();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:isShadowEnabled",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_isShadowEnabled'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Text_setFontSize(lua_State* tolua_S)
{
int argc = 0;
@ -12282,6 +12564,53 @@ int lua_cocos2dx_ui_Text_setFontSize(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Text_getShadowColor(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Text* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_getShadowColor'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Text_getShadowColor'", nullptr);
return 0;
}
cocos2d::Color4B ret = cobj->getShadowColor();
color4b_to_luaval(tolua_S, ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:getShadowColor",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_getShadowColor'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Text_setTextColor(lua_State* tolua_S)
{
int argc = 0;
@ -12665,21 +12994,28 @@ int lua_register_cocos2dx_ui_Text(lua_State* tolua_S)
tolua_function(tolua_S,"getFontSize",lua_cocos2dx_ui_Text_getFontSize);
tolua_function(tolua_S,"getString",lua_cocos2dx_ui_Text_getString);
tolua_function(tolua_S,"disableEffect",lua_cocos2dx_ui_Text_disableEffect);
tolua_function(tolua_S,"getLabelEffectType",lua_cocos2dx_ui_Text_getLabelEffectType);
tolua_function(tolua_S,"getTextColor",lua_cocos2dx_ui_Text_getTextColor);
tolua_function(tolua_S,"setTextVerticalAlignment",lua_cocos2dx_ui_Text_setTextVerticalAlignment);
tolua_function(tolua_S,"setFontName",lua_cocos2dx_ui_Text_setFontName);
tolua_function(tolua_S,"setTouchScaleChangeEnabled",lua_cocos2dx_ui_Text_setTouchScaleChangeEnabled);
tolua_function(tolua_S,"getShadowOffset",lua_cocos2dx_ui_Text_getShadowOffset);
tolua_function(tolua_S,"setString",lua_cocos2dx_ui_Text_setString);
tolua_function(tolua_S,"getOutlineSize",lua_cocos2dx_ui_Text_getOutlineSize);
tolua_function(tolua_S,"init",lua_cocos2dx_ui_Text_init);
tolua_function(tolua_S,"getShadowBlurRadius",lua_cocos2dx_ui_Text_getShadowBlurRadius);
tolua_function(tolua_S,"isTouchScaleChangeEnabled",lua_cocos2dx_ui_Text_isTouchScaleChangeEnabled);
tolua_function(tolua_S,"getFontName",lua_cocos2dx_ui_Text_getFontName);
tolua_function(tolua_S,"setTextAreaSize",lua_cocos2dx_ui_Text_setTextAreaSize);
tolua_function(tolua_S,"getStringLength",lua_cocos2dx_ui_Text_getStringLength);
tolua_function(tolua_S,"getAutoRenderSize",lua_cocos2dx_ui_Text_getAutoRenderSize);
tolua_function(tolua_S,"enableOutline",lua_cocos2dx_ui_Text_enableOutline);
tolua_function(tolua_S,"getEffectColor",lua_cocos2dx_ui_Text_getEffectColor);
tolua_function(tolua_S,"getType",lua_cocos2dx_ui_Text_getType);
tolua_function(tolua_S,"getTextHorizontalAlignment",lua_cocos2dx_ui_Text_getTextHorizontalAlignment);
tolua_function(tolua_S,"isShadowEnabled",lua_cocos2dx_ui_Text_isShadowEnabled);
tolua_function(tolua_S,"setFontSize",lua_cocos2dx_ui_Text_setFontSize);
tolua_function(tolua_S,"getShadowColor",lua_cocos2dx_ui_Text_getShadowColor);
tolua_function(tolua_S,"setTextColor",lua_cocos2dx_ui_Text_setTextColor);
tolua_function(tolua_S,"enableGlow",lua_cocos2dx_ui_Text_enableGlow);
tolua_function(tolua_S,"getTextVerticalAlignment",lua_cocos2dx_ui_Text_getTextVerticalAlignment);
@ -18496,53 +18832,6 @@ int lua_cocos2dx_ui_Slider_getBallNormalFile(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Slider* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer'", nullptr);
return 0;
}
const cocos2d::Rect& ret = cobj->getCapInsetsProgressBarRebderer();
rect_to_luaval(tolua_S, ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getCapInsetsProgressBarRebderer",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Slider_setScale9Enabled(lua_State* tolua_S)
{
int argc = 0;
@ -18687,6 +18976,56 @@ int lua_cocos2dx_ui_Slider_getZoomScale(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Slider* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::Rect arg0;
ok &= luaval_to_rect(tolua_S, 2, &arg0, "ccui.Slider:setCapInsetProgressBarRenderer");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer'", nullptr);
return 0;
}
cobj->setCapInsetProgressBarRenderer(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:setCapInsetProgressBarRenderer",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Slider_loadSlidBallTextures(lua_State* tolua_S)
{
int argc = 0;
@ -19062,6 +19401,53 @@ int lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Slider* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer'", nullptr);
return 0;
}
const cocos2d::Rect& ret = cobj->getCapInsetsProgressBarRenderer();
rect_to_luaval(tolua_S, ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getCapInsetsProgressBarRenderer",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed(lua_State* tolua_S)
{
int argc = 0;
@ -19270,56 +19656,6 @@ int lua_cocos2dx_ui_Slider_getBallDisabledFile(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Slider* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::Rect arg0;
ok &= luaval_to_rect(tolua_S, 2, &arg0, "ccui.Slider:setCapInsetProgressBarRebderer");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer'", nullptr);
return 0;
}
cobj->setCapInsetProgressBarRebderer(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:setCapInsetProgressBarRebderer",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Slider_setCapInsetsBarRenderer(lua_State* tolua_S)
{
int argc = 0;
@ -19740,21 +20076,21 @@ int lua_register_cocos2dx_ui_Slider(lua_State* tolua_S)
tolua_function(tolua_S,"loadSlidBallTextureNormal",lua_cocos2dx_ui_Slider_loadSlidBallTextureNormal);
tolua_function(tolua_S,"loadProgressBarTexture",lua_cocos2dx_ui_Slider_loadProgressBarTexture);
tolua_function(tolua_S,"getBallNormalFile",lua_cocos2dx_ui_Slider_getBallNormalFile);
tolua_function(tolua_S,"getCapInsetsProgressBarRebderer",lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer);
tolua_function(tolua_S,"setScale9Enabled",lua_cocos2dx_ui_Slider_setScale9Enabled);
tolua_function(tolua_S,"getBallPressedFile",lua_cocos2dx_ui_Slider_getBallPressedFile);
tolua_function(tolua_S,"getZoomScale",lua_cocos2dx_ui_Slider_getZoomScale);
tolua_function(tolua_S,"setCapInsetProgressBarRenderer",lua_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer);
tolua_function(tolua_S,"loadSlidBallTextures",lua_cocos2dx_ui_Slider_loadSlidBallTextures);
tolua_function(tolua_S,"addEventListener",lua_cocos2dx_ui_Slider_addEventListener);
tolua_function(tolua_S,"setMaxPercent",lua_cocos2dx_ui_Slider_setMaxPercent);
tolua_function(tolua_S,"loadBarTexture",lua_cocos2dx_ui_Slider_loadBarTexture);
tolua_function(tolua_S,"getProgressBarFile",lua_cocos2dx_ui_Slider_getProgressBarFile);
tolua_function(tolua_S,"getCapInsetsBarRenderer",lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer);
tolua_function(tolua_S,"getCapInsetsProgressBarRenderer",lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer);
tolua_function(tolua_S,"loadSlidBallTexturePressed",lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed);
tolua_function(tolua_S,"getBackFile",lua_cocos2dx_ui_Slider_getBackFile);
tolua_function(tolua_S,"isScale9Enabled",lua_cocos2dx_ui_Slider_isScale9Enabled);
tolua_function(tolua_S,"getBallDisabledFile",lua_cocos2dx_ui_Slider_getBallDisabledFile);
tolua_function(tolua_S,"setCapInsetProgressBarRebderer",lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer);
tolua_function(tolua_S,"setCapInsetsBarRenderer",lua_cocos2dx_ui_Slider_setCapInsetsBarRenderer);
tolua_function(tolua_S,"getPercent",lua_cocos2dx_ui_Slider_getPercent);
tolua_function(tolua_S,"setCapInsets",lua_cocos2dx_ui_Slider_setCapInsets);

View File

@ -650,6 +650,13 @@ int register_all_cocos2dx_ui(lua_State* tolua_S);

View File

@ -287,6 +287,10 @@
BA0CBB5F1BB0756F00003364 /* CCComponentLua.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0CBB5C1BB0756F00003364 /* CCComponentLua.cpp */; settings = {ASSET_TAGS = (); }; };
BA0CBB601BB0756F00003364 /* CCComponentLua.h in Headers */ = {isa = PBXBuildFile; fileRef = BA0CBB5D1BB0756F00003364 /* CCComponentLua.h */; settings = {ASSET_TAGS = (); }; };
BA0CBB611BB0756F00003364 /* CCComponentLua.h in Headers */ = {isa = PBXBuildFile; fileRef = BA0CBB5D1BB0756F00003364 /* CCComponentLua.h */; settings = {ASSET_TAGS = (); }; };
ADAC23ED1C2044A60049A6A2 /* lua_module_register.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADD1C0D21C196B9500733781 /* lua_module_register.cpp */; };
ADD1C0D51C196B9500733781 /* lua_module_register.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADD1C0D21C196B9500733781 /* lua_module_register.cpp */; };
ADD1C0D61C196B9500733781 /* lua_module_register.h in Headers */ = {isa = PBXBuildFile; fileRef = ADD1C0D31C196B9500733781 /* lua_module_register.h */; };
ADD1C0D71C196B9500733781 /* Lua-BindingsExport.h in Headers */ = {isa = PBXBuildFile; fileRef = ADD1C0D41C196B9500733781 /* Lua-BindingsExport.h */; };
F4FE0D5719ECD00100B8B12B /* luasocket_scripts.c in Sources */ = {isa = PBXBuildFile; fileRef = F4FE0D5519ECD00100B8B12B /* luasocket_scripts.c */; };
F4FE0D5819ECD00100B8B12B /* luasocket_scripts.c in Sources */ = {isa = PBXBuildFile; fileRef = F4FE0D5519ECD00100B8B12B /* luasocket_scripts.c */; };
F4FE0D5919ECD00100B8B12B /* luasocket_scripts.h in Headers */ = {isa = PBXBuildFile; fileRef = F4FE0D5619ECD00100B8B12B /* luasocket_scripts.h */; };
@ -445,6 +449,9 @@
3E2BDB0919C5E6100055CDCD /* lua_cocos2dx_audioengine_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_cocos2dx_audioengine_manual.h; sourceTree = "<group>"; };
566F015D19B5EB0F00FCA620 /* CustomGUIReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomGUIReader.cpp; sourceTree = "<group>"; };
566F015E19B5EB0F00FCA620 /* CustomGUIReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomGUIReader.h; sourceTree = "<group>"; };
ADD1C0D21C196B9500733781 /* lua_module_register.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_module_register.cpp; sourceTree = "<group>"; };
ADD1C0D31C196B9500733781 /* lua_module_register.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_module_register.h; sourceTree = "<group>"; };
ADD1C0D41C196B9500733781 /* Lua-BindingsExport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Lua-BindingsExport.h"; sourceTree = "<group>"; };
BA0CBB5C1BB0756F00003364 /* CCComponentLua.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCComponentLua.cpp; sourceTree = "<group>"; };
BA0CBB5D1BB0756F00003364 /* CCComponentLua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCComponentLua.h; sourceTree = "<group>"; };
C0D9BAFA1974D30000EC35BB /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = ../../../../external/lua/lua/prebuilt/ios/liblua.a; sourceTree = "<group>"; };
@ -680,6 +687,9 @@
15C1BD141986526C00A46ACC /* spine */,
15C1BD191986526C00A46ACC /* ui */,
15C1BCD21986525900A46ACC /* cocos2d */,
ADD1C0D21C196B9500733781 /* lua_module_register.cpp */,
ADD1C0D31C196B9500733781 /* lua_module_register.h */,
ADD1C0D41C196B9500733781 /* Lua-BindingsExport.h */,
1AACE76018BC45C200215002 /* CCLuaBridge.cpp */,
1AACE76118BC45C200215002 /* CCLuaBridge.h */,
1AACE76218BC45C200215002 /* CCLuaEngine.cpp */,
@ -857,6 +867,7 @@
15415AAB19A71A53004F1E71 /* buffer.h in Headers */,
15AC69DE1987711400D17520 /* lauxlib.h in Headers */,
155C7E1419A71CA800F08B25 /* Lua_web_socket.h in Headers */,
ADD1C0D61C196B9500733781 /* lua_module_register.h in Headers */,
15AC69DF1987711400D17520 /* lua.h in Headers */,
15AC69E01987711400D17520 /* luaconf.h in Headers */,
155C7DF819A71C4400F08B25 /* lua_cocos2dx_cocosdenshion_manual.h in Headers */,
@ -888,6 +899,7 @@
15415AD319A71A53004F1E71 /* timeout.h in Headers */,
15C1C2D5198749BC00A46ACC /* LuaOpengl.h in Headers */,
15A561EE1B00A3F1005D4720 /* lua_cocos2dx_physics3d_manual.h in Headers */,
ADD1C0D71C196B9500733781 /* Lua-BindingsExport.h in Headers */,
155C7E2819A71CE600F08B25 /* lua_cocos2dx_ui_manual.hpp in Headers */,
15C1C2D6198749BC00A46ACC /* lua_cocos2dx_deprecated.h in Headers */,
15C1C2D7198749BC00A46ACC /* lua_cocos2dx_experimental_manual.hpp in Headers */,
@ -1068,6 +1080,7 @@
15AC69DA1987710400D17520 /* tolua_is.c in Sources */,
15415ACD19A71A53004F1E71 /* tcp.c in Sources */,
15AC69DB1987710400D17520 /* tolua_map.c in Sources */,
ADD1C0D51C196B9500733781 /* lua_module_register.cpp in Sources */,
15415AD519A71A53004F1E71 /* udp.c in Sources */,
150983D01B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.cpp in Sources */,
15415ADD19A71A53004F1E71 /* usocket.c in Sources */,
@ -1133,6 +1146,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ADAC23ED1C2044A60049A6A2 /* lua_module_register.cpp in Sources */,
15415AC619A71A53004F1E71 /* select.c in Sources */,
15A561ED1B00A3F1005D4720 /* lua_cocos2dx_physics3d_manual.cpp in Sources */,
15EFA646198B3311000C57D3 /* tolua_event.c in Sources */,

View File

@ -256,7 +256,7 @@ void Button::loadTextureNormal(const std::string& normal,TextureResType texType)
}
}
//FIXME: https://github.com/cocos2d/cocos2d-x/issues/12249
if (!_ignoreSize) {
if (!_ignoreSize && _customSize.equals(Size::ZERO)) {
_customSize = _buttonNormalRenderer->getContentSize();
}
this->setupNormalTexture(textureLoaded);

View File

@ -137,7 +137,7 @@ void ImageView::loadTexture(const std::string& fileName, TextureResType texType)
break;
}
//FIXME: https://github.com/cocos2d/cocos2d-x/issues/12249
if (!_ignoreSize) {
if (!_ignoreSize && _customSize.equals(Size::ZERO)) {
_customSize = _imageRenderer->getContentSize();
}
this->setupTexture();

View File

@ -87,6 +87,7 @@ _isFocusPassing(false)
Layout::~Layout()
{
CC_SAFE_RELEASE(_clippingStencil);
CC_SAFE_DELETE(_stencileStateManager);
}
void Layout::onEnter()

View File

@ -390,8 +390,8 @@ protected:
virtual void onItemListChanged();
virtual void remedyLayoutParameter(Widget* item);
void updateInnerContainerSize();
void remedyLayoutParameter(Widget* item);
void remedyVerticalLayoutParameter(LinearLayoutParameter* layoutParameter, ssize_t itemIndex);
void remedyHorizontalLayoutParameter(LinearLayoutParameter* layoutParameter,ssize_t itemIndex);

View File

@ -111,26 +111,10 @@ void LoadingBar::setDirection(cocos2d::ui::LoadingBar::Direction direction)
case Direction::LEFT:
_barRenderer->setAnchorPoint(Vec2(0.0f,0.5f));
_barRenderer->setPosition(Vec2(0,_contentSize.height*0.5f));
if (!_scale9Enabled)
{
auto innerSprite = _barRenderer->getSprite();
if (nullptr != innerSprite)
{
innerSprite->setFlippedX(false);
}
}
break;
case Direction::RIGHT:
_barRenderer->setAnchorPoint(Vec2(1.0f,0.5f));
_barRenderer->setPosition(Vec2(_totalLength,_contentSize.height*0.5f));
if (!_scale9Enabled)
{
auto innerSprite = _barRenderer->getSprite();
if (nullptr != innerSprite)
{
innerSprite->setFlippedX(true);
}
}
break;
}
@ -163,7 +147,7 @@ void LoadingBar::loadTexture(const std::string& texture,TextureResType texType)
}
//FIXME: https://github.com/cocos2d/cocos2d-x/issues/12249
if (!_ignoreSize) {
if (!_ignoreSize && _customSize.equals(Size::ZERO)) {
_customSize = _barRenderer->getContentSize();
}
this->setupTexture();
@ -183,25 +167,9 @@ void LoadingBar::setupTexture()
{
case Direction::LEFT:
_barRenderer->setAnchorPoint(Vec2(0.0f,0.5f));
if (!_scale9Enabled)
{
auto innerSprite = _barRenderer->getSprite();
if (nullptr != innerSprite)
{
innerSprite->setFlippedX(false);
}
}
break;
case Direction::RIGHT:
_barRenderer->setAnchorPoint(Vec2(1.0f,0.5f));
if (!_scale9Enabled)
{
auto innerSprite = _barRenderer->getSprite();
if (nullptr != innerSprite)
{
innerSprite->setFlippedX(true);
}
}
break;
}
_barRenderer->setCapInsets(_capInsets);

View File

@ -427,6 +427,11 @@ const Color3B& PageView::getIndicatorSelectedIndexColor() const
return _indicator->getSelectedIndexColor();
}
void PageView::remedyLayoutParameter(Widget *item)
{
item->setContentSize(this->getContentSize());
ListView::remedyLayoutParameter(item);
}
}

View File

@ -350,6 +350,7 @@ CC_CONSTRUCTOR_ACCESS:
protected:
void pageTurningEvent();
virtual void remedyLayoutParameter(Widget* item)override;
virtual void moveInnerContainer(const Vec2& deltaMove, bool canStartBounceBack) override;
virtual void onItemListChanged() override;
virtual void onSizeChanged() override;

View File

@ -471,6 +471,7 @@ namespace ui {
_spriteFrameRotated = rotated;
_originalSize = size;
_preferredSize = size;
_offset = offset;
_capInsetsInternal = capInsets;
@ -520,23 +521,31 @@ namespace ui {
auto capInsets = CC_RECT_POINTS_TO_PIXELS(_capInsetsInternal);
auto textureRect = CC_RECT_POINTS_TO_PIXELS(_spriteRect);
auto spriteRectSize = CC_SIZE_POINTS_TO_PIXELS(_originalSize);
auto spriteRectSize = _spriteRect.size;
auto originalSize = CC_SIZE_POINTS_TO_PIXELS(_originalSize);
auto offset = CC_POINT_POINTS_TO_PIXELS(_offset);
Vec4 offsets;
offsets.x = offset.x + (originalSize.width - textureRect.size.width) / 2;
offsets.w = offset.y + (originalSize.height - textureRect.size.height) / 2;
offsets.z = originalSize.width - textureRect.size.width - offsets.x;
offsets.y = originalSize.height - textureRect.size.height - offsets.w;
//handle .9.png
if (_isPatch9)
{
spriteRectSize = Size(spriteRectSize.width - 2, spriteRectSize.height-2);
originalSize = Size(originalSize.width - 2, originalSize.height-2);
}
if(capInsets.equals(Rect::ZERO))
{
capInsets = Rect(spriteRectSize.width/3, spriteRectSize.height/3,
spriteRectSize.width/3, spriteRectSize.height/3);
capInsets = Rect(originalSize.width/3, originalSize.height/3,
originalSize.width/3, originalSize.height/3);
}
auto uv = this->calculateUV(tex, capInsets, spriteRectSize);
auto vertices = this->calculateVertices(capInsets, spriteRectSize);
auto uv = this->calculateUV(tex, capInsets, originalSize, offsets);
auto vertices = this->calculateVertices(capInsets, originalSize, offsets);
auto triangles = this->calculateTriangles(uv, vertices);
_scale9Image->getPolygonInfo().setTriangles(triangles);
@ -650,7 +659,7 @@ namespace ui {
this->updateWithSprite(this->_scale9Image,
_spriteRect,
_spriteFrameRotated,
Vec2::ZERO,
_offset,
_originalSize,
capInsets);
this->_insetLeft = capInsets.origin.x;
@ -687,7 +696,7 @@ namespace ui {
void Scale9Sprite::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
if (_scale9Image) {
if (_scale9Image && _scale9Enabled) {
#if CC_USE_CULLING
// Don't do calculate the culling if the transform was not updated
auto visitingCamera = Camera::getVisitingCamera();
@ -774,12 +783,21 @@ namespace ui {
else
break;
}
if (!_scale9Enabled && _scale9Image && _scale9Image->getLocalZOrder() < 0 )
{
_scale9Image->visit(renderer, _modelViewTransform, flags);
}
// draw self
//
if (isVisitableByVisitingCamera())
this->draw(renderer, _modelViewTransform, flags);
if (!_scale9Enabled && _scale9Image && _scale9Image->getLocalZOrder() >= 0 )
{
_scale9Image->visit(renderer, _modelViewTransform, flags);
}
for(auto it=_children.cbegin()+i; it != _children.cend(); ++it)
(*it)->visit(renderer, _modelViewTransform, flags);
@ -1070,7 +1088,8 @@ namespace ui {
// u0 u1 u2 u3
std::vector<Vec2> Scale9Sprite::calculateUV(Texture2D *tex,
const Rect& capInsets,
const Size& spriteRectSize)
const Size& originalSize,
const Vec4& offsets)
{
auto atlasWidth = tex->getPixelsWide();
auto atlasHeight = tex->getPixelsHigh();
@ -1081,23 +1100,46 @@ namespace ui {
if (_spriteFrameRotated)
{
rightWidth = capInsets.origin.y;
rightWidth = capInsets.origin.y - offsets.y;
centerWidth = capInsets.size.height;
leftWidth = spriteRectSize.height - centerWidth - rightWidth;
leftWidth = originalSize.height - centerWidth - capInsets.origin.y - offsets.w;
topHeight = capInsets.origin.x;
topHeight = capInsets.origin.x - offsets.x;
centerHeight = capInsets.size.width;
bottomHeight = spriteRectSize.width - (topHeight + centerHeight);
bottomHeight = originalSize.width - (capInsets.origin.x + centerHeight) - offsets.z;
}
else
{
leftWidth = capInsets.origin.x;
leftWidth = capInsets.origin.x - offsets.x;
centerWidth = capInsets.size.width;
rightWidth = spriteRectSize.width - (leftWidth + centerWidth);
rightWidth = originalSize.width - (capInsets.origin.x + centerWidth) - offsets.z;
topHeight = capInsets.origin.y;
topHeight = capInsets.origin.y - offsets.y;
centerHeight = capInsets.size.height;
bottomHeight =spriteRectSize.height - (topHeight + centerHeight);
bottomHeight = originalSize.height - (capInsets.origin.y + centerHeight) - offsets.w;
}
if(leftWidth<0)
{
centerWidth += leftWidth;
leftWidth = 0;
}
if(rightWidth<0)
{
centerWidth += rightWidth;
rightWidth = 0;
}
if(topHeight<0)
{
centerHeight += topHeight;
topHeight = 0;
}
if(bottomHeight<0)
{
centerHeight += bottomHeight;
bottomHeight = 0;
}
auto textureRect = CC_RECT_POINTS_TO_PIXELS(_spriteRect);
@ -1167,67 +1209,111 @@ namespace ui {
//x0,y0--------------------
// x1 x2 x3
std::vector<Vec2> Scale9Sprite::calculateVertices(const Rect& capInsets,
const Size& spriteRectSize)
const Size& originalSize,
const Vec4& offsets)
{
float leftWidth = 0, centerWidth = 0, rightWidth = 0;
float topHeight = 0, centerHeight = 0, bottomHeight = 0;
leftWidth = capInsets.origin.x;
centerWidth = capInsets.size.width;
rightWidth = spriteRectSize.width - (leftWidth + centerWidth);
topHeight = capInsets.origin.y;
centerHeight = capInsets.size.height;
bottomHeight = spriteRectSize.height - (topHeight + centerHeight);
leftWidth = leftWidth / CC_CONTENT_SCALE_FACTOR();
rightWidth = rightWidth / CC_CONTENT_SCALE_FACTOR();
topHeight = topHeight / CC_CONTENT_SCALE_FACTOR();
bottomHeight = bottomHeight / CC_CONTENT_SCALE_FACTOR();
float sizableWidth = _preferredSize.width - leftWidth - rightWidth;
float sizableHeight = _preferredSize.height - topHeight - bottomHeight;
float x0,x1,x2,x3;
float y0,y1,y2,y3;
if(sizableWidth >= 0)
{
x0 = 0;
x1 = leftWidth;
x2 = leftWidth + sizableWidth;
x3 = _preferredSize.width;
}
else
{
float xScale = _preferredSize.width / (leftWidth + rightWidth);
x0 = 0;
x1 = x2 = leftWidth * xScale;
x3 = (leftWidth + rightWidth) * xScale;
}
if(sizableHeight >= 0)
{
y0 = 0;
y1 = bottomHeight;
y2 = bottomHeight + sizableHeight;
y3 = _preferredSize.height;
}
else
{
float yScale = _preferredSize.height / (topHeight + bottomHeight);
y0 = 0;
y1 = y2= bottomHeight * yScale;
y3 = (bottomHeight + topHeight) * yScale;
}
std::vector<Vec2> vertices;
float offsetLeft = offsets.x / CC_CONTENT_SCALE_FACTOR();
float offsetTop = offsets.y / CC_CONTENT_SCALE_FACTOR();
float offsetRight = offsets.z / CC_CONTENT_SCALE_FACTOR();
float offsetBottom = offsets.w / CC_CONTENT_SCALE_FACTOR();
std::vector<Vec2> vertices;
if (_renderingType == RenderingType::SIMPLE)
{
vertices = {Vec2(x0,y0), Vec2(x3,y3)};
float hScale = _preferredSize.width / (originalSize.width / CC_CONTENT_SCALE_FACTOR());
float vScale = _preferredSize.height / (originalSize.height / CC_CONTENT_SCALE_FACTOR());
vertices = {Vec2(offsetLeft * hScale, offsetBottom * vScale),
Vec2(_preferredSize.width - offsetRight * hScale, _preferredSize.height - offsetTop * vScale)};
}
else
{
vertices = {Vec2(x0,y0), Vec2(x1,y1), Vec2(x2,y2), Vec2(x3,y3)};
float leftWidth = 0, centerWidth = 0, rightWidth = 0;
float topHeight = 0, centerHeight = 0, bottomHeight = 0;
leftWidth = capInsets.origin.x;
centerWidth = capInsets.size.width;
rightWidth = originalSize.width - (leftWidth + centerWidth);
topHeight = capInsets.origin.y;
centerHeight = capInsets.size.height;
bottomHeight = originalSize.height - (topHeight + centerHeight);
leftWidth = leftWidth / CC_CONTENT_SCALE_FACTOR();
rightWidth = rightWidth / CC_CONTENT_SCALE_FACTOR();
centerWidth = centerWidth / CC_CONTENT_SCALE_FACTOR();
topHeight = topHeight / CC_CONTENT_SCALE_FACTOR();
bottomHeight = bottomHeight / CC_CONTENT_SCALE_FACTOR();
centerHeight = centerHeight / CC_CONTENT_SCALE_FACTOR();
float sizableWidth = _preferredSize.width - leftWidth - rightWidth;
float sizableHeight = _preferredSize.height - topHeight - bottomHeight;
leftWidth -= offsetLeft;
rightWidth -= offsetRight;
topHeight -= offsetTop;
bottomHeight -= offsetBottom;
float hScale = sizableWidth / centerWidth;
float vScale = sizableHeight / centerHeight;
if(leftWidth<0)
{
offsetLeft -= leftWidth * (hScale - 1.0f);
sizableWidth += leftWidth * hScale;
leftWidth = 0;
}
if(rightWidth<0)
{
sizableWidth += rightWidth * hScale;
rightWidth = 0;
}
if(topHeight<0)
{
sizableHeight += topHeight * vScale;
topHeight = 0;
}
if(bottomHeight<0)
{
offsetBottom -= bottomHeight * (vScale - 1.0f);
sizableHeight += bottomHeight * vScale;
bottomHeight = 0;
}
float x0,x1,x2,x3;
float y0,y1,y2,y3;
if(sizableWidth >= 0)
{
x0 = offsetLeft;
x1 = x0 + leftWidth;
x2 = x1 + sizableWidth;
x3 = x2 + rightWidth;
}
else
{
float xScale = _preferredSize.width / (leftWidth + rightWidth);
x0 = offsetLeft;
x1 = x2 = offsetLeft + leftWidth * xScale;
x3 = x2 + rightWidth * xScale;
}
if(sizableHeight >= 0)
{
y0 = offsetBottom;
y1 = y0 + bottomHeight;
y2 = y1 + sizableHeight;
y3 = y2 + topHeight;
}
else
{
float yScale = _preferredSize.height / (topHeight + bottomHeight);
y0 = offsetBottom;
y1 = y2 = y0 + bottomHeight * yScale;
y3 = y2 + topHeight * yScale;
}
vertices = {Vec2(x0,y0), Vec2(x1,y1), Vec2(x2,y2), Vec2(x3,y3)};
}
return vertices;
}
@ -1353,5 +1439,14 @@ namespace ui {
CC_SAFE_RELEASE_NULL(this->_scale9Image);
}
void Scale9Sprite::setGlobalZOrder(float globalZOrder)
{
Node::setGlobalZOrder(globalZOrder);
if (_scale9Image)
{
_scale9Image->setGlobalZOrder(globalZOrder);
}
}
}}

View File

@ -577,6 +577,8 @@ namespace ui {
/**
* @brief Toggle 9-slice feature.
* If Scale9Sprite is 9-slice disabled, the Scale9Sprite will rendered as a normal sprite.
* @warning: Don't use setScale9Enabled(false), use setRenderingType(RenderingType::SIMPLE) instead.
* The setScale9Enabled(false) is kept only for back back compatibility.
* @param enabled True to enable 9-slice, false otherwise.
* @js NA
*/
@ -657,7 +659,8 @@ namespace ui {
virtual float getScale() const override;
using Node::getScaleZ;
virtual void setCameraMask(unsigned short mask, bool applyChildren = true) override;
virtual void setGlobalZOrder(float globalZOrder) override;
/**
* Set the slice sprite rendering type.
* When setting to SIMPLE, only 4 vertexes is used to rendering.
@ -682,8 +685,8 @@ namespace ui {
void applyBlendFunc();
void updateBlendFunc(Texture2D *texture);
std::vector<Vec2> calculateUV(Texture2D *tex, const Rect& capInsets,
const Size& spriteRectSize);
std::vector<Vec2> calculateVertices(const Rect& capInsets, const Size& spriteRectSize);
const Size& originalSize, const Vec4& offsets);
std::vector<Vec2> calculateVertices(const Rect& capInsets, const Size& originalSize, const Vec4& offsets);
TrianglesCommand::Triangles calculateTriangles(const std::vector<Vec2>& uv,
const std::vector<Vec2>& vertices);
@ -698,6 +701,7 @@ namespace ui {
/** Original sprite's size. */
Size _originalSize;
Vec2 _offset;
/** Preferred sprite's size. By default the preferred size is the original size. */
//if the preferredSize component is given as -1, it is ignored

View File

@ -178,19 +178,11 @@ void ScrollView::setInnerContainerSize(const Size &size)
// Calculate and set the position of the inner container.
Vec2 pos = _innerContainer->getPosition();
if (_innerContainer->getLeftBoundary() > 0.0f)
if (_innerContainer->getLeftBoundary() != 0.0f)
{
pos.x = _innerContainer->getAnchorPoint().x * _innerContainer->getContentSize().width;
}
if (_innerContainer->getRightBoundary() < _contentSize.width)
{
pos.x = _contentSize.width - ((1.0f - _innerContainer->getAnchorPoint().x) * _innerContainer->getContentSize().width);
}
if (_innerContainer->getPosition().y > 0.0f)
{
pos.y = _innerContainer->getAnchorPoint().y * _innerContainer->getContentSize().height;
}
if (_innerContainer->getTopBoundary() < _contentSize.height)
if (_innerContainer->getTopBoundary() != _contentSize.height)
{
pos.y = _contentSize.height - (1.0f - _innerContainer->getAnchorPoint().y) * _innerContainer->getContentSize().height;
}

View File

@ -172,7 +172,7 @@ void Slider::loadBarTexture(const std::string& fileName, TextureResType texType)
}
}
//FIXME: https://github.com/cocos2d/cocos2d-x/issues/12249
if (!_ignoreSize) {
if (!_ignoreSize && _customSize.equals(Size::ZERO)) {
_customSize = _barRenderer->getContentSize();
}
this->setupBarTexture();
@ -258,7 +258,7 @@ void Slider::setScale9Enabled(bool able)
ignoreContentAdaptWithSize(_prevIgnoreSize);
}
setCapInsetsBarRenderer(_capInsetsBarRenderer);
setCapInsetProgressBarRebderer(_capInsetsProgressBarRenderer);
setCapInsetProgressBarRenderer(_capInsetsProgressBarRenderer);
_barRendererAdaptDirty = true;
_progressBarRendererDirty = true;
}
@ -280,7 +280,7 @@ void Slider::ignoreContentAdaptWithSize(bool ignore)
void Slider::setCapInsets(const Rect &capInsets)
{
setCapInsetsBarRenderer(capInsets);
setCapInsetProgressBarRebderer(capInsets);
setCapInsetProgressBarRenderer(capInsets);
}
void Slider::setCapInsetsBarRenderer(const Rect &capInsets)
@ -298,7 +298,7 @@ const Rect& Slider::getCapInsetsBarRenderer()const
return _capInsetsBarRenderer;
}
void Slider::setCapInsetProgressBarRebderer(const Rect &capInsets)
void Slider::setCapInsetProgressBarRenderer(const Rect &capInsets)
{
_capInsetsProgressBarRenderer = ui::Helper::restrictCapInsetRect(capInsets, _progressBarRenderer->getContentSize());
if (!_scale9Enabled)
@ -308,7 +308,7 @@ void Slider::setCapInsetProgressBarRebderer(const Rect &capInsets)
_progressBarRenderer->setCapInsets(_capInsetsProgressBarRenderer);
}
const Rect& Slider::getCapInsetsProgressBarRebderer()const
const Rect& Slider::getCapInsetsProgressBarRenderer()const
{
return _capInsetsProgressBarRenderer;
}

View File

@ -143,14 +143,14 @@ public:
* @param capInsets Capinsets for progress bar slider.
* @js NA
*/
void setCapInsetProgressBarRebderer(const Rect &capInsets);
void setCapInsetProgressBarRenderer(const Rect &capInsets);
/**
* Gets capinsets for progress bar slider, if slider is using scale9 renderer.
* @return Capinsets for progress bar slider.
* @js NA
*/
const Rect& getCapInsetsProgressBarRebderer()const;
const Rect& getCapInsetsProgressBarRenderer()const;
/**
* Load textures for slider ball.

View File

@ -372,6 +372,38 @@ void Text::disableEffect(LabelEffect effect)
}
}
bool Text::isShadowEnabled() const
{
return _labelRenderer->isShadowEnabled();
}
Size Text::getShadowOffset() const
{
return _labelRenderer->getShadowOffset();
}
float Text::getShadowBlurRadius() const
{
return _labelRenderer->getShadowBlurRadius();
}
Color4B Text::getShadowColor() const
{
Color4F effect = _labelRenderer->getShadowColor();
return Color4B(effect.r * 255, effect.g * 255, effect.b * 255, effect.a * 255);
}
int Text::getOutlineSize() const
{
return _labelRenderer->getOutlineSize();
}
LabelEffect Text::getLabelEffectType() const
{
return _labelRenderer->getLabelEffectType();
}
Color4B Text::getEffectColor() const
{
Color4F effect = _labelRenderer->getEffectColor();
return Color4B(effect.r * 255, effect.g * 255, effect.b * 255, effect.a * 255);
}
Widget* Text::createCloneInstance()
{
return Text::create();
@ -391,6 +423,20 @@ void Text::copySpecialProperties(Widget *widget)
setTextVerticalAlignment(label->_labelRenderer->getVerticalAlignment());
setTextAreaSize(label->_labelRenderer->getDimensions());
setContentSize(label->getContentSize());
LabelEffect effectType = label->getLabelEffectType();
if (effectType == LabelEffect::GLOW)
{
enableGlow(label->getEffectColor());
}
else if (effectType == LabelEffect::OUTLINE)
{
enableOutline(label->getEffectColor(),label->getOutlineSize());
}
if (label->isShadowEnabled())
{
enableShadow(label->getShadowColor(),label->getShadowOffset(),label->getShadowBlurRadius());
}
}
}

View File

@ -294,6 +294,35 @@ public:
*/
void disableEffect(LabelEffect effect);
/**
* Return whether the shadow effect is enabled.
*/
bool isShadowEnabled() const;
/**
* Return shadow effect offset value.
*/
Size getShadowOffset() const;
/**
* Return the shadow effect blur radius.
*/
float getShadowBlurRadius() const;
/**
* Return the shadow effect color value.
*/
Color4B getShadowColor() const;
/**
* Return the outline effect size value.
*/
int getOutlineSize() const;
/**
* Return current effect type.
*/
LabelEffect getLabelEffectType() const;
/**
* Return current effect color vlaue.
*/
Color4B getEffectColor() const;
CC_CONSTRUCTOR_ACCESS:
virtual bool init() override;
virtual bool init(const std::string& textContent,

View File

@ -299,7 +299,7 @@ _useTouchArea(false),
_textFieldEventListener(nullptr),
_textFieldEventSelector(nullptr),
_eventCallback(nullptr),
_passwordStyleText(""),
_passwordStyleText("*"),
_textFieldRendererAdaptDirty(true),
_fontName("Thonburi"),
_fontSize(10),
@ -575,6 +575,8 @@ int TextField::getMaxLength()const
void TextField::setPasswordEnabled(bool enable)
{
_textFieldRenderer->setPasswordEnabled(enable);
if (enable)
setPasswordStyleText(getPasswordStyleText());
}
bool TextField::isPasswordEnabled()const

View File

@ -38,7 +38,7 @@ PROJECT_NAME = Cocos2d-x
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = v3.9
PROJECT_NUMBER = v3.10
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@ -63,10 +63,10 @@ ControlButton::~ControlButton()
bool ControlButton::init()
{
return this->initWithLabelAndBackgroundSprite(Label::createWithSystemFont("", "Helvetica", 12), cocos2d::ui::Scale9Sprite::create());
return this->initWithLabelAndBackgroundSprite(Label::createWithSystemFont("", "Helvetica", 12), cocos2d::ui::Scale9Sprite::create(),true);
}
bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, ui::Scale9Sprite* backgroundSprite)
bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, ui::Scale9Sprite* backgroundSprite, bool adjustBackGroundSize)
{
if (Control::init())
{
@ -79,9 +79,9 @@ bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, ui::Scale9Sprit
_isPushed = false;
// Adjust the background image by default
setAdjustBackgroundImage(true);
// Adjust the background image by adjustBackGroundSize
setPreferredSize(Size::ZERO);
setAdjustBackgroundImage(adjustBackGroundSize);
// Zooming button by default
_zoomOnTouchDown = true;
_scaleRatio = 1.1f;
@ -123,14 +123,22 @@ bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, ui::Scale9Sprit
ControlButton* ControlButton::create(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite)
{
ControlButton *pRet = new (std::nothrow) ControlButton();
pRet->initWithLabelAndBackgroundSprite(label, backgroundSprite);
pRet->initWithLabelAndBackgroundSprite(label, backgroundSprite, true);
pRet->autorelease();
return pRet;
}
ControlButton* ControlButton::create(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite, bool adjustBackGroundSize)
{
ControlButton *pRet = new (std::nothrow) ControlButton();
pRet->initWithLabelAndBackgroundSprite(label, backgroundSprite, adjustBackGroundSize);
pRet->autorelease();
return pRet;
}
bool ControlButton::initWithTitleAndFontNameAndFontSize(const std::string& title, const std::string& fontName, float fontSize)
{
return initWithLabelAndBackgroundSprite(Label::createWithSystemFont(title, fontName, fontSize), cocos2d::ui::Scale9Sprite::create());
return initWithLabelAndBackgroundSprite(Label::createWithSystemFont(title, fontName, fontSize), cocos2d::ui::Scale9Sprite::create(),true);
}
ControlButton* ControlButton::create(const std::string& title, const std::string& fontName, float fontSize)
@ -144,7 +152,7 @@ ControlButton* ControlButton::create(const std::string& title, const std::string
bool ControlButton::initWithBackgroundSprite(cocos2d::ui::Scale9Sprite* sprite)
{
Label *label = Label::createWithSystemFont("", "Arial", 30);//
return initWithLabelAndBackgroundSprite(label, sprite);
return initWithLabelAndBackgroundSprite(label, sprite,false);
}
ControlButton* ControlButton::create(cocos2d::ui::Scale9Sprite* sprite)

View File

@ -58,6 +58,7 @@ public:
static ControlButton* create(cocos2d::ui::Scale9Sprite* sprite);
static ControlButton* create(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite);
static ControlButton* create(const std::string& title, const std::string& fontName, float fontSize);
static ControlButton* create(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite, bool adjustBackGroundSize);
virtual void needsLayout(void) override;
@ -202,7 +203,7 @@ CC_CONSTRUCTOR_ACCESS:
virtual ~ControlButton();
virtual bool init() override;
virtual bool initWithLabelAndBackgroundSprite(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite);
virtual bool initWithLabelAndBackgroundSprite(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite, bool adjustBackGroundSize);
virtual bool initWithBackgroundSprite(cocos2d::ui::Scale9Sprite* sprite);
virtual bool initWithTitleAndFontNameAndFontSize(const std::string& title, const std::string& fontName, float fontSize);

View File

@ -43,6 +43,7 @@ Particle3DQuadRender::Particle3DQuadRender()
, _glProgramState(nullptr)
, _indexBuffer(nullptr)
, _vertexBuffer(nullptr)
, _texFile("")
{
}
@ -60,6 +61,7 @@ Particle3DQuadRender* Particle3DQuadRender::create(const std::string& texFile)
auto ret = new (std::nothrow)Particle3DQuadRender();
if (ret && ret->initQuadRender(texFile))
{
ret->_texFile = texFile;
ret->autorelease();
}
else
@ -187,6 +189,8 @@ bool Particle3DQuadRender::initQuadRender( const std::string& texFile )
_texture = tex;
glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_PARTICLE_TEXTURE);
}
else
_texture = nullptr;
}
auto glProgramState = GLProgramState::create(glProgram);
glProgramState->retain();
@ -213,6 +217,11 @@ bool Particle3DQuadRender::initQuadRender( const std::string& texFile )
return true;
}
void Particle3DQuadRender::reset()
{
this->initQuadRender(_texFile);
}
//////////////////////////////////////////////////////////////////////////////
Particle3DModelRender::Particle3DModelRender()
: _spriteSize(Vec3::ONE)
@ -284,6 +293,14 @@ void Particle3DModelRender::render(Renderer* renderer, const Mat4 &transform, Pa
}
}
void Particle3DModelRender::reset()
{
for (auto iter : _spriteList){
iter->release();
}
_spriteList.clear();
}
// MARK: Particle3DRender
Particle3DRender::Particle3DRender()

View File

@ -73,6 +73,8 @@ public:
void copyAttributesTo (Particle3DRender *render);
virtual void reset(){}
CC_CONSTRUCTOR_ACCESS:
Particle3DRender();
virtual ~Particle3DRender();
@ -94,6 +96,7 @@ public:
virtual void render(Renderer* renderer, const Mat4 &transform, ParticleSystem3D* particleSystem) override;
virtual void reset()override;
CC_CONSTRUCTOR_ACCESS:
Particle3DQuadRender();
virtual ~Particle3DQuadRender();
@ -118,6 +121,7 @@ protected:
std::vector<posuvcolor> _posuvcolors; //vertex data
std::vector<unsigned short> _indexData; //index data
std::string _texFile;
};
// particle render for Sprite3D
@ -128,6 +132,7 @@ public:
virtual void render(Renderer* renderer, const Mat4 &transform, ParticleSystem3D* particleSystem) override;
virtual void reset()override;
CC_CONSTRUCTOR_ACCESS:
Particle3DModelRender();
virtual ~Particle3DModelRender();

View File

@ -204,6 +204,10 @@ public:
* set particle render, can set your own particle render
*/
void setRender(Particle3DRender* render);
/**
* return particle render
*/
Particle3DRender* getRender(){ return _render; }
/**
* add particle affector
*/

View File

@ -734,21 +734,15 @@ void PUBillboardChain::setBlendFunc(const BlendFunc& blendFunc)
GLuint PUBillboardChain::getTextureName()
{
if (Director::getInstance()->getTextureCache()->isDirty())
{
if (Director::getInstance()->getTextureCache()->getTextureForKey(_texFile) == nullptr)
{
_texture = nullptr;
this->init("");
}
else
this->init(_texFile);
}
else if (_texture != nullptr && !_texture->isValid())
if (Director::getInstance()->getTextureCache()->getTextureForKey(_texFile) == nullptr)
{
_texture = nullptr;
this->init("");
}
else if (_texture == nullptr)
{
this->init(_texFile);
}
if (_texture == nullptr)
return 0;

View File

@ -244,7 +244,7 @@ void PUParticle3DQuadRender::render(Renderer* renderer, const Mat4 &transform, P
_stateBlock->setBlendFunc(particleSystem->getBlendFunc());
GLuint texId = this->getTextureName();
GLuint texId = (_texture ? _texture->getName() : 0);
_meshCommand->init(0,
texId,
_glProgramState,
@ -525,6 +525,14 @@ PUParticle3DModelRender* PUParticle3DModelRender::clone()
return mr;
}
void PUParticle3DModelRender::reset()
{
for (auto iter : _spriteList){
iter->release();
}
_spriteList.clear();
}
PUParticle3DEntityRender::PUParticle3DEntityRender()
: _meshCommand(nullptr)
@ -564,6 +572,8 @@ bool PUParticle3DEntityRender::initRender( const std::string &texFile )
_texture = tex;
glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_PARTICLE_TEXTURE);
}
else
_texture = nullptr;
}
auto glProgramState = GLProgramState::create(glProgram);
glProgramState->retain();
@ -587,35 +597,16 @@ bool PUParticle3DEntityRender::initRender( const std::string &texFile )
return true;
}
GLuint PUParticle3DEntityRender::getTextureName()
{
if (Director::getInstance()->getTextureCache()->isDirty())
{
if (Director::getInstance()->getTextureCache()->getTextureForKey(_texFile) == nullptr)
{
_texture = nullptr;
this->initRender("");
}
else
this->initRender(_texFile);
}
else if (_texture != nullptr && !_texture->isValid())
{
_texture = nullptr;
this->initRender("");
}
if (_texture == nullptr)
return 0;
return _texture->getName();
}
void PUParticle3DEntityRender::copyAttributesTo(PUParticle3DEntityRender *render)
{
PURender::copyAttributesTo(render);
}
void PUParticle3DEntityRender::reset()
{
this->initRender(_texFile);
}
PUParticle3DBoxRender::PUParticle3DBoxRender()
{
autoRotate = false;
@ -725,7 +716,7 @@ void PUParticle3DBoxRender::render( Renderer* renderer, const Mat4 &transform, P
_vertexBuffer->updateVertices(&_vertices[0], vertexindex/* * sizeof(_posuvcolors[0])*/, 0);
_indexBuffer->updateIndices(&_indices[0], index/* * sizeof(unsigned short)*/, 0);
GLuint texId = this->getTextureName();
GLuint texId = (_texture ? _texture->getName() : 0);
_stateBlock->setBlendFunc(_particleSystem->getBlendFunc());
_meshCommand->init(0,
texId,
@ -889,8 +880,7 @@ void PUSphereRender::render( Renderer* renderer, const Mat4 &transform, Particle
_vertexBuffer->updateVertices(&_vertices[0], vertexindex/* * sizeof(_posuvcolors[0])*/, 0);
_indexBuffer->updateIndices(&_indices[0], index/* * sizeof(unsigned short)*/, 0);
GLuint texId = this->getTextureName();
GLuint texId = (_texture ? _texture->getName() : 0);
_stateBlock->setBlendFunc(particleSystem->getBlendFunc());
_meshCommand->init(
0,

View File

@ -65,7 +65,7 @@ class CC_DLL PUParticle3DEntityRender : public PURender
{
public:
void copyAttributesTo(PUParticle3DEntityRender *render);
virtual void reset()override;
CC_CONSTRUCTOR_ACCESS:
PUParticle3DEntityRender();
virtual ~PUParticle3DEntityRender();
@ -73,8 +73,6 @@ CC_CONSTRUCTOR_ACCESS:
protected:
bool initRender(const std::string &texFile);
GLuint getTextureName();
protected:
struct VertexInfo
@ -189,6 +187,7 @@ public:
virtual PUParticle3DModelRender* clone() override;
void copyAttributesTo(PUParticle3DModelRender *render);
virtual void reset()override;
CC_CONSTRUCTOR_ACCESS:
PUParticle3DModelRender();
virtual ~PUParticle3DModelRender();

View File

@ -21,6 +21,7 @@
#include "ExtensionDeprecated.h"
// Particle System, include Particle Universe Particle System
#include "Particle3D/CCParticle3DRender.h"
#include "Particle3D/CCParticleSystem3D.h"
#include "Particle3D/PU/CCPUParticleSystem3D.h"

Some files were not shown because too many files have changed in this diff Show More