From 47e5688a9dcda6ee18b77503990bbc07706b4dba Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Wed, 20 Apr 2016 17:36:59 +0800 Subject: [PATCH 01/25] Bug fix: 1.Fixed fail to add component for node 2.Fixed crash on exit 3.Fixed FileUtils::isDirectoryExist may return the error result in iOS/Mac --- native/cocos/2d/CCComponentContainer.cpp | 2 +- native/cocos/2d/CCNode.cpp | 2 + native/cocos/base/CCScriptSupport.cpp | 20 ++- native/cocos/platform/CCGLView.cpp | 8 +- .../cocos/platform/apple/CCFileUtils-apple.h | 5 +- .../cocos/platform/apple/CCFileUtils-apple.mm | 63 +++++----- native/cocos/ui/UILayout.cpp | 14 +-- native/cocos/ui/UILayoutComponent.cpp | 115 ++++++------------ native/cocos/ui/UILayoutComponent.h | 2 - 9 files changed, 97 insertions(+), 134 deletions(-) diff --git a/native/cocos/2d/CCComponentContainer.cpp b/native/cocos/2d/CCComponentContainer.cpp index 44703eb55e..ab6502f825 100644 --- a/native/cocos/2d/CCComponentContainer.cpp +++ b/native/cocos/2d/CCComponentContainer.cpp @@ -58,7 +58,7 @@ bool ComponentContainer::add(Component *com) CCASSERT(com->getOwner() == nullptr, "Component already added. It can't be added again"); do { - if (com == nullptr || com->getOwner() == nullptr) { + if (com == nullptr || com->getOwner() != nullptr) { break; } diff --git a/native/cocos/2d/CCNode.cpp b/native/cocos/2d/CCNode.cpp index 1d9750a863..18c93352e5 100644 --- a/native/cocos/2d/CCNode.cpp +++ b/native/cocos/2d/CCNode.cpp @@ -730,6 +730,8 @@ Node* Node::getChildByTag(int tag) const Node* Node::getChildByName(const std::string& name) const { CCASSERT(!name.empty(), "Invalid name"); + if (name.empty()) + return nullptr; std::hash h; size_t hash = h(name); diff --git a/native/cocos/base/CCScriptSupport.cpp b/native/cocos/base/CCScriptSupport.cpp index b1c98bc0ce..1b866ed0bf 100644 --- a/native/cocos/base/CCScriptSupport.cpp +++ b/native/cocos/base/CCScriptSupport.cpp @@ -167,7 +167,10 @@ void ScriptEngineManager::destroyInstance() bool ScriptEngineManager::sendActionEventToJS(Action* actionObject, int eventType, void* param) { - auto scriptEngine = getInstance()->getScriptEngine(); + if (ShareInstance == nullptr) + return false; + + auto scriptEngine = ShareInstance->getScriptEngine(); ActionObjectScriptData data(actionObject,(int*)&eventType, param); ScriptEvent scriptEvent(kScriptActionEvent,(void*)&data); @@ -179,7 +182,10 @@ bool ScriptEngineManager::sendActionEventToJS(Action* actionObject, int eventTyp bool ScriptEngineManager::sendNodeEventToJS(Node* node, int action) { - auto scriptEngine = getInstance()->getScriptEngine(); + if (ShareInstance == nullptr) + return false; + + auto scriptEngine = ShareInstance->getScriptEngine(); if (scriptEngine->isCalledFromScript()) { @@ -199,7 +205,10 @@ bool ScriptEngineManager::sendNodeEventToJS(Node* node, int action) bool ScriptEngineManager::sendNodeEventToJSExtended(Node* node, int action) { - auto scriptEngine = getInstance()->getScriptEngine(); + if (ShareInstance == nullptr) + return false; + + auto scriptEngine = ShareInstance->getScriptEngine(); if (!scriptEngine->isCalledFromScript()) { @@ -214,7 +223,10 @@ bool ScriptEngineManager::sendNodeEventToJSExtended(Node* node, int action) void ScriptEngineManager::sendNodeEventToLua(Node* node, int action) { - auto scriptEngine = getInstance()->getScriptEngine(); + if (ShareInstance == nullptr) + return; + + auto scriptEngine = ShareInstance->getScriptEngine(); BasicScriptData data(node,(void*)&action); ScriptEvent scriptEvent(kNodeEvent,(void*)&data); diff --git a/native/cocos/platform/CCGLView.cpp b/native/cocos/platform/CCGLView.cpp index 8b9a22ec92..33a84cbb55 100644 --- a/native/cocos/platform/CCGLView.cpp +++ b/native/cocos/platform/CCGLView.cpp @@ -221,10 +221,10 @@ Vec2 GLView::getVisibleOrigin() const void GLView::setViewPortInPoints(float x , float y , float w , float h) { - glViewport((float)(x * _scaleX + _viewPortRect.origin.x), - (float)(y * _scaleY + _viewPortRect.origin.y), - (float)(w * _scaleX), - (float)(h * _scaleY)); + glViewport((GLint)(x * _scaleX + _viewPortRect.origin.x), + (GLint)(y * _scaleY + _viewPortRect.origin.y), + (GLsizei)(w * _scaleX), + (GLsizei)(h * _scaleY)); } void GLView::setScissorInPoints(float x , float y , float w , float h) diff --git a/native/cocos/platform/apple/CCFileUtils-apple.h b/native/cocos/platform/apple/CCFileUtils-apple.h index 9d507fd48c..259ec6318f 100644 --- a/native/cocos/platform/apple/CCFileUtils-apple.h +++ b/native/cocos/platform/apple/CCFileUtils-apple.h @@ -57,9 +57,12 @@ public: virtual ValueVector getValueVectorFromFile(const std::string& filename) override; void setBundle(NSBundle* bundle); -private: + + virtual bool isDirectoryExistInternal(const std::string& dirPath) const override; virtual bool isFileExistInternal(const std::string& filePath) const override; virtual bool removeDirectory(const std::string& dirPath) override; +private: + bool isFileExistInternal(const std::string& filePath,bool& isDirectory) const; NSBundle* getBundle() const; NSBundle* _bundle; diff --git a/native/cocos/platform/apple/CCFileUtils-apple.mm b/native/cocos/platform/apple/CCFileUtils-apple.mm index ee4751bac7..cd73e20cbc 100644 --- a/native/cocos/platform/apple/CCFileUtils-apple.mm +++ b/native/cocos/platform/apple/CCFileUtils-apple.mm @@ -359,46 +359,43 @@ std::string FileUtilsApple::getWritablePath() const return strRet; } -bool FileUtilsApple::isFileExistInternal(const std::string& filePath) const +bool FileUtilsApple::isDirectoryExistInternal(const std::string &dirPath) const +{ + bool isDirectory = false; + auto isExist = isFileExistInternal(dirPath, isDirectory); + return isExist && isDirectory; +} + +bool FileUtilsApple::isFileExistInternal(const std::string &filePath) const +{ + bool isDirectory = false; + auto isExist = isFileExistInternal(filePath, isDirectory); + return isExist && !isDirectory; +} + +bool FileUtilsApple::isFileExistInternal(const std::string& filePath, bool& isDirectory) const { if (filePath.empty()) - { return false; - } - - bool ret = false; - + + isDirectory = false; + + NSString* path = nil; if (filePath[0] != '/') - { - std::string path; - std::string file; - size_t pos = filePath.find_last_of("/"); - if (pos != std::string::npos) - { - file = filePath.substr(pos+1); - path = filePath.substr(0, pos+1); - } - else - { - file = filePath; - } - - NSString* fullpath = [getBundle() pathForResource:[NSString stringWithUTF8String:file.c_str()] - ofType:nil - inDirectory:[NSString stringWithUTF8String:path.c_str()]]; - if (fullpath != nil) { - ret = true; - } - } + path = [[getBundle() resourcePath] stringByAppendingPathComponent: + [NSString stringWithUTF8String:filePath.c_str()]]; else - { - // Search path is an absolute path. - if ([s_fileManager fileExistsAtPath:[NSString stringWithUTF8String:filePath.c_str()]]) { - ret = true; - } + path = [NSString stringWithUTF8String:filePath.c_str()]; + + BOOL isDir = NO; + // Search path is an absolute path. + if ([s_fileManager fileExistsAtPath:path isDirectory:&isDir]) { + if (isDir) + isDirectory = true; + return true; } - return ret; + return false; } static int unlink_cb(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf) diff --git a/native/cocos/ui/UILayout.cpp b/native/cocos/ui/UILayout.cpp index 2168f7478a..2a39eee1b1 100644 --- a/native/cocos/ui/UILayout.cpp +++ b/native/cocos/ui/UILayout.cpp @@ -774,13 +774,10 @@ const Color3B& Layout::getBackGroundColor()const void Layout::setBackGroundColor(const Color3B &startColor, const Color3B &endColor) { _gStartColor = startColor; - if (_gradientRender) - { - _gradientRender->setStartColor(startColor); - } _gEndColor = endColor; if (_gradientRender) { + _gradientRender->setStartColor(startColor); _gradientRender->setEndColor(endColor); } } @@ -899,8 +896,6 @@ void Layout::setLayoutType(Type type) _doLayoutDirty = true; } - - Layout::Type Layout::getLayoutType() const { return _layoutType; @@ -950,7 +945,6 @@ LayoutManager* Layout::createLayoutManager() void Layout::doLayout() { - if (!_doLayoutDirty) { return; @@ -1158,7 +1152,7 @@ int Layout::findFirstFocusEnabledWidgetIndex() } index++; } - CCASSERT(0, "invalide operation"); + CCASSERT(0, "invalid operation"); return 0; } @@ -1257,8 +1251,6 @@ int Layout::findFarthestChildWidgetIndex(FocusDirection direction, cocos2d::ui:: return 0; } - - Widget* Layout::findFocusEnabledChildWidgetByIndex(ssize_t index) { @@ -1472,7 +1464,7 @@ Widget* Layout::getPreviousFocusedWidget(FocusDirection direction, Widget *curre } else { - //handling the disabled widget, there is no actual focus lose or get, so we don't need any envet + //handling the disabled widget, there is no actual focus lose or get, so we don't need any event return this->getPreviousFocusedWidget(direction, nextWidget); } } diff --git a/native/cocos/ui/UILayoutComponent.cpp b/native/cocos/ui/UILayoutComponent.cpp index e633e912d5..343e0685f4 100644 --- a/native/cocos/ui/UILayoutComponent.cpp +++ b/native/cocos/ui/UILayoutComponent.cpp @@ -31,7 +31,7 @@ NS_CC_BEGIN namespace ui { LayoutComponent::LayoutComponent() - :_horizontalEdge(HorizontalEdge::None) + : _horizontalEdge(HorizontalEdge::None) , _verticalEdge(VerticalEdge::None) , _leftMargin(0) , _rightMargin(0) @@ -75,23 +75,6 @@ namespace ui { return nullptr; } - bool LayoutComponent::init() - { - bool ret = true; - do - { - if (!Component::init()) - { - ret = false; - break; - } - - //put layout component initalized code here - - } while (0); - return ret; - } - Node* LayoutComponent::getOwnerParent() { if (_owner) { @@ -188,7 +171,7 @@ namespace ui { else { _positionPercentX = 0; - if (_usingPositionPercentX) + if (_usingPositionPercentX || _horizontalEdge == HorizontalEdge::Center) ownerPoint.x = 0; } @@ -197,7 +180,7 @@ namespace ui { else { _positionPercentY = 0; - if (_usingPositionPercentY) + if (_usingPositionPercentY || _verticalEdge == VerticalEdge::Center) ownerPoint.y = 0; } @@ -231,11 +214,14 @@ namespace ui { { _positionPercentX = percentMargin; - Node* parent = this->getOwnerParent(); - if (parent != nullptr) + if (_usingPositionPercentX || _horizontalEdge == HorizontalEdge::Center) { - _owner->setPositionX(parent->getContentSize().width * _positionPercentX); - this->refreshHorizontalMargin(); + Node* parent = this->getOwnerParent(); + if (parent != nullptr) + { + _owner->setPositionX(parent->getContentSize().width * _positionPercentX); + this->refreshHorizontalMargin(); + } } } @@ -260,11 +246,14 @@ namespace ui { { _positionPercentY = percentMargin; - Node* parent = this->getOwnerParent(); - if (parent != nullptr) + if (_usingPositionPercentY || _verticalEdge == VerticalEdge::Center) { - _owner->setPositionY(parent->getContentSize().height * _positionPercentY); - this->refreshVerticalMargin(); + Node* parent = this->getOwnerParent(); + if (parent != nullptr) + { + _owner->setPositionY(parent->getContentSize().height * _positionPercentY); + this->refreshVerticalMargin(); + } } } @@ -279,24 +268,6 @@ namespace ui { { _usingPositionPercentX = false; } - - Node* parent = this->getOwnerParent(); - if (parent != nullptr) - { - Point ownerPoint = _owner->getPosition(); - const Size& parentSize = parent->getContentSize(); - if (parentSize.width != 0) - _positionPercentX = ownerPoint.x / parentSize.width; - else - { - _positionPercentX = 0; - ownerPoint.x = 0; - if (_usingPositionPercentX) - _owner->setPosition(ownerPoint); - } - - this->refreshHorizontalMargin(); - } } LayoutComponent::VerticalEdge LayoutComponent::getVerticalEdge()const @@ -310,24 +281,6 @@ namespace ui { { _usingPositionPercentY = false; } - - Node* parent = this->getOwnerParent(); - if (parent != nullptr) - { - Point ownerPoint = _owner->getPosition(); - const Size& parentSize = parent->getContentSize(); - if (parentSize.height != 0) - _positionPercentY = ownerPoint.y / parentSize.height; - else - { - _positionPercentY = 0; - ownerPoint.y = 0; - if (_usingPositionPercentY) - _owner->setPosition(ownerPoint); - } - - this->refreshVerticalMargin(); - } } float LayoutComponent::getLeftMargin()const @@ -384,7 +337,7 @@ namespace ui { else { _percentWidth = 0; - if (_usingPercentWidth) + if (_usingPercentWidth || (this->_horizontalEdge != HorizontalEdge::Center && this->_usingStretchWidth)) ownerSize.width = 0; } @@ -393,7 +346,7 @@ namespace ui { else { _percentHeight = 0; - if (_usingPercentHeight) + if (_usingPercentHeight || (this->_verticalEdge != VerticalEdge::Center && this->_usingStretchHeight)) ownerSize.height = 0; } @@ -455,14 +408,17 @@ namespace ui { { _percentWidth = percentWidth; - Node* parent = this->getOwnerParent(); - if (parent != nullptr) + if (_usingPercentWidth) { - Size ownerSize = _owner->getContentSize(); - ownerSize.width = parent->getContentSize().width * _percentWidth; - _owner->setContentSize(ownerSize); + Node* parent = this->getOwnerParent(); + if (parent != nullptr) + { + Size ownerSize = _owner->getContentSize(); + ownerSize.width = parent->getContentSize().width * _percentWidth; + _owner->setContentSize(ownerSize); - this->refreshHorizontalMargin(); + this->refreshHorizontalMargin(); + } } } @@ -515,14 +471,17 @@ namespace ui { { _percentHeight = percentHeight; - Node* parent = this->getOwnerParent(); - if (parent != nullptr) + if (_usingPercentHeight) { - Size ownerSize = _owner->getContentSize(); - ownerSize.height = parent->getContentSize().height * _percentHeight; - _owner->setContentSize(ownerSize); + Node* parent = this->getOwnerParent(); + if (parent != nullptr) + { + Size ownerSize = _owner->getContentSize(); + ownerSize.height = parent->getContentSize().height * _percentHeight; + _owner->setContentSize(ownerSize); - this->refreshVerticalMargin(); + this->refreshVerticalMargin(); + } } } diff --git a/native/cocos/ui/UILayoutComponent.h b/native/cocos/ui/UILayoutComponent.h index 36dae41e36..aab19fd995 100644 --- a/native/cocos/ui/UILayoutComponent.h +++ b/native/cocos/ui/UILayoutComponent.h @@ -55,8 +55,6 @@ namespace ui { */ ~LayoutComponent(); - virtual bool init()override; - /** * Create a LayoutComponent instance with default settings. */ From 83fc6fd1a82cf624ad8885d59ddecf998d2319bb Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Thu, 21 Apr 2016 15:19:47 +0800 Subject: [PATCH 02/25] Bug fix: 1.Fixed crash in win for rich text 2.Fixed crash when custom SSL certificate is set on iOS 3.Fixed SocketIO crash on reconnect 4.Fixed ActionManager memory leak 5.Fixed crash in MenuItem::activate 6.Fixed crash on exit game 7.Fixed crash in TableView::updateCellAtIndex 8.Fixed crash in RichText on window --- native/cocos/2d/CCActionManager.cpp | 5 + native/cocos/2d/CCMenuItem.cpp | 8 -- native/cocos/2d/CCNode.cpp | 2 +- native/cocos/base/CCDirector.cpp | 19 +-- .../cocos/network/HttpAsynConnection-apple.m | 9 +- native/cocos/network/SocketIO.cpp | 6 + native/cocos/network/WebSocket.cpp | 129 ++++++++---------- native/cocos/network/WebSocket.h | 2 +- .../js-bindings/manual/ScriptingCore.cpp | 1 + .../manual/network/jsb_websocket.cpp | 7 +- native/cocos/ui/UIRichText.cpp | 7 +- .../GUI/CCScrollView/CCTableView.cpp | 11 +- 12 files changed, 96 insertions(+), 110 deletions(-) diff --git a/native/cocos/2d/CCActionManager.cpp b/native/cocos/2d/CCActionManager.cpp index 43e2ea44f2..a588e320a7 100644 --- a/native/cocos/2d/CCActionManager.cpp +++ b/native/cocos/2d/CCActionManager.cpp @@ -446,6 +446,11 @@ void ActionManager::update(float dt) { deleteHashElement(_currentTarget); } + ////if some node refrence 'target', it's refrence count >= 2 (issues #14050) + else if(_currentTarget->target->getReferenceCount() == 1) + { + deleteHashElement(_currentTarget); + } } // issue #635 diff --git a/native/cocos/2d/CCMenuItem.cpp b/native/cocos/2d/CCMenuItem.cpp index 8fa6b7bce2..8a62642890 100644 --- a/native/cocos/2d/CCMenuItem.cpp +++ b/native/cocos/2d/CCMenuItem.cpp @@ -89,14 +89,6 @@ void MenuItem::activate() { _callback(this); } -#if CC_ENABLE_SCRIPT_BINDING - if (kScriptTypeNone != _scriptType && ScriptEngineManager::ShareInstance) - { - BasicScriptData data(this); - ScriptEvent scriptEvent(kMenuClickedEvent,&data); - ScriptEngineManager::ShareInstance->getScriptEngine()->sendEvent(&scriptEvent); - } -#endif } } diff --git a/native/cocos/2d/CCNode.cpp b/native/cocos/2d/CCNode.cpp index 18c93352e5..9abfe98ae5 100644 --- a/native/cocos/2d/CCNode.cpp +++ b/native/cocos/2d/CCNode.cpp @@ -189,7 +189,7 @@ Node::~Node() #endif if (_running) { - log("Node still marked as running on node destruction! Was base class onExit() called in derived class onExit() implementations?"); + CCLOG("Node still marked as running on node destruction! Was base class onExit() called in derived class onExit() implementations?"); } CC_SAFE_RELEASE(_eventDispatcher); } diff --git a/native/cocos/base/CCDirector.cpp b/native/cocos/base/CCDirector.cpp index 91969e4ca5..5b56f5d68c 100644 --- a/native/cocos/base/CCDirector.cpp +++ b/native/cocos/base/CCDirector.cpp @@ -183,17 +183,8 @@ Director::~Director() CC_SAFE_RELEASE(_runningScene); CC_SAFE_RELEASE(_notificationNode); - if (_scheduler) - { - delete _scheduler; - _scheduler = nullptr; - } - - if (_actionManager) - { - delete _actionManager; - _actionManager = nullptr; - } + CC_SAFE_RELEASE(_scheduler); + CC_SAFE_RELEASE(_actionManager); delete _eventBeforeUpdate; delete _eventAfterUpdate; @@ -206,11 +197,7 @@ Director::~Director() delete _console; - if (_eventDispatcher) - { - delete _eventDispatcher; - _eventDispatcher = nullptr; - } + CC_SAFE_RELEASE(_eventDispatcher); // delete _lastUpdate CC_SAFE_DELETE(_lastUpdate); diff --git a/native/cocos/network/HttpAsynConnection-apple.m b/native/cocos/network/HttpAsynConnection-apple.m index 6814005c31..6bb10002a7 100755 --- a/native/cocos/network/HttpAsynConnection-apple.m +++ b/native/cocos/network/HttpAsynConnection-apple.m @@ -187,11 +187,14 @@ CFDataRef errDataRef = SecTrustCopyExceptions(serverTrust); SecTrustSetExceptions(serverTrust, errDataRef); SecTrustEvaluate(serverTrust, &trustResult); - [(id)errDataRef release]; + CFRelease(errDataRef); } [certData release]; - [(id)certArrayRef release]; - [(id)certArrayRef release]; + if (cert) + CFRelease(cert); + if (certArrayRef) + CFRelease(certArrayRef); + //Did our custom trust chain evaluate successfully? return trustResult = kSecTrustResultUnspecified || trustResult == kSecTrustResultProceed; } diff --git a/native/cocos/network/SocketIO.cpp b/native/cocos/network/SocketIO.cpp index 07c17c3cf9..8901048ea7 100644 --- a/native/cocos/network/SocketIO.cpp +++ b/native/cocos/network/SocketIO.cpp @@ -986,6 +986,12 @@ void SIOClientImpl::onClose(WebSocket* ws) { iter->second->socketClosed(); } + // discard this client + _connected = false; + if (Director::DirectorInstance) + Director::DirectorInstance->getScheduler()->unscheduleAllForTarget(this); + + SocketIO::getInstance()->removeSocket(_uri); } this->release(); diff --git a/native/cocos/network/WebSocket.cpp b/native/cocos/network/WebSocket.cpp index 961f24a3c2..0d43df7938 100644 --- a/native/cocos/network/WebSocket.cpp +++ b/native/cocos/network/WebSocket.cpp @@ -122,8 +122,6 @@ public: // Creates a new thread bool createWebSocketThread(const WebSocket& ws); - // Quits websocket thread. - void quitWebSocketThread(); // Sends message to Cocos thread. It's needed to be invoked in Websocket thread. void sendMessageToCocosThread(const std::function& cb); @@ -141,7 +139,7 @@ private: std::mutex _subThreadWsMessageQueueMutex; std::thread* _subThreadInstance; WebSocket* _ws; - std::atomic _needQuit; + friend class WebSocket; }; @@ -166,11 +164,9 @@ public: } }; -// Implementation of WsThreadHelper WsThreadHelper::WsThreadHelper() : _subThreadInstance(nullptr) , _ws(nullptr) -, _needQuit(false) { _subThreadWsMessageQueue = new (std::nothrow) std::list(); } @@ -186,34 +182,14 @@ bool WsThreadHelper::createWebSocketThread(const WebSocket& ws) { _ws = const_cast(&ws); - // Creates websocket thread - _subThreadInstance = new (std::nothrow) std::thread(&WsThreadHelper::wsThreadEntryFunc, this); + _subThreadInstance = new (std::nothrow) std::thread(&WebSocket::onSubThreadLoop, _ws); return true; } -void WsThreadHelper::quitWebSocketThread() -{ - _needQuit = true; -} - -void WsThreadHelper::wsThreadEntryFunc() -{ - LOGD("WebSocket thread start, helper instance: %p\n", this); - _ws->onSubThreadStarted(); - - while (!_needQuit) - { - _ws->onSubThreadLoop(); - } - - _ws->onSubThreadEnded(); - - LOGD("WebSocket thread exit, helper instance: %p\n", this); -} - void WsThreadHelper::sendMessageToCocosThread(const std::function& cb) { - Director::getInstance()->getScheduler()->performFunctionInCocosThread(cb); + if (Director::DirectorInstance) + Director::DirectorInstance->getScheduler()->performFunctionInCocosThread(cb); } void WsThreadHelper::sendMessageToWebSocketThread(WsMessage *msg) @@ -230,7 +206,6 @@ void WsThreadHelper::joinWebSocketThread() } } -// Define a WebSocket frame class WebSocketFrame { public: @@ -281,8 +256,6 @@ private: ssize_t _frameLength; std::vector _data; }; -// - enum WS_MSG { WS_MSG_TO_SUBTRHEAD_SENDING_STRING = 0, @@ -295,14 +268,15 @@ void WebSocket::closeAllConnections() { if (__websocketInstances != nullptr) { + auto copyInstances = *__websocketInstances; ssize_t count = __websocketInstances->size(); for (ssize_t i = count-1; i >=0 ; i--) { - WebSocket* instance = __websocketInstances->at(i); + WebSocket* instance = copyInstances.at(i); instance->close(); } - - __websocketInstances->clear(); + + delete __websocketInstances; __websocketInstances = nullptr; } } @@ -340,6 +314,12 @@ WebSocket::WebSocket() WebSocket::~WebSocket() { + *_isDestroyed = true; + + if (Director::DirectorInstance) { + Director::DirectorInstance->getEventDispatcher()->removeEventListener(_resetDirectorListener); + } + LOGD("In the destructor of WebSocket (%p)\n", this); CC_SAFE_DELETE(_wsHelper); @@ -364,11 +344,6 @@ WebSocket::~WebSocket() LOGD("ERROR: WebSocket instance (%p) wasn't added to the container which saves websocket instances!\n", this); } } - - if (Director::DirectorInstance) { - Director::DirectorInstance->getEventDispatcher()->removeEventListener(_resetDirectorListener); - } - *_isDestroyed = true; } bool WebSocket::init(const Delegate& delegate, @@ -518,6 +493,7 @@ void WebSocket::close() _readStateMutex.unlock(); return; } + // Sets the state to 'closed' to make sure 'onConnectionClosed' which is // invoked by websocket thread don't post 'close' message to Cocos thread since // WebSocket instance is destroyed at next frame. @@ -525,9 +501,9 @@ void WebSocket::close() _readyState = State::CLOSED; _readStateMutex.unlock(); - _wsHelper->quitWebSocketThread(); LOGD("Waiting WebSocket (%p) to exit!\n", this); _wsHelper->joinWebSocketThread(); + // Since 'onConnectionClosed' didn't post message to Cocos Thread for invoking 'onClose' callback, do it here. // onClose must be invoked at the end of this method. _delegate->onClose(this); @@ -535,7 +511,10 @@ void WebSocket::close() void WebSocket::closeAsync() { - _wsHelper->quitWebSocketThread(); + _readStateMutex.lock(); + if (_readyState != State::CLOSING && _readyState != State::CLOSED) + _readyState = State::CLOSING; + _readStateMutex.unlock(); } WebSocket::State WebSocket::getReadyState() @@ -546,30 +525,38 @@ WebSocket::State WebSocket::getReadyState() void WebSocket::onSubThreadLoop() { - _readStateMutex.lock(); - if (_wsContext && _readyState != State::CLOSED && _readyState != State::CLOSING) - { - _readStateMutex.unlock(); - _wsHelper->_subThreadWsMessageQueueMutex.lock(); - bool isEmpty = _wsHelper->_subThreadWsMessageQueue->empty(); - _wsHelper->_subThreadWsMessageQueueMutex.unlock(); - if (!isEmpty) + onSubThreadStarted(); + + while (true) { + _readStateMutex.lock(); + if (_wsContext && (_readyState == State::CONNECTING || _readyState == State::OPEN)) { - lws_callback_on_writable(_wsInstance); + _readStateMutex.unlock(); + _wsHelper->_subThreadWsMessageQueueMutex.lock(); + bool isEmpty = _wsHelper->_subThreadWsMessageQueue->empty(); + _wsHelper->_subThreadWsMessageQueueMutex.unlock(); + if (!isEmpty) + { + lws_callback_on_writable(_wsInstance); + } + + lws_service(_wsContext, 50); + } + else + { + LOGD("Ready state is closing or was closed, code=%d, quit websocket thread!\n", _readyState); + _readStateMutex.unlock(); + break; } - - lws_service(_wsContext, 50); - } - else - { - LOGD("Ready state is closing or was closed, code=%d, quit websocket thread!\n", _readyState); - _readStateMutex.unlock(); - _wsHelper->quitWebSocketThread(); } + + onSubThreadEnded(); } void WebSocket::onSubThreadStarted() { + LOGD("WebSocket::onSubThreadStarted, instance: %p\n", this); + static const struct lws_extension exts[] = { { "permessage-deflate", @@ -603,7 +590,7 @@ void WebSocket::onSubThreadStarted() info.options = 0; info.user = this; - int log_level = LLL_ERR | LLL_WARN | LLL_NOTICE/* | LLL_INFO | LLL_DEBUG | LLL_PARSER*/ | LLL_HEADER | LLL_EXT | LLL_CLIENT | LLL_LATENCY; + int log_level = LLL_ERR | LLL_WARN | LLL_NOTICE | LLL_HEADER | LLL_EXT | LLL_CLIENT | LLL_LATENCY; lws_set_log_level(log_level, printWebSocketLog); _wsContext = lws_create_context(&info); @@ -625,10 +612,11 @@ void WebSocket::onSubThreadStarted() char portStr[10]; sprintf(portStr, "%d", _port); std::string ads_port = _host + ":" + portStr; - - _wsInstance = lws_client_connect(_wsContext, _host.c_str(), _port, _SSLConnection, - _path.c_str(), ads_port.c_str(), ads_port.c_str(), - name.c_str(), -1); + + lws_client_connect_info cInfo = {_wsContext, _host.c_str(), (int)_port, _SSLConnection, + _path.c_str(), ads_port.c_str(), ads_port.c_str(), + name.c_str(), -1,nullptr,nullptr}; + _wsInstance = lws_client_connect_via_info(&cInfo); if (nullptr == _wsInstance) { @@ -646,7 +634,10 @@ void WebSocket::onSubThreadEnded() if (_wsContext != nullptr) { lws_context_destroy(_wsContext); + _wsContext = nullptr; } + + LOGD("WebSocket::onSubThreadEnded, instance: %p\n", this); } void WebSocket::onClientWritable() @@ -801,7 +792,6 @@ void WebSocket::onClientReceivedData(void* in, ssize_t len) // If no more data pending, send it to the client thread size_t remainingSize = lws_remaining_packet_payload(_wsInstance); int isFinalFragment = lws_is_final_fragment(_wsInstance); -// LOGD("remainingSize: %d, isFinalFragment: %d\n", (int)remainingSize, isFinalFragment); if (remainingSize == 0 && isFinalFragment) { @@ -896,8 +886,7 @@ void WebSocket::onConnectionClosed() LOGD("WebSocket (%p) onConnectionClosed ...\n", this); _readyState = State::CLOSED; _readStateMutex.unlock(); - - _wsHelper->quitWebSocketThread(); + auto isDestroyed = _isDestroyed; _wsHelper->sendMessageToCocosThread([this, isDestroyed](){ if (*isDestroyed) { @@ -914,8 +903,6 @@ int WebSocket::onSocketCallback(struct lws *wsi, int reason, void *user, void *in, ssize_t len) { - //LOGD("socket callback for %d reason\n", reason); - switch (reason) { case LWS_CALLBACK_CLIENT_ESTABLISHED: @@ -938,9 +925,11 @@ int WebSocket::onSocketCallback(struct lws *wsi, case LWS_CALLBACK_CLIENT_WRITEABLE: onClientWritable(); break; - + + case LWS_CALLBACK_GET_THREAD_ID: + break; default: -// LOGD("Unhandled websocket event: %d\n", reason); + //LOGD("Unhandled websocket event: %d\n", reason); break; } diff --git a/native/cocos/network/WebSocket.h b/native/cocos/network/WebSocket.h index b8235a8ca1..f9d79244c6 100644 --- a/native/cocos/network/WebSocket.h +++ b/native/cocos/network/WebSocket.h @@ -227,7 +227,7 @@ private: std::mutex _readStateMutex; State _readyState; std::string _host; - unsigned int _port; + int _port; std::string _path; std::vector _receivedData; diff --git a/native/cocos/scripting/js-bindings/manual/ScriptingCore.cpp b/native/cocos/scripting/js-bindings/manual/ScriptingCore.cpp index 9db5fa4073..26f90305d4 100644 --- a/native/cocos/scripting/js-bindings/manual/ScriptingCore.cpp +++ b/native/cocos/scripting/js-bindings/manual/ScriptingCore.cpp @@ -704,6 +704,7 @@ JS::PersistentRootedScript* ScriptingCore::compileScript(const std::string& path if (compileSucceed) { return script; } else { + cocos2d::log("ScriptingCore:: compileScript fail:%s", path.c_str()); CC_SAFE_DELETE(script); return nullptr; } diff --git a/native/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp b/native/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp index a8e379345f..77d2ace2bb 100644 --- a/native/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp +++ b/native/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp @@ -175,7 +175,7 @@ public: js_proxy_t * p = jsb_get_native_proxy(ws); if (!p) return; - if (Director::DirectorInstance == nullptr || ScriptEngineManager::ShareInstance == nullptr) + if (Director::DirectorInstance == nullptr || ScriptEngineManager::ShareInstance == nullptr || Director::DirectorInstance->getRunningScene() == nullptr) return; JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET @@ -283,7 +283,6 @@ bool js_cocos2dx_extension_WebSocket_constructor(JSContext *cx, uint32_t argc, j if (argc == 1 || argc == 2) { - std::string url; do { @@ -377,8 +376,8 @@ static bool js_cocos2dx_extension_WebSocket_get_readyState(JSContext *cx, uint32 } } -void register_jsb_websocket(JSContext *cx, JS::HandleObject global) { - +void register_jsb_websocket(JSContext *cx, JS::HandleObject global) +{ js_cocos2dx_websocket_class = (JSClass *)calloc(1, sizeof(JSClass)); js_cocos2dx_websocket_class->name = "WebSocket"; js_cocos2dx_websocket_class->addProperty = JS_PropertyStub; diff --git a/native/cocos/ui/UIRichText.cpp b/native/cocos/ui/UIRichText.cpp index 30e4164215..e985e95732 100644 --- a/native/cocos/ui/UIRichText.cpp +++ b/native/cocos/ui/UIRichText.cpp @@ -25,6 +25,7 @@ #include "UIRichText.h" #include +#include #include "tinyxml2/tinyxml2.h" #include "platform/CCFileUtils.h" @@ -705,7 +706,7 @@ static int getPrevWord(const std::string& text, int idx) // start from idx-1 for (int i=idx-1; i>=0; --i) { - if (!std::isalnum(text[i])) + if (!std::isalnum(text[i], std::locale())) return i; } return -1; @@ -715,7 +716,7 @@ static bool isWrappable(const std::string& text) { for (int i=0; i 0) diff --git a/native/extensions/GUI/CCScrollView/CCTableView.cpp b/native/extensions/GUI/CCScrollView/CCTableView.cpp index be25b65319..5cdd81f860 100644 --- a/native/extensions/GUI/CCScrollView/CCTableView.cpp +++ b/native/extensions/GUI/CCScrollView/CCTableView.cpp @@ -155,14 +155,17 @@ void TableView::updateCellAtIndex(ssize_t idx) return; } - TableViewCell* cell = this->cellAtIndex(idx); + TableViewCell* cell = cellAtIndex(idx); if (cell) { - this->_moveCellOutOfSight(cell); + _moveCellOutOfSight(cell); } cell = _dataSource->tableCellAtIndex(this, idx); - this->_setIndexForCell(idx, cell); - this->_addCellIfNecessary(cell); + if (cell) + { + _setIndexForCell(idx, cell); + _addCellIfNecessary(cell); + } } void TableView::insertCellAtIndex(ssize_t idx) From a88147e27065ebdbe9e4eb84b40c864d310b5caf Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Thu, 21 Apr 2016 18:13:49 +0800 Subject: [PATCH 03/25] Fixed fail to exit normally on android --- native/cocos/platform/android/CCApplication-android.cpp | 1 - native/cocos/platform/android/CCGLViewImpl-android.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/native/cocos/platform/android/CCApplication-android.cpp b/native/cocos/platform/android/CCApplication-android.cpp index 87c5290c86..3db056c262 100644 --- a/native/cocos/platform/android/CCApplication-android.cpp +++ b/native/cocos/platform/android/CCApplication-android.cpp @@ -61,7 +61,6 @@ Application::Application() Application::~Application() { sm_pSharedApplication = nullptr; - JniHelper::callStaticVoidMethod("org/cocos2dx/lib/Cocos2dxHelper", "terminateProcess"); } int Application::run() diff --git a/native/cocos/platform/android/CCGLViewImpl-android.cpp b/native/cocos/platform/android/CCGLViewImpl-android.cpp index e34299d2d4..6e662305d0 100644 --- a/native/cocos/platform/android/CCGLViewImpl-android.cpp +++ b/native/cocos/platform/android/CCGLViewImpl-android.cpp @@ -110,7 +110,7 @@ bool GLViewImpl::isOpenGLReady() void GLViewImpl::end() { - + JniHelper::callStaticVoidMethod("org/cocos2dx/lib/Cocos2dxHelper", "terminateProcess"); } void GLViewImpl::swapBuffers() From a50b000b179a80e0dd7ac28ddcb4fd206d97bd34 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Thu, 21 Apr 2016 23:47:26 +0800 Subject: [PATCH 04/25] Fixed memory leak and warns --- native/cocos/2d/CCLabel.cpp | 2 -- native/cocos/2d/CCMenuItem.cpp | 10 +++++----- native/cocos/base/CCEventDispatcher.cpp | 1 - native/cocos/base/CCProperties.cpp | 2 +- .../editor-support/cocosbuilder/CCBReader.cpp | 4 ++-- .../editor-support/cocostudio/CCActionFrame.cpp | 4 ++-- .../editor-support/cocostudio/CCActionFrame.h | 4 ++-- .../cocos/editor-support/cocostudio/CocoLoader.cpp | 6 +++--- .../chipmunk/js_bindings_chipmunk_manual.cpp | 5 ++++- .../js-bindings/manual/js_manual_conversions.cpp | 2 ++ .../js-bindings/manual/network/jsb_websocket.cpp | 14 ++++++++------ native/cocos/ui/UIScale9Sprite.cpp | 11 ++++------- 12 files changed, 33 insertions(+), 32 deletions(-) diff --git a/native/cocos/2d/CCLabel.cpp b/native/cocos/2d/CCLabel.cpp index a29dd089f8..d44a0e7eb1 100644 --- a/native/cocos/2d/CCLabel.cpp +++ b/native/cocos/2d/CCLabel.cpp @@ -857,7 +857,6 @@ bool Label::updateQuads() batchNode->getTextureAtlas()->removeAllQuads(); } - bool letterClamp = false; for (int ctr = 0; ctr < _lengthOfString; ++ctr) { if (_lettersInfo[ctr].valid) @@ -893,7 +892,6 @@ bool Label::updateQuads() _reusedRect.size.width = 0; }else if(_overflow == Overflow::SHRINK){ if (_contentSize.width > letterDef.width) { - letterClamp = true; ret = false; break; }else{ diff --git a/native/cocos/2d/CCMenuItem.cpp b/native/cocos/2d/CCMenuItem.cpp index 8a62642890..819bdb365c 100644 --- a/native/cocos/2d/CCMenuItem.cpp +++ b/native/cocos/2d/CCMenuItem.cpp @@ -383,7 +383,8 @@ void MenuItemSprite::setNormalImage(Node* image) if (image) { addChild(image); - image->setAnchorPoint(Vec2(0, 0)); + image->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT); + setContentSize(image->getContentSize()); } if (_normalImage) @@ -392,7 +393,6 @@ void MenuItemSprite::setNormalImage(Node* image) } _normalImage = image; - this->setContentSize(_normalImage->getContentSize()); this->updateImagesVisibility(); } } @@ -536,7 +536,7 @@ void MenuItemSprite::updateImagesVisibility() { if (_enabled) { - if (_normalImage) _normalImage->setVisible(true); + if (_normalImage) _normalImage->setVisible(true); if (_selectedImage) _selectedImage->setVisible(false); if (_disabledImage) _disabledImage->setVisible(false); } @@ -544,13 +544,13 @@ void MenuItemSprite::updateImagesVisibility() { if (_disabledImage) { - if (_normalImage) _normalImage->setVisible(false); + if (_normalImage) _normalImage->setVisible(false); if (_selectedImage) _selectedImage->setVisible(false); if (_disabledImage) _disabledImage->setVisible(true); } else { - if (_normalImage) _normalImage->setVisible(true); + if (_normalImage) _normalImage->setVisible(true); if (_selectedImage) _selectedImage->setVisible(false); if (_disabledImage) _disabledImage->setVisible(false); } diff --git a/native/cocos/base/CCEventDispatcher.cpp b/native/cocos/base/CCEventDispatcher.cpp index 6bd98ba83f..ca03a133b3 100644 --- a/native/cocos/base/CCEventDispatcher.cpp +++ b/native/cocos/base/CCEventDispatcher.cpp @@ -767,7 +767,6 @@ void EventDispatcher::dispatchEventToListeners(EventListenerVector* listeners, c if (l->isEnabled() && !l->isPaused() && l->isRegistered() && onEvent(l)) { - shouldStopPropagation = true; break; } } diff --git a/native/cocos/base/CCProperties.cpp b/native/cocos/base/CCProperties.cpp index e6acec6349..be483fa3fe 100644 --- a/native/cocos/base/CCProperties.cpp +++ b/native/cocos/base/CCProperties.cpp @@ -140,7 +140,7 @@ static bool isVariable(const char* str, char* outName, size_t outSize) size_t size = len - 3; if (size > (outSize - 1)) size = outSize - 1; - strncpy(outName, str + 2, len - 3); + strncpy(outName, str + 2, size); outName[len - 3] = 0; return true; } diff --git a/native/cocos/editor-support/cocosbuilder/CCBReader.cpp b/native/cocos/editor-support/cocosbuilder/CCBReader.cpp index c07e82e0fc..780bb7ba3e 100644 --- a/native/cocos/editor-support/cocosbuilder/CCBReader.cpp +++ b/native/cocos/editor-support/cocosbuilder/CCBReader.cpp @@ -655,7 +655,7 @@ Node * CCBReader::readNodeGraph(Node * pParent) if(!assigned && this->_CCBMemberVariableAssigner != nullptr) { - assigned = this->_CCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node); + _CCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node); } } } @@ -696,7 +696,7 @@ Node * CCBReader::readNodeGraph(Node * pParent) if(!customAssigned && this->_CCBMemberVariableAssigner != nullptr) { - customAssigned = this->_CCBMemberVariableAssigner->onAssignCCBCustomProperty(target, iter->first.c_str(), iter->second); + _CCBMemberVariableAssigner->onAssignCCBCustomProperty(target, iter->first.c_str(), iter->second); } } } diff --git a/native/cocos/editor-support/cocostudio/CCActionFrame.cpp b/native/cocos/editor-support/cocostudio/CCActionFrame.cpp index f98220195c..4937d678ef 100644 --- a/native/cocos/editor-support/cocostudio/CCActionFrame.cpp +++ b/native/cocos/editor-support/cocostudio/CCActionFrame.cpp @@ -229,7 +229,7 @@ ActionMoveFrame::~ActionMoveFrame() { } -void ActionMoveFrame::setPosition(Vec2 pos) +void ActionMoveFrame::setPosition(const Vec2& pos) { _position = pos; } @@ -357,7 +357,7 @@ ActionTintFrame::~ActionTintFrame() } -void ActionTintFrame::setColor(Color3B ccolor) +void ActionTintFrame::setColor(const Color3B& ccolor) { _color = ccolor; } diff --git a/native/cocos/editor-support/cocostudio/CCActionFrame.h b/native/cocos/editor-support/cocostudio/CCActionFrame.h index 711b6aecbc..19fea31557 100644 --- a/native/cocos/editor-support/cocostudio/CCActionFrame.h +++ b/native/cocos/editor-support/cocostudio/CCActionFrame.h @@ -230,7 +230,7 @@ public: * * @param the move action position. */ - void setPosition(cocos2d::Vec2 pos); + void setPosition(const cocos2d::Vec2& pos); /** * Gets the move action position. @@ -429,7 +429,7 @@ public: * * @param ccolor the tint action color */ - void setColor(cocos2d::Color3B ccolor); + void setColor(const cocos2d::Color3B& ccolor); /** * Gets the tint action color. diff --git a/native/cocos/editor-support/cocostudio/CocoLoader.cpp b/native/cocos/editor-support/cocostudio/CocoLoader.cpp index f38b8ca36b..7650e79bcb 100644 --- a/native/cocos/editor-support/cocostudio/CocoLoader.cpp +++ b/native/cocos/editor-support/cocostudio/CocoLoader.cpp @@ -172,16 +172,16 @@ CocoLoader::~CocoLoader() } -bool CocoLoader::ReadCocoBinBuff(char* pBinBuff) +bool CocoLoader::ReadCocoBinBuff(char* pBinBuff) { if(m_pMemoryBuff)return true; char* pTempBuff = pBinBuff; m_pFileHeader = (stCocoFileHeader*)pTempBuff; pTempBuff += sizeof(stCocoFileHeader); - char* pStartAddr = m_pMemoryBuff = pTempBuff; + char* pStartAddr = m_pMemoryBuff = pTempBuff; - char* pDestBuff = new char[m_pFileHeader->m_nDataSize]; + char* pDestBuff = new char[m_pFileHeader->m_nDataSize]; if (m_pFileHeader->m_nCompressSize > 0) { uLongf dwSrcSize = m_pFileHeader->m_nCompressSize; diff --git a/native/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp b/native/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp index 60668efcc3..1a2fa47382 100644 --- a/native/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp +++ b/native/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp @@ -663,7 +663,10 @@ bool jsval_to_array_of_cpvect( JSContext *cx, jsval vp, cpVect**verts, int *numV double value = 0; ok = JS::ToNumber(cx, valarg, &value); - JSB_PRECONDITION( ok, "Error converting value to nsobject"); + if (!ok) { + free(array); + } + JSB_PRECONDITION(ok, "Error converting value to nsobject"); if(i%2==0) array[i/2].x = value; diff --git a/native/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp b/native/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp index 4158c40a4c..05325c24e4 100644 --- a/native/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp +++ b/native/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp @@ -917,6 +917,8 @@ bool jsval_to_ccarray_of_CCPoint(JSContext* cx, JS::HandleValue v, Point **point JS_GetElement(cx, jsobj, i, &valarg); ok = jsval_to_ccpoint(cx, valarg, &array[i]); + if(!ok) + delete [] array; JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); } diff --git a/native/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp b/native/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp index 77d2ace2bb..cb992f8aea 100644 --- a/native/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp +++ b/native/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp @@ -292,12 +292,8 @@ bool js_cocos2dx_extension_WebSocket_constructor(JSContext *cx, uint32_t argc, j JS::RootedObject proto(cx, js_cocos2dx_websocket_prototype); JS::RootedObject obj(cx, JS_NewObject(cx, js_cocos2dx_websocket_class, proto, JS::NullPtr())); - //JS::RootedObject obj(cx, JS_NewObjectForConstructor(cx, js_cocos2dx_websocket_class, args)); - - WebSocket* cobj = new (std::nothrow) WebSocket(); - auto delegate = new (std::nothrow) JSB_WebSocketDelegate(cx); - delegate->setJSDelegate(obj); + WebSocket* cobj = nullptr; if (argc == 2) { std::vector protocols; @@ -333,14 +329,20 @@ bool js_cocos2dx_extension_WebSocket_constructor(JSContext *cx, uint32_t argc, j protocols.push_back(protocol); } } + + cobj = new (std::nothrow) WebSocket(); + auto delegate = new (std::nothrow) JSB_WebSocketDelegate(cx); + delegate->setJSDelegate(obj); cobj->init(*delegate, url, &protocols); } else { + cobj = new (std::nothrow) WebSocket(); + auto delegate = new (std::nothrow) JSB_WebSocketDelegate(cx); + delegate->setJSDelegate(obj); cobj->init(*delegate, url); } - JS_DefineProperty(cx, obj, "URL", args.get(0), JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY); //protocol not support yet (always return "") diff --git a/native/cocos/ui/UIScale9Sprite.cpp b/native/cocos/ui/UIScale9Sprite.cpp index aa5c6cddd4..94ee8bf05f 100644 --- a/native/cocos/ui/UIScale9Sprite.cpp +++ b/native/cocos/ui/UIScale9Sprite.cpp @@ -1062,27 +1062,24 @@ namespace ui { bottomHeight = originalSize.height - (capInsets.origin.y + centerHeight) - offsets.w; } - - if(leftWidth<0) + if(leftWidth < 0) { centerWidth += leftWidth; leftWidth = 0; } - if(rightWidth<0) + if(rightWidth < 0) { centerWidth += rightWidth; - rightWidth = 0; } - if(topHeight<0) + if(topHeight < 0) { centerHeight += topHeight; topHeight = 0; } - if(bottomHeight<0) + if(bottomHeight < 0) { centerHeight += bottomHeight; - bottomHeight = 0; } auto textureRect = CC_RECT_POINTS_TO_PIXELS(_spriteRect); From a4bdfa270cab6a90adf3735ab17b8a91205ffce4 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Fri, 22 Apr 2016 11:31:32 +0800 Subject: [PATCH 05/25] Fixed warns in JS bindings --- .../auto/api/jsb_cocos2dx_auto_api.js | 248 -- .../auto/api/jsb_cocos2dx_spine_auto_api.js | 80 - .../auto/api/jsb_cocos2dx_studio_auto_api.js | 30 - .../auto/jsb_cocos2dx_audioengine_auto.cpp | 17 +- .../js-bindings/auto/jsb_cocos2dx_auto.cpp | 2301 ++++++++--------- .../js-bindings/auto/jsb_cocos2dx_auto.hpp | 21 - .../auto/jsb_cocos2dx_builder_auto.cpp | 13 +- .../auto/jsb_cocos2dx_extension_auto.cpp | 173 +- .../auto/jsb_cocos2dx_spine_auto.cpp | 431 +-- .../auto/jsb_cocos2dx_spine_auto.hpp | 6 - .../auto/jsb_cocos2dx_studio_auto.cpp | 268 +- .../auto/jsb_cocos2dx_studio_auto.hpp | 2 - .../js-bindings/auto/jsb_cocos2dx_ui_auto.cpp | 541 ++-- .../js-bindings/auto/jsb_creator_auto.cpp | 48 +- .../js-bindings/manual/cocos2d_specifics.cpp | 48 +- .../manual/js_manual_conversions.cpp | 122 +- .../manual/js_manual_conversions.h | 1 + native/tools/tojs/cocos2dx.ini | 21 +- native/tools/tojs/cocos2dx_spine.ini | 4 +- native/tools/tojs/cocos2dx_studio.ini | 4 +- 20 files changed, 1909 insertions(+), 2470 deletions(-) diff --git a/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js b/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js index 3ebe541235..a288e07768 100644 --- a/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js +++ b/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js @@ -90,26 +90,6 @@ hasPremultipliedAlpha : function ( return false; }, -/** - * @method initWithMipmaps - * @param {cc._MipmapInfo} arg0 - * @param {int} arg1 - * @param {cc.Texture2D::PixelFormat} arg2 - * @param {int} arg3 - * @param {int} arg4 - * @return {bool} - */ -initWithMipmaps : function ( -map, -int, -pixelformat, -int, -int -) -{ - return false; -}, - /** * @method getPixelsHigh * @return {int} @@ -955,16 +935,6 @@ getTag : function ( return 0; }, -/** - * @method getonEnterTransitionDidFinishCallback - * @return {function} - */ -getonEnterTransitionDidFinishCallback : function ( -) -{ - return std::function; -}, - /** * @method getNodeToWorldAffineTransform * @return {cc.AffineTransform} @@ -1161,16 +1131,6 @@ node return cc.AffineTransform; }, -/** - * @method getOnEnterCallback - * @return {function} - */ -getOnEnterCallback : function ( -) -{ - return std::function; -}, - /** * @method isOpacityModifyRGB * @return {bool} @@ -1714,16 +1674,6 @@ float { }, -/** - * @method getOnExitCallback - * @return {function} - */ -getOnExitCallback : function ( -) -{ - return std::function; -}, - /** * @method getChildByTag * @param {int} arg0 @@ -1904,16 +1854,6 @@ func { }, -/** - * @method getonExitTransitionDidStartCallback - * @return {function} - */ -getonExitTransitionDidStartCallback : function ( -) -{ - return std::function; -}, - /** * @method removeFromParentAndCleanup * @param {bool} bool @@ -2430,16 +2370,6 @@ glcontextattrs { }, -/** - * @method getGLContextAttrs - * @return {GLContextAttrs} - */ -getGLContextAttrs : function ( -) -{ - return GLContextAttrs; -}, - }; /** @@ -7218,20 +7148,6 @@ ActionCamera : function ( */ cc.OrbitCamera = { -/** - * @method sphericalRadius - * @param {float} arg0 - * @param {float} arg1 - * @param {float} arg2 - */ -sphericalRadius : function ( -float, -float, -float -) -{ -}, - /** * @method initWithDuration * @param {float} arg0 @@ -10021,30 +9937,6 @@ ShatteredTiles3D : function ( */ cc.ShuffleTiles = { -/** - * @method placeTile - * @param {vec2_object} arg0 - * @param {cc.Tile} arg1 - */ -placeTile : function ( -vec2, -tile -) -{ -}, - -/** - * @method shuffle - * @param {unsigned int} arg0 - * @param {unsigned int} arg1 - */ -shuffle : function ( -int, -int -) -{ -}, - /** * @method initWithDuration * @param {float} arg0 @@ -10291,18 +10183,6 @@ vec2 { }, -/** - * @method shuffle - * @param {unsigned int} arg0 - * @param {unsigned int} arg1 - */ -shuffle : function ( -int, -int -) -{ -}, - /** * @method initWithDuration * @param {float} arg0 @@ -10852,20 +10732,6 @@ glprogram { }, -/** - * @method setUniformFloatv -* @param {int|String} int -* @param {int|int} int -* @param {float|float} float -*/ -setUniformFloatv : function( -str, -int, -float -) -{ -}, - /** * @method getGLProgram * @return {cc.GLProgram} @@ -16519,48 +16385,6 @@ getRenderFormat : function ( return 0; }, -/** - * @method getData - * @return {unsigned char} - */ -getData : function ( -) -{ - return 0; -}, - -/** - * @method getMipmaps - * @return {cc._MipmapInfo} - */ -getMipmaps : function ( -) -{ - return cc._MipmapInfo; -}, - -/** - * @method initWithRawData - * @param {unsigned char} arg0 - * @param {int} arg1 - * @param {int} arg2 - * @param {int} arg3 - * @param {int} arg4 - * @param {bool} arg5 - * @return {bool} - */ -initWithRawData : function ( -char, -int, -int, -int, -int, -bool -) -{ - return false; -}, - /** * @method setPVRImagesHavePremultipliedAlpha * @param {bool} arg0 @@ -18561,16 +18385,6 @@ int { }, -/** - * @method getUniformFlags - * @return {cc.GLProgram::UniformFlags} - */ -getUniformFlags : function ( -) -{ - return cc.GLProgram::UniformFlags; -}, - /** * @method getUniformLocationForName * @param {char} arg0 @@ -18767,18 +18581,6 @@ str return 0; }, -/** - * @method getVertexAttrib - * @param {String} arg0 - * @return {cc.VertexAttrib} - */ -getVertexAttrib : function ( -str -) -{ - return cc.VertexAttrib; -}, - /** * @method setUniformLocationWith2f * @param {int} arg0 @@ -20014,16 +19816,6 @@ TextFieldTTF : function ( */ cc.ParallaxNode = { -/** - * @method getParallaxArray -* @return {cc._ccArray|cc._ccArray} -*/ -getParallaxArray : function( -) -{ - return cc._ccArray; -}, - /** * @method addChild * @param {cc.Node} arg0 @@ -20050,16 +19842,6 @@ bool { }, -/** - * @method setParallaxArray - * @param {cc._ccArray} arg0 - */ -setParallaxArray : function ( -_ccarray -) -{ -}, - /** * @method create * @return {cc.ParallaxNode} @@ -20668,16 +20450,6 @@ releaseMap : function ( { }, -/** - * @method getTGAInfo - * @return {cc.sImageTGA} - */ -getTGAInfo : function ( -) -{ - return cc.sImageTGA; -}, - /** * @method getTileAt * @param {vec2_object} arg0 @@ -20702,16 +20474,6 @@ vec2 { }, -/** - * @method setTGAInfo - * @param {cc.sImageTGA} arg0 - */ -setTGAInfo : function ( -simagetga -) -{ -}, - /** * @method create * @param {String} arg0 @@ -20816,16 +20578,6 @@ releaseMap : function ( { }, -/** - * @method setTiles - * @param {unsigned int} arg0 - */ -setTiles : function ( -int -) -{ -}, - /** * @method getLayerSize * @return {size_object} diff --git a/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js b/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js index 4b08825707..6ad64f8a82 100644 --- a/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js +++ b/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js @@ -50,18 +50,6 @@ setBonesToSetupPose : function ( { }, -/** - * @method initWithData - * @param {spSkeletonData} arg0 - * @param {bool} arg1 - */ -initWithData : function ( -spskeletondata, -bool -) -{ -}, - /** * @method setDebugSlotsEnabled * @param {bool} arg0 @@ -272,46 +260,6 @@ getState : function ( return spAnimationState; }, -/** - * @method setTrackCompleteListener - * @param {spTrackEntry} arg0 - * @param {function} arg1 - */ -setTrackCompleteListener : function ( -sptrackentry, -func -) -{ -}, - -/** - * @method onTrackEntryEvent - * @param {int} arg0 - * @param {spEventType} arg1 - * @param {spEvent} arg2 - * @param {int} arg3 - */ -onTrackEntryEvent : function ( -int, -speventtype, -spevent, -int -) -{ -}, - -/** - * @method setTrackStartListener - * @param {spTrackEntry} arg0 - * @param {function} arg1 - */ -setTrackStartListener : function ( -sptrackentry, -func -) -{ -}, - /** * @method update * @param {float} arg0 @@ -332,18 +280,6 @@ func { }, -/** - * @method setTrackEndListener - * @param {spTrackEntry} arg0 - * @param {function} arg1 - */ -setTrackEndListener : function ( -sptrackentry, -func -) -{ -}, - /** * @method setEventListener * @param {function} arg0 @@ -402,22 +338,6 @@ clearTrack : function ( { }, -/** - * @method onAnimationStateEvent - * @param {int} arg0 - * @param {spEventType} arg1 - * @param {spEvent} arg2 - * @param {int} arg3 - */ -onAnimationStateEvent : function ( -int, -speventtype, -spevent, -int -) -{ -}, - /** * @method createWithFile * @param {String|String} str diff --git a/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_studio_auto_api.js b/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_studio_auto_api.js index be2e55605b..70570125f8 100644 --- a/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_studio_auto_api.js +++ b/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_studio_auto_api.js @@ -114,20 +114,6 @@ getLoop : function ( return false; }, -/** - * @method initWithBinary - * @param {ccs.CocoLoader} arg0 - * @param {ccs.stExpCocoNode} arg1 - * @param {cc.Ref} arg2 - */ -initWithBinary : function ( -cocoloader, -stexpcoconode, -ref -) -{ -}, - /** * @method addActionNode * @param {ccs.ActionNode} arg0 @@ -232,22 +218,6 @@ char return ccs.ActionObject; }, -/** - * @method initWithBinary - * @param {char} arg0 - * @param {cc.Ref} arg1 - * @param {ccs.CocoLoader} arg2 - * @param {ccs.stExpCocoNode} arg3 - */ -initWithBinary : function ( -char, -ref, -cocoloader, -stexpcoconode -) -{ -}, - /** * @method playActionByName * @param {char|char} char diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp index 723bb9bfa9..68b6fded35 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp @@ -426,14 +426,15 @@ bool js_cocos2dx_audioengine_AudioEngine_setVolume(JSContext *cx, uint32_t argc, bool js_cocos2dx_audioengine_AudioEngine_preload(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::function arg1; + ok = true; do { if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION) { @@ -457,17 +458,18 @@ bool js_cocos2dx_audioengine_AudioEngine_preload(JSContext *cx, uint32_t argc, j } } while(0) ; - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::experimental::AudioEngine::preload(arg0, arg1); return true; } } while (0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::experimental::AudioEngine::preload(arg0); return true; } @@ -686,13 +688,13 @@ bool js_cocos2dx_audioengine_AudioEngine_setFinishCallback(JSContext *cx, uint32 bool js_cocos2dx_audioengine_AudioEngine_getProfile(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::experimental::AudioProfile* ret = cocos2d::experimental::AudioEngine::getProfile(arg0); jsval jsret = JSVAL_NULL; do { @@ -709,10 +711,11 @@ bool js_cocos2dx_audioengine_AudioEngine_getProfile(JSContext *cx, uint32_t argc } while (0); do { + bool ok = true; if (argc == 1) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::experimental::AudioProfile* ret = cocos2d::experimental::AudioEngine::getProfile(arg0); jsval jsret = JSVAL_NULL; do { diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp index 6ef785a339..e8fca71c23 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp @@ -111,7 +111,6 @@ bool js_cocos2dx_Texture2D_getStringForFormat(JSContext *cx, uint32_t argc, jsva } bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Texture2D* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -121,6 +120,7 @@ bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_initWithImage : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::Image* arg0 = nullptr; do { @@ -132,10 +132,11 @@ bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp arg0 = (cocos2d::Image*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D::PixelFormat arg1; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithImage(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -145,6 +146,7 @@ bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Image* arg0 = nullptr; do { @@ -156,7 +158,7 @@ bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp arg0 = (cocos2d::Image*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithImage(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -248,37 +250,6 @@ bool js_cocos2dx_Texture2D_hasPremultipliedAlpha(JSContext *cx, uint32_t argc, j JS_ReportError(cx, "js_cocos2dx_Texture2D_hasPremultipliedAlpha : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_Texture2D_initWithMipmaps(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_initWithMipmaps : Invalid Native Object"); - if (argc == 5) { - cocos2d::_MipmapInfo* arg0 = nullptr; - int arg1 = 0; - cocos2d::Texture2D::PixelFormat arg2; - int arg3 = 0; - int arg4 = 0; - #pragma warning NO CONVERSION TO NATIVE FOR _MipmapInfo* - ok = false; - ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_initWithMipmaps : Error processing arguments"); - bool ret = cobj->initWithMipmaps(arg0, arg1, arg2, arg3, arg4); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Texture2D_initWithMipmaps : wrong number of arguments: %d, was expecting %d", argc, 5); - return false; -} bool js_cocos2dx_Texture2D_getPixelsHigh(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -299,7 +270,6 @@ bool js_cocos2dx_Texture2D_getPixelsHigh(JSContext *cx, uint32_t argc, jsval *vp } bool js_cocos2dx_Texture2D_getBitsPerPixelForFormat(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Texture2D* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -309,10 +279,11 @@ bool js_cocos2dx_Texture2D_getBitsPerPixelForFormat(JSContext *cx, uint32_t argc cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getBitsPerPixelForFormat : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Texture2D::PixelFormat arg0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int ret = cobj->getBitsPerPixelForFormat(arg0); jsval jsret = JSVAL_NULL; jsret = uint32_to_jsval(cx, ret); @@ -354,7 +325,6 @@ bool js_cocos2dx_Texture2D_getName(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Texture2D* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -364,13 +334,15 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_initWithString : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::FontDefinition arg1; + ok = true; ok &= jsval_to_FontDefinition(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithString(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -380,16 +352,19 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v } while(0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithString(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -399,19 +374,23 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v } while(0); do { + bool ok = true; if (argc == 4) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg3; + ok = true; ok &= jsval_to_ccsize(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithString(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -421,22 +400,27 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v } while(0); do { + bool ok = true; if (argc == 5) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg3; + ok = true; ok &= jsval_to_ccsize(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextHAlignment arg4; + ok = true; ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -446,25 +430,31 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v } while(0); do { + bool ok = true; if (argc == 6) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg3; + ok = true; ok &= jsval_to_ccsize(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextHAlignment arg4; + ok = true; ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextVAlignment arg5; + ok = true; ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4, arg5); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -798,7 +788,6 @@ void js_register_cocos2dx_Texture2D(JSContext *cx, JS::HandleObject global) { JS_FN("getMaxS", js_cocos2dx_Texture2D_getMaxS, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("releaseGLTexture", js_cocos2dx_Texture2D_releaseGLTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), 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("getBitsPerPixelForFormat", js_cocos2dx_Texture2D_getBitsPerPixelForFormat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getName", js_cocos2dx_Texture2D_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -970,7 +959,6 @@ bool js_cocos2dx_Touch_getID(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Touch_setTouchInfo(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Touch* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -980,22 +968,27 @@ bool js_cocos2dx_Touch_setTouchInfo(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_setTouchInfo : Invalid Native Object"); do { + bool ok = true; if (argc == 5) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg3 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg4 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setTouchInfo(arg0, arg1, arg2, arg3, arg4); args.rval().setUndefined(); return true; @@ -1003,16 +996,19 @@ bool js_cocos2dx_Touch_setTouchInfo(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 3) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setTouchInfo(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -1452,7 +1448,6 @@ bool js_cocos2dx_ComponentContainer_visit(JSContext *cx, uint32_t argc, jsval *v } bool js_cocos2dx_ComponentContainer_remove(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ComponentContainer* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1462,6 +1457,7 @@ bool js_cocos2dx_ComponentContainer_remove(JSContext *cx, uint32_t argc, jsval * cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_remove : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Component* arg0 = nullptr; do { @@ -1473,7 +1469,7 @@ bool js_cocos2dx_ComponentContainer_remove(JSContext *cx, uint32_t argc, jsval * arg0 = (cocos2d::Component*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->remove(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -1483,10 +1479,11 @@ bool js_cocos2dx_ComponentContainer_remove(JSContext *cx, uint32_t argc, jsval * } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->remove(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -1911,7 +1908,6 @@ JSObject *jsb_cocos2d_Node_prototype; bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1921,6 +1917,7 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_addChild : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::Node* arg0 = nullptr; do { @@ -1932,10 +1929,11 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addChild(arg0, arg1); args.rval().setUndefined(); return true; @@ -1943,6 +1941,7 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Node* arg0 = nullptr; do { @@ -1954,7 +1953,7 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addChild(arg0); args.rval().setUndefined(); return true; @@ -1962,6 +1961,7 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 3) { cocos2d::Node* arg0 = nullptr; do { @@ -1973,13 +1973,15 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg2 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addChild(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -1987,6 +1989,7 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 3) { cocos2d::Node* arg0 = nullptr; do { @@ -1998,13 +2001,15 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addChild(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -2016,7 +2021,6 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -2026,6 +2030,7 @@ bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeComponent : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Component* arg0 = nullptr; do { @@ -2037,7 +2042,7 @@ bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Component*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->removeComponent(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -2047,10 +2052,11 @@ bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->removeComponent(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -2147,7 +2153,6 @@ bool js_cocos2dx_Node_setCascadeOpacityEnabled(JSContext *cx, uint32_t argc, jsv } bool js_cocos2dx_Node_getChildren(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -2542,24 +2547,6 @@ bool js_cocos2dx_Node_getTag(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Node_getTag : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_Node_getonEnterTransitionDidFinishCallback(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::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getonEnterTransitionDidFinishCallback : Invalid Native Object"); - if (argc == 0) { - const std::function& ret = cobj->getonEnterTransitionDidFinishCallback(); - jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR std::function; - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Node_getonEnterTransitionDidFinishCallback : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_Node_getNodeToWorldAffineTransform(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -2874,7 +2861,6 @@ bool js_cocos2dx_Node_convertTouchToNodeSpace(JSContext *cx, uint32_t argc, jsva } bool js_cocos2dx_Node_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -2884,6 +2870,7 @@ bool js_cocos2dx_Node_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeAllChildrenWithCleanup : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { bool arg0; arg0 = JS::ToBoolean(args.get(0)); @@ -3024,7 +3011,6 @@ bool js_cocos2dx_Node_getName(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Node_getNodeToParentAffineTransform(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3034,6 +3020,7 @@ bool js_cocos2dx_Node_getNodeToParentAffineTransform(JSContext *cx, uint32_t arg cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToParentAffineTransform : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Node* arg0 = nullptr; do { @@ -3045,7 +3032,7 @@ bool js_cocos2dx_Node_getNodeToParentAffineTransform(JSContext *cx, uint32_t arg arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::AffineTransform ret = cobj->getNodeToParentAffineTransform(arg0); jsval jsret = JSVAL_NULL; jsret = ccaffinetransform_to_jsval(cx, ret); @@ -3067,24 +3054,6 @@ bool js_cocos2dx_Node_getNodeToParentAffineTransform(JSContext *cx, uint32_t arg JS_ReportError(cx, "js_cocos2dx_Node_getNodeToParentAffineTransform : wrong number of arguments"); return false; } -bool js_cocos2dx_Node_getOnEnterCallback(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::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getOnEnterCallback : Invalid Native Object"); - if (argc == 0) { - const std::function& ret = cobj->getOnEnterCallback(); - jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR std::function; - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Node_getOnEnterCallback : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_Node_isOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3343,7 +3312,6 @@ bool js_cocos2dx_Node_getChildrenCount(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Node_getNodeToParentTransform(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3353,6 +3321,7 @@ bool js_cocos2dx_Node_getNodeToParentTransform(JSContext *cx, uint32_t argc, jsv cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToParentTransform : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Node* arg0 = nullptr; do { @@ -3364,7 +3333,7 @@ bool js_cocos2dx_Node_getNodeToParentTransform(JSContext *cx, uint32_t argc, jsv arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Mat4 ret = cobj->getNodeToParentTransform(arg0); jsval jsret = JSVAL_NULL; jsret = matrix_to_jsval(cx, ret); @@ -3541,7 +3510,6 @@ bool js_cocos2dx_Node_getAnchorPointInPoints(JSContext *cx, uint32_t argc, jsval } bool js_cocos2dx_Node_visit(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3559,6 +3527,7 @@ bool js_cocos2dx_Node_visit(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 3) { cocos2d::Renderer* arg0 = nullptr; do { @@ -3570,13 +3539,15 @@ bool js_cocos2dx_Node_visit(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Renderer*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Mat4 arg1; + ok = true; ok &= jsval_to_matrix(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg2 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->visit(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -3908,7 +3879,6 @@ bool js_cocos2dx_Node_getLocalZOrder(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Node_getScheduler(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4002,7 +3972,6 @@ bool js_cocos2dx_Node_setActionManager(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Node_getPosition(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4012,15 +3981,17 @@ bool js_cocos2dx_Node_getPosition(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPosition : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { float* arg0 = 0; #pragma warning NO CONVERSION TO NATIVE FOR float* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } float* arg1 = 0; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR float* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->getPosition(arg0, arg1); args.rval().setUndefined(); return true; @@ -4060,7 +4031,6 @@ bool js_cocos2dx_Node_isRunning(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Node_getParent(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4288,7 +4258,6 @@ bool js_cocos2dx_Node_setGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4298,13 +4267,15 @@ bool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScale : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setScale(arg0, arg1); args.rval().setUndefined(); return true; @@ -4312,10 +4283,11 @@ bool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setScale(arg0); args.rval().setUndefined(); return true; @@ -4325,24 +4297,6 @@ bool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Node_setScale : wrong number of arguments"); return false; } -bool js_cocos2dx_Node_getOnExitCallback(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::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getOnExitCallback : Invalid Native Object"); - if (argc == 0) { - const std::function& ret = cobj->getOnExitCallback(); - jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR std::function; - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Node_getOnExitCallback : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_Node_getChildByTag(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4639,7 +4593,6 @@ bool js_cocos2dx_Node_getGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Node_draw(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4657,6 +4610,7 @@ bool js_cocos2dx_Node_draw(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 3) { cocos2d::Renderer* arg0 = nullptr; do { @@ -4668,13 +4622,15 @@ bool js_cocos2dx_Node_draw(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Renderer*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Mat4 arg1; + ok = true; ok &= jsval_to_matrix(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg2 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->draw(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -4766,27 +4722,8 @@ bool js_cocos2dx_Node_enumerateChildren(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Node_enumerateChildren : wrong number of arguments: %d, was expecting %d", argc, 2); return false; } -bool js_cocos2dx_Node_getonExitTransitionDidStartCallback(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::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getonExitTransitionDidStartCallback : Invalid Native Object"); - if (argc == 0) { - const std::function& ret = cobj->getonExitTransitionDidStartCallback(); - jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR std::function; - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Node_getonExitTransitionDidStartCallback : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_Node_removeFromParentAndCleanup(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4796,6 +4733,7 @@ bool js_cocos2dx_Node_removeFromParentAndCleanup(JSContext *cx, uint32_t argc, j cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeFromParentAndCleanup : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { bool arg0; arg0 = JS::ToBoolean(args.get(0)); @@ -5044,7 +4982,6 @@ bool js_cocos2dx_Node_stopAction(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Node_getActionManager(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Node* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -5199,7 +5136,6 @@ void js_register_cocos2dx_Node(JSContext *cx, JS::HandleObject global) { JS_FN("getOpacity", js_cocos2dx_Node_getOpacity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCameraMask", js_cocos2dx_Node_setCameraMask, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTag", js_cocos2dx_Node_getTag, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getonEnterTransitionDidFinishCallback", js_cocos2dx_Node_getonEnterTransitionDidFinishCallback, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getNodeToWorldTransform", js_cocos2dx_Node_getNodeToWorldAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeChild", js_cocos2dx_Node_removeChild, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getScene", js_cocos2dx_Node_getScene, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -5219,7 +5155,6 @@ void js_register_cocos2dx_Node(JSContext *cx, JS::HandleObject global) { JS_FN("setParent", js_cocos2dx_Node_setParent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getName", js_cocos2dx_Node_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getNodeToParentTransform", js_cocos2dx_Node_getNodeToParentAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getOnEnterCallback", js_cocos2dx_Node_getOnEnterCallback, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isOpacityModifyRGB", js_cocos2dx_Node_isOpacityModifyRGB, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("stopActionByTag", js_cocos2dx_Node_stopActionByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("reorderChild", js_cocos2dx_Node_reorderChild, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -5272,7 +5207,6 @@ void js_register_cocos2dx_Node(JSContext *cx, JS::HandleObject global) { JS_FN("getVertexZ", js_cocos2dx_Node_getPositionZ, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setGlobalZOrder", js_cocos2dx_Node_setGlobalZOrder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setScale", js_cocos2dx_Node_setScale, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getOnExitCallback", js_cocos2dx_Node_getOnExitCallback, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getChildByTag", js_cocos2dx_Node_getChildByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setOrderOfArrival", js_cocos2dx_Node_setOrderOfArrival, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getScaleZ", js_cocos2dx_Node_getScaleZ, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -5290,7 +5224,6 @@ void js_register_cocos2dx_Node(JSContext *cx, JS::HandleObject global) { JS_FN("draw", js_cocos2dx_Node_draw, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setUserObject", js_cocos2dx_Node_setUserObject, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("enumerateChildren", js_cocos2dx_Node_enumerateChildren, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getonExitTransitionDidStartCallback", js_cocos2dx_Node_getonExitTransitionDidStartCallback, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeFromParent", js_cocos2dx_Node_removeFromParentAndCleanup, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("convertTouchToNodeSpaceAR", js_cocos2dx_Node_convertTouchToNodeSpaceAR, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("update", js_cocos2dx_Node_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -6051,19 +5984,6 @@ bool js_cocos2dx_GLView_setGLContextAttrs(JSContext *cx, uint32_t argc, jsval *v JS_ReportError(cx, "js_cocos2dx_GLView_setGLContextAttrs : wrong number of arguments"); return false; } -bool js_cocos2dx_GLView_getGLContextAttrs(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - if (argc == 0) { - GLContextAttrs ret = cocos2d::GLView::getGLContextAttrs(); - jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR GLContextAttrs; - args.rval().set(jsret); - return true; - } - JS_ReportError(cx, "js_cocos2dx_GLView_getGLContextAttrs : wrong number of arguments"); - return false; -} void js_cocos2d_GLView_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (GLView)", obj); @@ -6120,7 +6040,6 @@ void js_register_cocos2dx_GLView(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec st_funcs[] = { JS_FN("setGLContextAttrs", js_cocos2dx_GLView_setGLContextAttrs, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getGLContextAttrs", js_cocos2dx_GLView_getGLContextAttrs, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -8494,7 +8413,6 @@ bool js_cocos2dx_Properties_getLong(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Properties_getNamespace(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Properties* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -8514,10 +8432,11 @@ bool js_cocos2dx_Properties_getNamespace(JSContext *cx, uint32_t argc, jsval *vp } while(0); do { + bool ok = true; if (argc == 1) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Properties* ret = cobj->getNamespace(arg0); jsval jsret = JSVAL_NULL; do { @@ -8534,10 +8453,11 @@ bool js_cocos2dx_Properties_getNamespace(JSContext *cx, uint32_t argc, jsval *vp } while(0); do { + bool ok = true; if (argc == 2) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); cocos2d::Properties* ret = cobj->getNamespace(arg0, arg1); @@ -8556,10 +8476,11 @@ bool js_cocos2dx_Properties_getNamespace(JSContext *cx, uint32_t argc, jsval *vp } while(0); do { + bool ok = true; if (argc == 3) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); bool arg2; @@ -8777,7 +8698,6 @@ bool js_cocos2dx_Properties_getBool(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Properties_getColor(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Properties* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -8787,11 +8707,13 @@ bool js_cocos2dx_Properties_getColor(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getColor : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec4* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -8801,7 +8723,7 @@ bool js_cocos2dx_Properties_getColor(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Vec4*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->getColor(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -8811,11 +8733,13 @@ bool js_cocos2dx_Properties_getColor(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 2) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec3* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -8825,7 +8749,7 @@ bool js_cocos2dx_Properties_getColor(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Vec3*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->getColor(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -9069,14 +8993,15 @@ bool js_cocos2dx_Properties_getQuaternionFromAxisAngle(JSContext *cx, uint32_t a bool js_cocos2dx_Properties_parseColor(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec4* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -9086,7 +9011,7 @@ bool js_cocos2dx_Properties_parseColor(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Vec4*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cocos2d::Properties::parseColor(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -9096,11 +9021,13 @@ bool js_cocos2dx_Properties_parseColor(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec3* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -9110,7 +9037,7 @@ bool js_cocos2dx_Properties_parseColor(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Vec3*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cocos2d::Properties::parseColor(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -9410,7 +9337,6 @@ bool js_cocos2dx_FileUtils_isAbsolutePath(JSContext *cx, uint32_t argc, jsval *v } bool js_cocos2dx_FileUtils_renameFile(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::FileUtils* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9420,13 +9346,15 @@ bool js_cocos2dx_FileUtils_renameFile(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_renameFile : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->renameFile(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -9436,16 +9364,19 @@ bool js_cocos2dx_FileUtils_renameFile(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->renameFile(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -10663,7 +10594,6 @@ bool js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority(JSContext *cx } bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::EventDispatcher* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -10673,6 +10603,7 @@ bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, ui cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_removeEventListenersForTarget : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Node* arg0 = nullptr; do { @@ -10684,7 +10615,7 @@ bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, ui arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->removeEventListenersForTarget(arg0); args.rval().setUndefined(); return true; @@ -10692,6 +10623,7 @@ bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, ui } while(0); do { + bool ok = true; if (argc == 2) { cocos2d::Node* arg0 = nullptr; do { @@ -10703,7 +10635,7 @@ bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, ui arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); cobj->removeEventListenersForTarget(arg0, arg1); @@ -10713,10 +10645,11 @@ bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, ui } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::EventListener::Type arg0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->removeEventListenersForType(arg0); args.rval().setUndefined(); return true; @@ -13583,7 +13516,6 @@ bool js_cocos2dx_SpriteFrame_setOffset(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_SpriteFrame_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::SpriteFrame* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -13593,6 +13525,7 @@ bool js_cocos2dx_SpriteFrame_initWithTexture(JSContext *cx, uint32_t argc, jsval cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_initWithTexture : Invalid Native Object"); do { + bool ok = true; if (argc == 5) { cocos2d::Texture2D* arg0 = nullptr; do { @@ -13604,18 +13537,21 @@ bool js_cocos2dx_SpriteFrame_initWithTexture(JSContext *cx, uint32_t argc, jsval arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; arg2 = JS::ToBoolean(args.get(2)); cocos2d::Vec2 arg3; + ok = true; ok &= jsval_to_vector2(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg4; + ok = true; ok &= jsval_to_ccsize(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTexture(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -13625,6 +13561,7 @@ bool js_cocos2dx_SpriteFrame_initWithTexture(JSContext *cx, uint32_t argc, jsval } while(0); do { + bool ok = true; if (argc == 2) { cocos2d::Texture2D* arg0 = nullptr; do { @@ -13636,10 +13573,11 @@ bool js_cocos2dx_SpriteFrame_initWithTexture(JSContext *cx, uint32_t argc, jsval arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTexture(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -13671,7 +13609,6 @@ bool js_cocos2dx_SpriteFrame_isRotated(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_SpriteFrame_initWithTextureFilename(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::SpriteFrame* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -13681,21 +13618,25 @@ bool js_cocos2dx_SpriteFrame_initWithTextureFilename(JSContext *cx, uint32_t arg cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_initWithTextureFilename : Invalid Native Object"); do { + bool ok = true; if (argc == 5) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; arg2 = JS::ToBoolean(args.get(2)); cocos2d::Vec2 arg3; + ok = true; ok &= jsval_to_vector2(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg4; + ok = true; ok &= jsval_to_ccsize(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTextureFilename(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -13705,13 +13646,15 @@ bool js_cocos2dx_SpriteFrame_initWithTextureFilename(JSContext *cx, uint32_t arg } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTextureFilename(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -13782,25 +13725,29 @@ bool js_cocos2dx_SpriteFrame_getOriginalSize(JSContext *cx, uint32_t argc, jsval bool js_cocos2dx_SpriteFrame_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 5) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; + ok = true; arg2 = JS::ToBoolean(args.get(2)); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg3; + ok = true; ok &= jsval_to_vector2(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg4; + ok = true; ok &= jsval_to_ccsize(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::SpriteFrame* ret = cocos2d::SpriteFrame::create(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; do { @@ -13817,13 +13764,15 @@ bool js_cocos2dx_SpriteFrame_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::SpriteFrame* ret = cocos2d::SpriteFrame::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -13844,9 +13793,9 @@ bool js_cocos2dx_SpriteFrame_create(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 5) { cocos2d::Texture2D* arg0 = nullptr; do { @@ -13858,19 +13807,23 @@ bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsv arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; + ok = true; arg2 = JS::ToBoolean(args.get(2)); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg3; + ok = true; ok &= jsval_to_vector2(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg4; + ok = true; ok &= jsval_to_ccsize(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::SpriteFrame* ret = cocos2d::SpriteFrame::createWithTexture(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; do { @@ -13887,6 +13840,7 @@ bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsv } while (0); do { + bool ok = true; if (argc == 2) { cocos2d::Texture2D* arg0 = nullptr; do { @@ -13898,10 +13852,11 @@ bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsv arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::SpriteFrame* ret = cocos2d::SpriteFrame::createWithTexture(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -14062,7 +14017,6 @@ bool js_cocos2dx_AnimationFrame_setSpriteFrame(JSContext *cx, uint32_t argc, jsv } bool js_cocos2dx_AnimationFrame_getUserInfo(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::AnimationFrame* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -14759,16 +14713,17 @@ bool js_cocos2dx_Animation_addSpriteFrameWithTexture(JSContext *cx, uint32_t arg bool js_cocos2dx_Animation_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { cocos2d::Vector arg0; ok &= jsval_to_ccvector(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Animation* ret = cocos2d::Animation::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -14784,16 +14739,19 @@ bool js_cocos2dx_Animation_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 3) { cocos2d::Vector arg0; ok &= jsval_to_ccvector(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg2 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Animation* ret = cocos2d::Animation::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -15908,16 +15866,17 @@ bool js_cocos2dx_RotateTo_initWithDuration(JSContext *cx, uint32_t argc, jsval * bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::RotateTo* ret = cocos2d::RotateTo::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -15934,16 +15893,19 @@ bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::RotateTo* ret = cocos2d::RotateTo::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -16060,7 +16022,6 @@ JSObject *jsb_cocos2d_RotateBy_prototype; bool js_cocos2dx_RotateBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::RotateBy* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -16070,16 +16031,19 @@ bool js_cocos2dx_RotateBy_initWithDuration(JSContext *cx, uint32_t argc, jsval * cobj = (cocos2d::RotateBy *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RotateBy_initWithDuration : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithDuration(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -16089,13 +16053,15 @@ bool js_cocos2dx_RotateBy_initWithDuration(JSContext *cx, uint32_t argc, jsval * } while(0); do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithDuration(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -16110,19 +16076,21 @@ bool js_cocos2dx_RotateBy_initWithDuration(JSContext *cx, uint32_t argc, jsval * bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::RotateBy* ret = cocos2d::RotateBy::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -16139,13 +16107,15 @@ bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::RotateBy* ret = cocos2d::RotateBy::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -17354,7 +17324,6 @@ JSObject *jsb_cocos2d_ScaleTo_prototype; bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ScaleTo* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -17364,16 +17333,19 @@ bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *v cobj = (cocos2d::ScaleTo *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ScaleTo_initWithDuration : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithDuration(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -17383,13 +17355,15 @@ bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *v } while(0); do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithDuration(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -17399,19 +17373,23 @@ bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *v } while(0); do { + bool ok = true; if (argc == 4) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg3 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -17426,19 +17404,21 @@ bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *v bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ScaleTo* ret = cocos2d::ScaleTo::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -17455,13 +17435,15 @@ bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ScaleTo* ret = cocos2d::ScaleTo::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -17478,19 +17460,23 @@ bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 4) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg3 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ScaleTo* ret = cocos2d::ScaleTo::create(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { @@ -17608,19 +17594,21 @@ JSObject *jsb_cocos2d_ScaleBy_prototype; bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ScaleBy* ret = cocos2d::ScaleBy::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -17637,13 +17625,15 @@ bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ScaleBy* ret = cocos2d::ScaleBy::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -17660,19 +17650,23 @@ bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 4) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg3 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ScaleBy* ret = cocos2d::ScaleBy::create(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { @@ -18409,16 +18403,17 @@ bool js_cocos2dx_TintTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp bool js_cocos2dx_TintTo_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color3B arg1; + ok = true; ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TintTo* ret = cocos2d::TintTo::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -18435,19 +18430,23 @@ bool js_cocos2dx_TintTo_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 4) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } uint16_t arg1; + ok = true; ok &= jsval_to_uint16(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } uint16_t arg2; + ok = true; ok &= jsval_to_uint16(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } uint16_t arg3; + ok = true; ok &= jsval_to_uint16(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TintTo* ret = cocos2d::TintTo::create(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { @@ -19028,7 +19027,6 @@ bool js_cocos2dx_Animate_initWithAnimation(JSContext *cx, uint32_t argc, jsval * } bool js_cocos2dx_Animate_getAnimation(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Animate* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -19254,7 +19252,6 @@ JSObject *jsb_cocos2d_TargetedAction_prototype; bool js_cocos2dx_TargetedAction_getForcedTarget(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TargetedAction* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -19710,7 +19707,6 @@ JSObject *jsb_cocos2d_ActionCamera_prototype; bool js_cocos2dx_ActionCamera_setEye(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ActionCamera* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -19720,16 +19716,19 @@ bool js_cocos2dx_ActionCamera_setEye(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_setEye : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setEye(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -19737,10 +19736,11 @@ bool js_cocos2dx_ActionCamera_setEye(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Vec3 arg0; ok &= jsval_to_vector3(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setEye(arg0); args.rval().setUndefined(); return true; @@ -19943,33 +19943,6 @@ void js_register_cocos2dx_ActionCamera(JSContext *cx, JS::HandleObject global) { JSClass *jsb_cocos2d_OrbitCamera_class; JSObject *jsb_cocos2d_OrbitCamera_prototype; -bool js_cocos2dx_OrbitCamera_sphericalRadius(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::OrbitCamera* cobj = (cocos2d::OrbitCamera *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_OrbitCamera_sphericalRadius : Invalid Native Object"); - if (argc == 3) { - float* arg0 = 0; - float* arg1 = 0; - float* arg2 = 0; - #pragma warning NO CONVERSION TO NATIVE FOR float* - ok = false; - #pragma warning NO CONVERSION TO NATIVE FOR float* - ok = false; - #pragma warning NO CONVERSION TO NATIVE FOR float* - ok = false; - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_OrbitCamera_sphericalRadius : Error processing arguments"); - cobj->sphericalRadius(arg0, arg1, arg2); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_OrbitCamera_sphericalRadius : wrong number of arguments: %d, was expecting %d", argc, 3); - return false; -} bool js_cocos2dx_OrbitCamera_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -20108,7 +20081,6 @@ void js_register_cocos2dx_OrbitCamera(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { - JS_FN("sphericalRadius", js_cocos2dx_OrbitCamera_sphericalRadius, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithDuration", js_cocos2dx_OrbitCamera_initWithDuration, 7, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_OrbitCamera_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END @@ -21994,9 +21966,9 @@ JSObject *jsb_cocos2d_EaseElasticIn_prototype; bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { cocos2d::ActionInterval* arg0 = nullptr; do { @@ -22008,7 +21980,7 @@ bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::EaseElasticIn* ret = cocos2d::EaseElasticIn::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -22025,6 +21997,7 @@ bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { cocos2d::ActionInterval* arg0 = nullptr; do { @@ -22036,10 +22009,11 @@ bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::EaseElasticIn* ret = cocos2d::EaseElasticIn::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -22156,9 +22130,9 @@ JSObject *jsb_cocos2d_EaseElasticOut_prototype; bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { cocos2d::ActionInterval* arg0 = nullptr; do { @@ -22170,7 +22144,7 @@ bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::EaseElasticOut* ret = cocos2d::EaseElasticOut::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -22187,6 +22161,7 @@ bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { cocos2d::ActionInterval* arg0 = nullptr; do { @@ -22198,10 +22173,11 @@ bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::EaseElasticOut* ret = cocos2d::EaseElasticOut::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -22318,9 +22294,9 @@ JSObject *jsb_cocos2d_EaseElasticInOut_prototype; bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { cocos2d::ActionInterval* arg0 = nullptr; do { @@ -22332,7 +22308,7 @@ bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::EaseElasticInOut* ret = cocos2d::EaseElasticInOut::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -22349,6 +22325,7 @@ bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp } while (0); do { + bool ok = true; if (argc == 2) { cocos2d::ActionInterval* arg0 = nullptr; do { @@ -22360,10 +22337,11 @@ bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::EaseElasticInOut* ret = cocos2d::EaseElasticInOut::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -29940,52 +29918,6 @@ void js_register_cocos2dx_ShatteredTiles3D(JSContext *cx, JS::HandleObject globa JSClass *jsb_cocos2d_ShuffleTiles_class; JSObject *jsb_cocos2d_ShuffleTiles_prototype; -bool js_cocos2dx_ShuffleTiles_placeTile(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::ShuffleTiles* cobj = (cocos2d::ShuffleTiles *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShuffleTiles_placeTile : Invalid Native Object"); - if (argc == 2) { - cocos2d::Vec2 arg0; - cocos2d::Tile* arg1 = nullptr; - ok &= jsval_to_vector2(cx, args.get(0), &arg0); - #pragma warning NO CONVERSION TO NATIVE FOR Tile* - ok = false; - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ShuffleTiles_placeTile : Error processing arguments"); - cobj->placeTile(arg0, arg1); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ShuffleTiles_placeTile : wrong number of arguments: %d, was expecting %d", argc, 2); - return false; -} -bool js_cocos2dx_ShuffleTiles_shuffle(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::ShuffleTiles* cobj = (cocos2d::ShuffleTiles *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShuffleTiles_shuffle : Invalid Native Object"); - if (argc == 2) { - unsigned int* arg0 = 0; - unsigned int arg1 = 0; - #pragma warning NO CONVERSION TO NATIVE FOR unsigned int* - ok = false; - ok &= jsval_to_uint32(cx, args.get(1), &arg1); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ShuffleTiles_shuffle : Error processing arguments"); - cobj->shuffle(arg0, arg1); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ShuffleTiles_shuffle : wrong number of arguments: %d, was expecting %d", argc, 2); - return false; -} bool js_cocos2dx_ShuffleTiles_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -30114,8 +30046,6 @@ void js_register_cocos2dx_ShuffleTiles(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { - JS_FN("placeTile", js_cocos2dx_ShuffleTiles_placeTile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("shuffle", js_cocos2dx_ShuffleTiles_shuffle, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithDuration", js_cocos2dx_ShuffleTiles_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getDelta", js_cocos2dx_ShuffleTiles_getDelta, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END @@ -30762,29 +30692,6 @@ bool js_cocos2dx_TurnOffTiles_turnOffTile(JSContext *cx, uint32_t argc, jsval *v JS_ReportError(cx, "js_cocos2dx_TurnOffTiles_turnOffTile : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_TurnOffTiles_shuffle(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::TurnOffTiles* cobj = (cocos2d::TurnOffTiles *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TurnOffTiles_shuffle : Invalid Native Object"); - if (argc == 2) { - unsigned int* arg0 = 0; - unsigned int arg1 = 0; - #pragma warning NO CONVERSION TO NATIVE FOR unsigned int* - ok = false; - ok &= jsval_to_uint32(cx, args.get(1), &arg1); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TurnOffTiles_shuffle : Error processing arguments"); - cobj->shuffle(arg0, arg1); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_TurnOffTiles_shuffle : wrong number of arguments: %d, was expecting %d", argc, 2); - return false; -} bool js_cocos2dx_TurnOffTiles_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -30814,19 +30721,21 @@ bool js_cocos2dx_TurnOffTiles_initWithDuration(JSContext *cx, uint32_t argc, jsv bool js_cocos2dx_TurnOffTiles_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg1; + ok = true; ok &= jsval_to_ccsize(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg2 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TurnOffTiles* ret = cocos2d::TurnOffTiles::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -30843,13 +30752,15 @@ bool js_cocos2dx_TurnOffTiles_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg1; + ok = true; ok &= jsval_to_ccsize(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TurnOffTiles* ret = cocos2d::TurnOffTiles::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -30921,7 +30832,6 @@ void js_register_cocos2dx_TurnOffTiles(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("turnOnTile", js_cocos2dx_TurnOffTiles_turnOnTile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("turnOffTile", js_cocos2dx_TurnOffTiles_turnOffTile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("shuffle", js_cocos2dx_TurnOffTiles_shuffle, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithDuration", js_cocos2dx_TurnOffTiles_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -31772,7 +31682,6 @@ JSObject *jsb_cocos2d_GLProgramState_prototype; bool js_cocos2dx_GLProgramState_setUniformCallback(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GLProgramState* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -31782,11 +31691,13 @@ bool js_cocos2dx_GLProgramState_setUniformCallback(JSContext *cx, uint32_t argc, cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformCallback : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::function arg1; + ok = true; do { if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION) { @@ -31818,7 +31729,7 @@ bool js_cocos2dx_GLProgramState_setUniformCallback(JSContext *cx, uint32_t argc, } } while(0) ; - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformCallback(arg0, arg1); args.rval().setUndefined(); return true; @@ -31826,11 +31737,13 @@ bool js_cocos2dx_GLProgramState_setUniformCallback(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::function arg1; + ok = true; do { if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION) { @@ -31862,7 +31775,7 @@ bool js_cocos2dx_GLProgramState_setUniformCallback(JSContext *cx, uint32_t argc, } } while(0) ; - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformCallback(arg0, arg1); args.rval().setUndefined(); return true; @@ -31914,7 +31827,6 @@ bool js_cocos2dx_GLProgramState_applyAutoBinding(JSContext *cx, uint32_t argc, j } bool js_cocos2dx_GLProgramState_setUniformVec2(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GLProgramState* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -31924,13 +31836,15 @@ bool js_cocos2dx_GLProgramState_setUniformVec2(JSContext *cx, uint32_t argc, jsv cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformVec2 : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg1; + ok = true; ok &= jsval_to_vector2(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformVec2(arg0, arg1); args.rval().setUndefined(); return true; @@ -31938,13 +31852,15 @@ bool js_cocos2dx_GLProgramState_setUniformVec2(JSContext *cx, uint32_t argc, jsv } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg1; + ok = true; ok &= jsval_to_vector2(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformVec2(arg0, arg1); args.rval().setUndefined(); return true; @@ -31956,7 +31872,6 @@ bool js_cocos2dx_GLProgramState_setUniformVec2(JSContext *cx, uint32_t argc, jsv } bool js_cocos2dx_GLProgramState_setUniformVec3(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GLProgramState* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -31966,13 +31881,15 @@ bool js_cocos2dx_GLProgramState_setUniformVec3(JSContext *cx, uint32_t argc, jsv cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformVec3 : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec3 arg1; + ok = true; ok &= jsval_to_vector3(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformVec3(arg0, arg1); args.rval().setUndefined(); return true; @@ -31980,13 +31897,15 @@ bool js_cocos2dx_GLProgramState_setUniformVec3(JSContext *cx, uint32_t argc, jsv } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec3 arg1; + ok = true; ok &= jsval_to_vector3(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformVec3(arg0, arg1); args.rval().setUndefined(); return true; @@ -32142,7 +32061,6 @@ bool js_cocos2dx_GLProgramState_setNodeBinding(JSContext *cx, uint32_t argc, jsv } bool js_cocos2dx_GLProgramState_setUniformInt(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GLProgramState* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -32152,13 +32070,15 @@ bool js_cocos2dx_GLProgramState_setUniformInt(JSContext *cx, uint32_t argc, jsva cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformInt : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformInt(arg0, arg1); args.rval().setUndefined(); return true; @@ -32166,13 +32086,15 @@ bool js_cocos2dx_GLProgramState_setUniformInt(JSContext *cx, uint32_t argc, jsva } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformInt(arg0, arg1); args.rval().setUndefined(); return true; @@ -32206,7 +32128,6 @@ bool js_cocos2dx_GLProgramState_setParameterAutoBinding(JSContext *cx, uint32_t } bool js_cocos2dx_GLProgramState_setUniformVec2v(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GLProgramState* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -32216,16 +32137,19 @@ bool js_cocos2dx_GLProgramState_setUniformVec2v(JSContext *cx, uint32_t argc, js cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformVec2v : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } ssize_t arg1 = 0; + ok = true; ok &= jsval_to_ssize(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } const cocos2d::Vec2* arg2 = nullptr; + ok = true; std::vector tempData;ok &= jsval_to_vector_vec2(cx, args.get(2), &tempData);arg2=tempData.data(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformVec2v(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -32233,16 +32157,19 @@ bool js_cocos2dx_GLProgramState_setUniformVec2v(JSContext *cx, uint32_t argc, js } while(0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } ssize_t arg1 = 0; + ok = true; ok &= jsval_to_ssize(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } const cocos2d::Vec2* arg2 = nullptr; + ok = true; std::vector tempData;ok &= jsval_to_vector_vec2(cx, args.get(2), &tempData);arg2=tempData.data(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformVec2v(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -32348,56 +32275,6 @@ bool js_cocos2dx_GLProgramState_setGLProgram(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_GLProgramState_setGLProgram : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_GLProgramState_setUniformFloatv(JSContext *cx, uint32_t argc, jsval *vp) -{ - bool ok = true; - cocos2d::GLProgramState* cobj = nullptr; - - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx); - obj.set(args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformFloatv : Invalid Native Object"); - do { - if (argc == 3) { - int arg0 = 0; - ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } - ssize_t arg1 = 0; - ok &= jsval_to_ssize(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } - const float* arg2 = 0; - #pragma warning NO CONVERSION TO NATIVE FOR float* - ok = false; - if (!ok) { ok = true; break; } - cobj->setUniformFloatv(arg0, arg1, arg2); - args.rval().setUndefined(); - return true; - } - } while(0); - - do { - if (argc == 3) { - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } - ssize_t arg1 = 0; - ok &= jsval_to_ssize(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } - const float* arg2 = 0; - #pragma warning NO CONVERSION TO NATIVE FOR float* - ok = false; - if (!ok) { ok = true; break; } - cobj->setUniformFloatv(arg0, arg1, arg2); - args.rval().setUndefined(); - return true; - } - } while(0); - - JS_ReportError(cx, "js_cocos2dx_GLProgramState_setUniformFloatv : wrong number of arguments"); - return false; -} bool js_cocos2dx_GLProgramState_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -32425,7 +32302,6 @@ bool js_cocos2dx_GLProgramState_getGLProgram(JSContext *cx, uint32_t argc, jsval } bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GLProgramState* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -32435,13 +32311,15 @@ bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformTexture : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg1 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformTexture(arg0, arg1); args.rval().setUndefined(); return true; @@ -32449,11 +32327,13 @@ bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -32463,7 +32343,7 @@ bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformTexture(arg0, arg1); args.rval().setUndefined(); return true; @@ -32471,11 +32351,13 @@ bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 2) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -32485,7 +32367,7 @@ bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformTexture(arg0, arg1); args.rval().setUndefined(); return true; @@ -32493,13 +32375,15 @@ bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 2) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg1 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformTexture(arg0, arg1); args.rval().setUndefined(); return true; @@ -32527,7 +32411,6 @@ bool js_cocos2dx_GLProgramState_applyUniforms(JSContext *cx, uint32_t argc, jsva } bool js_cocos2dx_GLProgramState_setUniformFloat(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GLProgramState* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -32537,13 +32420,15 @@ bool js_cocos2dx_GLProgramState_setUniformFloat(JSContext *cx, uint32_t argc, js cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformFloat : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformFloat(arg0, arg1); args.rval().setUndefined(); return true; @@ -32551,13 +32436,15 @@ bool js_cocos2dx_GLProgramState_setUniformFloat(JSContext *cx, uint32_t argc, js } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformFloat(arg0, arg1); args.rval().setUndefined(); return true; @@ -32569,7 +32456,6 @@ bool js_cocos2dx_GLProgramState_setUniformFloat(JSContext *cx, uint32_t argc, js } bool js_cocos2dx_GLProgramState_setUniformMat4(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GLProgramState* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -32579,13 +32465,15 @@ bool js_cocos2dx_GLProgramState_setUniformMat4(JSContext *cx, uint32_t argc, jsv cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformMat4 : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Mat4 arg1; + ok = true; ok &= jsval_to_matrix(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformMat4(arg0, arg1); args.rval().setUndefined(); return true; @@ -32593,13 +32481,15 @@ bool js_cocos2dx_GLProgramState_setUniformMat4(JSContext *cx, uint32_t argc, jsv } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Mat4 arg1; + ok = true; ok &= jsval_to_matrix(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformMat4(arg0, arg1); args.rval().setUndefined(); return true; @@ -32611,7 +32501,6 @@ bool js_cocos2dx_GLProgramState_setUniformMat4(JSContext *cx, uint32_t argc, jsv } bool js_cocos2dx_GLProgramState_setUniformVec3v(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GLProgramState* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -32621,14 +32510,17 @@ bool js_cocos2dx_GLProgramState_setUniformVec3v(JSContext *cx, uint32_t argc, js cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformVec3v : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } ssize_t arg1 = 0; + ok = true; ok &= jsval_to_ssize(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } const cocos2d::Vec3* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -32638,7 +32530,7 @@ bool js_cocos2dx_GLProgramState_setUniformVec3v(JSContext *cx, uint32_t argc, js arg2 = (const cocos2d::Vec3*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformVec3v(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -32646,14 +32538,17 @@ bool js_cocos2dx_GLProgramState_setUniformVec3v(JSContext *cx, uint32_t argc, js } while(0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } ssize_t arg1 = 0; + ok = true; ok &= jsval_to_ssize(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } const cocos2d::Vec3* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -32663,7 +32558,7 @@ bool js_cocos2dx_GLProgramState_setUniformVec3v(JSContext *cx, uint32_t argc, js arg2 = (const cocos2d::Vec3*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformVec3v(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -32847,7 +32742,6 @@ void js_register_cocos2dx_GLProgramState(JSContext *cx, JS::HandleObject global) JS_FN("applyAttributes", js_cocos2dx_GLProgramState_applyAttributes, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("clone", js_cocos2dx_GLProgramState_clone, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setGLProgram", js_cocos2dx_GLProgramState_setGLProgram, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setUniformFloatv", js_cocos2dx_GLProgramState_setUniformFloatv, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getGLProgram", js_cocos2dx_GLProgramState_getGLProgram, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setUniformTexture", js_cocos2dx_GLProgramState_setUniformTexture, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("applyUniforms", js_cocos2dx_GLProgramState_applyUniforms, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -33414,9 +33308,9 @@ bool js_cocos2dx_ClippingNode_isInverted(JSContext *cx, uint32_t argc, jsval *vp bool js_cocos2dx_ClippingNode_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { cocos2d::Node* arg0 = nullptr; do { @@ -33428,7 +33322,7 @@ bool js_cocos2dx_ClippingNode_create(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ClippingNode* ret = cocos2d::ClippingNode::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -33574,7 +33468,6 @@ bool js_cocos2dx_DrawNode_drawLine(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_DrawNode_drawPoints(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::DrawNode* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -33584,19 +33477,23 @@ bool js_cocos2dx_DrawNode_drawPoints(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawPoints : Invalid Native Object"); do { + bool ok = true; if (argc == 4) { const cocos2d::Vec2* arg0 = nullptr; std::vector tempData;ok &= jsval_to_vector_vec2(cx, args.get(0), &tempData);arg0=tempData.data(); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg1 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color4F arg3; + ok = true; ok &= jsval_to_cccolor4f(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->drawPoints(arg0, arg1, arg2, arg3); args.rval().setUndefined(); return true; @@ -33604,16 +33501,19 @@ bool js_cocos2dx_DrawNode_drawPoints(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 3) { const cocos2d::Vec2* arg0 = nullptr; std::vector tempData;ok &= jsval_to_vector_vec2(cx, args.get(0), &tempData);arg0=tempData.data(); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg1 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color4F arg2; + ok = true; ok &= jsval_to_cccolor4f(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->drawPoints(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -33625,7 +33525,6 @@ bool js_cocos2dx_DrawNode_drawPoints(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_DrawNode_drawRect(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::DrawNode* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -33635,22 +33534,27 @@ bool js_cocos2dx_DrawNode_drawRect(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawRect : Invalid Native Object"); do { + bool ok = true; if (argc == 5) { cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg1; + ok = true; ok &= jsval_to_vector2(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg2; + ok = true; ok &= jsval_to_vector2(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg3; + ok = true; ok &= jsval_to_vector2(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color4F arg4; + ok = true; ok &= jsval_to_cccolor4f(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->drawRect(arg0, arg1, arg2, arg3, arg4); args.rval().setUndefined(); return true; @@ -33658,16 +33562,19 @@ bool js_cocos2dx_DrawNode_drawRect(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 3) { cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg1; + ok = true; ok &= jsval_to_vector2(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color4F arg2; + ok = true; ok &= jsval_to_cccolor4f(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->drawRect(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -33679,7 +33586,6 @@ bool js_cocos2dx_DrawNode_drawRect(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_DrawNode_drawSolidCircle(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::DrawNode* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -33689,22 +33595,27 @@ bool js_cocos2dx_DrawNode_drawSolidCircle(JSContext *cx, uint32_t argc, jsval *v cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawSolidCircle : Invalid Native Object"); do { + bool ok = true; if (argc == 5) { cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg3 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color4F arg4; + ok = true; ok &= jsval_to_cccolor4f(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->drawSolidCircle(arg0, arg1, arg2, arg3, arg4); args.rval().setUndefined(); return true; @@ -33712,28 +33623,35 @@ bool js_cocos2dx_DrawNode_drawSolidCircle(JSContext *cx, uint32_t argc, jsval *v } while(0); do { + bool ok = true; if (argc == 7) { cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg3 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg4 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg5 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color4F arg6; + ok = true; ok &= jsval_to_cccolor4f(cx, args.get(6), &arg6); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->drawSolidCircle(arg0, arg1, arg2, arg3, arg4, arg5, arg6); args.rval().setUndefined(); return true; @@ -33909,7 +33827,6 @@ bool js_cocos2dx_DrawNode_onDraw(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_DrawNode_drawCircle(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::DrawNode* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -33919,24 +33836,29 @@ bool js_cocos2dx_DrawNode_drawCircle(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawCircle : Invalid Native Object"); do { + bool ok = true; if (argc == 6) { cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg3 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg4; arg4 = JS::ToBoolean(args.get(4)); cocos2d::Color4F arg5; + ok = true; ok &= jsval_to_cccolor4f(cx, args.get(5), &arg5); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->drawCircle(arg0, arg1, arg2, arg3, arg4, arg5); args.rval().setUndefined(); return true; @@ -33944,30 +33866,37 @@ bool js_cocos2dx_DrawNode_drawCircle(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 8) { cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg3 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg4; arg4 = JS::ToBoolean(args.get(4)); double arg5 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg6 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(6), &arg6) && !isnan(arg6); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color4F arg7; + ok = true; ok &= jsval_to_cccolor4f(cx, args.get(7), &arg7); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->drawCircle(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); args.rval().setUndefined(); return true; @@ -34570,7 +34499,6 @@ bool js_cocos2dx_Label_getHeight(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Label_disableEffect(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Label* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -34580,10 +34508,11 @@ bool js_cocos2dx_Label_disableEffect(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Label *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_disableEffect : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::LabelEffect arg0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->disableEffect(arg0); args.rval().setUndefined(); return true; @@ -34931,7 +34860,6 @@ 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 ok = true; cocos2d::Label* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -34941,14 +34869,15 @@ bool js_cocos2dx_Label_initWithTTF(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Label *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_initWithTTF : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { - cocos2d::_ttfConfig arg0; - #pragma warning NO CONVERSION TO NATIVE FOR _ttfConfig - ok = false; - if (!ok) { ok = true; break; } + cocos2d::TTFConfig arg0; + ok &= jsval_to_TTFConfig(cx, args.get(0), &arg0); + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTTF(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -34958,17 +34887,19 @@ bool js_cocos2dx_Label_initWithTTF(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 3) { - cocos2d::_ttfConfig arg0; - #pragma warning NO CONVERSION TO NATIVE FOR _ttfConfig - ok = false; - if (!ok) { ok = true; break; } + cocos2d::TTFConfig arg0; + ok &= jsval_to_TTFConfig(cx, args.get(0), &arg0); + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextHAlignment arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTTF(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -34978,20 +34909,23 @@ bool js_cocos2dx_Label_initWithTTF(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 4) { - cocos2d::_ttfConfig arg0; - #pragma warning NO CONVERSION TO NATIVE FOR _ttfConfig - ok = false; - if (!ok) { ok = true; break; } + cocos2d::TTFConfig arg0; + ok &= jsval_to_TTFConfig(cx, args.get(0), &arg0); + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextHAlignment arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg3 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTTF(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -35001,16 +34935,19 @@ bool js_cocos2dx_Label_initWithTTF(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTTF(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -35020,19 +34957,23 @@ bool js_cocos2dx_Label_initWithTTF(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 4) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg3; + ok = true; ok &= jsval_to_ccsize(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTTF(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -35042,22 +34983,27 @@ bool js_cocos2dx_Label_initWithTTF(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 5) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg3; + ok = true; ok &= jsval_to_ccsize(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextHAlignment arg4; + ok = true; ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTTF(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -35067,25 +35013,31 @@ bool js_cocos2dx_Label_initWithTTF(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 6) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg3; + ok = true; ok &= jsval_to_ccsize(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextHAlignment arg4; + ok = true; ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextVAlignment arg5; + ok = true; ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTTF(arg0, arg1, arg2, arg3, arg4, arg5); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -35333,7 +35285,6 @@ bool js_cocos2dx_Label_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc } bool js_cocos2dx_Label_setCharMap(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Label* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -35343,6 +35294,7 @@ bool js_cocos2dx_Label_setCharMap(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Label *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setCharMap : Invalid Native Object"); do { + bool ok = true; if (argc == 4) { cocos2d::Texture2D* arg0 = nullptr; do { @@ -35354,16 +35306,19 @@ bool js_cocos2dx_Label_setCharMap(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg2 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg3 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->setCharMap(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -35373,19 +35328,23 @@ bool js_cocos2dx_Label_setCharMap(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 4) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg2 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg3 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->setCharMap(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -35395,10 +35354,11 @@ bool js_cocos2dx_Label_setCharMap(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->setCharMap(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -35568,7 +35528,7 @@ bool js_cocos2dx_Label_getTTFConfig(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getTTFConfig : Invalid Native Object"); if (argc == 0) { - const cocos2d::_ttfConfig& ret = cobj->getTTFConfig(); + const cocos2d::TTFConfig& ret = cobj->getTTFConfig(); jsval jsret = JSVAL_NULL; #pragma warning NO CONVERSION FROM NATIVE FOR _ttfConfig; args.rval().set(jsret); @@ -35923,7 +35883,6 @@ bool js_cocos2dx_Label_setFontDefinition(JSContext *cx, uint32_t argc, jsval *vp } bool js_cocos2dx_Label_setAlignment(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Label* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -35933,13 +35892,15 @@ bool js_cocos2dx_Label_setAlignment(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Label *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setAlignment : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::TextHAlignment arg0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextVAlignment arg1; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setAlignment(arg0, arg1); args.rval().setUndefined(); return true; @@ -35947,10 +35908,11 @@ bool js_cocos2dx_Label_setAlignment(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::TextHAlignment arg0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setAlignment(arg0); args.rval().setUndefined(); return true; @@ -36114,9 +36076,9 @@ bool js_cocos2dx_Label_create(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_Label_createWithCharMap(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 4) { cocos2d::Texture2D* arg0 = nullptr; do { @@ -36128,16 +36090,19 @@ bool js_cocos2dx_Label_createWithCharMap(JSContext *cx, uint32_t argc, jsval *vp arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg2 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg3 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Label* ret = cocos2d::Label::createWithCharMap(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { @@ -36154,19 +36119,23 @@ bool js_cocos2dx_Label_createWithCharMap(JSContext *cx, uint32_t argc, jsval *vp } while (0); do { + bool ok = true; if (argc == 4) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg2 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg3 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Label* ret = cocos2d::Label::createWithCharMap(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { @@ -36183,10 +36152,11 @@ bool js_cocos2dx_Label_createWithCharMap(JSContext *cx, uint32_t argc, jsval *vp } while (0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Label* ret = cocos2d::Label::createWithCharMap(arg0); jsval jsret = JSVAL_NULL; do { @@ -36614,7 +36584,6 @@ bool js_cocos2dx_LabelAtlas_setString(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_LabelAtlas_initWithString(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::LabelAtlas* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -36624,13 +36593,15 @@ bool js_cocos2dx_LabelAtlas_initWithString(JSContext *cx, uint32_t argc, jsval * cobj = (cocos2d::LabelAtlas *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelAtlas_initWithString : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithString(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -36640,22 +36611,27 @@ bool js_cocos2dx_LabelAtlas_initWithString(JSContext *cx, uint32_t argc, jsval * } while(0); do { + bool ok = true; if (argc == 5) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg2 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg3 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg4 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -36665,11 +36641,13 @@ bool js_cocos2dx_LabelAtlas_initWithString(JSContext *cx, uint32_t argc, jsval * } while(0); do { + bool ok = true; if (argc == 5) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -36679,16 +36657,19 @@ bool js_cocos2dx_LabelAtlas_initWithString(JSContext *cx, uint32_t argc, jsval * arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg2 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg3 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg4 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -36721,25 +36702,29 @@ bool js_cocos2dx_LabelAtlas_getString(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_LabelAtlas_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 5) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg2 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg3 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg4 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::LabelAtlas* ret = cocos2d::LabelAtlas::create(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; do { @@ -36773,13 +36758,15 @@ bool js_cocos2dx_LabelAtlas_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::LabelAtlas* ret = cocos2d::LabelAtlas::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -37094,7 +37081,6 @@ bool js_cocos2dx_LayerColor_changeWidth(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_LayerColor_initWithColor(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::LayerColor* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -37104,10 +37090,11 @@ bool js_cocos2dx_LayerColor_initWithColor(JSContext *cx, uint32_t argc, jsval *v cobj = (cocos2d::LayerColor *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerColor_initWithColor : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithColor(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -37117,16 +37104,19 @@ bool js_cocos2dx_LayerColor_initWithColor(JSContext *cx, uint32_t argc, jsval *v } while(0); do { + bool ok = true; if (argc == 3) { cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithColor(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -37161,19 +37151,21 @@ bool js_cocos2dx_LayerColor_changeHeight(JSContext *cx, uint32_t argc, jsval *vp bool js_cocos2dx_LayerColor_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::LayerColor* ret = cocos2d::LayerColor::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -37207,10 +37199,11 @@ bool js_cocos2dx_LayerColor_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 1) { cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::LayerColor* ret = cocos2d::LayerColor::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -37504,7 +37497,6 @@ bool js_cocos2dx_LayerGradient_setEndColor(JSContext *cx, uint32_t argc, jsval * } bool js_cocos2dx_LayerGradient_initWithColor(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::LayerGradient* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -37514,16 +37506,19 @@ bool js_cocos2dx_LayerGradient_initWithColor(JSContext *cx, uint32_t argc, jsval cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_initWithColor : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color4B arg1; + ok = true; ok &= jsval_to_cccolor4b(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg2; + ok = true; ok &= jsval_to_vector2(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithColor(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -37533,13 +37528,15 @@ bool js_cocos2dx_LayerGradient_initWithColor(JSContext *cx, uint32_t argc, jsval } while(0); do { + bool ok = true; if (argc == 2) { cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color4B arg1; + ok = true; ok &= jsval_to_cccolor4b(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithColor(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -37610,16 +37607,17 @@ bool js_cocos2dx_LayerGradient_setStartColor(JSContext *cx, uint32_t argc, jsval bool js_cocos2dx_LayerGradient_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color4B arg1; + ok = true; ok &= jsval_to_cccolor4b(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::LayerGradient* ret = cocos2d::LayerGradient::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -37653,16 +37651,19 @@ bool js_cocos2dx_LayerGradient_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 3) { cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color4B arg1; + ok = true; ok &= jsval_to_cccolor4b(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg2; + ok = true; ok &= jsval_to_vector2(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::LayerGradient* ret = cocos2d::LayerGradient::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -40342,7 +40343,6 @@ bool js_cocos2dx_MotionStreak_getStroke(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_MotionStreak_initWithFade(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::MotionStreak* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -40352,20 +40352,25 @@ bool js_cocos2dx_MotionStreak_initWithFade(JSContext *cx, uint32_t argc, jsval * cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_initWithFade : Invalid Native Object"); do { + bool ok = true; if (argc == 5) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color3B arg3; + ok = true; ok &= jsval_to_cccolor3b(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg4 = nullptr; + ok = true; do { if (args.get(4).isNull()) { arg4 = nullptr; break; } if (!args.get(4).isObject()) { ok = false; break; } @@ -40375,7 +40380,7 @@ bool js_cocos2dx_MotionStreak_initWithFade(JSContext *cx, uint32_t argc, jsval * arg4 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg4, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithFade(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -40385,22 +40390,27 @@ bool js_cocos2dx_MotionStreak_initWithFade(JSContext *cx, uint32_t argc, jsval * } while(0); do { + bool ok = true; if (argc == 5) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color3B arg3; + ok = true; ok &= jsval_to_cccolor3b(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg4; + ok = true; ok &= jsval_to_std_string(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithFade(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -40455,23 +40465,27 @@ bool js_cocos2dx_MotionStreak_setStroke(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_MotionStreak_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 5) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color3B arg3; + ok = true; ok &= jsval_to_cccolor3b(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg4 = nullptr; + ok = true; do { if (args.get(4).isNull()) { arg4 = nullptr; break; } if (!args.get(4).isObject()) { ok = false; break; } @@ -40481,7 +40495,7 @@ bool js_cocos2dx_MotionStreak_create(JSContext *cx, uint32_t argc, jsval *vp) arg4 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg4, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::MotionStreak* ret = cocos2d::MotionStreak::create(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; do { @@ -40498,22 +40512,27 @@ bool js_cocos2dx_MotionStreak_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 5) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color3B arg3; + ok = true; ok &= jsval_to_cccolor3b(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg4; + ok = true; ok &= jsval_to_std_string(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::MotionStreak* ret = cocos2d::MotionStreak::create(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; do { @@ -40670,7 +40689,6 @@ bool js_cocos2dx_NodeGrid_setTarget(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_NodeGrid_getGrid(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::NodeGrid* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -40737,13 +40755,13 @@ bool js_cocos2dx_NodeGrid_getGridRect(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_NodeGrid_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { cocos2d::Rect arg0; ok &= jsval_to_ccrect(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::NodeGrid* ret = cocos2d::NodeGrid::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -43276,7 +43294,6 @@ bool js_cocos2dx_ParticleSystem_setRadialAccel(JSContext *cx, uint32_t argc, jsv } bool js_cocos2dx_ParticleSystem_initWithDictionary(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ParticleSystem* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -43286,13 +43303,15 @@ bool js_cocos2dx_ParticleSystem_initWithDictionary(JSContext *cx, uint32_t argc, cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_initWithDictionary : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::ValueMap arg0; ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithDictionary(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -43302,10 +43321,11 @@ bool js_cocos2dx_ParticleSystem_initWithDictionary(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::ValueMap arg0; ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithDictionary(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -43761,13 +43781,13 @@ bool js_cocos2dx_ParticleSystemQuad_listenRendererRecreated(JSContext *cx, uint3 bool js_cocos2dx_ParticleSystemQuad_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ParticleSystemQuad* ret = cocos2d::ParticleSystemQuad::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -43801,10 +43821,11 @@ bool js_cocos2dx_ParticleSystemQuad_create(JSContext *cx, uint32_t argc, jsval * } while (0); do { + bool ok = true; if (argc == 1) { cocos2d::ValueMap arg0; ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ParticleSystemQuad* ret = cocos2d::ParticleSystemQuad::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -45898,7 +45919,6 @@ bool js_cocos2dx_ProgressTimer_getBarChangeRate(JSContext *cx, uint32_t argc, js } bool js_cocos2dx_ProgressTimer_setReverseDirection(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ProgressTimer* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -45908,6 +45928,7 @@ bool js_cocos2dx_ProgressTimer_setReverseDirection(JSContext *cx, uint32_t argc, cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_setReverseDirection : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { bool arg0; arg0 = JS::ToBoolean(args.get(0)); @@ -45918,6 +45939,7 @@ bool js_cocos2dx_ProgressTimer_setReverseDirection(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 1) { bool arg0; arg0 = JS::ToBoolean(args.get(0)); @@ -46131,7 +46153,6 @@ JSObject *jsb_cocos2d_ProtectedNode_prototype; bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ProtectedNode* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -46141,6 +46162,7 @@ bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, j cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_addProtectedChild : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::Node* arg0 = nullptr; do { @@ -46152,10 +46174,11 @@ bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, j arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addProtectedChild(arg0, arg1); args.rval().setUndefined(); return true; @@ -46163,6 +46186,7 @@ bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, j } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Node* arg0 = nullptr; do { @@ -46174,7 +46198,7 @@ bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, j arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addProtectedChild(arg0); args.rval().setUndefined(); return true; @@ -46182,6 +46206,7 @@ bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, j } while(0); do { + bool ok = true; if (argc == 3) { cocos2d::Node* arg0 = nullptr; do { @@ -46193,13 +46218,15 @@ bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, j arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg2 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addProtectedChild(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -46538,7 +46565,6 @@ JSObject *jsb_cocos2d_Sprite_prototype; bool js_cocos2dx_Sprite_setSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Sprite* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -46548,6 +46574,7 @@ bool js_cocos2dx_Sprite_setSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setSpriteFrame : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::SpriteFrame* arg0 = nullptr; do { @@ -46559,7 +46586,7 @@ bool js_cocos2dx_Sprite_setSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setSpriteFrame(arg0); args.rval().setUndefined(); return true; @@ -46567,10 +46594,11 @@ bool js_cocos2dx_Sprite_setSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setSpriteFrame(arg0); args.rval().setUndefined(); return true; @@ -46582,7 +46610,6 @@ bool js_cocos2dx_Sprite_setSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Sprite_setTexture(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Sprite* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -46592,6 +46619,7 @@ bool js_cocos2dx_Sprite_setTexture(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setTexture : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Texture2D* arg0 = nullptr; do { @@ -46603,7 +46631,7 @@ bool js_cocos2dx_Sprite_setTexture(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setTexture(arg0); args.rval().setUndefined(); return true; @@ -46611,10 +46639,11 @@ bool js_cocos2dx_Sprite_setTexture(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setTexture(arg0); args.rval().setUndefined(); return true; @@ -46731,7 +46760,6 @@ bool js_cocos2dx_Sprite_setRotationSkewY(JSContext *cx, uint32_t argc, jsval *vp } bool js_cocos2dx_Sprite_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Sprite* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -46741,6 +46769,7 @@ bool js_cocos2dx_Sprite_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_initWithTexture : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::Texture2D* arg0 = nullptr; do { @@ -46752,10 +46781,11 @@ bool js_cocos2dx_Sprite_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTexture(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -46765,6 +46795,7 @@ bool js_cocos2dx_Sprite_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Texture2D* arg0 = nullptr; do { @@ -46776,7 +46807,7 @@ bool js_cocos2dx_Sprite_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTexture(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -46786,6 +46817,7 @@ bool js_cocos2dx_Sprite_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 3) { cocos2d::Texture2D* arg0 = nullptr; do { @@ -46797,10 +46829,11 @@ bool js_cocos2dx_Sprite_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; arg2 = JS::ToBoolean(args.get(2)); bool ret = cobj->initWithTexture(arg0, arg1, arg2); @@ -46879,7 +46912,6 @@ bool js_cocos2dx_Sprite_removeAllChildrenWithCleanup(JSContext *cx, uint32_t arg } bool js_cocos2dx_Sprite_setTextureRect(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Sprite* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -46889,15 +46921,17 @@ bool js_cocos2dx_Sprite_setTextureRect(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setTextureRect : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { cocos2d::Rect arg0; ok &= jsval_to_ccrect(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); cocos2d::Size arg2; + ok = true; ok &= jsval_to_ccsize(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setTextureRect(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -46905,10 +46939,11 @@ bool js_cocos2dx_Sprite_setTextureRect(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Rect arg0; ok &= jsval_to_ccrect(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setTextureRect(arg0); args.rval().setUndefined(); return true; @@ -47205,7 +47240,6 @@ bool js_cocos2dx_Sprite_getTextureRect(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Sprite_initWithFile(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::Sprite* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -47215,13 +47249,15 @@ bool js_cocos2dx_Sprite_initWithFile(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_initWithFile : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithFile(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -47231,10 +47267,11 @@ bool js_cocos2dx_Sprite_initWithFile(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithFile(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -47738,94 +47775,6 @@ bool js_cocos2dx_Image_getRenderFormat(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Image_getRenderFormat : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_Image_getData(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::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_getData : Invalid Native Object"); - if (argc == 0) { - unsigned char* ret = cobj->getData(); - jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR unsigned char*; - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Image_getData : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_Image_getMipmaps(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::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_getMipmaps : Invalid Native Object"); - if (argc == 0) { - cocos2d::_MipmapInfo* ret = cobj->getMipmaps(); - jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR _MipmapInfo*; - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Image_getMipmaps : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_Image_initWithRawData(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::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_initWithRawData : Invalid Native Object"); - if (argc == 5) { - const unsigned char* arg0 = nullptr; - ssize_t arg1 = 0; - int arg2 = 0; - int arg3 = 0; - int arg4 = 0; - #pragma warning NO CONVERSION TO NATIVE FOR unsigned char* - ok = false; - ok &= jsval_to_ssize(cx, args.get(1), &arg1); - ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Image_initWithRawData : Error processing arguments"); - bool ret = cobj->initWithRawData(arg0, arg1, arg2, arg3, arg4); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - if (argc == 6) { - const unsigned char* arg0 = nullptr; - ssize_t arg1 = 0; - int arg2 = 0; - int arg3 = 0; - int arg4 = 0; - bool arg5; - #pragma warning NO CONVERSION TO NATIVE FOR unsigned char* - ok = false; - ok &= jsval_to_ssize(cx, args.get(1), &arg1); - ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); - arg5 = JS::ToBoolean(args.get(5)); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Image_initWithRawData : Error processing arguments"); - bool ret = cobj->initWithRawData(arg0, arg1, arg2, arg3, arg4, arg5); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Image_initWithRawData : wrong number of arguments: %d, was expecting %d", argc, 5); - return false; -} bool js_cocos2dx_Image_setPVRImagesHavePremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -47918,9 +47867,6 @@ void js_register_cocos2dx_Image(JSContext *cx, JS::HandleObject global) { JS_FN("getFileType", js_cocos2dx_Image_getFileType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getNumberOfMipmaps", js_cocos2dx_Image_getNumberOfMipmaps, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getRenderFormat", js_cocos2dx_Image_getRenderFormat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getData", js_cocos2dx_Image_getData, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getMipmaps", js_cocos2dx_Image_getMipmaps, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("initWithRawData", js_cocos2dx_Image_initWithRawData, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -48248,7 +48194,6 @@ bool js_cocos2dx_RenderTexture_endToLua(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_RenderTexture_beginWithClear(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::RenderTexture* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -48258,22 +48203,27 @@ bool js_cocos2dx_RenderTexture_beginWithClear(JSContext *cx, uint32_t argc, jsva cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_beginWithClear : Invalid Native Object"); do { + bool ok = true; if (argc == 5) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg3 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg4 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->beginWithClear(arg0, arg1, arg2, arg3, arg4); args.rval().setUndefined(); return true; @@ -48281,19 +48231,23 @@ bool js_cocos2dx_RenderTexture_beginWithClear(JSContext *cx, uint32_t argc, jsva } while(0); do { + bool ok = true; if (argc == 4) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg3 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->beginWithClear(arg0, arg1, arg2, arg3); args.rval().setUndefined(); return true; @@ -48301,25 +48255,31 @@ bool js_cocos2dx_RenderTexture_beginWithClear(JSContext *cx, uint32_t argc, jsva } while(0); do { + bool ok = true; if (argc == 6) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg3 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg4 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg5 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->beginWithClear(arg0, arg1, arg2, arg3, arg4, arg5); args.rval().setUndefined(); return true; @@ -48476,7 +48436,6 @@ bool js_cocos2dx_RenderTexture_setClearDepth(JSContext *cx, uint32_t argc, jsval } bool js_cocos2dx_RenderTexture_initWithWidthAndHeight(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::RenderTexture* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -48486,19 +48445,23 @@ bool js_cocos2dx_RenderTexture_initWithWidthAndHeight(JSContext *cx, uint32_t ar cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_initWithWidthAndHeight : Invalid Native Object"); do { + bool ok = true; if (argc == 4) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D::PixelFormat arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg3 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithWidthAndHeight(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -48508,16 +48471,19 @@ bool js_cocos2dx_RenderTexture_initWithWidthAndHeight(JSContext *cx, uint32_t ar } while(0); do { + bool ok = true; if (argc == 3) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D::PixelFormat arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithWidthAndHeight(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -48532,19 +48498,21 @@ bool js_cocos2dx_RenderTexture_initWithWidthAndHeight(JSContext *cx, uint32_t ar bool js_cocos2dx_RenderTexture_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D::PixelFormat arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::RenderTexture* ret = cocos2d::RenderTexture::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -48561,19 +48529,23 @@ bool js_cocos2dx_RenderTexture_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 4) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D::PixelFormat arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg3 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::RenderTexture* ret = cocos2d::RenderTexture::create(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { @@ -48590,13 +48562,15 @@ bool js_cocos2dx_RenderTexture_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::RenderTexture* ret = cocos2d::RenderTexture::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -50824,14 +50798,15 @@ JSObject *jsb_cocos2d_TransitionFlipX_prototype; bool js_cocos2dx_TransitionFlipX_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -50841,7 +50816,7 @@ bool js_cocos2dx_TransitionFlipX_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionFlipX* ret = cocos2d::TransitionFlipX::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -50858,11 +50833,13 @@ bool js_cocos2dx_TransitionFlipX_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -50872,10 +50849,11 @@ bool js_cocos2dx_TransitionFlipX_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionScene::Orientation arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionFlipX* ret = cocos2d::TransitionFlipX::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -50992,14 +50970,15 @@ JSObject *jsb_cocos2d_TransitionFlipY_prototype; bool js_cocos2dx_TransitionFlipY_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51009,7 +50988,7 @@ bool js_cocos2dx_TransitionFlipY_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionFlipY* ret = cocos2d::TransitionFlipY::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -51026,11 +51005,13 @@ bool js_cocos2dx_TransitionFlipY_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51040,10 +51021,11 @@ bool js_cocos2dx_TransitionFlipY_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionScene::Orientation arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionFlipY* ret = cocos2d::TransitionFlipY::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -51160,14 +51142,15 @@ JSObject *jsb_cocos2d_TransitionFlipAngular_prototype; bool js_cocos2dx_TransitionFlipAngular_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51177,7 +51160,7 @@ bool js_cocos2dx_TransitionFlipAngular_create(JSContext *cx, uint32_t argc, jsva arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionFlipAngular* ret = cocos2d::TransitionFlipAngular::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -51194,11 +51177,13 @@ bool js_cocos2dx_TransitionFlipAngular_create(JSContext *cx, uint32_t argc, jsva } while (0); do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51208,10 +51193,11 @@ bool js_cocos2dx_TransitionFlipAngular_create(JSContext *cx, uint32_t argc, jsva arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionScene::Orientation arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionFlipAngular* ret = cocos2d::TransitionFlipAngular::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -51328,14 +51314,15 @@ JSObject *jsb_cocos2d_TransitionZoomFlipX_prototype; bool js_cocos2dx_TransitionZoomFlipX_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51345,7 +51332,7 @@ bool js_cocos2dx_TransitionZoomFlipX_create(JSContext *cx, uint32_t argc, jsval arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionZoomFlipX* ret = cocos2d::TransitionZoomFlipX::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -51362,11 +51349,13 @@ bool js_cocos2dx_TransitionZoomFlipX_create(JSContext *cx, uint32_t argc, jsval } while (0); do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51376,10 +51365,11 @@ bool js_cocos2dx_TransitionZoomFlipX_create(JSContext *cx, uint32_t argc, jsval arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionScene::Orientation arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionZoomFlipX* ret = cocos2d::TransitionZoomFlipX::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -51496,14 +51486,15 @@ JSObject *jsb_cocos2d_TransitionZoomFlipY_prototype; bool js_cocos2dx_TransitionZoomFlipY_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51513,7 +51504,7 @@ bool js_cocos2dx_TransitionZoomFlipY_create(JSContext *cx, uint32_t argc, jsval arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionZoomFlipY* ret = cocos2d::TransitionZoomFlipY::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -51530,11 +51521,13 @@ bool js_cocos2dx_TransitionZoomFlipY_create(JSContext *cx, uint32_t argc, jsval } while (0); do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51544,10 +51537,11 @@ bool js_cocos2dx_TransitionZoomFlipY_create(JSContext *cx, uint32_t argc, jsval arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionScene::Orientation arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionZoomFlipY* ret = cocos2d::TransitionZoomFlipY::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -51664,14 +51658,15 @@ JSObject *jsb_cocos2d_TransitionZoomFlipAngular_prototype; bool js_cocos2dx_TransitionZoomFlipAngular_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51681,7 +51676,7 @@ bool js_cocos2dx_TransitionZoomFlipAngular_create(JSContext *cx, uint32_t argc, arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionZoomFlipAngular* ret = cocos2d::TransitionZoomFlipAngular::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -51698,11 +51693,13 @@ bool js_cocos2dx_TransitionZoomFlipAngular_create(JSContext *cx, uint32_t argc, } while (0); do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51712,10 +51709,11 @@ bool js_cocos2dx_TransitionZoomFlipAngular_create(JSContext *cx, uint32_t argc, arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionScene::Orientation arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionZoomFlipAngular* ret = cocos2d::TransitionZoomFlipAngular::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -51831,7 +51829,6 @@ JSObject *jsb_cocos2d_TransitionFade_prototype; bool js_cocos2dx_TransitionFade_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TransitionFade* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -51841,11 +51838,13 @@ bool js_cocos2dx_TransitionFade_initWithDuration(JSContext *cx, uint32_t argc, j cobj = (cocos2d::TransitionFade *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionFade_initWithDuration : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51855,7 +51854,7 @@ bool js_cocos2dx_TransitionFade_initWithDuration(JSContext *cx, uint32_t argc, j arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithDuration(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -51865,11 +51864,13 @@ bool js_cocos2dx_TransitionFade_initWithDuration(JSContext *cx, uint32_t argc, j } while(0); do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51879,10 +51880,11 @@ bool js_cocos2dx_TransitionFade_initWithDuration(JSContext *cx, uint32_t argc, j arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color3B arg2; + ok = true; ok &= jsval_to_cccolor3b(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithDuration(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -51897,14 +51899,15 @@ bool js_cocos2dx_TransitionFade_initWithDuration(JSContext *cx, uint32_t argc, j bool js_cocos2dx_TransitionFade_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51914,7 +51917,7 @@ bool js_cocos2dx_TransitionFade_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionFade* ret = cocos2d::TransitionFade::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -51931,11 +51934,13 @@ bool js_cocos2dx_TransitionFade_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 3) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Scene* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -51945,10 +51950,11 @@ bool js_cocos2dx_TransitionFade_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color3B arg2; + ok = true; ok &= jsval_to_cccolor3b(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TransitionFade* ret = cocos2d::TransitionFade::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -54680,7 +54686,6 @@ bool js_cocos2dx_GridBase_getReuseGrid(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_GridBase_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GridBase* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -54690,13 +54695,15 @@ bool js_cocos2dx_GridBase_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_initWithSize : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSize(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -54706,10 +54713,11 @@ bool js_cocos2dx_GridBase_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSize(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -54719,11 +54727,13 @@ bool js_cocos2dx_GridBase_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 3) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -54733,7 +54743,7 @@ bool js_cocos2dx_GridBase_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; arg2 = JS::ToBoolean(args.get(2)); bool ret = cobj->initWithSize(arg0, arg1, arg2); @@ -54745,11 +54755,13 @@ bool js_cocos2dx_GridBase_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 4) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -54759,12 +54771,13 @@ bool js_cocos2dx_GridBase_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; arg2 = JS::ToBoolean(args.get(2)); cocos2d::Rect arg3; + ok = true; ok &= jsval_to_ccrect(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSize(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -54849,13 +54862,13 @@ bool js_cocos2dx_GridBase_reuse(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_GridBase_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::GridBase* ret = cocos2d::GridBase::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -54872,11 +54885,13 @@ bool js_cocos2dx_GridBase_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 3) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -54886,10 +54901,11 @@ bool js_cocos2dx_GridBase_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; + ok = true; arg2 = JS::ToBoolean(args.get(2)); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::GridBase* ret = cocos2d::GridBase::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -55018,16 +55034,17 @@ bool js_cocos2dx_Grid3D_setNeedDepthTestForBlit(JSContext *cx, uint32_t argc, js bool js_cocos2dx_Grid3D_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Grid3D* ret = cocos2d::Grid3D::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -55044,10 +55061,11 @@ bool js_cocos2dx_Grid3D_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 1) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Grid3D* ret = cocos2d::Grid3D::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -55064,11 +55082,13 @@ bool js_cocos2dx_Grid3D_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 3) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -55078,10 +55098,11 @@ bool js_cocos2dx_Grid3D_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; + ok = true; arg2 = JS::ToBoolean(args.get(2)); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Grid3D* ret = cocos2d::Grid3D::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -55098,11 +55119,13 @@ bool js_cocos2dx_Grid3D_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 4) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -55112,13 +55135,15 @@ bool js_cocos2dx_Grid3D_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; + ok = true; arg2 = JS::ToBoolean(args.get(2)); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg3; + ok = true; ok &= jsval_to_ccrect(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Grid3D* ret = cocos2d::Grid3D::create(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { @@ -55237,16 +55262,17 @@ JSObject *jsb_cocos2d_TiledGrid3D_prototype; bool js_cocos2dx_TiledGrid3D_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TiledGrid3D* ret = cocos2d::TiledGrid3D::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -55263,10 +55289,11 @@ bool js_cocos2dx_TiledGrid3D_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 1) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TiledGrid3D* ret = cocos2d::TiledGrid3D::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -55283,11 +55310,13 @@ bool js_cocos2dx_TiledGrid3D_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 3) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -55297,10 +55326,11 @@ bool js_cocos2dx_TiledGrid3D_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; + ok = true; arg2 = JS::ToBoolean(args.get(2)); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TiledGrid3D* ret = cocos2d::TiledGrid3D::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -55317,11 +55347,13 @@ bool js_cocos2dx_TiledGrid3D_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 4) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -55331,13 +55363,15 @@ bool js_cocos2dx_TiledGrid3D_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; + ok = true; arg2 = JS::ToBoolean(args.get(2)); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg3; + ok = true; ok &= jsval_to_ccrect(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TiledGrid3D* ret = cocos2d::TiledGrid3D::create(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { @@ -55491,24 +55525,6 @@ bool js_cocos2dx_GLProgram_bindAttribLocation(JSContext *cx, uint32_t argc, jsva JS_ReportError(cx, "js_cocos2dx_GLProgram_bindAttribLocation : wrong number of arguments: %d, was expecting %d", argc, 2); return false; } -bool js_cocos2dx_GLProgram_getUniformFlags(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::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_getUniformFlags : Invalid Native Object"); - if (argc == 0) { - const cocos2d::GLProgram::UniformFlags& ret = cobj->getUniformFlags(); - jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR UniformFlags; - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_GLProgram_getUniformFlags : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_GLProgram_getUniformLocationForName(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -55589,7 +55605,6 @@ bool js_cocos2dx_GLProgram_getUniform(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_GLProgram_initWithByteArrays(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GLProgram* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -55599,16 +55614,19 @@ bool js_cocos2dx_GLProgram_initWithByteArrays(JSContext *cx, uint32_t argc, jsva cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_initWithByteArrays : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg1 = nullptr; + ok = true; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithByteArrays(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -55618,13 +55636,15 @@ bool js_cocos2dx_GLProgram_initWithByteArrays(JSContext *cx, uint32_t argc, jsva } while(0); do { + bool ok = true; if (argc == 2) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg1 = nullptr; + ok = true; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithByteArrays(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -55660,7 +55680,6 @@ bool js_cocos2dx_GLProgram_setUniformLocationWith1f(JSContext *cx, uint32_t argc } bool js_cocos2dx_GLProgram_initWithFilenames(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GLProgram* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -55670,16 +55689,19 @@ bool js_cocos2dx_GLProgram_initWithFilenames(JSContext *cx, uint32_t argc, jsval cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_initWithFilenames : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithFilenames(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -55689,13 +55711,15 @@ bool js_cocos2dx_GLProgram_initWithFilenames(JSContext *cx, uint32_t argc, jsval } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithFilenames(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -55735,7 +55759,6 @@ bool js_cocos2dx_GLProgram_setUniformLocationWith3f(JSContext *cx, uint32_t argc } bool js_cocos2dx_GLProgram_setUniformsForBuiltins(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::GLProgram* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -55745,10 +55768,11 @@ bool js_cocos2dx_GLProgram_setUniformsForBuiltins(JSContext *cx, uint32_t argc, cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformsForBuiltins : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Mat4 arg0; ok &= jsval_to_matrix(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setUniformsForBuiltins(arg0); args.rval().setUndefined(); return true; @@ -55914,28 +55938,6 @@ bool js_cocos2dx_GLProgram_getAttribLocation(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_GLProgram_getAttribLocation : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_GLProgram_getVertexAttrib(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::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_getVertexAttrib : Invalid Native Object"); - if (argc == 1) { - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_getVertexAttrib : Error processing arguments"); - cocos2d::VertexAttrib* ret = cobj->getVertexAttrib(arg0); - jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR VertexAttrib*; - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_GLProgram_getVertexAttrib : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_GLProgram_setUniformLocationWith2f(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -56037,19 +56039,21 @@ bool js_cocos2dx_GLProgram_setUniformLocationWith2i(JSContext *cx, uint32_t argc bool js_cocos2dx_GLProgram_createWithByteArrays(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg1 = nullptr; + ok = true; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::GLProgram* ret = cocos2d::GLProgram::createWithByteArrays(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -56066,13 +56070,15 @@ bool js_cocos2dx_GLProgram_createWithByteArrays(JSContext *cx, uint32_t argc, js } while (0); do { + bool ok = true; if (argc == 2) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg1 = nullptr; + ok = true; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::GLProgram* ret = cocos2d::GLProgram::createWithByteArrays(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -56093,19 +56099,21 @@ bool js_cocos2dx_GLProgram_createWithByteArrays(JSContext *cx, uint32_t argc, js bool js_cocos2dx_GLProgram_createWithFilenames(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::GLProgram* ret = cocos2d::GLProgram::createWithFilenames(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -56122,13 +56130,15 @@ bool js_cocos2dx_GLProgram_createWithFilenames(JSContext *cx, uint32_t argc, jsv } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::GLProgram* ret = cocos2d::GLProgram::createWithFilenames(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -56214,7 +56224,6 @@ void js_register_cocos2dx_GLProgram(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("getFragmentShaderLog", js_cocos2dx_GLProgram_getFragmentShaderLog, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("addAttribute", js_cocos2dx_GLProgram_bindAttribLocation, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getUniformFlags", js_cocos2dx_GLProgram_getUniformFlags, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getUniformLocationForName", js_cocos2dx_GLProgram_getUniformLocationForName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("use", js_cocos2dx_GLProgram_use, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getVertexShaderLog", js_cocos2dx_GLProgram_getVertexShaderLog, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -56231,7 +56240,6 @@ void js_register_cocos2dx_GLProgram(JSContext *cx, JS::HandleObject global) { JS_FN("link", js_cocos2dx_GLProgram_link, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("reset", js_cocos2dx_GLProgram_reset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getAttribLocation", js_cocos2dx_GLProgram_getAttribLocation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getVertexAttrib", js_cocos2dx_GLProgram_getVertexAttrib, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setUniformLocationWith2f", js_cocos2dx_GLProgram_setUniformLocationWith2f, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setUniformLocationWith4i", js_cocos2dx_GLProgram_setUniformLocationWith4i, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setUniformLocationI32", js_cocos2dx_GLProgram_setUniformLocationWith1i, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -56913,7 +56921,6 @@ bool js_cocos2dx_TextureCache_getCachedTextureInfo(JSContext *cx, uint32_t argc, } bool js_cocos2dx_TextureCache_addImage(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TextureCache* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -56923,6 +56930,7 @@ bool js_cocos2dx_TextureCache_addImage(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_addImage : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::Image* arg0 = nullptr; do { @@ -56934,10 +56942,11 @@ bool js_cocos2dx_TextureCache_addImage(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Image*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* ret = cobj->addImage(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -56954,10 +56963,11 @@ bool js_cocos2dx_TextureCache_addImage(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* ret = cobj->addImage(arg0); jsval jsret = JSVAL_NULL; do { @@ -58622,7 +58632,6 @@ bool js_cocos2dx_SpriteFrameCache_addSpriteFrame(JSContext *cx, uint32_t argc, j } bool js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFile(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::SpriteFrameCache* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -58632,13 +58641,15 @@ bool js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFile(JSContext *cx, uint32_ cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFile : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addSpriteFramesWithFile(arg0, arg1); args.rval().setUndefined(); return true; @@ -58646,10 +58657,11 @@ bool js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFile(JSContext *cx, uint32_ } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addSpriteFramesWithFile(arg0); args.rval().setUndefined(); return true; @@ -58657,11 +58669,13 @@ bool js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFile(JSContext *cx, uint32_ } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Texture2D* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -58671,7 +58685,7 @@ bool js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFile(JSContext *cx, uint32_ arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addSpriteFramesWithFile(arg0, arg1); args.rval().setUndefined(); return true; @@ -59020,7 +59034,6 @@ bool js_cocos2dx_TextFieldTTF_getColorSpaceHolder(JSContext *cx, uint32_t argc, } bool js_cocos2dx_TextFieldTTF_initWithPlaceHolder(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TextFieldTTF* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -59030,16 +59043,19 @@ bool js_cocos2dx_TextFieldTTF_initWithPlaceHolder(JSContext *cx, uint32_t argc, cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_initWithPlaceHolder : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithPlaceHolder(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -59049,22 +59065,27 @@ bool js_cocos2dx_TextFieldTTF_initWithPlaceHolder(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 5) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg1; + ok = true; ok &= jsval_to_ccsize(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextHAlignment arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg3; + ok = true; ok &= jsval_to_std_string(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg4 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithPlaceHolder(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -59078,7 +59099,6 @@ bool js_cocos2dx_TextFieldTTF_initWithPlaceHolder(JSContext *cx, uint32_t argc, } bool js_cocos2dx_TextFieldTTF_setColorSpaceHolder(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TextFieldTTF* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -59088,10 +59108,11 @@ bool js_cocos2dx_TextFieldTTF_setColorSpaceHolder(JSContext *cx, uint32_t argc, cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_setColorSpaceHolder : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setColorSpaceHolder(arg0); args.rval().setUndefined(); return true; @@ -59099,10 +59120,11 @@ bool js_cocos2dx_TextFieldTTF_setColorSpaceHolder(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Color3B arg0; ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setColorSpaceHolder(arg0); args.rval().setUndefined(); return true; @@ -59207,19 +59229,21 @@ bool js_cocos2dx_TextFieldTTF_attachWithIME(JSContext *cx, uint32_t argc, jsval bool js_cocos2dx_TextFieldTTF_textFieldWithPlaceHolder(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextFieldTTF* ret = cocos2d::TextFieldTTF::textFieldWithPlaceHolder(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -59236,22 +59260,27 @@ bool js_cocos2dx_TextFieldTTF_textFieldWithPlaceHolder(JSContext *cx, uint32_t a } while (0); do { + bool ok = true; if (argc == 5) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg1; + ok = true; ok &= jsval_to_ccsize(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextHAlignment arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg3; + ok = true; ok &= jsval_to_std_string(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg4 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextFieldTTF* ret = cocos2d::TextFieldTTF::textFieldWithPlaceHolder(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; do { @@ -59375,40 +59404,6 @@ void js_register_cocos2dx_TextFieldTTF(JSContext *cx, JS::HandleObject global) { JSClass *jsb_cocos2d_ParallaxNode_class; JSObject *jsb_cocos2d_ParallaxNode_prototype; -bool js_cocos2dx_ParallaxNode_getParallaxArray(JSContext *cx, uint32_t argc, jsval *vp) -{ - bool ok = true; - cocos2d::ParallaxNode* cobj = nullptr; - - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx); - obj.set(args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cobj = (cocos2d::ParallaxNode *)(proxy ? proxy->ptr : nullptr); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParallaxNode_getParallaxArray : Invalid Native Object"); - do { - if (argc == 0) { - const cocos2d::_ccArray* ret = cobj->getParallaxArray(); - jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR _ccArray*; - args.rval().set(jsret); - return true; - } - } while(0); - - do { - if (argc == 0) { - cocos2d::_ccArray* ret = cobj->getParallaxArray(); - jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR _ccArray*; - args.rval().set(jsret); - return true; - } - } while(0); - - JS_ReportError(cx, "js_cocos2dx_ParallaxNode_getParallaxArray : wrong number of arguments"); - return false; -} bool js_cocos2dx_ParallaxNode_addChild(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -59463,27 +59458,6 @@ bool js_cocos2dx_ParallaxNode_removeAllChildrenWithCleanup(JSContext *cx, uint32 JS_ReportError(cx, "js_cocos2dx_ParallaxNode_removeAllChildrenWithCleanup : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_ParallaxNode_setParallaxArray(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::ParallaxNode* cobj = (cocos2d::ParallaxNode *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParallaxNode_setParallaxArray : Invalid Native Object"); - if (argc == 1) { - cocos2d::_ccArray* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR _ccArray* - ok = false; - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParallaxNode_setParallaxArray : Error processing arguments"); - cobj->setParallaxArray(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ParallaxNode_setParallaxArray : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_ParallaxNode_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -59572,10 +59546,8 @@ void js_register_cocos2dx_ParallaxNode(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { - JS_FN("getParallaxArray", js_cocos2dx_ParallaxNode_getParallaxArray, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("addChild", js_cocos2dx_ParallaxNode_addChild, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeAllChildrenWithCleanup", js_cocos2dx_ParallaxNode_removeAllChildrenWithCleanup, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setParallaxArray", js_cocos2dx_ParallaxNode_setParallaxArray, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_ParallaxNode_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -59688,7 +59660,6 @@ bool js_cocos2dx_TMXObjectGroup_getObject(JSContext *cx, uint32_t argc, jsval *v } bool js_cocos2dx_TMXObjectGroup_getObjects(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TMXObjectGroup* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -59742,7 +59713,6 @@ bool js_cocos2dx_TMXObjectGroup_setGroupName(JSContext *cx, uint32_t argc, jsval } bool js_cocos2dx_TMXObjectGroup_getProperties(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TMXObjectGroup* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -60323,7 +60293,6 @@ bool js_cocos2dx_TMXMapInfo_parseXMLString(JSContext *cx, uint32_t argc, jsval * } bool js_cocos2dx_TMXMapInfo_getLayers(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TMXMapInfo* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -60357,7 +60326,6 @@ bool js_cocos2dx_TMXMapInfo_getLayers(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_TMXMapInfo_getTilesets(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TMXMapInfo* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -60527,7 +60495,6 @@ bool js_cocos2dx_TMXMapInfo_getTileProperties(JSContext *cx, uint32_t argc, jsva } bool js_cocos2dx_TMXMapInfo_getObjectGroups(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TMXMapInfo* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -60737,7 +60704,6 @@ bool js_cocos2dx_TMXMapInfo_setTilesets(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_TMXMapInfo_getProperties(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TMXMapInfo* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -61027,24 +60993,6 @@ bool js_cocos2dx_TileMapAtlas_releaseMap(JSContext *cx, uint32_t argc, jsval *vp JS_ReportError(cx, "js_cocos2dx_TileMapAtlas_releaseMap : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_TileMapAtlas_getTGAInfo(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::TileMapAtlas* cobj = (cocos2d::TileMapAtlas *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TileMapAtlas_getTGAInfo : Invalid Native Object"); - if (argc == 0) { - cocos2d::sImageTGA* ret = cobj->getTGAInfo(); - jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR sImageTGA*; - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_TileMapAtlas_getTGAInfo : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_TileMapAtlas_getTileAt(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -61089,27 +61037,6 @@ bool js_cocos2dx_TileMapAtlas_setTile(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_TileMapAtlas_setTile : wrong number of arguments: %d, was expecting %d", argc, 2); return false; } -bool js_cocos2dx_TileMapAtlas_setTGAInfo(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::TileMapAtlas* cobj = (cocos2d::TileMapAtlas *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TileMapAtlas_setTGAInfo : Invalid Native Object"); - if (argc == 1) { - cocos2d::sImageTGA* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR sImageTGA* - ok = false; - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TileMapAtlas_setTGAInfo : Error processing arguments"); - cobj->setTGAInfo(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_TileMapAtlas_setTGAInfo : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_TileMapAtlas_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -61210,10 +61137,8 @@ void js_register_cocos2dx_TileMapAtlas(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithTileFile", js_cocos2dx_TileMapAtlas_initWithTileFile, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("releaseMap", js_cocos2dx_TileMapAtlas_releaseMap, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getTGAInfo", js_cocos2dx_TileMapAtlas_getTGAInfo, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTileAt", js_cocos2dx_TileMapAtlas_getTileAt, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setTile", js_cocos2dx_TileMapAtlas_setTile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setTGAInfo", js_cocos2dx_TileMapAtlas_setTGAInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_TileMapAtlas_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -61409,27 +61334,6 @@ bool js_cocos2dx_TMXLayer_releaseMap(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_TMXLayer_releaseMap : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_TMXLayer_setTiles(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::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setTiles : Invalid Native Object"); - if (argc == 1) { - unsigned int* arg0 = 0; - #pragma warning NO CONVERSION TO NATIVE FOR unsigned int* - ok = false; - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_setTiles : Error processing arguments"); - cobj->setTiles(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_TMXLayer_setTiles : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_TMXLayer_getLayerSize(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -61548,7 +61452,6 @@ bool js_cocos2dx_TMXLayer_removeTileAt(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_TMXLayer_getProperties(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TMXLayer* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -61630,7 +61533,6 @@ bool js_cocos2dx_TMXLayer_setupTileSprite(JSContext *cx, uint32_t argc, jsval *v } bool js_cocos2dx_TMXLayer_setTileGID(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TMXLayer* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -61640,16 +61542,19 @@ bool js_cocos2dx_TMXLayer_setTileGID(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setTileGID : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg1; + ok = true; ok &= jsval_to_vector2(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TMXTileFlags_ arg2; + ok = true; ok &= jsval_to_uint32(cx, args.get(2), (uint32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setTileGID(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -61657,13 +61562,15 @@ bool js_cocos2dx_TMXLayer_setTileGID(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 2) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg1; + ok = true; ok &= jsval_to_vector2(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setTileGID(arg0, arg1); args.rval().setUndefined(); return true; @@ -61959,7 +61866,6 @@ void js_register_cocos2dx_TMXLayer(JSContext *cx, JS::HandleObject global) { JS_FN("setLayerOrientation", js_cocos2dx_TMXLayer_setLayerOrientation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithTilesetInfo", js_cocos2dx_TMXLayer_initWithTilesetInfo, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("releaseMap", js_cocos2dx_TMXLayer_releaseMap, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setTiles", js_cocos2dx_TMXLayer_setTiles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getLayerSize", js_cocos2dx_TMXLayer_getLayerSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setMapTileSize", js_cocos2dx_TMXLayer_setMapTileSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getLayerOrientation", js_cocos2dx_TMXLayer_getLayerOrientation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -62098,7 +62004,6 @@ bool js_cocos2dx_TMXTiledMap_getObjectGroup(JSContext *cx, uint32_t argc, jsval } bool js_cocos2dx_TMXTiledMap_getObjectGroups(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::TMXTiledMap* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp index c5379b97bf..19c5ca51df 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp @@ -20,7 +20,6 @@ bool js_cocos2dx_Texture2D_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_Texture2D_getMaxS(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_releaseGLTexture(JSContext *cx, uint32_t argc, jsval *vp); 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_getBitsPerPixelForFormat(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_getName(JSContext *cx, uint32_t argc, jsval *vp); @@ -147,7 +146,6 @@ bool js_cocos2dx_Node_removeAllComponents(JSContext *cx, uint32_t argc, jsval *v bool js_cocos2dx_Node_getOpacity(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setCameraMask(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getTag(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Node_getonEnterTransitionDidFinishCallback(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getNodeToWorldAffineTransform(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_removeChild(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getScene(JSContext *cx, uint32_t argc, jsval *vp); @@ -167,7 +165,6 @@ bool js_cocos2dx_Node_isCascadeOpacityEnabled(JSContext *cx, uint32_t argc, jsva bool js_cocos2dx_Node_setParent(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getNodeToParentAffineTransform(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Node_getOnEnterCallback(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_isOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_stopActionByTag(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_reorderChild(JSContext *cx, uint32_t argc, jsval *vp); @@ -220,7 +217,6 @@ bool js_cocos2dx_Node_getParentToNodeAffineTransform(JSContext *cx, uint32_t arg bool js_cocos2dx_Node_getPositionZ(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Node_getOnExitCallback(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getChildByTag(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setOrderOfArrival(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getScaleZ(JSContext *cx, uint32_t argc, jsval *vp); @@ -238,7 +234,6 @@ bool js_cocos2dx_Node_getGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_draw(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setUserObject(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_enumerateChildren(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Node_getonExitTransitionDidStartCallback(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_removeFromParentAndCleanup(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_convertTouchToNodeSpaceAR(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_update(JSContext *cx, uint32_t argc, jsval *vp); @@ -303,7 +298,6 @@ bool js_cocos2dx_GLView_getVisibleSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_isScissorEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_pollEvents(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_setGLContextAttrs(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_GLView_getGLContextAttrs(JSContext *cx, uint32_t argc, jsval *vp); extern JSClass *jsb_cocos2d_Director_class; extern JSObject *jsb_cocos2d_Director_prototype; @@ -1147,7 +1141,6 @@ bool js_cocos2dx_OrbitCamera_constructor(JSContext *cx, uint32_t argc, jsval *vp void js_cocos2dx_OrbitCamera_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_OrbitCamera(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_OrbitCamera_sphericalRadius(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_OrbitCamera_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_OrbitCamera_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_OrbitCamera_OrbitCamera(JSContext *cx, uint32_t argc, jsval *vp); @@ -1930,8 +1923,6 @@ bool js_cocos2dx_ShuffleTiles_constructor(JSContext *cx, uint32_t argc, jsval *v void js_cocos2dx_ShuffleTiles_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_ShuffleTiles(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_ShuffleTiles_placeTile(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ShuffleTiles_shuffle(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ShuffleTiles_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ShuffleTiles_getDelta(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ShuffleTiles_create(JSContext *cx, uint32_t argc, jsval *vp); @@ -1990,7 +1981,6 @@ void js_register_cocos2dx_TurnOffTiles(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_TurnOffTiles_turnOnTile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TurnOffTiles_turnOffTile(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_TurnOffTiles_shuffle(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TurnOffTiles_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TurnOffTiles_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TurnOffTiles_TurnOffTiles(JSContext *cx, uint32_t argc, jsval *vp); @@ -2081,7 +2071,6 @@ bool js_cocos2dx_GLProgramState_getUniformCount(JSContext *cx, uint32_t argc, js bool js_cocos2dx_GLProgramState_applyAttributes(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgramState_clone(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgramState_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_GLProgramState_setUniformFloatv(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgramState_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgramState_applyUniforms(JSContext *cx, uint32_t argc, jsval *vp); @@ -2895,9 +2884,6 @@ bool js_cocos2dx_Image_getBitPerPixel(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_getFileType(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_getNumberOfMipmaps(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_getRenderFormat(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Image_getData(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Image_getMipmaps(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Image_initWithRawData(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_setPVRImagesHavePremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_setPNGPremultipliedAlphaEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_Image(JSContext *cx, uint32_t argc, jsval *vp); @@ -3384,7 +3370,6 @@ void js_register_cocos2dx_GLProgram(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_GLProgram_getFragmentShaderLog(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgram_bindAttribLocation(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_GLProgram_getUniformFlags(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgram_getUniformLocationForName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgram_use(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgram_getVertexShaderLog(JSContext *cx, uint32_t argc, jsval *vp); @@ -3401,7 +3386,6 @@ bool js_cocos2dx_GLProgram_getUniformLocation(JSContext *cx, uint32_t argc, jsva bool js_cocos2dx_GLProgram_link(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgram_reset(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgram_getAttribLocation(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_GLProgram_getVertexAttrib(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgram_setUniformLocationWith2f(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgram_setUniformLocationWith4i(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLProgram_setUniformLocationWith1i(JSContext *cx, uint32_t argc, jsval *vp); @@ -3597,10 +3581,8 @@ bool js_cocos2dx_ParallaxNode_constructor(JSContext *cx, uint32_t argc, jsval *v void js_cocos2dx_ParallaxNode_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_ParallaxNode(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_ParallaxNode_getParallaxArray(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ParallaxNode_addChild(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ParallaxNode_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ParallaxNode_setParallaxArray(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ParallaxNode_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ParallaxNode_ParallaxNode(JSContext *cx, uint32_t argc, jsval *vp); @@ -3696,10 +3678,8 @@ void js_register_cocos2dx_TileMapAtlas(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_TileMapAtlas_initWithTileFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TileMapAtlas_releaseMap(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_TileMapAtlas_getTGAInfo(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TileMapAtlas_getTileAt(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TileMapAtlas_setTile(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_TileMapAtlas_setTGAInfo(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TileMapAtlas_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TileMapAtlas_TileMapAtlas(JSContext *cx, uint32_t argc, jsval *vp); @@ -3716,7 +3696,6 @@ bool js_cocos2dx_TMXLayer_getPositionAt(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_TMXLayer_setLayerOrientation(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_initWithTilesetInfo(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_releaseMap(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_TMXLayer_setTiles(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_getLayerSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_setMapTileSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_getLayerOrientation(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.cpp index dc9456bc93..232856b810 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.cpp @@ -1431,7 +1431,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv arg0 = (cocosbuilder::CCBReader*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) cocosbuilder::CCBReader(arg0); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -1467,8 +1467,9 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv arg0 = (cocosbuilder::NodeLoaderLibrary*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocosbuilder::CCBMemberVariableAssigner* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -1478,8 +1479,9 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv arg1 = (cocosbuilder::CCBMemberVariableAssigner*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocosbuilder::CCBSelectorResolver* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -1489,8 +1491,9 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv arg2 = (cocosbuilder::CCBSelectorResolver*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocosbuilder::NodeLoaderListener* arg3 = nullptr; + ok = true; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -1500,7 +1503,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv arg3 = (cocosbuilder::NodeLoaderListener*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) cocosbuilder::CCBReader(arg0, arg1, arg2, arg3); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp index 38ff3c36b1..fa9113db76 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp @@ -1176,7 +1176,6 @@ bool js_cocos2dx_extension_ControlButton_setMargins(JSContext *cx, uint32_t argc } bool js_cocos2dx_extension_ControlButton_getCurrentTitle(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::extension::ControlButton* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1293,9 +1292,9 @@ bool js_cocos2dx_extension_ControlButton_getTitleForState(JSContext *cx, uint32_ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { cocos2d::ui::Scale9Sprite* arg0 = nullptr; do { @@ -1307,7 +1306,7 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js arg0 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -1341,6 +1340,7 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js } while (0); do { + bool ok = true; if (argc == 2) { cocos2d::Node* arg0 = nullptr; do { @@ -1352,8 +1352,9 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -1363,7 +1364,7 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js arg1 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -1380,16 +1381,19 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js } while (0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -1406,6 +1410,7 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js } while (0); do { + bool ok = true; if (argc == 3) { cocos2d::Node* arg0 = nullptr; do { @@ -1417,8 +1422,9 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -1428,10 +1434,11 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js arg1 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; + ok = true; arg2 = JS::ToBoolean(args.get(2)); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -3196,7 +3203,6 @@ bool js_cocos2dx_extension_ControlSlider_getMaximumAllowedValue(JSContext *cx, u } bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::extension::ControlSlider* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3206,6 +3212,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t cobj = (cocos2d::extension::ControlSlider *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_initWithSprites : Invalid Native Object"); do { + bool ok = true; if (argc == 4) { cocos2d::Sprite* arg0 = nullptr; do { @@ -3217,8 +3224,9 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -3228,8 +3236,9 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -3239,8 +3248,9 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg3 = nullptr; + ok = true; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -3250,7 +3260,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t arg3 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSprites(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -3260,6 +3270,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t } while(0); do { + bool ok = true; if (argc == 3) { cocos2d::Sprite* arg0 = nullptr; do { @@ -3271,8 +3282,9 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -3282,8 +3294,9 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -3293,7 +3306,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSprites(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -3694,9 +3707,9 @@ bool js_cocos2dx_extension_ControlSlider_setMaximumAllowedValue(JSContext *cx, u bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { cocos2d::Sprite* arg0 = nullptr; do { @@ -3708,8 +3721,9 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -3719,8 +3733,9 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -3730,7 +3745,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::extension::ControlSlider* ret = cocos2d::extension::ControlSlider::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -3747,16 +3762,19 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js } while (0); do { + bool ok = true; if (argc == 3) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg1 = nullptr; + ok = true; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg2 = nullptr; + ok = true; std::string arg2_tmp; ok &= jsval_to_std_string(cx, args.get(2), &arg2_tmp); arg2 = arg2_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::extension::ControlSlider* ret = cocos2d::extension::ControlSlider::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -3773,19 +3791,23 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js } while (0); do { + bool ok = true; if (argc == 4) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg1 = nullptr; + ok = true; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg2 = nullptr; + ok = true; std::string arg2_tmp; ok &= jsval_to_std_string(cx, args.get(2), &arg2_tmp); arg2 = arg2_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg3 = nullptr; + ok = true; std::string arg3_tmp; ok &= jsval_to_std_string(cx, args.get(3), &arg3_tmp); arg3 = arg3_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::extension::ControlSlider* ret = cocos2d::extension::ControlSlider::create(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { @@ -3802,6 +3824,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js } while (0); do { + bool ok = true; if (argc == 4) { cocos2d::Sprite* arg0 = nullptr; do { @@ -3813,8 +3836,9 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -3824,8 +3848,9 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -3835,8 +3860,9 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg3 = nullptr; + ok = true; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -3846,7 +3872,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js arg3 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::extension::ControlSlider* ret = cocos2d::extension::ControlSlider::create(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { @@ -4602,7 +4628,6 @@ JSObject *jsb_cocos2d_extension_ControlSwitch_prototype; bool js_cocos2dx_extension_ControlSwitch_setOn(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::extension::ControlSwitch* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4612,6 +4637,7 @@ bool js_cocos2dx_extension_ControlSwitch_setOn(JSContext *cx, uint32_t argc, jsv cobj = (cocos2d::extension::ControlSwitch *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSwitch_setOn : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { bool arg0; arg0 = JS::ToBoolean(args.get(0)); @@ -4622,6 +4648,7 @@ bool js_cocos2dx_extension_ControlSwitch_setOn(JSContext *cx, uint32_t argc, jsv } while(0); do { + bool ok = true; if (argc == 2) { bool arg0; arg0 = JS::ToBoolean(args.get(0)); @@ -4686,7 +4713,6 @@ bool js_cocos2dx_extension_ControlSwitch_isOn(JSContext *cx, uint32_t argc, jsva } bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::extension::ControlSwitch* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4696,6 +4722,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 cobj = (cocos2d::extension::ControlSwitch *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSwitch_initWithMaskSprite : Invalid Native Object"); do { + bool ok = true; if (argc == 6) { cocos2d::Sprite* arg0 = nullptr; do { @@ -4707,8 +4734,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -4718,8 +4746,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -4729,8 +4758,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg3 = nullptr; + ok = true; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -4740,8 +4770,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 arg3 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Label* arg4 = nullptr; + ok = true; do { if (args.get(4).isNull()) { arg4 = nullptr; break; } if (!args.get(4).isObject()) { ok = false; break; } @@ -4751,8 +4782,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 arg4 = (cocos2d::Label*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg4, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Label* arg5 = nullptr; + ok = true; do { if (args.get(5).isNull()) { arg5 = nullptr; break; } if (!args.get(5).isObject()) { ok = false; break; } @@ -4762,7 +4794,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 arg5 = (cocos2d::Label*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg5, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithMaskSprite(arg0, arg1, arg2, arg3, arg4, arg5); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -4772,6 +4804,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 } while(0); do { + bool ok = true; if (argc == 4) { cocos2d::Sprite* arg0 = nullptr; do { @@ -4783,8 +4816,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -4794,8 +4828,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -4805,8 +4840,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg3 = nullptr; + ok = true; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -4816,7 +4852,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 arg3 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithMaskSprite(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -4849,9 +4885,9 @@ bool js_cocos2dx_extension_ControlSwitch_hasMoved(JSContext *cx, uint32_t argc, bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 4) { cocos2d::Sprite* arg0 = nullptr; do { @@ -4863,8 +4899,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -4874,8 +4911,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -4885,8 +4923,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg3 = nullptr; + ok = true; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -4896,7 +4935,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js arg3 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::extension::ControlSwitch* ret = cocos2d::extension::ControlSwitch::create(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { @@ -4913,6 +4952,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js } while (0); do { + bool ok = true; if (argc == 6) { cocos2d::Sprite* arg0 = nullptr; do { @@ -4924,8 +4964,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -4935,8 +4976,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -4946,8 +4988,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Sprite* arg3 = nullptr; + ok = true; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -4957,8 +5000,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js arg3 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Label* arg4 = nullptr; + ok = true; do { if (args.get(4).isNull()) { arg4 = nullptr; break; } if (!args.get(4).isObject()) { ok = false; break; } @@ -4968,8 +5012,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js arg4 = (cocos2d::Label*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg4, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Label* arg5 = nullptr; + ok = true; do { if (args.get(5).isNull()) { arg5 = nullptr; break; } if (!args.get(5).isObject()) { ok = false; break; } @@ -4979,7 +5024,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js arg5 = (cocos2d::Label*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg5, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::extension::ControlSwitch* ret = cocos2d::extension::ControlSwitch::create(arg0, arg1, arg2, arg3, arg4, arg5); jsval jsret = JSVAL_NULL; do { @@ -5755,7 +5800,6 @@ bool js_cocos2dx_extension_ScrollView_minContainerOffset(JSContext *cx, uint32_t } bool js_cocos2dx_extension_ScrollView_setZoomScale(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::extension::ScrollView* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -5765,10 +5809,11 @@ bool js_cocos2dx_extension_ScrollView_setZoomScale(JSContext *cx, uint32_t argc, cobj = (cocos2d::extension::ScrollView *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ScrollView_setZoomScale : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); cobj->setZoomScale(arg0, arg1); @@ -5778,10 +5823,11 @@ bool js_cocos2dx_extension_ScrollView_setZoomScale(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 1) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setZoomScale(arg0); args.rval().setUndefined(); return true; @@ -5794,7 +5840,6 @@ bool js_cocos2dx_extension_ScrollView_setZoomScale(JSContext *cx, uint32_t argc, bool js_cocos2dx_extension_ScrollView_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { if (argc == 0) { @@ -5814,11 +5859,13 @@ bool js_cocos2dx_extension_ScrollView_create(JSContext *cx, uint32_t argc, jsval } while (0); do { + bool ok = true; if (argc == 2) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Node* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -5828,7 +5875,7 @@ bool js_cocos2dx_extension_ScrollView_create(JSContext *cx, uint32_t argc, jsval arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::extension::ScrollView* ret = cocos2d::extension::ScrollView::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp index 6f1078de3e..7303637d80 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp @@ -85,7 +85,6 @@ bool js_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled(JSContext *cx, uint } bool js_cocos2dx_spine_SkeletonRenderer_setAttachment(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; spine::SkeletonRenderer* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -95,13 +94,15 @@ bool js_cocos2dx_spine_SkeletonRenderer_setAttachment(JSContext *cx, uint32_t ar cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setAttachment : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg1 = nullptr; + ok = true; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->setAttachment(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -111,13 +112,15 @@ bool js_cocos2dx_spine_SkeletonRenderer_setAttachment(JSContext *cx, uint32_t ar } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->setAttachment(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -145,38 +148,6 @@ bool js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose(JSContext *cx, uint3 JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_spine_SkeletonRenderer_initWithData(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); - spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithData : Invalid Native Object"); - if (argc == 1) { - spSkeletonData* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* - ok = false; - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithData : Error processing arguments"); - cobj->initWithData(arg0); - args.rval().setUndefined(); - return true; - } - if (argc == 2) { - spSkeletonData* arg0 = nullptr; - bool arg1; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* - ok = false; - arg1 = JS::ToBoolean(args.get(1)); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithData : Error processing arguments"); - cobj->initWithData(arg0, arg1); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_initWithData : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -359,7 +330,6 @@ bool js_cocos2dx_spine_SkeletonRenderer_getTimeScale(JSContext *cx, uint32_t arg } bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; spine::SkeletonRenderer* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -369,13 +339,15 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t arg cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithFile : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->initWithFile(arg0, arg1); args.rval().setUndefined(); return true; @@ -383,16 +355,19 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t arg } while(0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->initWithFile(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -400,14 +375,16 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t arg } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } spAtlas* arg1 = nullptr; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->initWithFile(arg0, arg1); args.rval().setUndefined(); return true; @@ -415,17 +392,20 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t arg } while(0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } spAtlas* arg1 = nullptr; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->initWithFile(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -457,7 +437,6 @@ bool js_cocos2dx_spine_SkeletonRenderer_setBlendFunc(JSContext *cx, uint32_t arg } bool js_cocos2dx_spine_SkeletonRenderer_setSkin(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; spine::SkeletonRenderer* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -467,10 +446,11 @@ bool js_cocos2dx_spine_SkeletonRenderer_setSkin(JSContext *cx, uint32_t argc, js cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setSkin : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->setSkin(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -480,10 +460,11 @@ bool js_cocos2dx_spine_SkeletonRenderer_setSkin(JSContext *cx, uint32_t argc, js } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->setSkin(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -516,16 +497,17 @@ bool js_cocos2dx_spine_SkeletonRenderer_getSkeleton(JSContext *cx, uint32_t argc bool js_cocos2dx_spine_SkeletonRenderer_createWithFile(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -541,16 +523,19 @@ bool js_cocos2dx_spine_SkeletonRenderer_createWithFile(JSContext *cx, uint32_t a } } while (0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -567,14 +552,16 @@ bool js_cocos2dx_spine_SkeletonRenderer_createWithFile(JSContext *cx, uint32_t a } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } spAtlas* arg1 = nullptr; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -590,17 +577,20 @@ bool js_cocos2dx_spine_SkeletonRenderer_createWithFile(JSContext *cx, uint32_t a } } while (0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } spAtlas* arg1 = nullptr; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -630,7 +620,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonRenderer(arg0); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -659,7 +649,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1); @@ -714,11 +704,12 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } spAtlas* arg1 = nullptr; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -746,14 +737,16 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } spAtlas* arg1 = nullptr; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1, arg2); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -781,10 +774,11 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -812,13 +806,15 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1, arg2); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -882,7 +878,6 @@ void js_register_cocos2dx_spine_SkeletonRenderer(JSContext *cx, JS::HandleObject JS_FN("getDebugSlotsEnabled", js_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setAttachment", js_cocos2dx_spine_SkeletonRenderer_setAttachment, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setBonesToSetupPose", js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("initWithData", js_cocos2dx_spine_SkeletonRenderer_initWithData, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setDebugSlotsEnabled", js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setSlotsToSetupPose", js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setToSetupPose", js_cocos2dx_spine_SkeletonRenderer_setToSetupPose, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -1029,124 +1024,6 @@ bool js_cocos2dx_spine_SkeletonAnimation_getState(JSContext *cx, uint32_t argc, JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_getState : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener(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); - spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener : Invalid Native Object"); - if (argc == 2) { - spTrackEntry* arg0 = nullptr; - std::function arg1; - #pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry* - ok = false; - do { - if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION) - { - JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull()); - std::shared_ptr func(new JSFunctionWrapper(cx, jstarget, args.get(1))); - auto lambda = [=](int larg0, int larg1) -> void { - JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET - jsval largv[2]; - largv[0] = int32_to_jsval(cx, larg0); - largv[1] = int32_to_jsval(cx, larg1); - JS::RootedValue rval(cx); - bool succeed = func->invoke(2, &largv[0], &rval); - if (!succeed && JS_IsExceptionPending(cx)) { - JS_ReportPendingException(cx); - } - }; - arg1 = lambda; - } - else - { - arg1 = nullptr; - } - } while(0) - ; - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener : Error processing arguments"); - cobj->setTrackCompleteListener(arg0, arg1); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener : wrong number of arguments: %d, was expecting %d", argc, 2); - return false; -} -bool js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent(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); - spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent : Invalid Native Object"); - if (argc == 4) { - int arg0 = 0; - spEventType arg1; - spEvent* arg2 = nullptr; - int arg3 = 0; - ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - #pragma warning NO CONVERSION TO NATIVE FOR spEvent* - ok = false; - ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent : Error processing arguments"); - cobj->onTrackEntryEvent(arg0, arg1, arg2, arg3); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent : wrong number of arguments: %d, was expecting %d", argc, 4); - return false; -} -bool js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener(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); - spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener : Invalid Native Object"); - if (argc == 2) { - spTrackEntry* arg0 = nullptr; - std::function arg1; - #pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry* - ok = false; - do { - if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION) - { - JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull()); - std::shared_ptr func(new JSFunctionWrapper(cx, jstarget, args.get(1))); - auto lambda = [=](int larg0) -> void { - JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET - jsval largv[1]; - largv[0] = int32_to_jsval(cx, larg0); - JS::RootedValue rval(cx); - bool succeed = func->invoke(1, &largv[0], &rval); - if (!succeed && JS_IsExceptionPending(cx)) { - JS_ReportPendingException(cx); - } - }; - arg1 = lambda; - } - else - { - arg1 = nullptr; - } - } while(0) - ; - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener : Error processing arguments"); - cobj->setTrackStartListener(arg0, arg1); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener : wrong number of arguments: %d, was expecting %d", argc, 2); - return false; -} bool js_cocos2dx_spine_SkeletonAnimation_update(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1210,51 +1087,6 @@ bool js_cocos2dx_spine_SkeletonAnimation_setCompleteListener(JSContext *cx, uint JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setCompleteListener : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener(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); - spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener : Invalid Native Object"); - if (argc == 2) { - spTrackEntry* arg0 = nullptr; - std::function arg1; - #pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry* - ok = false; - do { - if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION) - { - JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull()); - std::shared_ptr func(new JSFunctionWrapper(cx, jstarget, args.get(1))); - auto lambda = [=](int larg0) -> void { - JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET - jsval largv[1]; - largv[0] = int32_to_jsval(cx, larg0); - JS::RootedValue rval(cx); - bool succeed = func->invoke(1, &largv[0], &rval); - if (!succeed && JS_IsExceptionPending(cx)) { - JS_ReportPendingException(cx); - } - }; - arg1 = lambda; - } - else - { - arg1 = nullptr; - } - } while(0) - ; - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener : Error processing arguments"); - cobj->setTrackEndListener(arg0, arg1); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener : wrong number of arguments: %d, was expecting %d", argc, 2); - return false; -} bool js_cocos2dx_spine_SkeletonAnimation_setEventListener(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1421,46 +1253,20 @@ bool js_cocos2dx_spine_SkeletonAnimation_clearTrack(JSContext *cx, uint32_t argc JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_clearTrack : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent(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); - spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent : Invalid Native Object"); - if (argc == 4) { - int arg0 = 0; - spEventType arg1; - spEvent* arg2 = nullptr; - int arg3 = 0; - ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - #pragma warning NO CONVERSION TO NATIVE FOR spEvent* - ok = false; - ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent : Error processing arguments"); - cobj->onAnimationStateEvent(arg0, arg1, arg2, arg3); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent : wrong number of arguments: %d, was expecting %d", argc, 4); - return false; -} bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -1476,16 +1282,19 @@ bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t } } while (0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -1502,14 +1311,16 @@ bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } spAtlas* arg1 = nullptr; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -1525,17 +1336,20 @@ bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t } } while (0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } spAtlas* arg1 = nullptr; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -1565,7 +1379,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -1594,7 +1408,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1); @@ -1649,11 +1463,12 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } spAtlas* arg1 = nullptr; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -1681,14 +1496,16 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } spAtlas* arg1 = nullptr; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -1716,10 +1533,11 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -1747,13 +1565,15 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -1799,7 +1619,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -1817,7 +1637,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1); @@ -1850,11 +1670,12 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } spAtlas* arg1 = nullptr; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -1871,14 +1692,16 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } spAtlas* arg1 = nullptr; + ok = true; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -1895,10 +1718,11 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -1915,13 +1739,15 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -1974,19 +1800,14 @@ void js_register_cocos2dx_spine_SkeletonAnimation(JSContext *cx, JS::HandleObjec JS_FN("setStartListener", js_cocos2dx_spine_SkeletonAnimation_setStartListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setTrackEventListener", js_cocos2dx_spine_SkeletonAnimation_setTrackEventListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getState", js_cocos2dx_spine_SkeletonAnimation_getState, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setTrackCompleteListener", js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("onTrackEntryEvent", js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setTrackStartListener", js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("update", js_cocos2dx_spine_SkeletonAnimation_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCompleteListener", js_cocos2dx_spine_SkeletonAnimation_setCompleteListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setTrackEndListener", js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setEventListener", js_cocos2dx_spine_SkeletonAnimation_setEventListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setMix", js_cocos2dx_spine_SkeletonAnimation_setMix, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setEndListener", js_cocos2dx_spine_SkeletonAnimation_setEndListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initialize", js_cocos2dx_spine_SkeletonAnimation_initialize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("clearTracks", js_cocos2dx_spine_SkeletonAnimation_clearTracks, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("clearTrack", js_cocos2dx_spine_SkeletonAnimation_clearTrack, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("onAnimationStateEvent", js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_spine_SkeletonAnimation_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp index e30d2fb9fd..259b216814 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp @@ -16,7 +16,6 @@ bool js_cocos2dx_spine_SkeletonRenderer_setTimeScale(JSContext *cx, uint32_t arg bool js_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonRenderer_setAttachment(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_spine_SkeletonRenderer_initWithData(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonRenderer_setToSetupPose(JSContext *cx, uint32_t argc, jsval *vp); @@ -44,19 +43,14 @@ void register_all_cocos2dx_spine(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_spine_SkeletonAnimation_setStartListener(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonAnimation_setTrackEventListener(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonAnimation_getState(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonAnimation_update(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonAnimation_setCompleteListener(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonAnimation_setEventListener(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonAnimation_setMix(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonAnimation_setEndListener(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonAnimation_initialize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonAnimation_clearTracks(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonAnimation_clearTrack(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_spine_SkeletonAnimation_SkeletonAnimation(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.cpp index 3236ca3f03..c42b62eca0 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.cpp @@ -176,7 +176,6 @@ bool js_cocos2dx_studio_ActionObject_stop(JSContext *cx, uint32_t argc, jsval *v } bool js_cocos2dx_studio_ActionObject_play(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::ActionObject* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -186,6 +185,7 @@ bool js_cocos2dx_studio_ActionObject_play(JSContext *cx, uint32_t argc, jsval *v cobj = (cocostudio::ActionObject *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_play : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::CallFunc* arg0 = nullptr; do { @@ -197,7 +197,7 @@ bool js_cocos2dx_studio_ActionObject_play(JSContext *cx, uint32_t argc, jsval *v arg0 = (cocos2d::CallFunc*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->play(arg0); args.rval().setUndefined(); return true; @@ -279,47 +279,6 @@ bool js_cocos2dx_studio_ActionObject_getLoop(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_studio_ActionObject_getLoop : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_studio_ActionObject_initWithBinary(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); - cocostudio::ActionObject* cobj = (cocostudio::ActionObject *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_initWithBinary : Invalid Native Object"); - if (argc == 3) { - cocostudio::CocoLoader* arg0 = nullptr; - cocostudio::stExpCocoNode* arg1 = nullptr; - cocos2d::Ref* arg2 = 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 = (cocostudio::CocoLoader*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); - } while (0); - #pragma warning NO CONVERSION TO NATIVE FOR stExpCocoNode* - ok = false; - do { - if (args.get(2).isNull()) { arg2 = nullptr; break; } - if (!args.get(2).isObject()) { ok = false; break; } - js_proxy_t *jsProxy; - JS::RootedObject tmpObj(cx, args.get(2).toObjectOrNull()); - jsProxy = jsb_get_js_proxy(tmpObj); - arg2 = (cocos2d::Ref*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); - } while (0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionObject_initWithBinary : Error processing arguments"); - cobj->initWithBinary(arg0, arg1, arg2); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_studio_ActionObject_initWithBinary : wrong number of arguments: %d, was expecting %d", argc, 3); - return false; -} bool js_cocos2dx_studio_ActionObject_addActionNode(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -505,7 +464,6 @@ void js_register_cocos2dx_studio_ActionObject(JSContext *cx, JS::HandleObject gl JS_FN("getCurrentTime", js_cocos2dx_studio_ActionObject_getCurrentTime, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeActionNode", js_cocos2dx_studio_ActionObject_removeActionNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getLoop", js_cocos2dx_studio_ActionObject_getLoop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("initWithBinary", js_cocos2dx_studio_ActionObject_initWithBinary, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("addActionNode", js_cocos2dx_studio_ActionObject_addActionNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getUnitTime", js_cocos2dx_studio_ActionObject_getUnitTime, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isPlaying", js_cocos2dx_studio_ActionObject_isPlaying, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -596,52 +554,8 @@ bool js_cocos2dx_studio_ActionManagerEx_getActionByName(JSContext *cx, uint32_t JS_ReportError(cx, "js_cocos2dx_studio_ActionManagerEx_getActionByName : wrong number of arguments: %d, was expecting %d", argc, 2); return false; } -bool js_cocos2dx_studio_ActionManagerEx_initWithBinary(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); - cocostudio::ActionManagerEx* cobj = (cocostudio::ActionManagerEx *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionManagerEx_initWithBinary : Invalid Native Object"); - if (argc == 4) { - const char* arg0 = nullptr; - cocos2d::Ref* arg1 = nullptr; - cocostudio::CocoLoader* arg2 = nullptr; - cocostudio::stExpCocoNode* arg3 = nullptr; - std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - 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::Ref*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); - } while (0); - do { - if (args.get(2).isNull()) { arg2 = nullptr; break; } - if (!args.get(2).isObject()) { ok = false; break; } - js_proxy_t *jsProxy; - JS::RootedObject tmpObj(cx, args.get(2).toObjectOrNull()); - jsProxy = jsb_get_js_proxy(tmpObj); - arg2 = (cocostudio::CocoLoader*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); - } while (0); - #pragma warning NO CONVERSION TO NATIVE FOR stExpCocoNode* - ok = false; - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionManagerEx_initWithBinary : Error processing arguments"); - cobj->initWithBinary(arg0, arg1, arg2, arg3); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_studio_ActionManagerEx_initWithBinary : wrong number of arguments: %d, was expecting %d", argc, 4); - return false; -} bool js_cocos2dx_studio_ActionManagerEx_playActionByName(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::ActionManagerEx* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -651,14 +565,17 @@ bool js_cocos2dx_studio_ActionManagerEx_playActionByName(JSContext *cx, uint32_t cobj = (cocostudio::ActionManagerEx *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionManagerEx_playActionByName : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg1 = nullptr; + ok = true; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::CallFunc* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -668,7 +585,7 @@ bool js_cocos2dx_studio_ActionManagerEx_playActionByName(JSContext *cx, uint32_t arg2 = (cocos2d::CallFunc*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocostudio::ActionObject* ret = cobj->playActionByName(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -685,13 +602,15 @@ bool js_cocos2dx_studio_ActionManagerEx_playActionByName(JSContext *cx, uint32_t } while(0); do { + bool ok = true; if (argc == 2) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg1 = nullptr; + ok = true; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocostudio::ActionObject* ret = cobj->playActionByName(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -782,7 +701,6 @@ void js_register_cocos2dx_studio_ActionManagerEx(JSContext *cx, JS::HandleObject static JSFunctionSpec funcs[] = { JS_FN("stopActionByName", js_cocos2dx_studio_ActionManagerEx_stopActionByName, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getActionByName", js_cocos2dx_studio_ActionManagerEx_getActionByName, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("initWithBinary", js_cocos2dx_studio_ActionManagerEx_initWithBinary, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("playActionByName", js_cocos2dx_studio_ActionManagerEx_playActionByName, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("releaseActions", js_cocos2dx_studio_ActionManagerEx_releaseActions, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END @@ -2433,7 +2351,6 @@ bool js_cocos2dx_studio_ColliderDetector_removeAll(JSContext *cx, uint32_t argc, } bool js_cocos2dx_studio_ColliderDetector_init(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::ColliderDetector* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -2443,6 +2360,7 @@ bool js_cocos2dx_studio_ColliderDetector_init(JSContext *cx, uint32_t argc, jsva cobj = (cocostudio::ColliderDetector *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ColliderDetector_init : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocostudio::Bone* arg0 = nullptr; do { @@ -2454,7 +2372,7 @@ bool js_cocos2dx_studio_ColliderDetector_init(JSContext *cx, uint32_t argc, jsva arg0 = (cocostudio::Bone*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->init(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -2527,9 +2445,9 @@ bool js_cocos2dx_studio_ColliderDetector_setBone(JSContext *cx, uint32_t argc, j bool js_cocos2dx_studio_ColliderDetector_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { cocostudio::Bone* arg0 = nullptr; do { @@ -2541,7 +2459,7 @@ bool js_cocos2dx_studio_ColliderDetector_create(JSContext *cx, uint32_t argc, js arg0 = (cocostudio::Bone*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocostudio::ColliderDetector* ret = cocostudio::ColliderDetector::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -3106,7 +3024,6 @@ bool js_cocos2dx_studio_DisplayManager_getBoundingBox(JSContext *cx, uint32_t ar } bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::DisplayManager* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3116,6 +3033,7 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc, cobj = (cocostudio::DisplayManager *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DisplayManager_addDisplay : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::Node* arg0 = nullptr; do { @@ -3127,10 +3045,11 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc, arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addDisplay(arg0, arg1); args.rval().setUndefined(); return true; @@ -3138,6 +3057,7 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 2) { cocostudio::DisplayData* arg0 = nullptr; do { @@ -3149,10 +3069,11 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc, arg0 = (cocostudio::DisplayData*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addDisplay(arg0, arg1); args.rval().setUndefined(); return true; @@ -3164,7 +3085,6 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc, } bool js_cocos2dx_studio_DisplayManager_containPoint(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::DisplayManager* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3174,13 +3094,15 @@ bool js_cocos2dx_studio_DisplayManager_containPoint(JSContext *cx, uint32_t argc cobj = (cocostudio::DisplayManager *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DisplayManager_containPoint : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->containPoint(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -3190,10 +3112,11 @@ bool js_cocos2dx_studio_DisplayManager_containPoint(JSContext *cx, uint32_t argc } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->containPoint(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -3917,7 +3840,6 @@ bool js_cocos2dx_studio_Bone_setParentBone(JSContext *cx, uint32_t argc, jsval * } bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::Bone* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3927,6 +3849,7 @@ bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocostudio::Bone *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Bone_addDisplay : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::Node* arg0 = nullptr; do { @@ -3938,10 +3861,11 @@ bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addDisplay(arg0, arg1); args.rval().setUndefined(); return true; @@ -3949,6 +3873,7 @@ bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 2) { cocostudio::DisplayData* arg0 = nullptr; do { @@ -3960,10 +3885,11 @@ bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocostudio::DisplayData*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addDisplay(arg0, arg1); args.rval().setUndefined(); return true; @@ -4302,13 +4228,13 @@ bool js_cocos2dx_studio_Bone_getArmature(JSContext *cx, uint32_t argc, jsval *vp bool js_cocos2dx_studio_Bone_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocostudio::Bone* ret = cocostudio::Bone::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -5102,7 +5028,6 @@ bool js_cocos2dx_studio_ArmatureDataManager_addArmatureData(JSContext *cx, uint3 } bool js_cocos2dx_studio_ArmatureDataManager_addArmatureFileInfo(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::ArmatureDataManager* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -5112,16 +5037,19 @@ bool js_cocos2dx_studio_ArmatureDataManager_addArmatureFileInfo(JSContext *cx, u cobj = (cocostudio::ArmatureDataManager *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ArmatureDataManager_addArmatureFileInfo : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addArmatureFileInfo(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -5129,10 +5057,11 @@ bool js_cocos2dx_studio_ArmatureDataManager_addArmatureFileInfo(JSContext *cx, u } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->addArmatureFileInfo(arg0); args.rval().setUndefined(); return true; @@ -5809,7 +5738,6 @@ bool js_cocos2dx_studio_Armature_getBatchNode(JSContext *cx, uint32_t argc, jsva } bool js_cocos2dx_studio_Armature_init(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::Armature* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -5819,11 +5747,13 @@ bool js_cocos2dx_studio_Armature_init(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocostudio::Armature *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Armature_init : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocostudio::Bone* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -5833,7 +5763,7 @@ bool js_cocos2dx_studio_Armature_init(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocostudio::Bone*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->init(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -5843,10 +5773,11 @@ bool js_cocos2dx_studio_Armature_init(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->init(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -6082,13 +6013,13 @@ bool js_cocos2dx_studio_Armature_getBoneDic(JSContext *cx, uint32_t argc, jsval bool js_cocos2dx_studio_Armature_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocostudio::Armature* ret = cocostudio::Armature::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -6122,11 +6053,13 @@ bool js_cocos2dx_studio_Armature_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocostudio::Bone* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -6136,7 +6069,7 @@ bool js_cocos2dx_studio_Armature_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocostudio::Bone*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocostudio::Armature* ret = cocostudio::Armature::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -6378,13 +6311,13 @@ bool js_cocos2dx_studio_Skin_setBone(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_studio_Skin_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocostudio::Skin* ret = cocostudio::Skin::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -7008,7 +6941,6 @@ bool js_cocos2dx_studio_ComAudio_end(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_studio_ComAudio_stopBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::ComAudio* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -7026,6 +6958,7 @@ bool js_cocos2dx_studio_ComAudio_stopBackgroundMusic(JSContext *cx, uint32_t arg } while(0); do { + bool ok = true; if (argc == 1) { bool arg0; arg0 = JS::ToBoolean(args.get(0)); @@ -7144,7 +7077,6 @@ bool js_cocos2dx_studio_ComAudio_preloadBackgroundMusic(JSContext *cx, uint32_t } bool js_cocos2dx_studio_ComAudio_playBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::ComAudio* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -7154,10 +7086,11 @@ bool js_cocos2dx_studio_ComAudio_playBackgroundMusic(JSContext *cx, uint32_t arg cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_playBackgroundMusic : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->playBackgroundMusic(arg0); args.rval().setUndefined(); return true; @@ -7165,10 +7098,11 @@ bool js_cocos2dx_studio_ComAudio_playBackgroundMusic(JSContext *cx, uint32_t arg } while(0); do { + bool ok = true; if (argc == 2) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); cobj->playBackgroundMusic(arg0, arg1); @@ -7190,7 +7124,6 @@ bool js_cocos2dx_studio_ComAudio_playBackgroundMusic(JSContext *cx, uint32_t arg } bool js_cocos2dx_studio_ComAudio_playEffect(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::ComAudio* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -7200,10 +7133,11 @@ bool js_cocos2dx_studio_ComAudio_playEffect(JSContext *cx, uint32_t argc, jsval cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_playEffect : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int ret = cobj->playEffect(arg0); jsval jsret = JSVAL_NULL; jsret = uint32_to_jsval(cx, ret); @@ -7213,10 +7147,11 @@ bool js_cocos2dx_studio_ComAudio_playEffect(JSContext *cx, uint32_t argc, jsval } while(0); do { + bool ok = true; if (argc == 2) { const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); unsigned int ret = cobj->playEffect(arg0, arg1); @@ -7971,9 +7906,9 @@ bool js_cocos2dx_studio_ComRender_getNode(JSContext *cx, uint32_t argc, jsval *v bool js_cocos2dx_studio_ComRender_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { cocos2d::Node* arg0 = nullptr; do { @@ -7985,10 +7920,11 @@ bool js_cocos2dx_studio_ComRender_create(JSContext *cx, uint32_t argc, jsval *vp arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg1 = nullptr; + ok = true; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocostudio::ComRender* ret = cocostudio::ComRender::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -8042,10 +7978,11 @@ bool js_cocos2dx_studio_ComRender_constructor(JSContext *cx, uint32_t argc, jsva arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } const char* arg1 = nullptr; + ok = true; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj = new (std::nothrow) cocostudio::ComRender(arg0, arg1); cocos2d::Ref *_ccobj = dynamic_cast(cobj); if (_ccobj) { @@ -11887,7 +11824,6 @@ bool js_cocos2dx_studio_ActionTimeline_removeFrameEndCallFuncs(JSContext *cx, ui } bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::timeline::ActionTimeline* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -11897,10 +11833,11 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t cobj = (cocostudio::timeline::ActionTimeline *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); cobj->gotoFrameAndPlay(arg0, arg1); @@ -11910,10 +11847,11 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t } while(0); do { + bool ok = true; if (argc == 1) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->gotoFrameAndPlay(arg0); args.rval().setUndefined(); return true; @@ -11921,13 +11859,15 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t } while(0); do { + bool ok = true; if (argc == 3) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; arg2 = JS::ToBoolean(args.get(2)); cobj->gotoFrameAndPlay(arg0, arg1, arg2); @@ -11937,16 +11877,19 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t } while(0); do { + bool ok = true; if (argc == 4) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg1 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg2 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg3; arg3 = JS::ToBoolean(args.get(3)); cobj->gotoFrameAndPlay(arg0, arg1, arg2, arg3); @@ -12239,7 +12182,6 @@ bool js_cocos2dx_studio_BoneNode_getDebugDrawWidth(JSContext *cx, uint32_t argc, } bool js_cocos2dx_studio_BoneNode_getChildBones(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::timeline::BoneNode* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -12385,7 +12327,6 @@ bool js_cocos2dx_studio_BoneNode_getAllSubSkins(JSContext *cx, uint32_t argc, js } bool js_cocos2dx_studio_BoneNode_displaySkin(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::timeline::BoneNode* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -12395,10 +12336,11 @@ bool js_cocos2dx_studio_BoneNode_displaySkin(JSContext *cx, uint32_t argc, jsval cobj = (cocostudio::timeline::BoneNode *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_BoneNode_displaySkin : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); cobj->displaySkin(arg0, arg1); @@ -12408,6 +12350,7 @@ bool js_cocos2dx_studio_BoneNode_displaySkin(JSContext *cx, uint32_t argc, jsval } while(0); do { + bool ok = true; if (argc == 2) { cocos2d::Node* arg0 = nullptr; do { @@ -12419,7 +12362,7 @@ bool js_cocos2dx_studio_BoneNode_displaySkin(JSContext *cx, uint32_t argc, jsval arg0 = (cocostudio::timeline::SkinNode*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); cobj->displaySkin(arg0, arg1); @@ -12451,7 +12394,6 @@ bool js_cocos2dx_studio_BoneNode_isDebugDrawEnabled(JSContext *cx, uint32_t argc } bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::timeline::BoneNode* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -12461,6 +12403,7 @@ bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp cobj = (cocostudio::timeline::BoneNode *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_BoneNode_addSkin : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { cocos2d::Node* arg0 = nullptr; do { @@ -12472,7 +12415,7 @@ bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp arg0 = (cocostudio::timeline::SkinNode*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); bool arg2; @@ -12484,6 +12427,7 @@ bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp } while(0); do { + bool ok = true; if (argc == 2) { cocos2d::Node* arg0 = nullptr; do { @@ -12495,7 +12439,7 @@ bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp arg0 = (cocostudio::timeline::SkinNode*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg1; arg1 = JS::ToBoolean(args.get(1)); cobj->addSkin(arg0, arg1); @@ -12554,7 +12498,6 @@ bool js_cocos2dx_studio_BoneNode_setDebugDrawLength(JSContext *cx, uint32_t argc } bool js_cocos2dx_studio_BoneNode_getSkins(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::timeline::BoneNode* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -12683,13 +12626,13 @@ bool js_cocos2dx_studio_BoneNode_getDebugDrawColor(JSContext *cx, uint32_t argc, bool js_cocos2dx_studio_BoneNode_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocostudio::timeline::BoneNode* ret = cocostudio::timeline::BoneNode::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -12870,7 +12813,6 @@ bool js_cocos2dx_studio_SkeletonNode_getBoneNode(JSContext *cx, uint32_t argc, j } bool js_cocos2dx_studio_SkeletonNode_changeSkins(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocostudio::timeline::SkeletonNode* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -12880,10 +12822,11 @@ bool js_cocos2dx_studio_SkeletonNode_changeSkins(JSContext *cx, uint32_t argc, j cobj = (cocostudio::timeline::SkeletonNode *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_SkeletonNode_changeSkins : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->changeSkins(arg0); args.rval().setUndefined(); return true; @@ -12891,10 +12834,11 @@ bool js_cocos2dx_studio_SkeletonNode_changeSkins(JSContext *cx, uint32_t argc, j } while(0); do { + bool ok = true; if (argc == 1) { std::map arg0; ok &= jsval_to_std_map_string_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->changeSkins(arg0); args.rval().setUndefined(); return true; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp index 9660684c49..2765b6e6f3 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp @@ -23,7 +23,6 @@ bool js_cocos2dx_studio_ActionObject_play(JSContext *cx, uint32_t argc, jsval *v bool js_cocos2dx_studio_ActionObject_getCurrentTime(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_studio_ActionObject_removeActionNode(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_studio_ActionObject_getLoop(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_studio_ActionObject_initWithBinary(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_studio_ActionObject_addActionNode(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_studio_ActionObject_getUnitTime(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_studio_ActionObject_isPlaying(JSContext *cx, uint32_t argc, jsval *vp); @@ -41,7 +40,6 @@ void js_register_cocos2dx_studio_ActionManagerEx(JSContext *cx, JS::HandleObject void register_all_cocos2dx_studio(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_studio_ActionManagerEx_stopActionByName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_studio_ActionManagerEx_getActionByName(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_studio_ActionManagerEx_initWithBinary(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_studio_ActionManagerEx_playActionByName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_studio_ActionManagerEx_releaseActions(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_studio_ActionManagerEx_destroyInstance(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp index 07193b076c..09f0c37e84 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp @@ -1565,7 +1565,6 @@ bool js_cocos2dx_ui_Widget_requestFocus(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_ui_Widget_updateSizeAndPosition(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::Widget* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1575,10 +1574,11 @@ bool js_cocos2dx_ui_Widget_updateSizeAndPosition(JSContext *cx, uint32_t argc, j cobj = (cocos2d::ui::Widget *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Widget_updateSizeAndPosition : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->updateSizeAndPosition(arg0); args.rval().setUndefined(); return true; @@ -2397,7 +2397,6 @@ bool js_cocos2dx_ui_Layout_setBackGroundImage(JSContext *cx, uint32_t argc, jsva } bool js_cocos2dx_ui_Layout_setBackGroundColor(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::Layout* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -2407,13 +2406,15 @@ bool js_cocos2dx_ui_Layout_setBackGroundColor(JSContext *cx, uint32_t argc, jsva cobj = (cocos2d::ui::Layout *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Layout_setBackGroundColor : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::Color3B arg0; ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Color3B arg1; + ok = true; ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setBackGroundColor(arg0, arg1); args.rval().setUndefined(); return true; @@ -2421,10 +2422,11 @@ bool js_cocos2dx_ui_Layout_setBackGroundColor(JSContext *cx, uint32_t argc, jsva } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Color3B arg0; ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setBackGroundColor(arg0); args.rval().setUndefined(); return true; @@ -3432,7 +3434,6 @@ bool js_cocos2dx_ui_Button_getCapInsetsNormalRenderer(JSContext *cx, uint32_t ar } bool js_cocos2dx_ui_Button_setTitleAlignment(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::Button* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3442,13 +3443,15 @@ bool js_cocos2dx_ui_Button_setTitleAlignment(JSContext *cx, uint32_t argc, jsval cobj = (cocos2d::ui::Button *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Button_setTitleAlignment : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::TextHAlignment arg0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::TextVAlignment arg1; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setTitleAlignment(arg0, arg1); args.rval().setUndefined(); return true; @@ -3456,10 +3459,11 @@ bool js_cocos2dx_ui_Button_setTitleAlignment(JSContext *cx, uint32_t argc, jsval } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::TextHAlignment arg0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setTitleAlignment(arg0); args.rval().setUndefined(); return true; @@ -3725,13 +3729,13 @@ bool js_cocos2dx_ui_Button_setZoomScale(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_ui_Button_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Button* ret = cocos2d::ui::Button::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -3747,13 +3751,15 @@ bool js_cocos2dx_ui_Button_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Button* ret = cocos2d::ui::Button::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -3769,16 +3775,19 @@ bool js_cocos2dx_ui_Button_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Button* ret = cocos2d::ui::Button::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -3794,19 +3803,23 @@ bool js_cocos2dx_ui_Button_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 4) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Widget::TextureResType arg3; + ok = true; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Button* ret = cocos2d::ui::Button::create(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { @@ -4535,25 +4548,29 @@ bool js_cocos2dx_ui_CheckBox_addEventListener(JSContext *cx, uint32_t argc, jsva bool js_cocos2dx_ui_CheckBox_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 5) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg3; + ok = true; ok &= jsval_to_std_string(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg4; + ok = true; ok &= jsval_to_std_string(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::CheckBox* ret = cocos2d::ui::CheckBox::create(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; do { @@ -4569,25 +4586,31 @@ bool js_cocos2dx_ui_CheckBox_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 6) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg3; + ok = true; ok &= jsval_to_std_string(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg4; + ok = true; ok &= jsval_to_std_string(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Widget::TextureResType arg5; + ok = true; ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::CheckBox* ret = cocos2d::ui::CheckBox::create(arg0, arg1, arg2, arg3, arg4, arg5); jsval jsret = JSVAL_NULL; do { @@ -4621,13 +4644,15 @@ bool js_cocos2dx_ui_CheckBox_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::CheckBox* ret = cocos2d::ui::CheckBox::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -4643,16 +4668,19 @@ bool js_cocos2dx_ui_CheckBox_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Widget::TextureResType arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::CheckBox* ret = cocos2d::ui::CheckBox::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -4820,25 +4848,29 @@ bool js_cocos2dx_ui_RadioButton_addEventListener(JSContext *cx, uint32_t argc, j bool js_cocos2dx_ui_RadioButton_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 5) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg3; + ok = true; ok &= jsval_to_std_string(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg4; + ok = true; ok &= jsval_to_std_string(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::RadioButton* ret = cocos2d::ui::RadioButton::create(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; do { @@ -4854,25 +4886,31 @@ bool js_cocos2dx_ui_RadioButton_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 6) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg2; + ok = true; ok &= jsval_to_std_string(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg3; + ok = true; ok &= jsval_to_std_string(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg4; + ok = true; ok &= jsval_to_std_string(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Widget::TextureResType arg5; + ok = true; ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::RadioButton* ret = cocos2d::ui::RadioButton::create(arg0, arg1, arg2, arg3, arg4, arg5); jsval jsret = JSVAL_NULL; do { @@ -4906,13 +4944,15 @@ bool js_cocos2dx_ui_RadioButton_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::RadioButton* ret = cocos2d::ui::RadioButton::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -4928,16 +4968,19 @@ bool js_cocos2dx_ui_RadioButton_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Widget::TextureResType arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::RadioButton* ret = cocos2d::ui::RadioButton::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -5138,7 +5181,6 @@ bool js_cocos2dx_ui_RadioButtonGroup_setAllowedNoSelection(JSContext *cx, uint32 } bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButtonWithoutEvent(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::RadioButtonGroup* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -5148,6 +5190,7 @@ bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButtonWithoutEvent(JSContext *cx cobj = (cocos2d::ui::RadioButtonGroup *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RadioButtonGroup_setSelectedButtonWithoutEvent : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::ui::RadioButton* arg0 = nullptr; do { @@ -5159,7 +5202,7 @@ bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButtonWithoutEvent(JSContext *cx arg0 = (cocos2d::ui::RadioButton*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setSelectedButtonWithoutEvent(arg0); args.rval().setUndefined(); return true; @@ -5167,10 +5210,11 @@ bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButtonWithoutEvent(JSContext *cx } while(0); do { + bool ok = true; if (argc == 1) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setSelectedButtonWithoutEvent(arg0); args.rval().setUndefined(); return true; @@ -5324,7 +5368,6 @@ bool js_cocos2dx_ui_RadioButtonGroup_addRadioButton(JSContext *cx, uint32_t argc } bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButton(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::RadioButtonGroup* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -5334,6 +5377,7 @@ bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButton(JSContext *cx, uint32_t a cobj = (cocos2d::ui::RadioButtonGroup *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RadioButtonGroup_setSelectedButton : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::ui::RadioButton* arg0 = nullptr; do { @@ -5345,7 +5389,7 @@ bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButton(JSContext *cx, uint32_t a arg0 = (cocos2d::ui::RadioButton*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setSelectedButton(arg0); args.rval().setUndefined(); return true; @@ -5353,10 +5397,11 @@ bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButton(JSContext *cx, uint32_t a } while(0); do { + bool ok = true; if (argc == 1) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setSelectedButton(arg0); args.rval().setUndefined(); return true; @@ -5656,13 +5701,13 @@ bool js_cocos2dx_ui_ImageView_isScale9Enabled(JSContext *cx, uint32_t argc, jsva bool js_cocos2dx_ui_ImageView_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::ImageView* ret = cocos2d::ui::ImageView::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -5678,13 +5723,15 @@ bool js_cocos2dx_ui_ImageView_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Widget::TextureResType arg1; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::ImageView* ret = cocos2d::ui::ImageView::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -5907,7 +5954,6 @@ 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 ok = true; cocos2d::ui::Text* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -5917,10 +5963,11 @@ bool js_cocos2dx_ui_Text_disableEffect(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_disableEffect : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::LabelEffect arg0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->disableEffect(arg0); args.rval().setUndefined(); return true; @@ -6465,19 +6512,21 @@ bool js_cocos2dx_ui_Text_setTextHorizontalAlignment(JSContext *cx, uint32_t argc bool js_cocos2dx_ui_Text_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Text* ret = cocos2d::ui::Text::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -6742,25 +6791,29 @@ bool js_cocos2dx_ui_TextAtlas_adaptRenderers(JSContext *cx, uint32_t argc, jsval bool js_cocos2dx_ui_TextAtlas_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 5) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg2 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg3 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg4; + ok = true; ok &= jsval_to_std_string(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::TextAtlas* ret = cocos2d::ui::TextAtlas::create(arg0, arg1, arg2, arg3, arg4); jsval jsret = JSVAL_NULL; do { @@ -7081,13 +7134,13 @@ bool js_cocos2dx_ui_LoadingBar_getPercent(JSContext *cx, uint32_t argc, jsval *v bool js_cocos2dx_ui_LoadingBar_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::LoadingBar* ret = cocos2d::ui::LoadingBar::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -7103,13 +7156,15 @@ bool js_cocos2dx_ui_LoadingBar_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::LoadingBar* ret = cocos2d::ui::LoadingBar::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -7143,13 +7198,15 @@ bool js_cocos2dx_ui_LoadingBar_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Widget::TextureResType arg1; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::LoadingBar* ret = cocos2d::ui::LoadingBar::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -7165,16 +7222,19 @@ bool js_cocos2dx_ui_LoadingBar_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Widget::TextureResType arg1; + ok = true; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg2 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::LoadingBar* ret = cocos2d::ui::LoadingBar::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -9049,7 +9109,6 @@ bool js_cocos2dx_ui_ListView_removeItem(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_ui_ListView_scrollToItem(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::ListView* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9059,19 +9118,23 @@ bool js_cocos2dx_ui_ListView_scrollToItem(JSContext *cx, uint32_t argc, jsval *v cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_scrollToItem : Invalid Native Object"); do { + bool ok = true; if (argc == 4) { ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg1; + ok = true; ok &= jsval_to_vector2(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg2; + ok = true; ok &= jsval_to_vector2(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg3 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->scrollToItem(arg0, arg1, arg2, arg3); args.rval().setUndefined(); return true; @@ -9079,16 +9142,19 @@ bool js_cocos2dx_ui_ListView_scrollToItem(JSContext *cx, uint32_t argc, jsval *v } while(0); do { + bool ok = true; if (argc == 3) { ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg1; + ok = true; ok &= jsval_to_vector2(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Vec2 arg2; + ok = true; ok &= jsval_to_vector2(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->scrollToItem(arg0, arg1, arg2); args.rval().setUndefined(); return true; @@ -9930,16 +9996,17 @@ bool js_cocos2dx_ui_Slider_loadSlidBallTextureNormal(JSContext *cx, uint32_t arg bool js_cocos2dx_ui_Slider_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Slider* ret = cocos2d::ui::Slider::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -9955,16 +10022,19 @@ bool js_cocos2dx_ui_Slider_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Widget::TextureResType arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Slider* ret = cocos2d::ui::Slider::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -11362,7 +11432,6 @@ bool js_cocos2dx_ui_TextField_setPlaceHolder(JSContext *cx, uint32_t argc, jsval } bool js_cocos2dx_ui_TextField_setPlaceHolderColor(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::TextField* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -11372,10 +11441,11 @@ bool js_cocos2dx_ui_TextField_setPlaceHolderColor(JSContext *cx, uint32_t argc, cobj = (cocos2d::ui::TextField *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_TextField_setPlaceHolderColor : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setPlaceHolderColor(arg0); args.rval().setUndefined(); return true; @@ -11383,10 +11453,11 @@ bool js_cocos2dx_ui_TextField_setPlaceHolderColor(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Color3B arg0; ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setPlaceHolderColor(arg0); args.rval().setUndefined(); return true; @@ -11591,19 +11662,21 @@ bool js_cocos2dx_ui_TextField_getTouchSize(JSContext *cx, uint32_t argc, jsval * bool js_cocos2dx_ui_TextField_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } int arg2 = 0; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::TextField* ret = cocos2d::ui::TextField::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -11870,16 +11943,17 @@ bool js_cocos2dx_ui_TextBMFont_resetRender(JSContext *cx, uint32_t argc, jsval * bool js_cocos2dx_ui_TextBMFont_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::TextBMFont* ret = cocos2d::ui::TextBMFont::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -13719,7 +13793,6 @@ bool js_cocos2dx_ui_RichText_initWithXML(JSContext *cx, uint32_t argc, jsval *vp } bool js_cocos2dx_ui_RichText_removeElement(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::RichText* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -13729,6 +13802,7 @@ bool js_cocos2dx_ui_RichText_removeElement(JSContext *cx, uint32_t argc, jsval * cobj = (cocos2d::ui::RichText *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichText_removeElement : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::ui::RichElement* arg0 = nullptr; do { @@ -13740,7 +13814,7 @@ bool js_cocos2dx_ui_RichText_removeElement(JSContext *cx, uint32_t argc, jsval * arg0 = (cocos2d::ui::RichElement*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->removeElement(arg0); args.rval().setUndefined(); return true; @@ -13748,10 +13822,11 @@ bool js_cocos2dx_ui_RichText_removeElement(JSContext *cx, uint32_t argc, jsval * } while(0); do { + bool ok = true; if (argc == 1) { int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->removeElement(arg0); args.rval().setUndefined(); return true; @@ -13935,13 +14010,13 @@ bool js_cocos2dx_ui_HBox_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_ui_HBox_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::HBox* ret = cocos2d::ui::HBox::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -14098,13 +14173,13 @@ bool js_cocos2dx_ui_VBox_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_ui_VBox_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::VBox* ret = cocos2d::ui::VBox::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -14261,13 +14336,13 @@ bool js_cocos2dx_ui_RelativeBox_initWithSize(JSContext *cx, uint32_t argc, jsval bool js_cocos2dx_ui_RelativeBox_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 1) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::RelativeBox* ret = cocos2d::ui::RelativeBox::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -14417,7 +14492,6 @@ bool js_cocos2dx_ui_Scale9Sprite_disableCascadeColor(JSContext *cx, uint32_t arg } bool js_cocos2dx_ui_Scale9Sprite_updateWithSprite(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::Scale9Sprite* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -14427,6 +14501,7 @@ bool js_cocos2dx_ui_Scale9Sprite_updateWithSprite(JSContext *cx, uint32_t argc, cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_updateWithSprite : Invalid Native Object"); do { + bool ok = true; if (argc == 6) { cocos2d::Sprite* arg0 = nullptr; do { @@ -14438,21 +14513,25 @@ bool js_cocos2dx_ui_Scale9Sprite_updateWithSprite(JSContext *cx, uint32_t argc, arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; arg2 = JS::ToBoolean(args.get(2)); cocos2d::Vec2 arg3; + ok = true; ok &= jsval_to_vector2(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg4; + ok = true; ok &= jsval_to_ccsize(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg5; + ok = true; ok &= jsval_to_ccrect(cx, args.get(5), &arg5); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->updateWithSprite(arg0, arg1, arg2, arg3, arg4, arg5); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -14462,6 +14541,7 @@ bool js_cocos2dx_ui_Scale9Sprite_updateWithSprite(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 4) { cocos2d::Sprite* arg0 = nullptr; do { @@ -14473,15 +14553,17 @@ bool js_cocos2dx_ui_Scale9Sprite_updateWithSprite(JSContext *cx, uint32_t argc, arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; arg2 = JS::ToBoolean(args.get(2)); cocos2d::Rect arg3; + ok = true; ok &= jsval_to_ccrect(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->updateWithSprite(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -14676,7 +14758,6 @@ bool js_cocos2dx_ui_Scale9Sprite_setInsetBottom(JSContext *cx, uint32_t argc, js } bool js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrameName(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::Scale9Sprite* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -14686,10 +14767,11 @@ bool js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrameName(JSContext *cx, uint32_t cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrameName : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSpriteFrameName(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -14699,13 +14781,15 @@ bool js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrameName(JSContext *cx, uint32_t } while(0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSpriteFrameName(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -14784,7 +14868,6 @@ bool js_cocos2dx_ui_Scale9Sprite_setRenderingType(JSContext *cx, uint32_t argc, } bool js_cocos2dx_ui_Scale9Sprite_init(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::Scale9Sprite* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -14794,6 +14877,7 @@ bool js_cocos2dx_ui_Scale9Sprite_init(JSContext *cx, uint32_t argc, jsval *vp) cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_init : Invalid Native Object"); do { + bool ok = true; if (argc == 3) { cocos2d::Sprite* arg0 = nullptr; do { @@ -14805,13 +14889,15 @@ bool js_cocos2dx_ui_Scale9Sprite_init(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg2; + ok = true; ok &= jsval_to_ccrect(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->init(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -14821,6 +14907,7 @@ bool js_cocos2dx_ui_Scale9Sprite_init(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 4) { cocos2d::Sprite* arg0 = nullptr; do { @@ -14832,15 +14919,17 @@ bool js_cocos2dx_ui_Scale9Sprite_init(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; arg2 = JS::ToBoolean(args.get(2)); cocos2d::Rect arg3; + ok = true; ok &= jsval_to_ccrect(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->init(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -14850,6 +14939,7 @@ bool js_cocos2dx_ui_Scale9Sprite_init(JSContext *cx, uint32_t argc, jsval *vp) } while(0); do { + bool ok = true; if (argc == 6) { cocos2d::Sprite* arg0 = nullptr; do { @@ -14861,21 +14951,25 @@ bool js_cocos2dx_ui_Scale9Sprite_init(JSContext *cx, uint32_t argc, jsval *vp) arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool arg2; arg2 = JS::ToBoolean(args.get(2)); cocos2d::Vec2 arg3; + ok = true; ok &= jsval_to_vector2(cx, args.get(3), &arg3); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Size arg4; + ok = true; ok &= jsval_to_ccsize(cx, args.get(4), &arg4); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg5; + ok = true; ok &= jsval_to_ccrect(cx, args.get(5), &arg5); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->init(arg0, arg1, arg2, arg3, arg4, arg5); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -15097,7 +15191,6 @@ bool js_cocos2dx_ui_Scale9Sprite_getOriginalSize(JSContext *cx, uint32_t argc, j } bool js_cocos2dx_ui_Scale9Sprite_initWithFile(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::Scale9Sprite* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -15107,13 +15200,15 @@ bool js_cocos2dx_ui_Scale9Sprite_initWithFile(JSContext *cx, uint32_t argc, jsva cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_initWithFile : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithFile(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -15123,16 +15218,19 @@ bool js_cocos2dx_ui_Scale9Sprite_initWithFile(JSContext *cx, uint32_t argc, jsva } while(0); do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg2; + ok = true; ok &= jsval_to_ccrect(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithFile(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -15142,13 +15240,15 @@ bool js_cocos2dx_ui_Scale9Sprite_initWithFile(JSContext *cx, uint32_t argc, jsva } while(0); do { + bool ok = true; if (argc == 2) { cocos2d::Rect arg0; ok &= jsval_to_ccrect(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithFile(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -15158,10 +15258,11 @@ bool js_cocos2dx_ui_Scale9Sprite_initWithFile(JSContext *cx, uint32_t argc, jsva } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithFile(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -15233,7 +15334,6 @@ bool js_cocos2dx_ui_Scale9Sprite_setInsetLeft(JSContext *cx, uint32_t argc, jsva } bool js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::Scale9Sprite* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -15243,6 +15343,7 @@ bool js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrame(JSContext *cx, uint32_t arg cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrame : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::SpriteFrame* arg0 = nullptr; do { @@ -15254,7 +15355,7 @@ bool js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrame(JSContext *cx, uint32_t arg arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSpriteFrame(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -15264,6 +15365,7 @@ bool js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrame(JSContext *cx, uint32_t arg } while(0); do { + bool ok = true; if (argc == 2) { cocos2d::SpriteFrame* arg0 = nullptr; do { @@ -15275,10 +15377,11 @@ bool js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrame(JSContext *cx, uint32_t arg arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSpriteFrame(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -15387,19 +15490,21 @@ bool js_cocos2dx_ui_Scale9Sprite_setInsetRight(JSContext *cx, uint32_t argc, jsv bool js_cocos2dx_ui_Scale9Sprite_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg2; + ok = true; ok &= jsval_to_ccrect(cx, args.get(2), &arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* ret = cocos2d::ui::Scale9Sprite::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -15433,13 +15538,15 @@ bool js_cocos2dx_ui_Scale9Sprite_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { cocos2d::Rect arg0; ok &= jsval_to_ccrect(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* ret = cocos2d::ui::Scale9Sprite::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -15456,13 +15563,15 @@ bool js_cocos2dx_ui_Scale9Sprite_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* ret = cocos2d::ui::Scale9Sprite::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -15479,10 +15588,11 @@ bool js_cocos2dx_ui_Scale9Sprite_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* ret = cocos2d::ui::Scale9Sprite::create(arg0); jsval jsret = JSVAL_NULL; do { @@ -15503,16 +15613,17 @@ bool js_cocos2dx_ui_Scale9Sprite_create(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_ui_Scale9Sprite_createWithSpriteFrameName(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* ret = cocos2d::ui::Scale9Sprite::createWithSpriteFrameName(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -15529,10 +15640,11 @@ bool js_cocos2dx_ui_Scale9Sprite_createWithSpriteFrameName(JSContext *cx, uint32 } while (0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* ret = cocos2d::ui::Scale9Sprite::createWithSpriteFrameName(arg0); jsval jsret = JSVAL_NULL; do { @@ -15553,9 +15665,9 @@ bool js_cocos2dx_ui_Scale9Sprite_createWithSpriteFrameName(JSContext *cx, uint32 bool js_cocos2dx_ui_Scale9Sprite_createWithSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { cocos2d::SpriteFrame* arg0 = nullptr; do { @@ -15567,10 +15679,11 @@ bool js_cocos2dx_ui_Scale9Sprite_createWithSpriteFrame(JSContext *cx, uint32_t a arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::Rect arg1; + ok = true; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* ret = cocos2d::ui::Scale9Sprite::createWithSpriteFrame(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -15587,6 +15700,7 @@ bool js_cocos2dx_ui_Scale9Sprite_createWithSpriteFrame(JSContext *cx, uint32_t a } while (0); do { + bool ok = true; if (argc == 1) { cocos2d::SpriteFrame* arg0 = nullptr; do { @@ -15598,7 +15712,7 @@ bool js_cocos2dx_ui_Scale9Sprite_createWithSpriteFrame(JSContext *cx, uint32_t a arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* ret = cocos2d::ui::Scale9Sprite::createWithSpriteFrame(arg0); jsval jsret = JSVAL_NULL; do { @@ -15908,7 +16022,6 @@ bool js_cocos2dx_ui_EditBox_setInputMode(JSContext *cx, uint32_t argc, jsval *vp } bool js_cocos2dx_ui_EditBox_setPlaceholderFontColor(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::EditBox* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -15918,10 +16031,11 @@ bool js_cocos2dx_ui_EditBox_setPlaceholderFontColor(JSContext *cx, uint32_t argc cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_setPlaceholderFontColor : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setPlaceholderFontColor(arg0); args.rval().setUndefined(); return true; @@ -15929,10 +16043,11 @@ bool js_cocos2dx_ui_EditBox_setPlaceholderFontColor(JSContext *cx, uint32_t argc } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Color3B arg0; ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setPlaceholderFontColor(arg0); args.rval().setUndefined(); return true; @@ -15944,7 +16059,6 @@ bool js_cocos2dx_ui_EditBox_setPlaceholderFontColor(JSContext *cx, uint32_t argc } bool js_cocos2dx_ui_EditBox_setFontColor(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::EditBox* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -15954,10 +16068,11 @@ bool js_cocos2dx_ui_EditBox_setFontColor(JSContext *cx, uint32_t argc, jsval *vp cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_setFontColor : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setFontColor(arg0); args.rval().setUndefined(); return true; @@ -15965,10 +16080,11 @@ bool js_cocos2dx_ui_EditBox_setFontColor(JSContext *cx, uint32_t argc, jsval *vp } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Color3B arg0; ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setFontColor(arg0); args.rval().setUndefined(); return true; @@ -16002,7 +16118,6 @@ bool js_cocos2dx_ui_EditBox_setPlaceholderFont(JSContext *cx, uint32_t argc, jsv } bool js_cocos2dx_ui_EditBox_initWithSizeAndBackgroundSprite(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; cocos2d::ui::EditBox* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -16012,11 +16127,13 @@ bool js_cocos2dx_ui_EditBox_initWithSizeAndBackgroundSprite(JSContext *cx, uint3 cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_initWithSizeAndBackgroundSprite : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -16026,7 +16143,7 @@ bool js_cocos2dx_ui_EditBox_initWithSizeAndBackgroundSprite(JSContext *cx, uint3 arg1 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSizeAndBackgroundSprite(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -16036,13 +16153,15 @@ bool js_cocos2dx_ui_EditBox_initWithSizeAndBackgroundSprite(JSContext *cx, uint3 } while(0); do { + bool ok = true; if (argc == 2) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSizeAndBackgroundSprite(arg0, arg1); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -16052,16 +16171,19 @@ bool js_cocos2dx_ui_EditBox_initWithSizeAndBackgroundSprite(JSContext *cx, uint3 } while(0); do { + bool ok = true; if (argc == 3) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Widget::TextureResType arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSizeAndBackgroundSprite(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -16196,16 +16318,17 @@ bool js_cocos2dx_ui_EditBox_setFont(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; do { + bool ok = true; if (argc == 2) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::EditBox* ret = cocos2d::ui::EditBox::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -16221,16 +16344,19 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 3) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } std::string arg1; + ok = true; ok &= jsval_to_std_string(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Widget::TextureResType arg2; + ok = true; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::EditBox* ret = cocos2d::ui::EditBox::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -16247,11 +16373,13 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) } while (0); do { + bool ok = true; if (argc == 2) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -16261,7 +16389,7 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::EditBox* ret = cocos2d::ui::EditBox::create(arg0, arg1); jsval jsret = JSVAL_NULL; do { @@ -16277,11 +16405,13 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 3) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -16291,8 +16421,9 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -16302,7 +16433,7 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) arg2 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::EditBox* ret = cocos2d::ui::EditBox::create(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; do { @@ -16318,11 +16449,13 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) } } while (0); do { + bool ok = true; if (argc == 4) { cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* arg1 = nullptr; + ok = true; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -16332,8 +16465,9 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) arg1 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* arg2 = nullptr; + ok = true; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -16343,8 +16477,9 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) arg2 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::Scale9Sprite* arg3 = nullptr; + ok = true; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -16354,7 +16489,7 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) arg3 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cocos2d::ui::EditBox* ret = cocos2d::ui::EditBox::create(arg0, arg1, arg2, arg3); jsval jsret = JSVAL_NULL; do { diff --git a/native/cocos/scripting/js-bindings/auto/jsb_creator_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_creator_auto.cpp index 6534745d49..e3f1777a06 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_creator_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_creator_auto.cpp @@ -46,7 +46,6 @@ JSObject *jsb_creator_Scale9SpriteV2_prototype; bool js_creator_Scale9SpriteV2_setTexture(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; creator::Scale9SpriteV2* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -56,6 +55,7 @@ bool js_creator_Scale9SpriteV2_setTexture(JSContext *cx, uint32_t argc, jsval *v cobj = (creator::Scale9SpriteV2 *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_creator_Scale9SpriteV2_setTexture : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::Texture2D* arg0 = nullptr; do { @@ -67,7 +67,7 @@ bool js_creator_Scale9SpriteV2_setTexture(JSContext *cx, uint32_t argc, jsval *v arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->setTexture(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -77,10 +77,11 @@ bool js_creator_Scale9SpriteV2_setTexture(JSContext *cx, uint32_t argc, jsval *v } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->setTexture(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -284,7 +285,6 @@ bool js_creator_Scale9SpriteV2_setRenderingType(JSContext *cx, uint32_t argc, js } bool js_creator_Scale9SpriteV2_setFillCenter(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; creator::Scale9SpriteV2* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -294,13 +294,15 @@ bool js_creator_Scale9SpriteV2_setFillCenter(JSContext *cx, uint32_t argc, jsval cobj = (creator::Scale9SpriteV2 *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_creator_Scale9SpriteV2_setFillCenter : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } double arg1 = 0; + ok = true; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setFillCenter(arg0, arg1); args.rval().setUndefined(); return true; @@ -308,10 +310,11 @@ bool js_creator_Scale9SpriteV2_setFillCenter(JSContext *cx, uint32_t argc, jsval } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setFillCenter(arg0); args.rval().setUndefined(); return true; @@ -323,7 +326,6 @@ bool js_creator_Scale9SpriteV2_setFillCenter(JSContext *cx, uint32_t argc, jsval } bool js_creator_Scale9SpriteV2_setSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; creator::Scale9SpriteV2* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -333,6 +335,7 @@ bool js_creator_Scale9SpriteV2_setSpriteFrame(JSContext *cx, uint32_t argc, jsva cobj = (creator::Scale9SpriteV2 *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_creator_Scale9SpriteV2_setSpriteFrame : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { cocos2d::SpriteFrame* arg0 = nullptr; do { @@ -344,7 +347,7 @@ bool js_creator_Scale9SpriteV2_setSpriteFrame(JSContext *cx, uint32_t argc, jsva arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->setSpriteFrame(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -354,10 +357,11 @@ bool js_creator_Scale9SpriteV2_setSpriteFrame(JSContext *cx, uint32_t argc, jsva } while(0); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->setSpriteFrame(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -389,7 +393,6 @@ bool js_creator_Scale9SpriteV2_getBlendFunc(JSContext *cx, uint32_t argc, jsval } bool js_creator_Scale9SpriteV2_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; creator::Scale9SpriteV2* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -399,10 +402,11 @@ bool js_creator_Scale9SpriteV2_initWithTexture(JSContext *cx, uint32_t argc, jsv cobj = (creator::Scale9SpriteV2 *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_creator_Scale9SpriteV2_initWithTexture : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTexture(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -412,6 +416,7 @@ bool js_creator_Scale9SpriteV2_initWithTexture(JSContext *cx, uint32_t argc, jsv } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::Texture2D* arg0 = nullptr; do { @@ -423,7 +428,7 @@ bool js_creator_Scale9SpriteV2_initWithTexture(JSContext *cx, uint32_t argc, jsv arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithTexture(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -529,7 +534,6 @@ bool js_creator_Scale9SpriteV2_getInsetRight(JSContext *cx, uint32_t argc, jsval } bool js_creator_Scale9SpriteV2_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; creator::Scale9SpriteV2* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -539,13 +543,15 @@ bool js_creator_Scale9SpriteV2_setBlendFunc(JSContext *cx, uint32_t argc, jsval cobj = (creator::Scale9SpriteV2 *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_creator_Scale9SpriteV2_setBlendFunc : Invalid Native Object"); do { + bool ok = true; if (argc == 2) { unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } unsigned int arg1 = 0; + ok = true; ok &= jsval_to_uint32(cx, args.get(1), &arg1); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setBlendFunc(arg0, arg1); args.rval().setUndefined(); return true; @@ -553,10 +559,11 @@ bool js_creator_Scale9SpriteV2_setBlendFunc(JSContext *cx, uint32_t argc, jsval } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::BlendFunc arg0; ok &= jsval_to_blendfunc(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } cobj->setBlendFunc(arg0); args.rval().setUndefined(); return true; @@ -624,7 +631,6 @@ bool js_creator_Scale9SpriteV2_setInsetLeft(JSContext *cx, uint32_t argc, jsval } bool js_creator_Scale9SpriteV2_initWithSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp) { - bool ok = true; creator::Scale9SpriteV2* cobj = nullptr; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -634,10 +640,11 @@ bool js_creator_Scale9SpriteV2_initWithSpriteFrame(JSContext *cx, uint32_t argc, cobj = (creator::Scale9SpriteV2 *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_creator_Scale9SpriteV2_initWithSpriteFrame : Invalid Native Object"); do { + bool ok = true; if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSpriteFrame(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); @@ -647,6 +654,7 @@ bool js_creator_Scale9SpriteV2_initWithSpriteFrame(JSContext *cx, uint32_t argc, } while(0); do { + bool ok = true; if (argc == 1) { cocos2d::SpriteFrame* arg0 = nullptr; do { @@ -658,7 +666,7 @@ bool js_creator_Scale9SpriteV2_initWithSpriteFrame(JSContext *cx, uint32_t argc, arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); - if (!ok) { ok = true; break; } + if (!ok) { break; } bool ret = cobj->initWithSpriteFrame(arg0); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); diff --git a/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp b/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp index 3096399361..1e6fca0547 100644 --- a/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp +++ b/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp @@ -2620,8 +2620,10 @@ bool js_cocos2dx_ActionInterval_easing(JSContext *cx, uint32_t argc, jsval *vp) JS_ValueToObject(cx, vpi, &tmp) && JS_GetProperty(cx, tmp, "tag", &jsTag) && JS::ToNumber(cx, jsTag, &tag); - JS_GetProperty(cx, tmp, "param", &jsParam) && JS::ToNumber(cx, jsParam, ¶meter); - bool hasParam = (parameter == parameter); + + bool hasParam = JS_GetProperty(cx, tmp, "param", &jsParam) && !jsParam.isUndefined(); + JS::ToNumber(cx, jsParam, ¶meter); + if (!ok) continue; cocos2d::ActionEase* action; @@ -4643,48 +4645,6 @@ void __JSPlistDelegator::textHandler(void *ctx, const char *ch, int len) { } } -bool jsval_to_TTFConfig(JSContext *cx, jsval v, TTFConfig* ret) { - JS::RootedObject tmp(cx); - JS::RootedValue js_fontFilePath(cx); - JS::RootedValue js_fontSize(cx); - JS::RootedValue js_outlineSize(cx); - JS::RootedValue js_glyphs(cx); - JS::RootedValue js_customGlyphs(cx); - JS::RootedValue js_distanceFieldEnable(cx); - - std::string fontFilePath,customGlyphs; - double fontSize, glyphs, outlineSize; - - JS::RootedValue jsv(cx, v); - bool ok = jsv.isObject() && - JS_ValueToObject(cx, jsv, &tmp) && - JS_GetProperty(cx, tmp, "fontFilePath", &js_fontFilePath) && - JS_GetProperty(cx, tmp, "fontSize", &js_fontSize) && - JS_GetProperty(cx, tmp, "outlineSize", &js_outlineSize) && - JS_GetProperty(cx, tmp, "glyphs", &js_glyphs) && - JS_GetProperty(cx, tmp, "customGlyphs", &js_customGlyphs) && - JS_GetProperty(cx, tmp, "distanceFieldEnable", &js_distanceFieldEnable) && - JS::ToNumber(cx, js_fontSize, &fontSize) && - JS::ToNumber(cx, js_outlineSize, &outlineSize) && - JS::ToNumber(cx, js_glyphs, &glyphs) && - jsval_to_std_string(cx,js_fontFilePath,&ret->fontFilePath) && - jsval_to_std_string(cx,js_customGlyphs,&customGlyphs); - bool distanceFieldEnable = JS::ToBoolean(js_distanceFieldEnable); - - JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); - - ret->fontSize = (int)fontSize; - ret->outlineSize = (int)outlineSize; - ret->glyphs = GlyphCollection((int)glyphs); - ret->distanceFieldEnabled = distanceFieldEnable; - if(ret->glyphs == GlyphCollection::CUSTOM && customGlyphs.length() > 0) - ret->customGlyphs = customGlyphs.c_str(); - else - ret->customGlyphs = nullptr; - - return true; -} - bool js_cocos2dx_Label_createWithTTF(JSContext *cx, uint32_t argc, jsval *vp) { if (argc < 2) diff --git a/native/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp b/native/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp index 05325c24e4..421b2ba383 100644 --- a/native/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp +++ b/native/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp @@ -633,70 +633,64 @@ bool jsval_to_quaternion( JSContext *cx, JS::HandleValue v, cocos2d::Quaternion* return true; } -//bool jsval_to_obb(JSContext *cx, JS::HandleValue v, cocos2d::OBB* ret) -//{ -// JS::RootedObject tmp(cx); -// JS::RootedValue jscenter(cx); -// JS::RootedValue jsxAxis(cx); -// JS::RootedValue jsyAxis(cx); -// JS::RootedValue jszAxis(cx); -// JS::RootedValue jsextents(cx); -// JS::RootedValue jsextentx(cx); -// JS::RootedValue jsextenty(cx); -// JS::RootedValue jsextentz(cx); -// -// cocos2d::Vec3 center, xAxis, yAxis, zAxis, extents, extentx, extenty, extentz; -// bool ok = v.isObject() && -// JS_ValueToObject(cx, v, &tmp) && -// JS_GetProperty(cx, tmp, "center", &jscenter) && -// JS_GetProperty(cx, tmp, "xAxis", &jsxAxis) && -// JS_GetProperty(cx, tmp, "yAxis", &jsyAxis) && -// JS_GetProperty(cx, tmp, "zAxis", &jszAxis) && -// JS_GetProperty(cx, tmp, "extents", &jsextents) && -// JS_GetProperty(cx, tmp, "extentX", &jsextentx) && -// JS_GetProperty(cx, tmp, "extentY", &jsextenty) && -// JS_GetProperty(cx, tmp, "extentZ", &jsextentz) && -// jsval_to_vector3(cx, jscenter, ¢er) && -// jsval_to_vector3(cx, jsxAxis, &xAxis) && -// jsval_to_vector3(cx, jsyAxis, &yAxis) && -// jsval_to_vector3(cx, jszAxis, &zAxis) && -// jsval_to_vector3(cx, jsextents, &extents) && -// jsval_to_vector3(cx, jsextentx, &extentx) && -// jsval_to_vector3(cx, jsextenty, &extenty) && -// jsval_to_vector3(cx, jsextentz, &extentz); -// -// JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); -// -// ret->_center.set(center); -// ret->_xAxis.set(xAxis); -// ret->_yAxis.set(yAxis); -// ret->_zAxis.set(zAxis); -// ret->_extents.set(extents); -// ret->_extentX.set(extentx); -// ret->_extentY.set(extenty); -// ret->_extentZ.set(extentz); -// return true; -//} - -//bool jsval_to_ray(JSContext *cx, JS::HandleValue v, cocos2d::Ray* ret) -//{ -// JS::RootedObject tmp(cx); -// JS::RootedValue jsorigin(cx); -// JS::RootedValue jsdirection(cx); -// -// cocos2d::Vec3 origin, direction; -// bool ok = v.isObject() && -// JS_ValueToObject(cx, v, &tmp) && -// JS_GetProperty(cx, tmp, "origin", &jsorigin) && -// JS_GetProperty(cx, tmp, "direction", &jsdirection) && -// jsval_to_vector3(cx, jsorigin, &origin) && -// jsval_to_vector3(cx, jsdirection, &direction); -// -// JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); -// -// ret->set(origin, direction); -// return true; -//} +bool jsval_to_TTFConfig(JSContext *cx, JS::HandleValue v, cocos2d::TTFConfig* ret) { + JS::RootedObject tmp(cx); + JS::RootedValue js_fontFilePath(cx); + JS::RootedValue js_fontSize(cx); + JS::RootedValue js_outlineSize(cx); + JS::RootedValue js_glyphs(cx); + JS::RootedValue js_customGlyphs(cx); + JS::RootedValue js_distanceFieldEnable(cx); + + std::string fontFilePath,customGlyphs; + double fontSize, glyphs, outlineSize; + + JS::RootedValue jsv(cx, v); + bool ok = jsv.isObject() && JS_ValueToObject(cx, jsv, &tmp); + if (ok) + { + if (JS_GetProperty(cx, tmp, "fontFilePath", &js_fontFilePath) && !js_fontFilePath.isUndefined()) + { + jsval_to_std_string(cx,js_fontFilePath,&ret->fontFilePath); + } + + if (JS_GetProperty(cx, tmp, "fontSize", &js_fontSize) && !js_fontSize.isUndefined()) + { + if (JS::ToNumber(cx, js_fontSize, &fontSize)) + ret->fontSize = (int)fontSize; + } + + if (JS_GetProperty(cx, tmp, "outlineSize", &js_outlineSize) && !js_outlineSize.isUndefined()) + { + if (JS::ToNumber(cx, js_outlineSize, &outlineSize)) + ret->outlineSize = (int)outlineSize; + } + + if (JS_GetProperty(cx, tmp, "glyphs", &js_glyphs) && !js_glyphs.isUndefined()) + { + if (JS::ToNumber(cx, js_glyphs, &glyphs)) + ret->glyphs = (GlyphCollection)glyphs; + } + + if (JS_GetProperty(cx, tmp, "customGlyphs", &js_customGlyphs) && !js_customGlyphs.isUndefined()) + { + jsval_to_std_string(cx,js_customGlyphs,&customGlyphs); + } + if(ret->glyphs == GlyphCollection::CUSTOM && !customGlyphs.empty()) + ret->customGlyphs = customGlyphs.c_str(); + else + ret->customGlyphs = ""; + + if (JS_GetProperty(cx, tmp, "distanceFieldEnable", &js_distanceFieldEnable) && !js_distanceFieldEnable.isUndefined()) + { + ret->distanceFieldEnabled = JS::ToBoolean(js_distanceFieldEnable); + } + } + + JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); + + return true; +} bool jsvals_variadic_to_ccvaluevector( JSContext *cx, jsval *vp, int argc, cocos2d::ValueVector* ret) { diff --git a/native/cocos/scripting/js-bindings/manual/js_manual_conversions.h b/native/cocos/scripting/js-bindings/manual/js_manual_conversions.h index e164571e5c..121084f1af 100644 --- a/native/cocos/scripting/js-bindings/manual/js_manual_conversions.h +++ b/native/cocos/scripting/js-bindings/manual/js_manual_conversions.h @@ -106,6 +106,7 @@ bool jsval_cccolor_to_opacity(JSContext *cx, JS::HandleValue v, int32_t* ret); bool jsval_to_ccarray_of_CCPoint(JSContext* cx, JS::HandleValue v, cocos2d::Point **points, int *numPoints); bool jsval_to_ccacceleration(JSContext* cx, JS::HandleValue v, cocos2d::Acceleration* ret); bool jsval_to_quaternion(JSContext *cx, JS::HandleValue vp, cocos2d::Quaternion* ret); +bool jsval_to_TTFConfig(JSContext *cx, JS::HandleValue, cocos2d::TTFConfig* ret); // forward declaration js_proxy_t* jsb_get_js_proxy(JS::HandleObject jsObj); diff --git a/native/tools/tojs/cocos2dx.ini b/native/tools/tojs/cocos2dx.ini index 9ca02bfe0a..6037aae4e6 100644 --- a/native/tools/tojs/cocos2dx.ini +++ b/native/tools/tojs/cocos2dx.ini @@ -40,7 +40,7 @@ classes_need_extend = Node Layer.* Sprite SpriteBatchNode SpriteFrame Menu MenuI # will apply to all class names. This is a convenience wildcard to be able to skip similar named # functions from all classes. -skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserData getGLServerState .*schedule setContentSize setAnchorPoint setColor pause resume setAdditionalTransform convertToWorldSpace], +skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserData getGLServerState .*schedule setContentSize setAnchorPoint setColor pause resume setAdditionalTransform convertToWorldSpace get(.*)Callback$], Sprite::[getQuad ^setPosition$ create setPolygonInfo initWithPolygon getPolygonInfo], NodeGrid::[setGrid], SpriteBatchNode::[getDescendants], @@ -56,7 +56,7 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat Label::[getLettersInfo createWithTTF setTTFConfig getFontAtlas listenToBackground listenToFontAtlasPurge], .*Delegate::[*], PoolManager::[*], - Texture2D::[initWithPVRTCData addPVRTCImage releaseData setTexParameters initWithData keepData getPixelFormatInfoMap updateWithData fouceDeleteALLTexture2D], + Texture2D::[initWithPVRTCData addPVRTCImage releaseData setTexParameters initWithData keepData getPixelFormatInfoMap updateWithData fouceDeleteALLTexture2D initWithMipmaps], Set::[begin end acceptVisitor], IMEDispatcher::[*], Thread::[*], @@ -72,7 +72,7 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat ScriptEngineManager::[*], KeypadHandler::[*], Invocation::[*], - GLView::[end swapBuffers getAllTouches], + GLView::[end swapBuffers getAllTouches getGLContextAttrs], GLViewProtocol::[pollInputEvents handleTouches.* setScissorInPoints getScissorRect isScissorEnabled swapBuffers], SchedulerScriptHandlerEntry::[*], Size::[*], @@ -81,17 +81,17 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat Rect::[*], Data::[*], Range::[*], - Image::[initWithString initWithImageData], + Image::[initWithString initWithImageData getData$ getMipmaps initWithRawData], Sequence::[create], Spawn::[create], RotateTo::[calculateAngles], - GLProgram::[getProgram setUniformLocationWith(1|2|3|4)fv setUniformLocationWith(2|3|4)iv setUniformLocationWithMatrix(2|3|4)fv], - GLProgramState::[setUniformVec4 setVertexAttribPointer], + GLProgram::[getProgram setUniformLocationWith(1|2|3|4)fv setUniformLocationWith(2|3|4)iv setUniformLocationWithMatrix(2|3|4)fv getVertexAttrib getUniformFlags], + GLProgramState::[setUniformVec4 setVertexAttribPointer setUniformFloatv], Grid3DAction::[create actionWith.* vertex originalVertex (g|s)etVertex getOriginalVertex], Grid3D::[vertex originalVertex (g|s)etVertex getOriginalVertex], TiledGrid3DAction::[create actionWith.* tile originalTile getOriginalTile (g|s)etTile], TiledGrid3D::[tile originalTile getOriginalTile (g|s)etTile], - TMXLayer::[getTiles], + TMXLayer::[getTiles setTiles], TMXMapInfo::[startElement endElement textHandler], ParticleSystemQuad::[postStep setBatchNode draw setTexture$ setTotalParticles updateQuadWithParticle setupIndices listenBackToForeground initWithTotalParticles particleWithFile node], LayerMultiplex::[create layerWith.* initWithLayers], @@ -121,7 +121,12 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat Device::[getTextureDataForText], ClippingNode::[init], RenderState::[setStateBlock], - ComponentJS::[getScriptObject update] + ComponentJS::[getScriptObject update], + OrbitCamera::[sphericalRadius], + ShuffleTiles::[shuffle placeTile], + TurnOffTiles::[shuffle], + ParallaxNode::[getParallaxArray setParallaxArray], + TileMapAtlas::[getTGAInfo setTGAInfo] rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame], MenuItemFont::[setFontNameObj=setFontName setFontSizeObj=setFontSize getFontSizeObj=getFontSize getFontNameObj=getFontName], diff --git a/native/tools/tojs/cocos2dx_spine.ini b/native/tools/tojs/cocos2dx_spine.ini index 4b4eeb6c33..5e30312180 100644 --- a/native/tools/tojs/cocos2dx_spine.ini +++ b/native/tools/tojs/cocos2dx_spine.ini @@ -26,8 +26,8 @@ classes = SkeletonRenderer SkeletonAnimation classes_need_extend = SkeletonAnimation -skip = SkeletonRenderer::[createWithData findBone findSlot getAttachment], - SkeletonAnimation::[createWithData getCurrent setAnimation addAnimation] +skip = SkeletonRenderer::[createWithData findBone findSlot getAttachment initWithData], + SkeletonAnimation::[createWithData getCurrent setAnimation addAnimation onTrackEntryEvent setTrackStartListener setTrackEndListener onAnimationStateEvent setTrackCompleteListener] remove_prefix = diff --git a/native/tools/tojs/cocos2dx_studio.ini b/native/tools/tojs/cocos2dx_studio.ini index 476960a6df..4bc9eef652 100644 --- a/native/tools/tojs/cocos2dx_studio.ini +++ b/native/tools/tojs/cocos2dx_studio.ini @@ -46,13 +46,13 @@ skip = *::[createInstance ^visit$ copyWith.* onEnter.* onExit.* ^description$ ge Skin::[getSkinData setSkinData], ArmatureAnimation::[updateHandler updateFrameData frameEvent setMovementEventCallFunc setFrameEventCallFunc], ArmatureDataManager::[getTextureDatas], - ActionManagerEx::[initWithDictionary purgeActionManager], + ActionManagerEx::[initWithDictionary purgeActionManager initWithBinary], Bone::[getTweenData getBoneData], BaseData::[copy subtract], ColliderFilter::[updateShape], Tween::[(s|g)etMovementBoneData], ActionNode::[initWithDictionary], - ActionObject::[initWithDictionary], + ActionObject::[initWithDictionary initWithBinary], ColliderDetector::[addContourData.* removeContourData], ColliderBody::[getContourData getCalculatedVertexList], ActionTimelineCache::[*], From f1d7d03ab50fe1a480aa9b61f75fd453a669053f Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Fri, 22 Apr 2016 11:43:17 +0800 Subject: [PATCH 06/25] Update the submodule `bindings-generator` --- native/tools/bindings-generator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/tools/bindings-generator b/native/tools/bindings-generator index 1b94253ae4..56f4e9d36b 160000 --- a/native/tools/bindings-generator +++ b/native/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 1b94253ae43fe1c26a9d8cb1dadc6dcfae334f68 +Subproject commit 56f4e9d36b6e70be50ac3c388f02b0238c654500 From 1c5f974d7882161e2ca5e38f04dbaec1c58aa73a Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Fri, 22 Apr 2016 14:10:02 +0800 Subject: [PATCH 07/25] Fixed generate error code for constructor --- .../auto/jsb_cocos2dx_builder_auto.cpp | 3 +++ .../auto/jsb_cocos2dx_spine_auto.cpp | 21 +++++++++++++++++++ .../auto/jsb_cocos2dx_studio_auto.cpp | 2 ++ native/tools/bindings-generator | 2 +- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.cpp index 232856b810..31287cef87 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.cpp @@ -1420,6 +1420,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx); do { + ok = true; if (argc == 1) { cocosbuilder::CCBReader* arg0 = nullptr; do { @@ -1456,6 +1457,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv } while(0); do { + ok = true; if (argc == 4) { cocosbuilder::NodeLoaderLibrary* arg0 = nullptr; do { @@ -1528,6 +1530,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv } while(0); do { + ok = true; if (argc == 0) { cobj = new (std::nothrow) cocosbuilder::CCBReader(); cocos2d::Ref *_ccobj = dynamic_cast(cobj); diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp index 7303637d80..6e1bce8793 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp @@ -616,6 +616,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx); do { + ok = true; if (argc == 1) { spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* @@ -645,6 +646,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc } while(0); do { + ok = true; if (argc == 2) { spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* @@ -676,6 +678,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc } while(0); do { + ok = true; if (argc == 0) { cobj = new (std::nothrow) spine::SkeletonRenderer(); cocos2d::Ref *_ccobj = dynamic_cast(cobj); @@ -701,6 +704,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc } while(0); do { + ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -734,6 +738,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc } while(0); do { + ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -771,6 +776,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc } while(0); do { + ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -803,6 +809,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc } while(0); do { + ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -1375,6 +1382,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx); do { + ok = true; if (argc == 1) { spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* @@ -1404,6 +1412,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg } while(0); do { + ok = true; if (argc == 2) { spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* @@ -1435,6 +1444,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg } while(0); do { + ok = true; if (argc == 0) { cobj = new (std::nothrow) spine::SkeletonAnimation(); cocos2d::Ref *_ccobj = dynamic_cast(cobj); @@ -1460,6 +1470,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg } while(0); do { + ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -1493,6 +1504,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg } while(0); do { + ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -1530,6 +1542,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg } while(0); do { + ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -1562,6 +1575,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg } while(0); do { + ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -1615,6 +1629,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); do { + ok = true; if (argc == 1) { spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* @@ -1633,6 +1648,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva } while(0); do { + ok = true; if (argc == 2) { spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* @@ -1653,6 +1669,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva } while(0); do { + ok = true; if (argc == 0) { cobj = new (std::nothrow) spine::SkeletonAnimation(); cocos2d::Ref *_ccobj = dynamic_cast(cobj); @@ -1667,6 +1684,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva } while(0); do { + ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -1689,6 +1707,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva } while(0); do { + ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -1715,6 +1734,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva } while(0); do { + ok = true; if (argc == 2) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -1736,6 +1756,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva } while(0); do { + ok = true; if (argc == 3) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.cpp index c42b62eca0..dbaf8cf10a 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.cpp @@ -7967,6 +7967,7 @@ bool js_cocos2dx_studio_ComRender_constructor(JSContext *cx, uint32_t argc, jsva JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx); do { + ok = true; if (argc == 2) { cocos2d::Node* arg0 = nullptr; do { @@ -8007,6 +8008,7 @@ bool js_cocos2dx_studio_ComRender_constructor(JSContext *cx, uint32_t argc, jsva } while(0); do { + ok = true; if (argc == 0) { cobj = new (std::nothrow) cocostudio::ComRender(); cocos2d::Ref *_ccobj = dynamic_cast(cobj); diff --git a/native/tools/bindings-generator b/native/tools/bindings-generator index 56f4e9d36b..a96c5e38fd 160000 --- a/native/tools/bindings-generator +++ b/native/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 56f4e9d36b6e70be50ac3c388f02b0238c654500 +Subproject commit a96c5e38fd7bab7eb881f285d14c36a37eb0cdcd From 94501cc8f17547a26f48179bb75f85d24495fb6f Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Mon, 25 Apr 2016 15:56:03 +0800 Subject: [PATCH 08/25] Bug fix and stability improvements --- native/cocos/2d/CCNode.cpp | 5 + native/cocos/2d/CCRenderTexture.cpp | 4 +- native/cocos/base/CCDirector.cpp | 9 +- native/cocos/base/CCDirector.h | 4 +- .../editor-support/creator/CCScale9Sprite.cpp | 6 +- native/cocos/network/HttpClient-apple.mm | 31 ++- .../js-bindings/auto/jsb_creator_auto.cpp | 2 +- .../js-bindings/manual/cocos2d_specifics.cpp | 3 +- .../manual/js_manual_conversions.cpp | 215 ++++++------------ .../script/ccui/jsb_ccui_create_apis.js | 18 +- .../js-bindings/script/ccui/jsb_cocos2d_ui.js | 13 ++ .../scripting/js-bindings/script/jsb_boot.js | 8 +- .../js-bindings/script/jsb_cocos2d.js | 32 ++- .../js-bindings/script/jsb_create_apis.js | 41 ++-- .../script/studio/parsers/action-2.x.js | 8 +- .../script/studio/parsers/compatible.js | 6 +- .../studio/parsers/timelineParser-1.x.js | 6 +- .../studio/parsers/timelineParser-2.x.js | 184 ++++++--------- .../script/studio/parsers/uiParser-1.x.js | 8 +- native/cocos/ui/UIImageView.cpp | 1 + native/tools/bindings-generator | 2 +- 21 files changed, 263 insertions(+), 343 deletions(-) diff --git a/native/cocos/2d/CCNode.cpp b/native/cocos/2d/CCNode.cpp index 9abfe98ae5..21e341d85d 100644 --- a/native/cocos/2d/CCNode.cpp +++ b/native/cocos/2d/CCNode.cpp @@ -885,6 +885,11 @@ void Node::addChildHelper(Node* child, int localZOrder, int tag, const std::stri if (child == nullptr) { return; } + if (child->_parent != nullptr) + { + log("child already added. It can't be added again"); + return; + } if (_children.empty()) { this->childrenAlloc(); diff --git a/native/cocos/2d/CCRenderTexture.cpp b/native/cocos/2d/CCRenderTexture.cpp index 35808f8043..e84d3fc0ac 100644 --- a/native/cocos/2d/CCRenderTexture.cpp +++ b/native/cocos/2d/CCRenderTexture.cpp @@ -531,7 +531,7 @@ Image* RenderTexture::newImage(bool fliimage) glBindFramebuffer(GL_FRAMEBUFFER, _FBO); // TODO: move this to configuration, so we don't check it every time - /* Certain Qualcomm Andreno gpu's will retain data in memory after a frame buffer switch which corrupts the render to the texture. The solution is to clear the frame buffer before rendering to the texture. However, calling glClear has the unintended result of clearing the current texture. Create a temporary texture to overcome this. At the end of RenderTexture::begin(), switch the attached texture to the second one, call glClear, and then switch back to the original texture. This solution is unnecessary for other devices as they don't have the same issue with switching frame buffers. + /* Certain Qualcomm Adreno GPU's will retain data in memory after a frame buffer switch which corrupts the render to the texture. The solution is to clear the frame buffer before rendering to the texture. However, calling glClear has the unintended result of clearing the current texture. Create a temporary texture to overcome this. At the end of RenderTexture::begin(), switch the attached texture to the second one, call glClear, and then switch back to the original texture. This solution is unnecessary for other devices as they don't have the same issue with switching frame buffers. */ if (Configuration::getInstance()->checkForGLExtension("GL_QCOM")) { @@ -613,7 +613,7 @@ void RenderTexture::onBegin() glBindFramebuffer(GL_FRAMEBUFFER, _FBO); // TODO: move this to configuration, so we don't check it every time - /* Certain Qualcomm Andreno gpu's will retain data in memory after a frame buffer switch which corrupts the render to the texture. The solution is to clear the frame buffer before rendering to the texture. However, calling glClear has the unintended result of clearing the current texture. Create a temporary texture to overcome this. At the end of RenderTexture::begin(), switch the attached texture to the second one, call glClear, and then switch back to the original texture. This solution is unnecessary for other devices as they don't have the same issue with switching frame buffers. + /* Certain Qualcomm Adreno GPU's will retain data in memory after a frame buffer switch which corrupts the render to the texture. The solution is to clear the frame buffer before rendering to the texture. However, calling glClear has the unintended result of clearing the current texture. Create a temporary texture to overcome this. At the end of RenderTexture::begin(), switch the attached texture to the second one, call glClear, and then switch back to the original texture. This solution is unnecessary for other devices as they don't have the same issue with switching frame buffers. */ if (Configuration::getInstance()->checkForGLExtension("GL_QCOM")) { diff --git a/native/cocos/base/CCDirector.cpp b/native/cocos/base/CCDirector.cpp index 5b56f5d68c..e814e5c176 100644 --- a/native/cocos/base/CCDirector.cpp +++ b/native/cocos/base/CCDirector.cpp @@ -82,6 +82,7 @@ NS_CC_BEGIN extern const char* cocos2dVersion(); Director* Director::DirectorInstance = nullptr; +bool Director::PurgeDirectorInNextLoop = false; const char *Director::EVENT_PROJECTION_CHANGED = "director_projection_changed"; const char *Director::EVENT_AFTER_DRAW = "director_after_draw"; @@ -131,7 +132,7 @@ bool Director::init() _paused = false; // purge ? - _purgeDirectorInNextLoop = false; + PurgeDirectorInNextLoop = false; // restart ? _restartDirectorInNextLoop = false; @@ -900,7 +901,7 @@ void Director::popToSceneStackLevel(int level) void Director::end() { - _purgeDirectorInNextLoop = true; + PurgeDirectorInNextLoop = true; } void Director::restart() @@ -1321,10 +1322,10 @@ void DisplayLinkDirector::startAnimation() void DisplayLinkDirector::mainLoop() { - if (_purgeDirectorInNextLoop) + if (PurgeDirectorInNextLoop) { - _purgeDirectorInNextLoop = false; purgeDirector(); + PurgeDirectorInNextLoop = false; } else if (_restartDirectorInNextLoop) { diff --git a/native/cocos/base/CCDirector.h b/native/cocos/base/CCDirector.h index 8263cfacf0..ea859de839 100644 --- a/native/cocos/base/CCDirector.h +++ b/native/cocos/base/CCDirector.h @@ -490,13 +490,13 @@ public: */ const std::thread::id& getCocos2dThreadId() const { return _cocos2d_thread_id; } - bool isPurgeDirectorInNextLoop() const { return _purgeDirectorInNextLoop; } + static bool isPurgeDirectorInNextLoop() { return PurgeDirectorInNextLoop; } void purgeDirector(); protected: void reset(); - bool _purgeDirectorInNextLoop; // this flag will be set to true in end() + static bool PurgeDirectorInNextLoop; // this flag will be set to true in end() void restartDirector(); bool _restartDirectorInNextLoop; // this flag will be set to true in restart() diff --git a/native/cocos/editor-support/creator/CCScale9Sprite.cpp b/native/cocos/editor-support/creator/CCScale9Sprite.cpp index faee88bd21..ad3a4ce0d3 100644 --- a/native/cocos/editor-support/creator/CCScale9Sprite.cpp +++ b/native/cocos/editor-support/creator/CCScale9Sprite.cpp @@ -181,17 +181,15 @@ public: } std::vector _calculateVertices(cocos2d::SpriteFrame* spriteFrame, const cocos2d::Size& contentSize, float insetLeft, float insetRight, float insetTop, float insetBottom) { - float leftWidth, centerWidth, rightWidth; - float topHeight, centerHeight, bottomHeight; + float leftWidth, rightWidth; + float topHeight, bottomHeight; auto rect = spriteFrame->getRect(); leftWidth = insetLeft; rightWidth = insetRight; - centerWidth = rect.size.width - leftWidth - rightWidth; topHeight = insetTop; bottomHeight = insetBottom; - centerHeight = rect.size.height - topHeight - bottomHeight; auto preferSize = contentSize; auto sizableWidth = preferSize.width - leftWidth - rightWidth; diff --git a/native/cocos/network/HttpClient-apple.mm b/native/cocos/network/HttpClient-apple.mm index 7b7a618fdd..2b6e210f17 100644 --- a/native/cocos/network/HttpClient-apple.mm +++ b/native/cocos/network/HttpClient-apple.mm @@ -50,8 +50,7 @@ void HttpClient::networkThread() { increaseThreadCount(); - while (true) @autoreleasepool { - + while (true) { HttpRequest *request; // step 1: send http request if the requestQueue isn't empty @@ -68,22 +67,20 @@ void HttpClient::networkThread() break; } - // Create a HttpResponse object, the default setting is http access failed - HttpResponse *response = new (std::nothrow) HttpResponse(request); - - processResponse(response, _responseMessage); - - // add response packet into queue - _responseQueueMutex.lock(); - _responseQueue.pushBack(response); - _responseQueueMutex.unlock(); - - _schedulerMutex.lock(); - if (Director::DirectorInstance) + if (Director::DirectorInstance && !Director::isPurgeDirectorInNextLoop()) { + // Create a HttpResponse object, the default setting is http access failed + HttpResponse *response = new (std::nothrow) HttpResponse(request); + + processResponse(response, _responseMessage); + + // add response packet into queue + _responseQueueMutex.lock(); + _responseQueue.pushBack(response); + _responseQueueMutex.unlock(); + Director::DirectorInstance->getScheduler()->performFunctionInCocosThread(CC_CALLBACK_0(HttpClient::dispatchResponseCallbacks, this)); } - _schedulerMutex.unlock(); } // cleanup: if worker thread received quit signal, clean up un-completed request queue @@ -106,8 +103,7 @@ void HttpClient::networkThreadAlone(HttpRequest* request, HttpResponse* response char responseMessage[RESPONSE_BUFFER_SIZE] = { 0 }; processResponse(response, responseMessage); - _schedulerMutex.lock(); - if (Director::DirectorInstance) + if (Director::DirectorInstance && !Director::isPurgeDirectorInNextLoop()) { Director::DirectorInstance->getScheduler()->performFunctionInCocosThread([this, response, request]{ const ccHttpRequestCallback& callback = request->getCallback(); @@ -127,7 +123,6 @@ void HttpClient::networkThreadAlone(HttpRequest* request, HttpResponse* response request->release(); }); } - _schedulerMutex.unlock(); decreaseThreadCountAndMayDeleteThis(); } diff --git a/native/cocos/scripting/js-bindings/auto/jsb_creator_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_creator_auto.cpp index e3f1777a06..f81c7a882f 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_creator_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_creator_auto.cpp @@ -755,7 +755,7 @@ bool js_creator_Scale9SpriteV2_constructor(JSContext *cx, uint32_t argc, jsval * JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent)); args.rval().set(OBJECT_TO_JSVAL(obj)); // link the native object with the javascript object - js_proxy_t* p = jsb_new_proxy(cobj, obj); + jsb_new_proxy(cobj, obj); if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; diff --git a/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp b/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp index 1e6fca0547..9b02979d00 100644 --- a/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp +++ b/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp @@ -5064,7 +5064,7 @@ void js_register_cocos2dx_EventKeyboard(JSContext *cx, JS::HandleObject global) bool js_console_log(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - if (argc == 1) { + if (argc >= 1) { std::string msg; bool ok = jsval_to_std_string(cx, args.get(0), &msg); if (!ok) { @@ -5077,7 +5077,6 @@ bool js_console_log(JSContext *cx, uint32_t argc, jsval *vp) return true; } - JS_ReportError(cx, "js_console_log : wrong number of arguments"); return false; } diff --git a/native/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp b/native/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp index 421b2ba383..76cffec3a0 100644 --- a/native/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp +++ b/native/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp @@ -1966,198 +1966,117 @@ bool jsval_to_FontDefinition( JSContext *cx, JS::HandleValue vp, FontDefinition JSB_PRECONDITION( jsobj, "Not a valid JS object"); // defaul values - const char * defautlFontName = "Arial"; - const int defaultFontSize = 32; - TextHAlignment defaultTextAlignment = TextHAlignment::LEFT; - TextVAlignment defaultTextVAlignment = TextVAlignment::TOP; - - // by default shadow and stroke are off - out->_shadow._shadowEnabled = false; - out->_stroke._strokeEnabled = false; - - // white text by default - out->_fontFillColor = Color3B::WHITE; + out->_fontName = "Arial"; + out->_fontSize = 32; + out->_alignment = TextHAlignment::LEFT; + out->_vertAlignment = TextVAlignment::TOP; // font name - JS::RootedValue jsr(cx); - JS_GetProperty(cx, jsobj, "fontName", &jsr); - JS::ToString(cx, jsr); - JSStringWrapper wrapper(jsr); - const char* fontName = wrapper.get(); - - if (fontName && strlen(fontName) > 0) - { - out->_fontName = fontName; - } - else - { - out->_fontName = defautlFontName; - } + JS::RootedValue jsFontName(cx); + if (JS_GetProperty(cx, jsobj, "fontName", &jsFontName) && !jsFontName.isNullOrUndefined()) + jsval_to_std_string(cx, jsFontName, &(out->_fontName)); // font size - bool hasProperty, hasSecondProp; - JS_HasProperty(cx, jsobj, "fontSize", &hasProperty); - if ( hasProperty ) + JS::RootedValue jsFontSize(cx); + if (JS_GetProperty(cx, jsobj, "fontSize", &jsFontSize) && !jsFontSize.isNullOrUndefined()) { - JS_GetProperty(cx, jsobj, "fontSize", &jsr); double fontSize = 0.0; - JS::ToNumber(cx, jsr, &fontSize); - out->_fontSize = fontSize; - } - else - { - out->_fontSize = defaultFontSize; + JS::ToNumber(cx, jsFontSize, &fontSize); + out->_fontSize = fontSize; } // font alignment horizontal - JS_HasProperty(cx, jsobj, "textAlign", &hasProperty); - if ( hasProperty ) + JS::RootedValue jsTextAlign(cx); + if (JS_GetProperty(cx, jsobj, "textAlign", &jsTextAlign) && !jsTextAlign.isNullOrUndefined()) { - JS_GetProperty(cx, jsobj, "textAlign", &jsr); - double fontAlign = 0.0; - JS::ToNumber(cx, jsr, &fontAlign); - out->_alignment = (TextHAlignment)(int)fontAlign; - } - else - { - out->_alignment = defaultTextAlignment; + double textAlign = 0.0; + JS::ToNumber(cx, jsTextAlign, &textAlign); + out->_alignment = (TextHAlignment)(int)textAlign; } // font alignment vertical - JS_HasProperty(cx, jsobj, "verticalAlign", &hasProperty); - if ( hasProperty ) + JS::RootedValue jsVerticalAlign(cx); + if (JS_GetProperty(cx, jsobj, "verticalAlign", &jsVerticalAlign) && !jsVerticalAlign.isNullOrUndefined()) { - JS_GetProperty(cx, jsobj, "verticalAlign", &jsr); - double fontAlign = 0.0; - JS::ToNumber(cx, jsr, &fontAlign); - out->_vertAlignment = (TextVAlignment)(int)fontAlign; - } - else - { - out->_vertAlignment = defaultTextVAlignment; + double verticalAlign = 0.0; + JS::ToNumber(cx, jsVerticalAlign, &verticalAlign); + out->_vertAlignment = (TextVAlignment)(int)verticalAlign; } // font fill color - JS_HasProperty(cx, jsobj, "fillStyle", &hasProperty); - if ( hasProperty ) + JS::RootedValue jsFillColor(cx); + if (JS_GetProperty(cx, jsobj, "fillStyle", &jsFillColor) && !jsFillColor.isNullOrUndefined()) { - JS_GetProperty(cx, jsobj, "fillStyle", &jsr); - - JS::RootedObject jsobjColor(cx); - JS::RootedValue jsvalColor(cx, jsr); - if (!JS_ValueToObject(cx, jsvalColor, &jsobjColor)) - return false; - - out->_fontFillColor = getColorFromJSObject(cx, jsobjColor); + jsval_to_cccolor3b(cx, jsFillColor, &(out->_fontFillColor)); } // font rendering box dimensions - JS_HasProperty(cx, jsobj, "boundingWidth", &hasProperty); - JS_HasProperty(cx, jsobj, "boundingHeight", &hasSecondProp); - if ( hasProperty && hasSecondProp ) + JS::RootedValue jsWidth(cx); + if (JS_GetProperty(cx, jsobj, "boundingWidth", &jsWidth) && !jsWidth.isNullOrUndefined()) { - JS_GetProperty(cx, jsobj, "boundingWidth", &jsr); - double boundingW = 0.0; - JS::ToNumber(cx, jsr, &boundingW); - - JS_GetProperty(cx, jsobj, "boundingHeight", &jsr); - double boundingH = 0.0; - JS::ToNumber(cx, jsr, &boundingH); - - Size dimension; - dimension.width = boundingW; - dimension.height = boundingH; - out->_dimensions = dimension; + double boundingWidth = 0.0; + JS::ToNumber(cx, jsWidth, &boundingWidth); + out->_dimensions.width = boundingWidth; + } + JS::RootedValue jsHeight(cx); + if (JS_GetProperty(cx, jsobj, "boundingHeight", &jsHeight) && !jsHeight.isNullOrUndefined()) + { + double boundingHeight = 0.0; + JS::ToNumber(cx, jsHeight, &boundingHeight); + out->_dimensions.height = boundingHeight; } // shadow - JS_HasProperty(cx, jsobj, "shadowEnabled", &hasProperty); - if ( hasProperty ) + JS::RootedValue jsShadowEnabled(cx); + if (JS_GetProperty(cx, jsobj, "shadowEnabled", &jsShadowEnabled) && !jsShadowEnabled.isNullOrUndefined()) { - JS_GetProperty(cx, jsobj, "shadowEnabled", &jsr); - out->_shadow._shadowEnabled = ToBoolean(jsr); - - if ( out->_shadow._shadowEnabled ) + out->_shadow._shadowEnabled = ToBoolean(jsShadowEnabled); + if (out->_shadow._shadowEnabled) { - // default shadow values - out->_shadow._shadowOffset = Size(5, 5); - out->_shadow._shadowBlur = 1; - out->_shadow._shadowOpacity = 1; - - // shado offset - JS_HasProperty(cx, jsobj, "shadowOffsetX", &hasProperty); - JS_HasProperty(cx, jsobj, "shadowOffsetY", &hasSecondProp); - if ( hasProperty && hasSecondProp ) + JS::RootedValue jsOffsetX(cx); + if (JS_GetProperty(cx, jsobj, "shadowOffsetX", &jsOffsetX) && !jsOffsetX.isNullOrUndefined()) { - JS_GetProperty(cx, jsobj, "shadowOffsetX", &jsr); - double offx = 0.0; - JS::ToNumber(cx, jsr, &offx); - - JS_GetProperty(cx, jsobj, "shadowOffsetY", &jsr); - double offy = 0.0; - JS::ToNumber(cx, jsr, &offy); - - Size offset; - offset.width = offx; - offset.height = offy; - out->_shadow._shadowOffset = offset; + double shadowOffsetX = 0.0; + JS::ToNumber(cx, jsOffsetX, &shadowOffsetX); + out->_shadow._shadowOffset.width = shadowOffsetX; } - - // shadow blur - JS_HasProperty(cx, jsobj, "shadowBlur", &hasProperty); - if ( hasProperty ) + JS::RootedValue jsOffsetY(cx); + if (JS_GetProperty(cx, jsobj, "shadowOffsetY", &jsOffsetY) && !jsOffsetY.isNullOrUndefined()) { - JS_GetProperty(cx, jsobj, "shadowBlur", &jsr); - double shadowBlur = 0.0; - JS::ToNumber(cx, jsr, &shadowBlur); - out->_shadow._shadowBlur = shadowBlur; + double shadowOffsetY = 0.0; + JS::ToNumber(cx, jsOffsetY, &shadowOffsetY); + out->_shadow._shadowOffset.height = shadowOffsetY; } - - // shadow intensity - JS_HasProperty(cx, jsobj, "shadowOpacity", &hasProperty); - if ( hasProperty ) + + JS::RootedValue jsOpacity(cx); + if (JS_GetProperty(cx, jsobj, "shadowOpacity", &jsOpacity) && !jsOpacity.isNullOrUndefined()) { - JS_GetProperty(cx, jsobj, "shadowOpacity", &jsr); double shadowOpacity = 0.0; - JS::ToNumber(cx, jsr, &shadowOpacity); + JS::ToNumber(cx, jsOpacity, &shadowOpacity); out->_shadow._shadowOpacity = shadowOpacity; } } } // stroke - JS_HasProperty(cx, jsobj, "strokeEnabled", &hasProperty); - if ( hasProperty ) + JS::RootedValue jsStrokeEnabled(cx); + if (JS_GetProperty(cx, jsobj, "shadowEnabled", &jsStrokeEnabled) && !jsStrokeEnabled.isNullOrUndefined()) { - JS_GetProperty(cx, jsobj, "strokeEnabled", &jsr); - out->_stroke._strokeEnabled = ToBoolean(jsr); - - if ( out->_stroke._strokeEnabled ) + out->_stroke._strokeEnabled = ToBoolean(jsStrokeEnabled); + if (out->_stroke._strokeEnabled) { - // default stroke values - out->_stroke._strokeSize = 1; - out->_stroke._strokeColor = Color3B::BLUE; - - // stroke color - JS_HasProperty(cx, jsobj, "strokeStyle", &hasProperty); - if ( hasProperty ) + JS::RootedValue jsStrokeColor(cx); + if (JS_GetProperty(cx, jsobj, "strokeStyle", &jsStrokeColor) && !jsStrokeColor.isNullOrUndefined()) { - JS_GetProperty(cx, jsobj, "strokeStyle", &jsr); - - JS::RootedObject jsobjStrokeColor(cx); - if (!JS_ValueToObject( cx, jsr, &jsobjStrokeColor ) ) - return false; - out->_stroke._strokeColor = getColorFromJSObject(cx, jsobjStrokeColor); + jsval_to_cccolor3b(cx, jsStrokeColor, &(out->_stroke._strokeColor)); } - - // stroke size - JS_HasProperty(cx, jsobj, "lineWidth", &hasProperty); - if ( hasProperty ) + + JS::RootedValue jsLineWidth(cx); + if (JS_GetProperty(cx, jsobj, "lineWidth", &jsLineWidth) && !jsLineWidth.isNullOrUndefined()) { - JS_GetProperty(cx, jsobj, "lineWidth", &jsr); - double strokeSize = 0.0; - JS::ToNumber(cx, jsr, &strokeSize); - out->_stroke._strokeSize = strokeSize; + double lineWidth = 0.0; + JS::ToNumber(cx, jsLineWidth, &lineWidth); + out->_stroke._strokeSize = lineWidth; } } } diff --git a/native/cocos/scripting/js-bindings/script/ccui/jsb_ccui_create_apis.js b/native/cocos/scripting/js-bindings/script/ccui/jsb_ccui_create_apis.js index 69e3904cbe..e18ffae7e8 100644 --- a/native/cocos/scripting/js-bindings/script/ccui/jsb_ccui_create_apis.js +++ b/native/cocos/scripting/js-bindings/script/ccui/jsb_ccui_create_apis.js @@ -129,14 +129,10 @@ ccui.TextField.prototype._ctor = function(placeholder, fontName, fontSize){ ccui.RichElementText.prototype._ctor = function(tag, color, opacity, text, fontName, fontSize, flags, url) { - if(fontName == undefined) - fontName = "Helvetica"; - if(text == undefined) - text = ""; - if (flags == undefined) - flags = 0; - if (url == undefined) - url = ""; + fontName = fontName || ''; + text = text || ''; + flags = flags || 0; + url = url || ''; fontSize !== undefined && this.init(tag, color, opacity, text, fontName, fontSize, flags, url); }; @@ -153,7 +149,8 @@ if (ccui.WebView) { ccui.WebView.prototype._ctor = function(url){ this.init(); - url !== undefined && this.loadURL(url); + if(url) + this.loadURL(url); }; } @@ -161,7 +158,8 @@ if (ccui.VideoPlayer) { ccui.VideoPlayer.prototype._ctor = function(url){ this.init(); - url !== undefined && this.setURL(url); + if(url) + this.setURL(url); }; } diff --git a/native/cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js b/native/cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js index b072c548ee..0aea03ecf2 100644 --- a/native/cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js +++ b/native/cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js @@ -500,6 +500,19 @@ if (ccui.VideoPlayer) this["VideoPlayer_"+event] = callback; }; } + +ccui.Text.prototype._setString = ccui.Text.prototype.setString; +ccui.Text.prototype.setString = function(text) +{ + var textType = typeof text; + if(textType === 'string') + this._setString(text); + else if(textType === 'number') + this._setString('' + text); + else + cc.log('ccui.Text.setString error: text is not string,is ' + (typeof text)); +}; + /* * UIWidget temporary solution to addChild * addNode and addChild function should be merged in ccui.Widget diff --git a/native/cocos/scripting/js-bindings/script/jsb_boot.js b/native/cocos/scripting/js-bindings/script/jsb_boot.js index f7dc8d81b3..4a96b85e87 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_boot.js +++ b/native/cocos/scripting/js-bindings/script/jsb_boot.js @@ -1306,7 +1306,7 @@ cc._initSys = function(config, CONFIG_KEY){ str += "os : " + self.os + "\r\n"; str += "platform : " + self.platform + "\r\n"; cc.log(str); - } + }; platform = locSys.platform; locSys.isMobile = ( platform === locSys.ANDROID || @@ -1410,9 +1410,9 @@ cc._initDebugSetting = function (mode) { //+++++++++++++++++++++++++something about CCGame begin+++++++++++++++++++++++++++ /** - * @type {Object} - * @name cc.game * An object to boot the game. + * @class + * @name cc.game */ cc.game = { DEBUG_MODE_NONE : 0, @@ -1446,7 +1446,7 @@ cc.game = { _prepareCalled : false,//whether the prepare function has been called _prepared : false,//whether the engine has prepared - _paused : true,//whether the game is paused + _paused : false,//whether the game is paused _intervalId : null,//interval target of main diff --git a/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js b/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js index da4fa92523..9f3b006b52 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js +++ b/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js @@ -1962,9 +1962,30 @@ cc.TMXLayer.prototype.getPositonAt = function(x, y){ return this._getPositionAt(pos); }; +// Predefined font definition +cc.FontDefinition = function () { + this.fontName = "Arial"; + this.fontSize = 32; + this.textAlign = cc.TEXT_ALIGNMENT_CENTER; + this.verticalAlign = cc.VERTICAL_TEXT_ALIGNMENT_TOP; + this.fillStyle = cc.color(255, 255, 255, 255); + this.boundingWidth = 0; + this.boundingHeight = 0; + + this.strokeEnabled = false; + this.strokeStyle = cc.color(255, 255, 255, 255); + this.lineWidth = 1; + + this.shadowEnabled = false; + this.shadowOffsetX = 0; + this.shadowOffsetY = 0; + this.shadowBlur = 0; + this.shadowOpacity = 1.0; +}; + //LabelTTF cc.LabelTTF.prototype.initWithString = function(text, fontName, fontSize, dimensions, hAlignment, vAlignment) { - var fontDef = new cc.FontDefinition(); + var fontDef = {}; if(typeof fontName === 'string') fontDef.fontName = fontName; if(typeof fontSize === 'number') fontDef.fontSize = fontSize; if(dimensions) { @@ -2955,6 +2976,15 @@ cc.GLProgram.prototype.setUniformLocationWithMatrix4fv = function(){ this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray); } +cc.Node.prototype._setPositionX = cc.Node.prototype.setPositionX; +cc.Node.prototype.setPositionX = function(posX) +{ + if (typeof posX === 'number') { + this._setPositionX(posX); + } + else + cc.log('cc.Node.setPositionX error:value is not number'); +}; // // Script Component diff --git a/native/cocos/scripting/js-bindings/script/jsb_create_apis.js b/native/cocos/scripting/js-bindings/script/jsb_create_apis.js index f510d6d6c0..135e6d8947 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_create_apis.js +++ b/native/cocos/scripting/js-bindings/script/jsb_create_apis.js @@ -235,32 +235,33 @@ _p._ctor = function(normalImage, selectedImage, three, four, five) { callback = null, target = null; - if (normalImage === undefined) { + if (!normalImage) { + //undefined || null || '' cc.MenuItemImage.prototype.init.call(this); } else { - if (four === undefined) { - callback = three; - } - else if (five === undefined) { - if (typeof three === 'function') { - callback = three; - target = four; - } - else { - disabledImage = three; - callback = four; + var imageIndex = 0; + var imageArray = new Array(); + for (var i = 0; i < arguments.length && i < 5; ++i) { + if(typeof arguments[i] === 'function') + callback = arguments[i]; + else if (typeof arguments[i] === 'object') + target = arguments[i]; + else if (typeof arguments[i] === 'string') + { + imageArray[imageIndex] = arguments[i]; + imageIndex += 1; } } - else if (five) { - disabledImage = three; - callback = four; - target = five; - } - callback = callback ? callback.bind(target) : null; + + if(!callback) + callback = null; + else if(callback && target) + callback = callback.bind(target); + var normalSprite = new cc.Sprite(normalImage); - var selectedSprite = new cc.Sprite(selectedImage); - var disabledSprite = disabledImage ? new cc.Sprite(disabledImage) : new cc.Sprite(normalImage); + var selectedSprite = imageArray[1] ? new cc.Sprite(imageArray[1]) : new cc.Sprite(normalImage); + var disabledSprite = imageArray[2] ? new cc.Sprite(imageArray[2]) : new cc.Sprite(normalImage); this.initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, callback); } }; diff --git a/native/cocos/scripting/js-bindings/script/studio/parsers/action-2.x.js b/native/cocos/scripting/js-bindings/script/studio/parsers/action-2.x.js index 5be479ef43..50bac976e7 100644 --- a/native/cocos/scripting/js-bindings/script/studio/parsers/action-2.x.js +++ b/native/cocos/scripting/js-bindings/script/studio/parsers/action-2.x.js @@ -149,7 +149,8 @@ frame.setAnchorPoint(cc.p(anchorx, anchory)); return frame; } - },{ + }, + { name: "AnchorPoint", handle: function(options){ var frame = new ccs.AnchorPointFrame(); @@ -158,7 +159,8 @@ frame.setAnchorPoint(cc.p(anchorx, anchory)); return frame; } - },{ + }, + { name: "InnerAction", handle: function(options){ var frame = new ccs.InnerActionFrame(); @@ -197,7 +199,7 @@ var frame, texture, plist, path, spriteFrame; frame = new ccs.TextureFrame(); texture = options["TextureFile"]; - if(texture != null) { + if(texture) { plist = texture["Plist"]; path = texture["Path"]; spriteFrame = cc.spriteFrameCache.getSpriteFrame(path); diff --git a/native/cocos/scripting/js-bindings/script/studio/parsers/compatible.js b/native/cocos/scripting/js-bindings/script/studio/parsers/compatible.js index cfb5934732..6cac678cfc 100644 --- a/native/cocos/scripting/js-bindings/script/studio/parsers/compatible.js +++ b/native/cocos/scripting/js-bindings/script/studio/parsers/compatible.js @@ -42,8 +42,12 @@ */ widgetFromJsonFile: function(file){ var json = cc.loader.getRes(cc.path.join(cc.loader.resPath, file)); - if(json) + if(json) { this._fileDesignSizes[file] = cc.size(json["designWidth"]||0, json["designHeight"]||0); + } + else { + return null; + } var version = json["Version"] || json["version"]; var versionNum = ccs.uiReader.getVersionInteger(version); diff --git a/native/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-1.x.js b/native/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-1.x.js index 6cf606bdc6..d97d2e8512 100644 --- a/native/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-1.x.js +++ b/native/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-1.x.js @@ -167,7 +167,7 @@ var filePath = options["fileName"]; var node; - if (filePath && "" !== filePath){ + if (filePath){ node = this.createNode(filePath); }else{ node = new ccs.Node(); @@ -219,9 +219,9 @@ var path = options["resourcePath"]; var tmx = null; - if (tmxFile && "" !== tmxFile){ + if (tmxFile){ tmx = new cc.TMXTiledMap(tmxFile); - }else if (tmxString && "" !== tmxString && path && "" !== path){ + }else if (tmxString && path){ tmx = new cc.TMXTiledMap(tmxString, path); } return tmx; diff --git a/native/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js b/native/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js index a42a17b7ba..858be8a3db 100644 --- a/native/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js +++ b/native/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js @@ -42,8 +42,9 @@ getNodeJson: function(json){ var content = json["Content"]; - if(content["ObjectData"]) - return content["ObjectData"]; + var ObjectData = content["ObjectData"]; + if(ObjectData !== undefined && ObjectData !== null) + return ObjectData; return content["Content"]["ObjectData"]; }, @@ -57,7 +58,7 @@ var getParam = function(value, dValue){ - if(value === undefined) + if(value === undefined || value === null) return dValue; else return value; @@ -84,28 +85,26 @@ } var rotationSkewX = json["RotationSkewX"]; - if (cc.isValidValue(rotationSkewX)) + if (rotationSkewX) node.setRotationX(rotationSkewX); var rotationSkewY = json["RotationSkewY"]; - if (cc.isValidValue(rotationSkewY)) + if (rotationSkewY) node.setRotationY(rotationSkewY); var anchor = json["AnchorPoint"]; if(anchor){ - if(anchor["ScaleX"] == null) - anchor["ScaleX"] = 0; - if(anchor["ScaleY"] == null) - anchor["ScaleY"] = 0; - if(anchor["ScaleX"] != 0.5 || anchor["ScaleY"] != 0.5) - node.setAnchorPoint(cc.p(anchor["ScaleX"] || 0, anchor["ScaleY"] || 0)); + var anchorX = anchor["ScaleX"] || 0; + var anchorY = anchor["ScaleY"] || 0; + node.setAnchorPoint(cc.p(anchorX, anchorY)); } - if (cc.isValidValue(json["ZOrder"])) + if (json["ZOrder"]) node.setLocalZOrder(json["ZOrder"]); - var visible = getParam(json["VisibleForFrame"], true); - node.setVisible(visible); + var visible = json["VisibleForFrame"]; + if(cc.isValidValue(visible)) + node.setVisible(visible); var size = json["Size"]; if(size) @@ -119,7 +118,7 @@ var actionTag = json["ActionTag"] || 0; var extensionData = new ccs.ComExtensionData(); var customProperty = json["UserData"]; - if(customProperty !== undefined) + if(customProperty !== undefined && customProperty !== null) extensionData.setCustomProperty(customProperty); extensionData.setActionTag(actionTag); if (node.getComponent("ComExtensionData")) @@ -282,7 +281,6 @@ if (rotationSkewY) widget.setRotationY(rotationSkewY); - //var rotation = json["Rotation"]; var flipX = json["FlipX"]; if (flipX) @@ -293,16 +291,14 @@ widget.setFlippedY(true); var zOrder = json["zOrder"]; - if (cc.isValidValue(zOrder)) + if (zOrder) widget.setLocalZOrder(zOrder); - //var visible = json["Visible"]; - var visible = getParam(json["VisibleForFrame"], true); widget.setVisible(visible); var alpha = json["Alpha"]; - if (cc.isValidValue(alpha)) + if (cc.isValidValue(alpha) && alpha !== 255) widget.setOpacity(alpha); widget.setTag(json["Tag"] || 0); @@ -310,8 +306,6 @@ var touchEnabled = json["TouchEnable"] || false; widget.setTouchEnabled(touchEnabled); - // -- var frameEvent = json["FrameEvent"]; - var callBackType = json["CallBackType"]; if (cc.isValidValue(callBackType)) widget.setCallbackType(callBackType); @@ -361,13 +355,12 @@ }; var setLayoutComponent = function(widget, json){ - var layoutComponent = ccui.LayoutComponent.bindLayoutComponent(widget); if(!layoutComponent) return; - var positionXPercentEnabled = json["PositionPercentXEnable"] || json["PositionPercentXEnabled"] || false; - var positionYPercentEnabled = json["PositionPercentYEnable"] || json["PositionPercentYEnabled"] || false; + var positionXPercentEnabled = json["PositionPercentXEnable"]|| false; + var positionYPercentEnabled = json["PositionPercentYEnable"] || false; var positionXPercent = 0, positionYPercent = 0, PrePosition = json["PrePosition"]; @@ -375,19 +368,19 @@ positionXPercent = PrePosition["X"] || 0; positionYPercent = PrePosition["Y"] || 0; } - var sizeXPercentEnable = json["PercentWidthEnable"] || json["PercentWidthEnabled"] || false; - var sizeYPercentEnable = json["PercentHeightEnable"]|| json["PercentHeightEnabled"] || false; + var sizeXPercentEnable = json["PercentWidthEnable"] || false; + var sizeYPercentEnable = json["PercentHeightEnable"] || false; var sizeXPercent = 0, sizeYPercent = 0, PreSize = json["PreSize"]; - if (PrePosition) { + if (PreSize) { sizeXPercent = PreSize["X"] || 0; sizeYPercent = PreSize["Y"] || 0; } var stretchHorizontalEnabled = json["StretchWidthEnable"] || false; var stretchVerticalEnabled = json["StretchHeightEnable"] || false; - var horizontalEdge = json["HorizontalEdge"];// = ccui.LayoutComponent.horizontalEdge.LEFT; - var verticalEdge = json["VerticalEdge"]; // = ccui.LayoutComponent.verticalEdge.TOP; + var horizontalEdge = json["HorizontalEdge"]; + var verticalEdge = json["VerticalEdge"]; var leftMargin = json["LeftMargin"] || 0; var rightMargin = json["RightMargin"] || 0; var topMargin = json["TopMargin"] || 0; @@ -401,7 +394,6 @@ layoutComponent.setPercentHeightEnabled(sizeYPercentEnable); layoutComponent.setPercentWidth(sizeXPercent); layoutComponent.setPercentHeight(sizeYPercent); - layoutComponent.setPercentWidthEnabled(sizeXPercentEnable || sizeYPercentEnable); layoutComponent.setStretchWidthEnabled(stretchHorizontalEnabled); layoutComponent.setStretchHeightEnabled(stretchVerticalEnabled); @@ -425,26 +417,20 @@ } layoutComponent.setVerticalEdge(verticalEdgeType); - layoutComponent.setTopMargin(topMargin); - layoutComponent.setBottomMargin(bottomMargin); - layoutComponent.setLeftMargin(leftMargin); - layoutComponent.setRightMargin(rightMargin); - - layoutComponent.setVerticalEdge(verticalEdgeType); - - layoutComponent.setTopMargin(topMargin); - layoutComponent.setBottomMargin(bottomMargin); - layoutComponent.setLeftMargin(leftMargin); - layoutComponent.setRightMargin(rightMargin); + if(topMargin !== 0) + layoutComponent.setTopMargin(topMargin); + if(bottomMargin !== 0) + layoutComponent.setBottomMargin(bottomMargin); + if(leftMargin !== 0) + layoutComponent.setLeftMargin(leftMargin); + if(rightMargin !== 0) + layoutComponent.setRightMargin(rightMargin); }; var setLayoutBackground = function(layout, single, first, end){ if( layout.getBackGroundColorType() === 2 ){ - first = first || {}; - end = end || {}; layout.setBackGroundColor(getColor(first), getColor(end)); }else{ - single = single || {}; layout.setBackGroundColor(getColor(single)); } }; @@ -463,31 +449,30 @@ */ parser.initPanel = function(json, resourcePath){ var widget = new ccui.Layout(); - this.widgetAttributes(widget, json); var clipEnabled = json["ClipAble"] || false; - if(clipEnabled != null) + if(clipEnabled) widget.setClippingEnabled(clipEnabled); - var colorType = getParam(json["ComboBoxIndex"], 0); - widget.setBackGroundColorType(colorType); + var backGroundScale9Enabled = json["Scale9Enable"] || false; + if(backGroundScale9Enabled) + widget.setBackGroundImageScale9Enabled(true); + var bgColorType = getParam(json["ComboBoxIndex"], 0); + if(bgColorType !== 0) { + widget.setBackGroundColorType(bgColorType); + } + setLayoutBackgroundVector(widget, json["ColorVector"]); + setLayoutBackground(widget, json["SingleColor"], json["FirstColor"], json["EndColor"]); var bgColorOpacity = getParam(json["BackColorAlpha"], 255); - if(bgColorOpacity != null) + if(bgColorOpacity !== 255) widget.setBackGroundColorOpacity(bgColorOpacity); - var backGroundScale9Enabled = json["Scale9Enable"]; - if(backGroundScale9Enabled != null) - widget.setBackGroundImageScale9Enabled(backGroundScale9Enabled); - - var opacity = getParam(json["Alpha"], 255); - widget.setOpacity(opacity); - - loadTexture(json["FileData"], resourcePath, function(path, type){ + loadTexture(json["FileData"], resourcePath, function(path, type) { widget.setBackGroundImage(path, type); }); - + if(backGroundScale9Enabled){ var scale9OriginX = json["Scale9OriginX"] || 0; var scale9OriginY = json["Scale9OriginY"] || 0; @@ -498,18 +483,8 @@ widget.setBackGroundImageCapInsets(cc.rect( scale9OriginX, scale9OriginY, scale9Width, scale9Height )); - - setContentSize(widget, json["Size"]); - }else{ - if (!widget.isIgnoreContentAdaptWithSize()){ - setContentSize(widget, json["Size"]); - } - } - setLayoutBackground(widget, json["SingleColor"], json["FirstColor"], json["EndColor"]); - setLayoutBackgroundVector(widget, json["ColorVector"]); - return widget; }; @@ -519,7 +494,6 @@ * @param resourcePath */ parser.initText = function(json, resourcePath){ - var widget = new ccui.Text(); var touchScaleEnabled = json["TouchScaleChangeAble"]; @@ -527,15 +501,15 @@ widget.setTouchScaleChangeEnabled(touchScaleEnabled); var text = json["LabelText"]; - if(text != null) + if(text) widget.setString(text); var fontSize = json["FontSize"]; - if(fontSize != null) + if(typeof fontSize === 'number') widget.setFontSize(fontSize); var fontName = json["FontName"]; - if(fontName && '' !== fontName) + if(fontName) widget.setFontName(fontName); var areaWidth = json["AreaWidth"]; @@ -570,7 +544,6 @@ var fontResource = json["FontResource"]; if(fontResource != null){ var path = fontResource["Path"]; - //resoutceType = fontResource["Type"]; if(path){ if (cc.sys.isNative) { fontName = cc.path.join(cc.loader.resPath, resourcePath, path); @@ -604,7 +577,6 @@ this.widgetAttributes(widget, json, widget.isIgnoreContentAdaptWithSize()); json["CColor"] = color; return widget; - }; /** @@ -613,7 +585,6 @@ * @param resourcePath */ parser.initButton = function(json, resourcePath){ - var widget = new ccui.Button(); loadTexture(json["NormalFileData"], resourcePath, function(path, type){ @@ -640,7 +611,7 @@ widget.setTitleFontSize(fontSize); var fontName = json["FontName"]; - if(fontName && '' !== fontName) + if(fontName) widget.setTitleFontName(fontName); var textColor = json["TextColor"]; @@ -654,7 +625,6 @@ var fontResource = json["FontResource"]; if(fontResource != null){ var path = fontResource["Path"]; - //resoutceType = fontResource["Type"]; if(path){ if (cc.sys.isNative) { fontName = cc.path.join(cc.loader.resPath, resourcePath, path); @@ -671,7 +641,7 @@ label.enableShadow( getColor(json["ShadowColor"]), cc.size(getParam(json["ShadowOffsetX"], 2), getParam(json["ShadowOffsetY"], -2)), - json["ShadowBlurRadius"] || 0 + 0 ); } if(label && json["OutlineEnabled"] && json["OutlineColor"] && label.enableStroke) @@ -689,13 +659,11 @@ json["Scale9Height"] || 0 ); widget.setCapInsets(capInsets); - } setContentSize(widget, json["Size"]); return widget; - }; /** @@ -704,7 +672,6 @@ * @param resourcePath */ parser.initCheckBox = function(json, resourcePath){ - var widget = new ccui.CheckBox(); this.widgetAttributes(widget, json); @@ -761,7 +728,6 @@ if(backGroundScale9Enabled){ widget.setBackGroundImageScale9Enabled(true); - var scale9OriginX = json["Scale9OriginX"] || 0; var scale9OriginY = json["Scale9OriginY"] || 0; var scale9Width = json["Scale9Width"] || 0; @@ -802,7 +768,6 @@ * @param resourcePath */ parser.initImageView = function(json, resourcePath){ - var widget = new ccui.ImageView(); loadTexture(json["FileData"], resourcePath, function(path, type){ @@ -828,7 +793,8 @@ scale9Width, scale9Height )); - } else + } + else setContentSize(widget, json["Size"]); this.widgetAttributes(widget, json); @@ -843,7 +809,6 @@ * @returns {ccui.LoadingBar} */ parser.initLoadingBar = function(json, resourcePath){ - var widget = new ccui.LoadingBar(); this.widgetAttributes(widget, json); @@ -860,7 +825,6 @@ widget.setPercent(percent); return widget; - }; /** @@ -869,7 +833,6 @@ * @param resourcePath */ parser.initSlider = function(json, resourcePath){ - var widget = new ccui.Slider(); var loader = cc.loader; @@ -904,7 +867,6 @@ * @param resourcePath */ parser.initPageView = function(json, resourcePath){ - var widget = new ccui.PageView(); this.widgetAttributes(widget, json); @@ -945,7 +907,6 @@ setContentSize(widget, json["Size"]); return widget; - }; /** @@ -955,7 +916,6 @@ * @returns {ccui.ListView} */ parser.initListView = function(json, resourcePath){ - var widget = new ccui.ListView(); this.widgetAttributes(widget, json); @@ -971,6 +931,9 @@ widget.setBackGroundColorType(colorType); var bgColorOpacity = getParam(json["BackColorAlpha"], 255); + if(bgColorOpacity !== 255) + widget.setBackGroundColorOpacity(bgColorOpacity); + var backGroundScale9Enabled = json["Scale9Enable"]; if(backGroundScale9Enabled){ widget.setBackGroundImageScale9Enabled(true); @@ -1008,7 +971,6 @@ widget.setGravity(ccui.ListView.GRAVITY_CENTER_HORIZONTAL); } - var bounceEnabled = getParam(json["IsBounceEnabled"], false); widget.setBounceEnabled(bounceEnabled); @@ -1017,15 +979,12 @@ var innerSize = json["InnerNodeSize"]; //Width - if(innerSize != null) + if(innerSize) widget.setInnerContainerSize(cc.size(innerSize["Widget"]||0, innerSize["Height"]||0)); setLayoutBackground(widget, json["SingleColor"], json["FirstColor"], json["EndColor"]); setLayoutBackgroundVector(widget, json["ColorVector"]); - if(bgColorOpacity != null) - widget.setBackGroundColorOpacity(bgColorOpacity); - setContentSize(widget, json["Size"]); return widget; @@ -1038,7 +997,6 @@ * @returns {ccui.TextAtlas} */ parser.initTextAtlas = function(json, resourcePath){ - var widget = new ccui.TextAtlas(); var stringValue = json["LabelText"]; @@ -1064,12 +1022,12 @@ * @returns {ccui.TextBMFont} */ parser.initTextBMFont = function(json, resourcePath){ - var widget = new ccui.TextBMFont(); this.widgetAttributes(widget, json); var text = json["LabelText"]; - widget.setString(text); + if(text) + widget.setString(text); loadTexture(json["LabelBMFontFile_CNB"], resourcePath, function(path, type){ widget.setFntFile(path); @@ -1095,15 +1053,15 @@ } var placeHolder = json["PlaceHolderText"]; - if(placeHolder != null) + if(placeHolder) widget.setPlaceHolder(placeHolder); var fontSize = json["FontSize"]; - if(fontSize != null) + if(typeof fontSize === 'number') widget.setFontSize(fontSize); var fontName = json["FontName"]; - if(fontName && '' !== fontName) + if(fontName) widget.setFontName(fontName); var maxLengthEnabled = json["MaxLengthEnable"]; @@ -1117,13 +1075,12 @@ this.widgetAttributes(widget, json); var text = json["LabelText"]; - if(text != null) + if(text) widget.setString(text); var fontResource = json["FontResource"]; - if(fontResource != null){ + if(fontResource){ var path = fontResource["Path"]; - //resoutceType = fontResource["Type"]; if(path){ if (cc.sys.isNative) { fontName = cc.path.join(cc.loader.resPath, resourcePath, path); @@ -1148,9 +1105,7 @@ widget.getVirtualRenderer().setLineBreakWithoutSpace(true); } - return widget; - }; /** @@ -1159,7 +1114,6 @@ * @param resourcePath */ parser.initSimpleAudio = function(json, resourcePath){ - var node = new ccs.ComAudio(); var loop = json["Loop"] || false; //var volume = json["Volume"] || 0; @@ -1168,7 +1122,6 @@ loadTexture(json["FileData"], resourcePath, function(path, type){ node.setFile(path); }); - }; /** @@ -1178,7 +1131,6 @@ * @returns {*} */ parser.initGameMap = function(json, resourcePath){ - var node = null; loadTexture(json["FileData"], resourcePath, function(path, type){ @@ -1199,7 +1151,7 @@ */ parser.initProjectNode = function(json, resourcePath){ var projectFile = json["FileData"]; - if(projectFile != null && projectFile["Path"]){ + if(projectFile && projectFile["Path"]){ var file = resourcePath + projectFile["Path"]; if(cc.loader.getRes(file)){ var obj = ccs.load(file, resourcePath); @@ -1259,7 +1211,6 @@ node.getAnimation().play(currentAnimationName); node.getAnimation().gotoAndPause(0); } - }); parser.generalAttributes(node, json); @@ -1296,7 +1247,7 @@ var loadedPlist = {}; var loadTexture = function(json, resourcePath, cb){ - if(json != null){ + if(json !== undefined && json !== null){ var path = json["Path"]; var type; if(json["Type"] === "Default" || json["Type"] === "Normal") @@ -1321,7 +1272,7 @@ } else { var filePath = resourcePath + path; - if(path && "" !== path && jsb.fileUtils.isFileExist(filePath)) + if(path && jsb.fileUtils.isFileExist(filePath)) cb(filePath, type); else cb("", type); @@ -1330,11 +1281,14 @@ }; var getColor = function(json){ - if(!json) return; + if(json === undefined || json === null) + return cc.color(255,255,255,255); + var r = cc.isValidValue(json["R"]) ? json["R"] : 255; var g = cc.isValidValue(json["G"]) ? json["G"] : 255; var b = cc.isValidValue(json["B"]) ? json["B"] : 255; var a = cc.isValidValue(json["A"]) ? json["A"] : 255; + return cc.color(r, g, b, a); }; diff --git a/native/cocos/scripting/js-bindings/script/studio/parsers/uiParser-1.x.js b/native/cocos/scripting/js-bindings/script/studio/parsers/uiParser-1.x.js index aa40001f8b..51fe85a8d0 100644 --- a/native/cocos/scripting/js-bindings/script/studio/parsers/uiParser-1.x.js +++ b/native/cocos/scripting/js-bindings/script/studio/parsers/uiParser-1.x.js @@ -98,14 +98,14 @@ widget.setScaleY(scaleY); var rotation = options["rotation"]; - if(cc.isValidValue(rotation) && rotation !== 0) + if(rotation) widget.setRotation(rotation); if(options["visible"] === false) widget.setVisible(false); var ZOrder = options["ZOrder"]; - if(cc.isValidValue(ZOrder) && ZOrder !== 0) + if(ZOrder) widget.setLocalZOrder(ZOrder); var layout = options["layoutParameter"]; @@ -302,7 +302,7 @@ var sw = options["scale9Width"]; var sh = options["scale9Height"]; if (cc.isValidValue(sw) && cc.isValidValue(sh)) - button.setSize(cc.size(sw, sh)); + button.setContentSize(cc.size(sw, sh)); } var text = options["text"]; if (text) @@ -389,7 +389,7 @@ var sw = options["scale9Width"]; var sh = options["scale9Height"]; if (cc.isValidValue(sw) && cc.isValidValue(sh)) { - widget.setSize(cc.size(sw, sh)); + widget.setContentSize(cc.size(sw, sh)); } var cx = options["capInsetsX"]; diff --git a/native/cocos/ui/UIImageView.cpp b/native/cocos/ui/UIImageView.cpp index 4d7307f25b..7c1aedb3ed 100644 --- a/native/cocos/ui/UIImageView.cpp +++ b/native/cocos/ui/UIImageView.cpp @@ -161,6 +161,7 @@ void ImageView::setTextureRect(const Rect &rect) if (sprite) { sprite->setTextureRect(rect); + setupTexture(); } else { diff --git a/native/tools/bindings-generator b/native/tools/bindings-generator index a96c5e38fd..d73c478763 160000 --- a/native/tools/bindings-generator +++ b/native/tools/bindings-generator @@ -1 +1 @@ -Subproject commit a96c5e38fd7bab7eb881f285d14c36a37eb0cdcd +Subproject commit d73c4787636705aa31cb662ed79036b0f41aa6fd From cdbd28ce43521589a965e7461e393286b71833a9 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Wed, 27 Apr 2016 13:54:25 +0800 Subject: [PATCH 09/25] [JSB]Fixed crash when WebSocket is closed. --- .../scripting/js-bindings/manual/network/jsb_websocket.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/native/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp b/native/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp index cb992f8aea..ea4cbc715a 100644 --- a/native/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp +++ b/native/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp @@ -159,9 +159,8 @@ public: JS::RootedValue args(cx, OBJECT_TO_JSVAL(jsobj)); ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate.ref()), "onclose", 1, args.address()); - auto copy = &p->obj; + JS::RemoveObjectRoot(cx, &p->obj); jsb_remove_proxy(p); - JS::RemoveObjectRoot(cx, copy); } // Delete WebSocket instance From 43e89ca5fad8e19aa77c5642e42f5dd66ad59392 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Wed, 27 Apr 2016 13:55:14 +0800 Subject: [PATCH 10/25] Fixed warns --- native/cocos/Android.mk | 4 ++-- native/cocos/base/ccUTF8.cpp | 21 ++++++++++++------- native/cocos/platform/android/Android.mk | 4 ---- .../cocos/ui/UIEditBox/UIEditBoxImpl-common.h | 2 +- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/native/cocos/Android.mk b/native/cocos/Android.mk index 6cda88269b..c2e17a8906 100644 --- a/native/cocos/Android.mk +++ b/native/cocos/Android.mk @@ -203,9 +203,9 @@ LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dxandroid_static # define the macro to compile through support/zip_support/ioapi.c LOCAL_CFLAGS := -DUSE_FILE32API -fexceptions -LOCAL_CPPFLAGS := -Wno-deprecated-declarations -Wno-extern-c-compat +LOCAL_CPPFLAGS := -Wno-deprecated-declarations LOCAL_EXPORT_CFLAGS := -DUSE_FILE32API -LOCAL_EXPORT_CPPFLAGS := -Wno-deprecated-declarations -Wno-extern-c-compat +LOCAL_EXPORT_CPPFLAGS := -Wno-deprecated-declarations include $(BUILD_STATIC_LIBRARY) diff --git a/native/cocos/base/ccUTF8.cpp b/native/cocos/base/ccUTF8.cpp index 48b6607e5f..77fdfa76d3 100644 --- a/native/cocos/base/ccUTF8.cpp +++ b/native/cocos/base/ccUTF8.cpp @@ -167,14 +167,21 @@ long getCharacterCountInUTF8String(const std::string& utf8) } //namespace StringUtils { +namespace +{ + int wcslen_internal(const unsigned short* str) + { + if (str == nullptr) + return -1; + int i=0; + while(*str++) i++; + return i; + } +} int cc_wcslen(const unsigned short* str) { - if (str == nullptr) - return -1; - int i=0; - while(*str++) i++; - return i; + return wcslen_internal(str); } void cc_utf8_trim_ws(std::vector* str) @@ -224,7 +231,7 @@ std::vector cc_utf16_vec_from_utf16_str(const unsigned short* st if (str == nullptr) return str_new; - int len = cc_wcslen(str); + int len = wcslen_internal(str); for (int i = 0; i < len; ++i) { @@ -267,7 +274,7 @@ char * cc_utf16_to_utf8 (const unsigned short *str, std::u16string utf16; - int utf16Len = len < 0 ? cc_wcslen(str) : len; + int utf16Len = len < 0 ? wcslen_internal(str) : len; for (int i = 0; i < utf16Len; ++i) { diff --git a/native/cocos/platform/android/Android.mk b/native/cocos/platform/android/Android.mk index c889e79011..ceca429a99 100644 --- a/native/cocos/platform/android/Android.mk +++ b/native/cocos/platform/android/Android.mk @@ -34,8 +34,4 @@ LOCAL_EXPORT_LDLIBS := -lGLESv1_CM \ -llog \ -landroid -LOCAL_CPPFLAGS := -Wno-extern-c-compat - -LOCAL_EXPORT_CPPFLAGS := -Wno-extern-c-compat - include $(BUILD_STATIC_LIBRARY) diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.h b/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.h index 35d065bfd9..d284e11267 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.h +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.h @@ -37,7 +37,7 @@ namespace ui { class EditBox; -class EditBoxImplCommon : public EditBoxImpl +class CC_GUI_DLL EditBoxImplCommon : public EditBoxImpl { public: /** From 6da52bccadc7ccd2d9924ec8bff76d5f9eacd706 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Wed, 27 Apr 2016 14:16:02 +0800 Subject: [PATCH 11/25] Refine Websocket --- native/cocos/base/CCEventDispatcher.cpp | 4 +- native/cocos/network/WebSocket.cpp | 130 +++++++++------------ native/cocos/network/WebSocket.h | 3 +- native/cocos/renderer/CCGLProgramCache.cpp | 4 + 4 files changed, 65 insertions(+), 76 deletions(-) diff --git a/native/cocos/base/CCEventDispatcher.cpp b/native/cocos/base/CCEventDispatcher.cpp index ca03a133b3..7b0c5103f3 100644 --- a/native/cocos/base/CCEventDispatcher.cpp +++ b/native/cocos/base/CCEventDispatcher.cpp @@ -635,7 +635,9 @@ void EventDispatcher::removeEventListener(EventListener* listener) if (iter->second->empty()) { - _priorityDirtyFlagMap.erase(listener->getTypeKey()); + auto typeKey = listener->getTypeKey(); + if(_priorityDirtyFlagMap.find(typeKey) != _priorityDirtyFlagMap.end()) + _priorityDirtyFlagMap.erase(typeKey); auto list = iter->second; iter = _listenerMap.erase(iter); CC_SAFE_DELETE(list); diff --git a/native/cocos/network/WebSocket.cpp b/native/cocos/network/WebSocket.cpp index 0d43df7938..b8bddc29da 100644 --- a/native/cocos/network/WebSocket.cpp +++ b/native/cocos/network/WebSocket.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include "base/CCDirector.h" #include "base/CCScheduler.h" @@ -135,9 +136,9 @@ public: protected: void wsThreadEntryFunc(); private: - std::list* _subThreadWsMessageQueue; + std::list _subThreadWsMessageQueue; std::mutex _subThreadWsMessageQueueMutex; - std::thread* _subThreadInstance; + std::thread _subThreadInstance; WebSocket* _ws; friend class WebSocket; @@ -165,24 +166,19 @@ public: }; WsThreadHelper::WsThreadHelper() -: _subThreadInstance(nullptr) -, _ws(nullptr) +: _ws(nullptr) { - _subThreadWsMessageQueue = new (std::nothrow) std::list(); } WsThreadHelper::~WsThreadHelper() { - joinWebSocketThread(); - CC_SAFE_DELETE(_subThreadInstance); - delete _subThreadWsMessageQueue; } bool WsThreadHelper::createWebSocketThread(const WebSocket& ws) { _ws = const_cast(&ws); - _subThreadInstance = new (std::nothrow) std::thread(&WebSocket::onSubThreadLoop, _ws); + _subThreadInstance = std::thread(&WebSocket::onSubThreadLoop, _ws); return true; } @@ -195,14 +191,14 @@ void WsThreadHelper::sendMessageToCocosThread(const std::function& cb) void WsThreadHelper::sendMessageToWebSocketThread(WsMessage *msg) { std::lock_guard lk(_subThreadWsMessageQueueMutex); - _subThreadWsMessageQueue->push_back(msg); + _subThreadWsMessageQueue.push_back(msg); } void WsThreadHelper::joinWebSocketThread() { - if (_subThreadInstance->joinable()) + if (_subThreadInstance.joinable()) { - _subThreadInstance->join(); + _subThreadInstance.join(); } } @@ -262,17 +258,15 @@ enum WS_MSG { WS_MSG_TO_SUBTRHEAD_SENDING_BINARY, }; -static std::vector* __websocketInstances = nullptr; +static std::unordered_set* __websocketInstances = nullptr; void WebSocket::closeAllConnections() { if (__websocketInstances != nullptr) { auto copyInstances = *__websocketInstances; - ssize_t count = __websocketInstances->size(); - for (ssize_t i = count-1; i >=0 ; i--) + for (auto&& instance : copyInstances) { - WebSocket* instance = copyInstances.at(i); instance->close(); } @@ -287,7 +281,6 @@ WebSocket::WebSocket() , _wsHelper(nullptr) , _wsInstance(nullptr) , _wsContext(nullptr) -, _isDestroyed(std::make_shared>(false)) , _delegate(nullptr) , _SSLConnection(0) , _wsProtocols(nullptr) @@ -296,25 +289,36 @@ WebSocket::WebSocket() _receivedData.reserve(WS_RESERVE_RECEIVE_BUFFER_SIZE); if (__websocketInstances == nullptr) { - __websocketInstances = new (std::nothrow) std::vector(); + __websocketInstances = new (std::nothrow) std::unordered_set(); } - - __websocketInstances->push_back(this); + __websocketInstances->insert(this); auto eventDispatcher = Director::getInstance()->getEventDispatcher(); - auto isDestroyed = _isDestroyed; + auto instance = this; _resetDirectorListener = eventDispatcher->addCustomEventListener(Director::EVENT_RESET, - [this, isDestroyed](EventCustom*) + [instance](EventCustom*) { - if (*isDestroyed) - return; - close(); + if (__websocketInstances && __websocketInstances->find(instance) != __websocketInstances->end()) + { + instance->close(); + } }); } WebSocket::~WebSocket() { - *_isDestroyed = true; + if (__websocketInstances != nullptr) + { + auto iter = __websocketInstances->find(this); + if (iter != __websocketInstances->end()) + { + __websocketInstances->erase(iter); + } + else + { + LOGD("ERROR: WebSocket instance (%p) wasn't added to the container which saves websocket instances!\n", this); + } + } if (Director::DirectorInstance) { Director::DirectorInstance->getEventDispatcher()->removeEventListener(_resetDirectorListener); @@ -331,19 +335,6 @@ WebSocket::~WebSocket() } } CC_SAFE_DELETE_ARRAY(_wsProtocols); - - if (__websocketInstances != nullptr) - { - auto iter = std::find(__websocketInstances->begin(), __websocketInstances->end(), this); - if (iter != __websocketInstances->end()) - { - __websocketInstances->erase(iter); - } - else - { - LOGD("ERROR: WebSocket instance (%p) wasn't added to the container which saves websocket instances!\n", this); - } - } } bool WebSocket::init(const Delegate& delegate, @@ -533,7 +524,7 @@ void WebSocket::onSubThreadLoop() { _readStateMutex.unlock(); _wsHelper->_subThreadWsMessageQueueMutex.lock(); - bool isEmpty = _wsHelper->_subThreadWsMessageQueue->empty(); + bool isEmpty = _wsHelper->_subThreadWsMessageQueue.empty(); _wsHelper->_subThreadWsMessageQueueMutex.unlock(); if (!isEmpty) { @@ -644,15 +635,15 @@ void WebSocket::onClientWritable() { std::lock_guard lk(_wsHelper->_subThreadWsMessageQueueMutex); - if (_wsHelper->_subThreadWsMessageQueue->empty()) + if (_wsHelper->_subThreadWsMessageQueue.empty()) { return; } - std::list::iterator iter = _wsHelper->_subThreadWsMessageQueue->begin(); + std::list::iterator iter = _wsHelper->_subThreadWsMessageQueue.begin(); ssize_t bytesWrite = 0; - if (iter != _wsHelper->_subThreadWsMessageQueue->end()) + if (iter != _wsHelper->_subThreadWsMessageQueue.end()) { WsMessage* subThreadMsg = *iter; Data* data = (Data*)subThreadMsg->obj; @@ -683,7 +674,7 @@ void WebSocket::onClientWritable() delete frame; CC_SAFE_FREE(data->bytes); CC_SAFE_DELETE(data); - _wsHelper->_subThreadWsMessageQueue->erase(iter); + _wsHelper->_subThreadWsMessageQueue.erase(iter); CC_SAFE_DELETE(subThreadMsg); return; } @@ -725,7 +716,7 @@ void WebSocket::onClientWritable() delete ((WebSocketFrame*)data->ext); data->ext = nullptr; CC_SAFE_DELETE(data); - _wsHelper->_subThreadWsMessageQueue->erase(iter); + _wsHelper->_subThreadWsMessageQueue.erase(iter); CC_SAFE_DELETE(subThreadMsg); closeAsync(); @@ -764,7 +755,7 @@ void WebSocket::onClientWritable() delete ((WebSocketFrame*)data->ext); data->ext = nullptr; CC_SAFE_DELETE(data); - _wsHelper->_subThreadWsMessageQueue->erase(iter); + _wsHelper->_subThreadWsMessageQueue.erase(iter); CC_SAFE_DELETE(subThreadMsg); LOGD("-----------------------------------------------------------\n"); @@ -809,8 +800,8 @@ void WebSocket::onClientReceivedData(void* in, ssize_t len) frameData->push_back('\0'); } - auto isDestroyed = _isDestroyed; - _wsHelper->sendMessageToCocosThread([this, frameData, frameSize, isBinary, isDestroyed](){ + auto instance = this; + _wsHelper->sendMessageToCocosThread([instance, frameData, frameSize, isBinary](){ // In UI thread LOGD("Notify data len %d to Cocos thread.\n", (int)frameSize); @@ -819,13 +810,9 @@ void WebSocket::onClientReceivedData(void* in, ssize_t len) data.bytes = (char*)frameData->data(); data.len = frameSize; - if (*isDestroyed) + if (__websocketInstances && __websocketInstances->find(instance) != __websocketInstances->end()) { - LOGD("WebSocket instance was destroyed!\n"); - } - else - { - _delegate->onMessage(this, data); + instance->_delegate->onMessage(instance, data); } delete frameData; @@ -845,12 +832,11 @@ void WebSocket::onConnectionOpened() _readyState = State::OPEN; _readStateMutex.unlock(); - auto isDestroyed = _isDestroyed; - _wsHelper->sendMessageToCocosThread([this, isDestroyed](){ - if (*isDestroyed) { - LOGD("WebSocket instance was destroyed!\n"); - } else { - _delegate->onOpen(this); + auto instance = this; + _wsHelper->sendMessageToCocosThread([instance](){ + if (__websocketInstances && __websocketInstances->find(instance) != __websocketInstances->end()) + { + instance->_delegate->onOpen(instance); } }); } @@ -863,12 +849,11 @@ void WebSocket::onConnectionError() _readyState = State::CLOSING; _readStateMutex.unlock(); - auto isDestroyed = _isDestroyed; - _wsHelper->sendMessageToCocosThread([this, isDestroyed](){ - if (*isDestroyed) { - LOGD("WebSocket instance was destroyed!\n"); - } else { - _delegate->onError(this, ErrorCode::CONNECTION_FAILURE); + auto instance = this; + _wsHelper->sendMessageToCocosThread([instance](){ + if (__websocketInstances && __websocketInstances->find(instance) != __websocketInstances->end()) + { + instance->_delegate->onError(instance, ErrorCode::CONNECTION_FAILURE); } }); } @@ -887,14 +872,13 @@ void WebSocket::onConnectionClosed() _readyState = State::CLOSED; _readStateMutex.unlock(); - auto isDestroyed = _isDestroyed; - _wsHelper->sendMessageToCocosThread([this, isDestroyed](){ - if (*isDestroyed) { - LOGD("WebSocket instance was destroyed!\n"); - } else { + auto instance = this; + _wsHelper->sendMessageToCocosThread([instance](){ + if (__websocketInstances && __websocketInstances->find(instance) != __websocketInstances->end()) + { //Waiting for the subThread safety exit - _wsHelper->joinWebSocketThread(); - _delegate->onClose(this); + instance->_wsHelper->joinWebSocketThread(); + instance->_delegate->onClose(instance); } }); } diff --git a/native/cocos/network/WebSocket.h b/native/cocos/network/WebSocket.h index f9d79244c6..9755e2aa5f 100644 --- a/native/cocos/network/WebSocket.h +++ b/native/cocos/network/WebSocket.h @@ -30,7 +30,6 @@ #ifndef __CC_WEBSOCKET_H__ #define __CC_WEBSOCKET_H__ -#include #include #include #include @@ -238,7 +237,7 @@ private: struct lws* _wsInstance; struct lws_context* _wsContext; - std::shared_ptr> _isDestroyed; + Delegate* _delegate; int _SSLConnection; struct lws_protocols* _wsProtocols; diff --git a/native/cocos/renderer/CCGLProgramCache.cpp b/native/cocos/renderer/CCGLProgramCache.cpp index 9f2e786b12..e69364b77f 100644 --- a/native/cocos/renderer/CCGLProgramCache.cpp +++ b/native/cocos/renderer/CCGLProgramCache.cpp @@ -301,6 +301,10 @@ void GLProgramCache::reloadDefaultGLPrograms() p = getGLProgram(GLProgram::SHADER_CAMERA_CLEAR); p->reset(); loadDefaultGLProgram(p, kShaderType_CameraClear); + + p = getGLProgram(GLProgram::SHADER_NAME_POSITION_GRAYSCALE); + p->reset(); + loadDefaultGLProgram(p, kShaderType_UIGrayScale); } void GLProgramCache::reloadDefaultGLProgramsRelativeToLights() From 4d7038bdb66a6066e3c43f1979e773630cc7b52b Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Wed, 27 Apr 2016 20:04:20 +0800 Subject: [PATCH 12/25] Fixed the software keyboard gets opened by call EditBox::setVisible(true) on Android. (#47) --- native/cocos/audio/android/AudioEngine-inl.cpp | 8 ++++---- native/cocos/ui/UIEditBox/UIEditBoxImpl-android.cpp | 13 ++++++++----- native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/native/cocos/audio/android/AudioEngine-inl.cpp b/native/cocos/audio/android/AudioEngine-inl.cpp index e7b88c6ec7..16ce0d19f9 100644 --- a/native/cocos/audio/android/AudioEngine-inl.cpp +++ b/native/cocos/audio/android/AudioEngine-inl.cpp @@ -321,7 +321,7 @@ void AudioEngineImpl::setVolume(int audioID,float volume) } auto result = (*player._fdPlayerVolume)->SetVolumeLevel(player._fdPlayerVolume, dbVolume); if(SL_RESULT_SUCCESS != result){ - log("%s error:%lu",__func__, result); + log("%s error:%u",__func__, result); } } @@ -341,7 +341,7 @@ void AudioEngineImpl::pause(int audioID) auto& player = _audioPlayers[audioID]; auto result = (*player._fdPlayerPlay)->SetPlayState(player._fdPlayerPlay, SL_PLAYSTATE_PAUSED); if(SL_RESULT_SUCCESS != result){ - log("%s error:%lu",__func__, result); + log("%s error:%u",__func__, result); } } @@ -350,7 +350,7 @@ void AudioEngineImpl::resume(int audioID) auto& player = _audioPlayers[audioID]; auto result = (*player._fdPlayerPlay)->SetPlayState(player._fdPlayerPlay, SL_PLAYSTATE_PLAYING); if(SL_RESULT_SUCCESS != result){ - log("%s error:%lu",__func__, result); + log("%s error:%u",__func__, result); } } @@ -359,7 +359,7 @@ void AudioEngineImpl::stop(int audioID) auto& player = _audioPlayers[audioID]; auto result = (*player._fdPlayerPlay)->SetPlayState(player._fdPlayerPlay, SL_PLAYSTATE_STOPPED); if(SL_RESULT_SUCCESS != result){ - log("%s error:%lu",__func__, result); + log("%s error:%u",__func__, result); } /*If destroy openSL object immediately,it may cause dead lock. diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-android.cpp b/native/cocos/ui/UIEditBox/UIEditBoxImpl-android.cpp index 0939c9bbbb..91c65cb713 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-android.cpp +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-android.cpp @@ -43,7 +43,7 @@ NS_CC_BEGIN namespace ui { -#define LOGD(...) __android_log_print(ANDROID_LOG_ERROR,"",__VA_ARGS__) +#define LOGD(...) __android_log_print(ANDROID_LOG_ERROR,"cocos EditBoxImplAndroid",__VA_ARGS__) static void editBoxEditingDidBegin(int index); static void editBoxEditingDidChanged(int index, const std::string& text); static void editBoxEditingDidEnd(int index, const std::string& text); @@ -101,7 +101,7 @@ void EditBoxImplAndroid::createNativeControl(const Rect& frame) auto uiTop = frameSize.height /2 - (rightTop.y - winSize.height / 2) * glView->getScaleY(); auto uiWidth = (rightTop.x - leftBottom.x) * glView->getScaleX(); auto uiHeight = (rightTop.y - leftBottom.y) * glView->getScaleY(); - LOGD("scaleX = %f", glView->getScaleX()); + _editBoxIndex = JniHelper::callStaticIntMethod(editBoxClassName, "createEditBox", (int)uiLeft, (int)uiTop, (int)uiWidth, (int)uiHeight, (float)glView->getScaleX()); @@ -173,10 +173,12 @@ void EditBoxImplAndroid::setNativePlaceHolder(const char* pText) JniHelper::callStaticVoidMethod(editBoxClassName, "setPlaceHolderText", _editBoxIndex, pText); } - void EditBoxImplAndroid::setNativeVisible(bool visible) -{ // don't need to be implemented on android platform. - JniHelper::callStaticVoidMethod(editBoxClassName, "setVisible", _editBoxIndex, visible); +{ + if (!visible) + { + nativeCloseKeyboard(); + } } void EditBoxImplAndroid::updateNativeFrame(const Rect& rect) @@ -206,6 +208,7 @@ void editBoxEditingDidBegin(int index) s_allEditBoxes[index]->editBoxEditingDidBegin(); } } + void editBoxEditingDidChanged(int index, const std::string& text) { auto it = s_allEditBoxes.find(index); diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp b/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp index 3f95cf88ee..5a4c3fa9ee 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp @@ -145,7 +145,7 @@ void EditBoxImplCommon::setFontColor(const Color4B& color) void EditBoxImplCommon::setPlaceholderFont(const char* pFontName, int fontSize) { - this->setNativePlaceholderFont(pFontName, fontSize * _label->getNodeToWorldAffineTransform().a); + this->setNativePlaceholderFont(pFontName, fontSize * _labelPlaceHolder->getNodeToWorldAffineTransform().a); if( strlen(pFontName) > 0) { From d4481bfd5a4c4be9e99e2c64f2981698bdf0bbea Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Thu, 28 Apr 2016 11:58:34 +0800 Subject: [PATCH 13/25] Refine (#48) --- native/cocos/base/CCEventDispatcher.cpp | 4 ++-- native/cocos/base/CCProperties.cpp | 8 ++++---- native/cocos/base/CCProperties.h | 2 -- native/cocos/base/ZipUtils.cpp | 2 +- .../editor-support/cocosbuilder/CCBAnimationManager.cpp | 4 ++-- .../editor-support/cocosbuilder/CCBAnimationManager.h | 4 ++-- native/cocos/editor-support/cocosbuilder/CCBReader.cpp | 2 +- native/cocos/editor-support/cocosbuilder/CCBReader.h | 2 +- .../cocostudio/ActionTimeline/CCActionTimeline.cpp | 6 +++--- .../cocostudio/ActionTimeline/CCActionTimeline.h | 4 ++-- .../editor-support/cocostudio/ActionTimeline/CCFrame.h | 4 ++-- .../cocostudio/ActionTimeline/CCSkeletonNode.cpp | 2 +- .../cocostudio/ActionTimeline/CCSkeletonNode.h | 2 +- .../cocostudio/Armature/CCArmatureDataManager.cpp | 8 ++++---- .../cocostudio/Armature/CCDataReaderHelper.cpp | 2 +- native/cocos/editor-support/cocostudio/CCActionFrame.cpp | 2 +- native/cocos/editor-support/cocostudio/CCActionFrame.h | 2 +- native/cocos/editor-support/creator/CCScale9Sprite.cpp | 2 +- native/cocos/network/HttpClient-apple.mm | 6 +++--- native/cocos/network/HttpClient.cpp | 6 +++--- native/cocos/network/HttpCookie.cpp | 2 +- native/cocos/network/HttpCookie.h | 2 +- native/cocos/network/SocketIO.cpp | 8 ++++---- native/cocos/network/WebSocket.cpp | 6 +++--- native/cocos/renderer/CCTextureCache.cpp | 2 +- .../cocos/scripting/js-bindings/manual/ScriptingCore.cpp | 2 +- .../scripting/js-bindings/manual/cocos2d_specifics.cpp | 2 +- 27 files changed, 48 insertions(+), 50 deletions(-) diff --git a/native/cocos/base/CCEventDispatcher.cpp b/native/cocos/base/CCEventDispatcher.cpp index 7b0c5103f3..9b985d329d 100644 --- a/native/cocos/base/CCEventDispatcher.cpp +++ b/native/cocos/base/CCEventDispatcher.cpp @@ -874,7 +874,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event) } } } - else if (listener->_claimedTouches.size() > 0 + else if (!listener->_claimedTouches.empty() && ((removedIter = std::find(listener->_claimedTouches.begin(), listener->_claimedTouches.end(), *touchesIter)) != listener->_claimedTouches.end())) { isClaimed = true; @@ -951,7 +951,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event) // // process standard handlers 2nd // - if (allAtOnceListeners && mutableTouches.size() > 0) + if (allAtOnceListeners && !mutableTouches.empty()) { auto onTouchesEvent = [&](EventListener* l) -> bool{ diff --git a/native/cocos/base/CCProperties.cpp b/native/cocos/base/CCProperties.cpp index be483fa3fe..25589360bb 100644 --- a/native/cocos/base/CCProperties.cpp +++ b/native/cocos/base/CCProperties.cpp @@ -667,7 +667,7 @@ Properties* Properties::getNamespace(const char* id, bool searchNames, bool recu { CCASSERT(id, "invalid id"); - for (std::vector::const_iterator it = _namespaces.begin(); it < _namespaces.end(); ++it) + for (auto it = _namespaces.begin(); it < _namespaces.end(); ++it) { Properties* p = *it; if (strcmp(searchNames ? p->_namespace.c_str() : p->_id.c_str(), id) == 0) @@ -700,7 +700,7 @@ bool Properties::exists(const char* name) const if (name == NULL) return false; - for (std::vector::const_iterator itr = _properties.begin(); itr != _properties.end(); ++itr) + for (auto itr = _properties.begin(); itr != _properties.end(); ++itr) { if (itr->name == name) return true; @@ -790,7 +790,7 @@ const char* Properties::getString(const char* name, const char* defaultValue) co return getVariable(variable, defaultValue); } - for (std::vector::const_iterator itr = _properties.begin(); itr != _properties.end(); ++itr) + for (auto itr = _properties.begin(); itr != _properties.end(); ++itr) { if (itr->name == name) { @@ -824,7 +824,7 @@ bool Properties::setString(const char* name, const char* value) { if (name) { - for (std::vector::iterator itr = _properties.begin(); itr != _properties.end(); ++itr) + for (auto itr = _properties.begin(); itr != _properties.end(); ++itr) { if (itr->name == name) { diff --git a/native/cocos/base/CCProperties.h b/native/cocos/base/CCProperties.h index c7febc2647..d03ce30d5a 100644 --- a/native/cocos/base/CCProperties.h +++ b/native/cocos/base/CCProperties.h @@ -159,8 +159,6 @@ class Data; */ class CC_DLL Properties { - friend class Game; - public: /** diff --git a/native/cocos/base/ZipUtils.cpp b/native/cocos/base/ZipUtils.cpp index c2a4194226..4a48bc5b99 100644 --- a/native/cocos/base/ZipUtils.cpp +++ b/native/cocos/base/ZipUtils.cpp @@ -620,7 +620,7 @@ unsigned char *ZipFile::getFileData(const std::string &fileName, ssize_t *size) CC_BREAK_IF(!_data->zipFile); CC_BREAK_IF(fileName.empty()); - ZipFilePrivate::FileListContainer::const_iterator it = _data->fileList.find(fileName); + auto it = _data->fileList.find(fileName); CC_BREAK_IF(it == _data->fileList.end()); ZipEntryInfo fileInfo = it->second; diff --git a/native/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp b/native/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp index fed9421b6d..d4f7db7376 100644 --- a/native/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp +++ b/native/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp @@ -116,7 +116,7 @@ void CCBAnimationManager::addDocumentCallbackNode(Node *node) _documentCallbackNodes.pushBack(node); } -void CCBAnimationManager::addDocumentCallbackName(std::string name) +void CCBAnimationManager::addDocumentCallbackName(const std::string& name) { _documentCallbackNames.push_back(Value(name)); } @@ -146,7 +146,7 @@ void CCBAnimationManager::addDocumentOutletNode(Node *node) _documentOutletNodes.pushBack(node); } -void CCBAnimationManager::addDocumentOutletName(std::string name) +void CCBAnimationManager::addDocumentOutletName(const std::string& name) { _documentOutletNames.push_back(Value(name)); } diff --git a/native/cocos/editor-support/cocosbuilder/CCBAnimationManager.h b/native/cocos/editor-support/cocosbuilder/CCBAnimationManager.h index 10cb8e4767..5387f9f149 100644 --- a/native/cocos/editor-support/cocosbuilder/CCBAnimationManager.h +++ b/native/cocos/editor-support/cocosbuilder/CCBAnimationManager.h @@ -52,11 +52,11 @@ public: void addDocumentCallbackNode(cocos2d::Node *node); - void addDocumentCallbackName(std::string name); + void addDocumentCallbackName(const std::string& name); void addDocumentCallbackControlEvents(cocos2d::extension::Control::EventType eventType); void addDocumentOutletNode(cocos2d::Node *node); - void addDocumentOutletName(std::string name); + void addDocumentOutletName(const std::string& name); void setDocumentControllerName(const std::string &name); diff --git a/native/cocos/editor-support/cocosbuilder/CCBReader.cpp b/native/cocos/editor-support/cocosbuilder/CCBReader.cpp index 780bb7ba3e..b4cae756ec 100644 --- a/native/cocos/editor-support/cocosbuilder/CCBReader.cpp +++ b/native/cocos/editor-support/cocosbuilder/CCBReader.cpp @@ -1061,7 +1061,7 @@ Vector& CCBReader::getAnimationManagersForNodes() return _animationManagersForNodes; } -void CCBReader::addOwnerOutletName(std::string name) +void CCBReader::addOwnerOutletName(const std::string& name) { _ownerOutletNames.push_back(name); } diff --git a/native/cocos/editor-support/cocosbuilder/CCBReader.h b/native/cocos/editor-support/cocosbuilder/CCBReader.h index 18033db968..6eb90f6bb1 100644 --- a/native/cocos/editor-support/cocosbuilder/CCBReader.h +++ b/native/cocos/editor-support/cocosbuilder/CCBReader.h @@ -342,7 +342,7 @@ public: */ cocos2d::Node* readFileWithCleanUp(bool bCleanUp, CCBAnimationManagerMapPtr am); - void addOwnerOutletName(std::string name); + void addOwnerOutletName(const std::string& name); void addOwnerOutletNode(cocos2d::Node *node); private: diff --git a/native/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp b/native/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp index 0c819ea512..ffd924cb27 100644 --- a/native/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp +++ b/native/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp @@ -93,7 +93,7 @@ bool ActionTimeline::init() return true; } -void ActionTimeline::play(std::string name, bool loop) +void ActionTimeline::play(const std::string& name, bool loop) { if (name.empty() || _animationInfos.find(name) == _animationInfos.end()) { @@ -193,7 +193,7 @@ ActionTimeline* ActionTimeline::clone() const void ActionTimeline::step(float delta) { - if (!_playing || _timelineMap.size() == 0 || _duration == 0) + if (!_playing || _timelineMap.empty() || _duration == 0) { return; } @@ -310,7 +310,7 @@ void ActionTimeline::addAnimationInfo(const AnimationInfo& animationInfo) addFrameEndCallFunc(animationInfo.endIndex, animationInfo.name, animationInfo.clipEndCallBack); } -void ActionTimeline::removeAnimationInfo(std::string animationName) +void ActionTimeline::removeAnimationInfo(const std::string& animationName) { auto clipIter = _animationInfos.find(animationName); if (clipIter == _animationInfos.end()) diff --git a/native/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h b/native/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h index 80d266b3e4..89e34501af 100644 --- a/native/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h +++ b/native/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h @@ -80,7 +80,7 @@ public: ActionTimeline(); virtual ~ActionTimeline(); - virtual void play(std::string animationName, bool loop); + virtual void play(const std::string& animationName, bool loop); virtual bool init(); @@ -153,7 +153,7 @@ public: /** AnimationInfo*/ virtual void addAnimationInfo(const AnimationInfo& animationInfo); - virtual void removeAnimationInfo(std::string animationName); + virtual void removeAnimationInfo(const std::string& animationName); virtual bool IsAnimationInfoExists(const std::string& animationName); virtual const AnimationInfo& getAnimationInfo(const std::string& animationName); /**add a frame end call back to animation's end frame diff --git a/native/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h b/native/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h index b7cbd5eea6..ae7214bd8b 100644 --- a/native/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h +++ b/native/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h @@ -121,7 +121,7 @@ public: virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override; virtual Frame* clone() override; - inline void setTextureName(std::string textureName) { _textureName = textureName;} + inline void setTextureName(const std::string& textureName) { _textureName = textureName;} inline std::string getTextureName() const { return _textureName; } protected: @@ -371,7 +371,7 @@ public: virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override; virtual Frame* clone() override; - inline void setEvent(std::string event) { _event = event;} + inline void setEvent(const std::string& event) { _event = event;} inline std::string getEvent() const { return _event; } protected: diff --git a/native/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp b/native/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp index 0c5dd3a03f..d97397be62 100644 --- a/native/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp +++ b/native/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp @@ -312,7 +312,7 @@ const cocos2d::Map& SkeletonNode::getAllSubBonesMap() co return _subBonesMap; } -void SkeletonNode::addSkinGroup(std::string groupName, std::map boneSkinNameMap) +void SkeletonNode::addSkinGroup(const std::string& groupName, const std::map& boneSkinNameMap) { _skinGroupMap.insert(std::make_pair(groupName, boneSkinNameMap)); } diff --git a/native/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.h b/native/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.h index 44b02a219e..af9ec5809d 100644 --- a/native/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.h +++ b/native/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.h @@ -68,7 +68,7 @@ public: *@param: groupName, key *@param: boneSkinNameMap, map */ - void addSkinGroup(std::string groupName, std::map boneSkinNameMap); + void addSkinGroup(const std::string& groupName, const std::map& boneSkinNameMap); cocos2d::Rect getBoundingBox() const override; diff --git a/native/cocos/editor-support/cocostudio/Armature/CCArmatureDataManager.cpp b/native/cocos/editor-support/cocostudio/Armature/CCArmatureDataManager.cpp index bc66c2e30d..3f62887c3f 100644 --- a/native/cocos/editor-support/cocostudio/Armature/CCArmatureDataManager.cpp +++ b/native/cocos/editor-support/cocostudio/Armature/CCArmatureDataManager.cpp @@ -94,22 +94,22 @@ void ArmatureDataManager::removeArmatureFileInfo(const std::string& configFilePa { if (RelativeData *data = getRelativeData(configFilePath)) { - for (std::string str : data->armatures) + for (auto&& str : data->armatures) { removeArmatureData(str); } - for (std::string str : data->animations) + for (auto&& str : data->animations) { removeAnimationData(str); } - for (std::string str : data->textures) + for (auto&& str : data->textures) { removeTextureData(str); } - for (std::string str : data->plistFiles) + for (auto&& str : data->plistFiles) { SpriteFrameCacheHelper::getInstance()->removeSpriteFrameFromFile(str); } diff --git a/native/cocos/editor-support/cocostudio/Armature/CCDataReaderHelper.cpp b/native/cocos/editor-support/cocostudio/Armature/CCDataReaderHelper.cpp index 1d32aaa4b9..28784133ee 100644 --- a/native/cocos/editor-support/cocostudio/Armature/CCDataReaderHelper.cpp +++ b/native/cocos/editor-support/cocostudio/Armature/CCDataReaderHelper.cpp @@ -522,7 +522,7 @@ void DataReaderHelper::addDataAsyncCallBack(float dt) void DataReaderHelper::removeConfigFile(const std::string& configFile) { std::vector::iterator it = _configFileList.end(); - for (std::vector::iterator i = _configFileList.begin(); i != _configFileList.end(); i++) + for (auto i = _configFileList.begin(); i != _configFileList.end(); i++) { if (*i == configFile) { diff --git a/native/cocos/editor-support/cocostudio/CCActionFrame.cpp b/native/cocos/editor-support/cocostudio/CCActionFrame.cpp index 4937d678ef..b7e0973405 100644 --- a/native/cocos/editor-support/cocostudio/CCActionFrame.cpp +++ b/native/cocos/editor-support/cocostudio/CCActionFrame.cpp @@ -88,7 +88,7 @@ ActionInterval* ActionFrame::getAction(float fDuration,ActionFrame* srcFrame) return this->getAction(fDuration); } -void ActionFrame::setEasingParameter(std::vector& parameter) +void ActionFrame::setEasingParameter(const std::vector& parameter) { _Parameter.clear(); diff --git a/native/cocos/editor-support/cocostudio/CCActionFrame.h b/native/cocos/editor-support/cocostudio/CCActionFrame.h index 19fea31557..de886e1562 100644 --- a/native/cocos/editor-support/cocostudio/CCActionFrame.h +++ b/native/cocos/editor-support/cocostudio/CCActionFrame.h @@ -189,7 +189,7 @@ public: *@parame parameter the parameter for frame ease * */ - virtual void setEasingParameter(std::vector& parameter); + virtual void setEasingParameter(const std::vector& parameter); protected: /** * Gets the Easing Action of ActionFrame. diff --git a/native/cocos/editor-support/creator/CCScale9Sprite.cpp b/native/cocos/editor-support/creator/CCScale9Sprite.cpp index ad3a4ce0d3..b9a9fbc671 100644 --- a/native/cocos/editor-support/creator/CCScale9Sprite.cpp +++ b/native/cocos/editor-support/creator/CCScale9Sprite.cpp @@ -1079,7 +1079,7 @@ void Scale9SpriteV2::draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &tran } - if (this->_indices.size() > 0 && this->_verts.size() > 0) { + if (!_indices.empty() && !_verts.empty()) { cocos2d::TrianglesCommand::Triangles triangles; triangles.indices = &this->_indices[0]; triangles.verts = &this->_verts[0]; diff --git a/native/cocos/network/HttpClient-apple.mm b/native/cocos/network/HttpClient-apple.mm index 2b6e210f17..d4114a3305 100644 --- a/native/cocos/network/HttpClient-apple.mm +++ b/native/cocos/network/HttpClient-apple.mm @@ -151,7 +151,7 @@ static int processTask(HttpClient* client, HttpRequest* request, NSString* reque if(!headers.empty()) { /* append custom headers one by one */ - for (std::vector::iterator it = headers.begin(); it != headers.end(); ++it) + for (auto it = headers.begin(); it != headers.end(); ++it) { unsigned long i = it->find(':', 0); unsigned long length = it->size(); @@ -282,13 +282,13 @@ static int processTask(HttpClient* client, HttpRequest* request, NSString* reque [header deleteCharactersInRange:range]; } NSData *headerData = [header dataUsingEncoding:NSUTF8StringEncoding]; - std::vector *headerBuffer = (std::vector*)headerStream; + auto headerBuffer = (std::vector*)headerStream; const void* headerptr = [headerData bytes]; long headerlen = [headerData length]; headerBuffer->insert(headerBuffer->end(), (char*)headerptr, (char*)headerptr+headerlen); //handle response data - std::vector *recvBuffer = (std::vector*)stream; + auto recvBuffer = (std::vector*)stream; const void* ptr = [httpAsynConn.responseData bytes]; long len = [httpAsynConn.responseData length]; recvBuffer->insert(recvBuffer->end(), (char*)ptr, (char*)ptr+len); diff --git a/native/cocos/network/HttpClient.cpp b/native/cocos/network/HttpClient.cpp index 835d9fd5f4..085091e769 100644 --- a/native/cocos/network/HttpClient.cpp +++ b/native/cocos/network/HttpClient.cpp @@ -46,7 +46,7 @@ typedef size_t (*write_callback)(void *ptr, size_t size, size_t nmemb, void *str // Callback function used by libcurl for collect response data static size_t writeData(void *ptr, size_t size, size_t nmemb, void *stream) { - std::vector *recvBuffer = (std::vector*)stream; + auto recvBuffer = (std::vector*)stream; size_t sizes = size * nmemb; // add data to the end of recvBuffer @@ -59,7 +59,7 @@ static size_t writeData(void *ptr, size_t size, size_t nmemb, void *stream) // Callback function used by libcurl for collect header data static size_t writeHeaderData(void *ptr, size_t size, size_t nmemb, void *stream) { - std::vector *recvBuffer = (std::vector*)stream; + auto recvBuffer = (std::vector*)stream; size_t sizes = size * nmemb; // add data to the end of recvBuffer @@ -253,7 +253,7 @@ public: if(!headers.empty()) { /* append custom headers one by one */ - for (std::vector::iterator it = headers.begin(); it != headers.end(); ++it) + for (auto it = headers.begin(); it != headers.end(); ++it) _headers = curl_slist_append(_headers,it->c_str()); /* set custom headers for curl */ if (!setOption(CURLOPT_HTTPHEADER, _headers)) diff --git a/native/cocos/network/HttpCookie.cpp b/native/cocos/network/HttpCookie.cpp index 662308acc6..e41ee5c71c 100644 --- a/native/cocos/network/HttpCookie.cpp +++ b/native/cocos/network/HttpCookie.cpp @@ -152,7 +152,7 @@ void HttpCookie::writeFile() fclose(out); } -void HttpCookie::setCookieFileName(std::string filename) +void HttpCookie::setCookieFileName(const std::string& filename) { _cookieFileName = filename; } diff --git a/native/cocos/network/HttpCookie.h b/native/cocos/network/HttpCookie.h index 387aa422ac..87cc9820cc 100644 --- a/native/cocos/network/HttpCookie.h +++ b/native/cocos/network/HttpCookie.h @@ -43,7 +43,7 @@ public: void readFile(); void writeFile(); - void setCookieFileName(const std::string fileName); + void setCookieFileName(const std::string& fileName); const std::vector* getCookies()const; const CookiesInfo* getMatchCookie(const std::string& url) const; diff --git a/native/cocos/network/SocketIO.cpp b/native/cocos/network/SocketIO.cpp index 8901048ea7..d696ba2a55 100644 --- a/native/cocos/network/SocketIO.cpp +++ b/native/cocos/network/SocketIO.cpp @@ -76,7 +76,7 @@ public: std::vector getData()const{ return _args; }; virtual std::string stringify()const; - static SocketIOPacket * createPacketWithType(std::string type, SocketIOVersion version); + static SocketIOPacket * createPacketWithType(const std::string& type, SocketIOVersion version); static SocketIOPacket * createPacketWithTypeIndex(int type, SocketIOVersion version); protected: std::string _pId;//id message @@ -171,7 +171,7 @@ std::string SocketIOPacket::toString()const int SocketIOPacket::typeAsNumber()const { std::string::size_type num = 0; - std::vector::const_iterator item = std::find(_types.begin(), _types.end(), _type); + auto item = std::find(_types.begin(), _types.end(), _type); if (item != _types.end()) { num = item - _types.begin(); @@ -251,7 +251,7 @@ SocketIOPacketV10x::SocketIOPacketV10x() int SocketIOPacketV10x::typeAsNumber()const { std::vector::size_type num = 0; - std::vector::const_iterator item = std::find(_typesMessage.begin(), _typesMessage.end(), _type); + auto item = std::find(_typesMessage.begin(), _typesMessage.end(), _type); if (item != _typesMessage.end()) {//it's a message num = item - _typesMessage.begin(); @@ -302,7 +302,7 @@ SocketIOPacketV10x::~SocketIOPacketV10x() _endpoint = ""; } -SocketIOPacket * SocketIOPacket::createPacketWithType(std::string type, SocketIOPacket::SocketIOVersion version) +SocketIOPacket * SocketIOPacket::createPacketWithType(const std::string& type, SocketIOPacket::SocketIOVersion version) { SocketIOPacket *ret; switch (version) diff --git a/native/cocos/network/WebSocket.cpp b/native/cocos/network/WebSocket.cpp index b8bddc29da..68daf9f270 100644 --- a/native/cocos/network/WebSocket.cpp +++ b/native/cocos/network/WebSocket.cpp @@ -382,7 +382,7 @@ bool WebSocket::init(const Delegate& delegate, LOGD("[WebSocket::init] _host: %s, _port: %d, _path: %s\n", _host.c_str(), _port, _path.c_str()); size_t protocolCount = 0; - if (protocols && protocols->size() > 0) + if (protocols && !protocols->empty()) { protocolCount = protocols->size(); } @@ -394,10 +394,10 @@ bool WebSocket::init(const Delegate& delegate, _wsProtocols = new (std::nothrow) lws_protocols[protocolCount+1]; memset(_wsProtocols, 0, sizeof(lws_protocols)*(protocolCount+1)); - if (protocols && protocols->size() > 0) + if (protocols && !protocols->empty()) { int i = 0; - for (std::vector::const_iterator iter = protocols->begin(); iter != protocols->end(); ++iter, ++i) + for (auto iter = protocols->begin(); iter != protocols->end(); ++iter, ++i) { char* name = new (std::nothrow) char[(*iter).length()+1]; strcpy(name, (*iter).c_str()); diff --git a/native/cocos/renderer/CCTextureCache.cpp b/native/cocos/renderer/CCTextureCache.cpp index 1f3c6e749c..d35eccf1f6 100644 --- a/native/cocos/renderer/CCTextureCache.cpp +++ b/native/cocos/renderer/CCTextureCache.cpp @@ -781,7 +781,7 @@ void VolatileTextureMgr::reloadAllTextures() break; case VolatileTexture::kString: { - vt->_texture->initWithString(vt->_text.c_str(), vt->_fontDefinition); + vt->_texture->initWithString(vt->_text, vt->_fontDefinition); } break; case VolatileTexture::kImage: diff --git a/native/cocos/scripting/js-bindings/manual/ScriptingCore.cpp b/native/cocos/scripting/js-bindings/manual/ScriptingCore.cpp index 26f90305d4..93bfa849a9 100644 --- a/native/cocos/scripting/js-bindings/manual/ScriptingCore.cpp +++ b/native/cocos/scripting/js-bindings/manual/ScriptingCore.cpp @@ -600,7 +600,7 @@ void ScriptingCore::createGlobalContext() { runScript("script/jsb_prepare.js", globalRef, _cx); - for (std::vector::iterator it = registrationList.begin(); it != registrationList.end(); it++) { + for (auto it = registrationList.begin(); it != registrationList.end(); it++) { sc_register_sth callback = *it; callback(_cx, _global.ref()); } diff --git a/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp b/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp index 9b02979d00..31428d7868 100644 --- a/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp +++ b/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp @@ -4003,7 +4003,7 @@ static jsval string_vector_to_jsval(JSContext* cx, const std::vector::const_iterator iter = arr.begin(); iter != arr.end(); ++iter, ++i) { + for(auto iter = arr.begin(); iter != arr.end(); ++iter, ++i) { JS::RootedValue arrElement(cx, std_string_to_jsval(cx, *iter)); if(!JS_SetElement(cx, jsretArr, i, arrElement)) { break; From 5159d14367a4be94d7b1cb03d1fed15ebfaa89c2 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Thu, 28 Apr 2016 23:31:25 +0800 Subject: [PATCH 14/25] Bug fix --- native/cocos/2d/CCClippingNode.cpp | 4 +--- native/cocos/2d/CCSprite.cpp | 10 +++++----- native/cocos/ui/UIImageView.cpp | 5 ++++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/native/cocos/2d/CCClippingNode.cpp b/native/cocos/2d/CCClippingNode.cpp index 24aaa23044..241deb5651 100644 --- a/native/cocos/2d/CCClippingNode.cpp +++ b/native/cocos/2d/CCClippingNode.cpp @@ -107,9 +107,7 @@ bool ClippingNode::init() bool ClippingNode::init(Node *stencil) { - CC_SAFE_RELEASE(_stencil); - _stencil = stencil; - CC_SAFE_RETAIN(_stencil); + setStencil(stencil); return true; } diff --git a/native/cocos/2d/CCSprite.cpp b/native/cocos/2d/CCSprite.cpp index d3ca07ca09..c72f2ffeb5 100644 --- a/native/cocos/2d/CCSprite.cpp +++ b/native/cocos/2d/CCSprite.cpp @@ -144,7 +144,7 @@ Sprite* Sprite::create() bool Sprite::init() { - return initWithTexture(nullptr, Rect::ZERO ); + return initWithTexture(nullptr, Rect::ZERO, false); } bool Sprite::initWithTexture(Texture2D *texture) @@ -158,7 +158,7 @@ bool Sprite::initWithTexture(Texture2D *texture) Rect rect = Rect::ZERO; rect.size = texture->getContentSize(); - return initWithTexture(texture, rect); + return initWithTexture(texture, rect, false); } bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect) @@ -175,7 +175,7 @@ bool Sprite::initWithFile(const std::string& filename) { Rect rect = Rect::ZERO; rect.size = texture->getContentSize(); - return initWithTexture(texture, rect); + return initWithTexture(texture, rect, false); } return false; @@ -188,7 +188,7 @@ bool Sprite::initWithFile(const std::string &filename, const Rect& rect) Texture2D *texture = _director->getTextureCache()->addImage(filename); if (texture) { - return initWithTexture(texture, rect); + return initWithTexture(texture, rect, false); } return false; @@ -336,7 +336,7 @@ void Sprite::setTexture(const std::string &filename) Texture2D *texture = _director->getTextureCache()->addImage(filename); setTexture(texture); - + _unflippedOffsetPositionFromCenter = Vec2::ZERO; Rect rect = Rect::ZERO; if (texture) rect.size = texture->getContentSize(); diff --git a/native/cocos/ui/UIImageView.cpp b/native/cocos/ui/UIImageView.cpp index 7c1aedb3ed..4e333607b4 100644 --- a/native/cocos/ui/UIImageView.cpp +++ b/native/cocos/ui/UIImageView.cpp @@ -158,15 +158,18 @@ void ImageView::setTextureRect(const Rect &rect) else { auto sprite = _imageRenderer->getSprite(); + _imageRenderer->setScale9Enabled(false); if (sprite) { sprite->setTextureRect(rect); - setupTexture(); } else { CCLOG("Warning!! you should load texture before set the texture's rect!"); } + + _imageRenderer->setContentSize(rect.size); + setupTexture(); } } From e2a4f300ec8d5ea1075521685b661c12de4976d9 Mon Sep 17 00:00:00 2001 From: 2youyou2 <501251991@qq.com> Date: Wed, 20 Apr 2016 16:02:58 +0800 Subject: [PATCH 15/25] fixed default-template release build on windows --- .../frameworks/runtime-src/proj.win32/HelloJavascript.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/templates/js-template-default/frameworks/runtime-src/proj.win32/HelloJavascript.vcxproj b/native/templates/js-template-default/frameworks/runtime-src/proj.win32/HelloJavascript.vcxproj index 796940db23..ce343ff9ac 100755 --- a/native/templates/js-template-default/frameworks/runtime-src/proj.win32/HelloJavascript.vcxproj +++ b/native/templates/js-template-default/frameworks/runtime-src/proj.win32/HelloJavascript.vcxproj @@ -143,7 +143,7 @@ copy "$(ProjectDir)..\..\..\project.json" "$(OutDir)\" /Y game_p.c - $(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;%(AdditionalIncludeDirectories) + $(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\spidermonkey;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include;$(EngineRoot)extensions;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) From 72bebecd6d35952cf52b3274a02c4a4a17d309f7 Mon Sep 17 00:00:00 2001 From: Nan Wang Date: Thu, 21 Apr 2016 16:22:21 +0800 Subject: [PATCH 16/25] Add workflow to generate release package, prebuilt libs and simulator --- native/.gitignore | 6 ++ native/gulpfile.js | 175 ++++++++++++++++++++++++++++++++++++++++++++ native/package.json | 25 +++++++ 3 files changed, 206 insertions(+) create mode 100644 native/gulpfile.js create mode 100644 native/package.json diff --git a/native/.gitignore b/native/.gitignore index 5b9e8fdc4a..3d73eb4e97 100644 --- a/native/.gitignore +++ b/native/.gitignore @@ -1,6 +1,12 @@ # Ignore thumbnails created by windows Thumbs.db +# Ignore npm files +/node_modules +/tools/make-package/cocos2d-x.zip +/simulator_*.zip +/prebuilt_*.zip + # Ignore files build by Visual Studio *.obj *.exe diff --git a/native/gulpfile.js b/native/gulpfile.js new file mode 100644 index 0000000000..75d8941ba3 --- /dev/null +++ b/native/gulpfile.js @@ -0,0 +1,175 @@ +'use strict'; + +var gulp = require('gulp'); +var gulpSequence = require('gulp-sequence'); +var zip = require('gulp-zip'); +var Ftp = require('ftp'); +var ExecSync = require('child_process').execSync; +var spawn = require('child_process').spawn; +var Path = require('path'); +var fs = require('fs'); + +gulp.task('make-cocos2d-x', gulpSequence('gen-cocos2d-x', 'upload-cocos2d-x')); +gulp.task('make-prebuilt', gulpSequence('gen-libs', 'archive-prebuilt', 'upload-prebuilt')); +gulp.task('make-simulator', gulpSequence('gen-simulator', 'archive-simulator', 'upload-simulator')); + +function execSync(cmd, workPath) { + var execOptions = { + cwd : workPath, + stdio : 'inherit' + }; + ExecSync(cmd, execOptions); +} + +function upload2Ftp(localPath, ftpPath, config, cb) { + var ftpClient = new Ftp(); + ftpClient.on('error', function(err) { + if (err) { + cb(err); + } + }); + ftpClient.on('ready', function() { + var dirName = Path.dirname(ftpPath); + ftpClient.mkdir(dirName, true, function(err) { + if (err) { + cb(err); + } + }); + + ftpClient.put(localPath, ftpPath, function(err) { + if (err) { + cb(err); + } + ftpClient.end(); + cb(); + }); + }); + + // connect to ftp + ftpClient.connect(config); +} + +function uploadZipFile (zipFileName, path, cb) { + var remotePath = Path.join('TestBuilds','Fireball', 'cocos2d-x', zipFileName); + var zipFilePath = Path.join(path, zipFileName); + upload2Ftp(zipFilePath, remotePath, { + host: '192.168.52.109', + user: process.env.ftpUser, + password: process.env.ftpPass + },function(err) { + if (err) { + throw err; + } + cb(); + }); +} + +gulp.task('init', function(cb) { + execSync('python download-deps.py', '.'); + execSync('git submodule update --init', '.'); + cb(); +}); + +gulp.task('gen-libs', function(cb) { + execSync('./tools/cocos2d-console/bin/cocos gen-libs -m release', '.'); + cb(); +}); + +gulp.task('gen-cocos2d-x', function (cb) { + execSync('./git-archive-all cocos2d-x.zip', './tools/make-package'); + cb(); +}); + +gulp.task('gen-simulator', function (cb) { + var cocosConsoleRoot = './tools/cocos2d-console/bin'; + var cocosConsoleBin; + if (process.platform === 'darwin') { + cocosConsoleBin = Path.join(cocosConsoleRoot, 'cocos'); + } + else { + cocosConsoleBin = Path.join(cocosConsoleRoot, 'cocos.bat'); + } + var args; + if (process.platform === 'darwin') { + args = ['gen-simulator', '-m', 'debug', '-p', 'mac']; + } + else { + args = ['gen-simulator', '-m', 'debug', '-p', 'win32', '--vs', '2013', '--ol', 'en']; + } + try { + var child = spawn(cocosConsoleBin, args); + child.stdout.on('data', function (data) { + console.log(data.toString()); + }); + child.stderr.on('data', function (data) { + console.error(data.toString()); + }); + child.on('close', (code) => { + if (code !== 0) { + console.error('Generate simulator failed'); + cb(); + return; + } + + //var src, dest; + + //if (process.platform === 'darwin') { + // src = './cocos2d-x/simulator/mac/Simulator.app'; + // dest = './utils/simulator/mac/Simulator.app'; + //} + //else { + // src = './cocos2d-x/simulator/win32/'; + // dest = './utils/simulator/win32'; + //} + // + //if (!Fs.existsSync(src)) { + // console.error(`Can\'t find simulator [${src}]`); + // cb(); + // return; + //} + // + //if (Fs.existsSync(dest)) { + // Del.sync(dest, {force: true}); + //} + // + //Fs.copySync(src, dest); + }); + child.on('error', function () { + console.error('Generate simulator failed'); + cb(); + }); + } + catch (err) { + console.error(err); + cb(); + return; + } +}); + +gulp.task('archive-simulator', function () { + return gulp.src('./simulator/**/*') + .pipe(zip('simulator_' + process.platform + '.zip')) + .pipe(gulp.dest('./')); +}); + +gulp.task('archive-prebuilt', function () { + return gulp.src('./prebuilt/**/*', { + base: './' + }).pipe(zip('prebuilt_' + process.platform + '.zip')) + .pipe(gulp.dest('./')); +}); + +gulp.task('upload-prebuilt', function (cb) { + var zipFileName = 'prebuilt_' + process.platform + '.zip'; + uploadZipFile(zipFileName, '.', cb); +}); + +gulp.task('upload-cocos2d-x', function (cb) { + var zipFileName = 'cocos2d-x.zip'; + uploadZipFile(zipFileName, './tools/make-package', cb); +}); + +gulp.task('upload-simulator', function (cb) { + var zipFileName = 'simulator_' + process.platform + '.zip'; + uploadZipFile(zipFileName, '.', cb); +}); \ No newline at end of file diff --git a/native/package.json b/native/package.json new file mode 100644 index 0000000000..b00aa54808 --- /dev/null +++ b/native/package.json @@ -0,0 +1,25 @@ +{ + "name": "cocos2d-x-lite", + "version": "1.0.0", + "description": "Cocos2d-x, compact version ==========================", + "main": "gulpfile.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "devDependencies": { + "ftp": "^0.3.10", + "gulp": "^3.9.1", + "gulp-sequence": "^0.4.5", + "gulp-zip": "^3.2.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/cocos-creator/cocos2d-x-lite.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/cocos-creator/cocos2d-x-lite/issues" + }, + "homepage": "https://github.com/cocos-creator/cocos2d-x-lite#readme" +} From 035e3677a8b7063fb146ab6a208f02af5445ad88 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Tue, 3 May 2016 15:49:17 +0800 Subject: [PATCH 17/25] 1.Allow to use custom shader uniforms and attributes on drawNode 2.Remove duplicate definition of `cc.FontDefinition` 3.Warn if fontDef.charID exceeds 16bits --- native/cocos/2d/CCDrawNode.cpp | 4 +-- native/cocos/2d/CCFontFNT.cpp | 10 +++++--- native/cocos/platform/CCApplicationProtocol.h | 24 +++++++++--------- .../js-bindings/script/jsb_cocos2d.js | 25 ++----------------- .../js-bindings/script/jsb_create_apis.js | 3 ++- 5 files changed, 23 insertions(+), 43 deletions(-) diff --git a/native/cocos/2d/CCDrawNode.cpp b/native/cocos/2d/CCDrawNode.cpp index 491e4a9e99..4486a57857 100644 --- a/native/cocos/2d/CCDrawNode.cpp +++ b/native/cocos/2d/CCDrawNode.cpp @@ -326,9 +326,7 @@ void DrawNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) void DrawNode::onDraw(const Mat4 &transform, uint32_t flags) { - auto glProgram = getGLProgram(); - glProgram->use(); - glProgram->setUniformsForBuiltins(transform); + getGLProgramState()->apply(transform); GL::blendFunc(_blendFunc.src, _blendFunc.dst); diff --git a/native/cocos/2d/CCFontFNT.cpp b/native/cocos/2d/CCFontFNT.cpp index 9862c20762..b303e0d670 100644 --- a/native/cocos/2d/CCFontFNT.cpp +++ b/native/cocos/2d/CCFontFNT.cpp @@ -779,15 +779,17 @@ FontAtlas * FontFNT::createFontAtlas() // Purge uniform hash HASH_ITER(hh, _configuration->_fontDefDictionary, currentElement, tmp) { - - FontLetterDefinition tempDefinition; - fontDef = currentElement->fontDef; + if (fontDef.charID > 65535) { + CCLOGWARN("Warning: 65535 < fontDef.charID (%u), ignored", fontDef.charID); + continue; + } + Rect tempRect; - tempRect = fontDef.rect; tempRect = CC_RECT_PIXELS_TO_POINTS(tempRect); + FontLetterDefinition tempDefinition; tempDefinition.offsetX = fontDef.xOffset; tempDefinition.offsetY = fontDef.yOffset; diff --git a/native/cocos/platform/CCApplicationProtocol.h b/native/cocos/platform/CCApplicationProtocol.h index e9517e6afa..04b83f6328 100644 --- a/native/cocos/platform/CCApplicationProtocol.h +++ b/native/cocos/platform/CCApplicationProtocol.h @@ -46,18 +46,18 @@ public: */ enum class Platform { - OS_WINDOWS,/** Windows */ - OS_LINUX,/** Linux */ - OS_MAC,/** Mac*/ - OS_ANDROID,/** Android */ - OS_IPHONE,/** Iphone */ - OS_IPAD,/** Ipad */ - OS_BLACKBERRY,/** BLACKBERRY */ - OS_NACL,/** Nacl */ - OS_EMSCRIPTEN,/** Emscripten */ - OS_TIZEN,/** Tizen */ - OS_WINRT,/** Windows Store Applications */ - OS_WP8/** Windows Phone Applications */ + OS_WINDOWS, /**< Windows */ + OS_LINUX, /**< Linux */ + OS_MAC, /**< Mac OS X*/ + OS_ANDROID, /**< Android */ + OS_IPHONE, /**< iPhone */ + OS_IPAD, /**< iPad */ + OS_BLACKBERRY, /**< BlackBerry */ + OS_NACL, /**< Native Client in Chrome */ + OS_EMSCRIPTEN, /**< Emscripten */ + OS_TIZEN, /**< Tizen */ + OS_WINRT, /**< Windows Runtime Applications */ + OS_WP8 /**< Windows Phone 8 Applications */ }; /** diff --git a/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js b/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js index 9f3b006b52..d2e04ecddd 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js +++ b/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js @@ -1661,7 +1661,7 @@ cc.visibleRect.init(); // Predefined font definition cc.FontDefinition = function () { this.fontName = "Arial"; - this.fontSize = 12; + this.fontSize = 18; this.textAlign = cc.TEXT_ALIGNMENT_CENTER; this.verticalAlign = cc.VERTICAL_TEXT_ALIGNMENT_TOP; this.fillStyle = cc.color(255, 255, 255, 255); @@ -1962,30 +1962,9 @@ cc.TMXLayer.prototype.getPositonAt = function(x, y){ return this._getPositionAt(pos); }; -// Predefined font definition -cc.FontDefinition = function () { - this.fontName = "Arial"; - this.fontSize = 32; - this.textAlign = cc.TEXT_ALIGNMENT_CENTER; - this.verticalAlign = cc.VERTICAL_TEXT_ALIGNMENT_TOP; - this.fillStyle = cc.color(255, 255, 255, 255); - this.boundingWidth = 0; - this.boundingHeight = 0; - - this.strokeEnabled = false; - this.strokeStyle = cc.color(255, 255, 255, 255); - this.lineWidth = 1; - - this.shadowEnabled = false; - this.shadowOffsetX = 0; - this.shadowOffsetY = 0; - this.shadowBlur = 0; - this.shadowOpacity = 1.0; -}; - //LabelTTF cc.LabelTTF.prototype.initWithString = function(text, fontName, fontSize, dimensions, hAlignment, vAlignment) { - var fontDef = {}; + var fontDef = new cc.FontDefinition(); if(typeof fontName === 'string') fontDef.fontName = fontName; if(typeof fontSize === 'number') fontDef.fontSize = fontSize; if(dimensions) { diff --git a/native/cocos/scripting/js-bindings/script/jsb_create_apis.js b/native/cocos/scripting/js-bindings/script/jsb_create_apis.js index 135e6d8947..da644bb502 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_create_apis.js +++ b/native/cocos/scripting/js-bindings/script/jsb_create_apis.js @@ -814,7 +814,8 @@ cc.LabelTTF.prototype._ctor = function(text, fontName, fontSize, dimensions, hAl } else { fontName = fontName || ''; - fontSize = fontSize || 16; + if(!fontSize) + fontSize = 16; dimensions = dimensions || cc.size(0,0); hAlignment = hAlignment ? hAlignment : cc.TEXT_ALIGNMENT_LEFT; vAlignment = vAlignment ? vAlignment : cc.VERTICAL_TEXT_ALIGNMENT_TOP; From 73314ab5263981c3ce9ca8e1f7e6fa420ccdb4f3 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Wed, 4 May 2016 10:53:35 +0800 Subject: [PATCH 18/25] Reduce unnecessary c_str() calls --- native/cocos/base/ccUtils.cpp | 2 +- native/cocos/editor-support/cocostudio/CCComAttribute.cpp | 2 +- native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp | 2 +- native/cocos/ui/UITextField.cpp | 7 +++---- native/cocos/ui/UIWebViewImpl-ios.mm | 4 ++-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/native/cocos/base/ccUtils.cpp b/native/cocos/base/ccUtils.cpp index 28ba3b6cb6..ec50c10356 100644 --- a/native/cocos/base/ccUtils.cpp +++ b/native/cocos/base/ccUtils.cpp @@ -186,7 +186,7 @@ std::vector findChildren(const Node &node, const std::string &name) return vec; } -#define MAX_ITOA_BUFFER_SIZE 256 +#define MAX_ITOA_BUFFER_SIZE 128 double atof(const char* str) { if (str == nullptr) diff --git a/native/cocos/editor-support/cocostudio/CCComAttribute.cpp b/native/cocos/editor-support/cocostudio/CCComAttribute.cpp index a88a954259..d69bcfd864 100644 --- a/native/cocos/editor-support/cocostudio/CCComAttribute.cpp +++ b/native/cocos/editor-support/cocostudio/CCComAttribute.cpp @@ -196,7 +196,7 @@ bool ComAttribute::serialize(void* r) { filePath.assign(cocos2d::FileUtils::getInstance()->fullPathForFilename(file)); } - if (parse(filePath.c_str())) + if (parse(filePath)) { ret = true; } diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp b/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp index b8e4e2d625..1b02c73151 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp @@ -390,7 +390,7 @@ void CWin32InputBox::InitDialog() _hwndEditCtrl = hwndEdit1; std::u16string utf16Result; - cocos2d::StringUtils::UTF8ToUTF16(_param->pstrResult->c_str(), utf16Result); + cocos2d::StringUtils::UTF8ToUTF16(*_param->pstrResult, utf16Result); ::SetWindowTextW(_hwndEditCtrl, (LPCWSTR) utf16Result.c_str()); RECT rectDlg, rectEdit1, rectEdit2; diff --git a/native/cocos/ui/UITextField.cpp b/native/cocos/ui/UITextField.cpp index 4dfa384af9..e07d0d6265 100644 --- a/native/cocos/ui/UITextField.cpp +++ b/native/cocos/ui/UITextField.cpp @@ -422,16 +422,15 @@ void TextField::setString(const std::string& text) } } - const char* content = strText.c_str(); if (isPasswordEnabled()) { - _textFieldRenderer->setPasswordText(content); + _textFieldRenderer->setPasswordText(strText); _textFieldRenderer->setString(""); - _textFieldRenderer->insertText(content, strlen(content)); + _textFieldRenderer->insertText(strText.c_str(), strText.size()); } else { - _textFieldRenderer->setString(content); + _textFieldRenderer->setString(strText); } _textFieldRendererAdaptDirty = true; updateContentSizeWithTextureSize(_textFieldRenderer->getContentSize()); diff --git a/native/cocos/ui/UIWebViewImpl-ios.mm b/native/cocos/ui/UIWebViewImpl-ios.mm index c1342571f9..5611d35254 100644 --- a/native/cocos/ui/UIWebViewImpl-ios.mm +++ b/native/cocos/ui/UIWebViewImpl-ios.mm @@ -37,7 +37,7 @@ static std::string getFixedBaseUrl(const std::string& baseUrl) { std::string fixedBaseUrl; - if (baseUrl.empty() || baseUrl.c_str()[0] != '/') { + if (baseUrl.empty() || baseUrl.at(0) != '/') { fixedBaseUrl = [[[NSBundle mainBundle] resourcePath] UTF8String]; fixedBaseUrl += "/"; fixedBaseUrl += baseUrl; @@ -51,7 +51,7 @@ static std::string getFixedBaseUrl(const std::string& baseUrl) fixedBaseUrl.replace(pos, 1, "%20"); } - if (fixedBaseUrl.c_str()[fixedBaseUrl.length() - 1] != '/') { + if (fixedBaseUrl.at(fixedBaseUrl.length() - 1) != '/') { fixedBaseUrl += "/"; } From cf2107f6414a89179c4d0748ab8eea33972dcc57 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Wed, 4 May 2016 13:44:47 +0800 Subject: [PATCH 19/25] Refine utils::atof --- native/cocos/base/ccUtils.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/native/cocos/base/ccUtils.cpp b/native/cocos/base/ccUtils.cpp index ec50c10356..4d3f858545 100644 --- a/native/cocos/base/ccUtils.cpp +++ b/native/cocos/base/ccUtils.cpp @@ -194,17 +194,25 @@ double atof(const char* str) return 0.0; } - char buf[MAX_ITOA_BUFFER_SIZE]; - strncpy(buf, str, MAX_ITOA_BUFFER_SIZE); - - // strip string, only remain 7 numbers after '.' - char* dot = strchr(buf, '.'); - if (dot != nullptr && dot - buf + 8 < MAX_ITOA_BUFFER_SIZE) + auto dot = strchr(str, '.'); + if (dot == nullptr) { - dot[8] = '\0'; + return std::atof(str); + } + else + { + char buf[MAX_ITOA_BUFFER_SIZE]; + strncpy(buf, str, MAX_ITOA_BUFFER_SIZE); + + // strip string, only remain 7 numbers after '.' + auto index = dot - str + 8; + if (index < MAX_ITOA_BUFFER_SIZE) + { + buf[index] = '\0'; + } + + return std::atof(buf); } - - return ::atof(buf); } double gettime() From 26e7dcc49e230826a15fe0e5df5a7d92b809ad54 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Wed, 4 May 2016 15:43:21 +0800 Subject: [PATCH 20/25] Fixed the initial placeholder of ui::TextField is incorrect. --- native/cocos/2d/CCTextFieldTTF.cpp | 2 +- native/cocos/ui/UITextField.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/native/cocos/2d/CCTextFieldTTF.cpp b/native/cocos/2d/CCTextFieldTTF.cpp index 59362951c3..d3a1177bfb 100644 --- a/native/cocos/2d/CCTextFieldTTF.cpp +++ b/native/cocos/2d/CCTextFieldTTF.cpp @@ -120,7 +120,7 @@ bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const Siz } bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const std::string& fontName, float fontSize) { - _placeHolder = std::string(placeholder); + _placeHolder = placeholder; setSystemFontName(fontName); setSystemFontSize(fontSize); Label::setTextColor(_colorSpaceHolder); diff --git a/native/cocos/ui/UITextField.cpp b/native/cocos/ui/UITextField.cpp index e07d0d6265..d4d9d0d3ac 100644 --- a/native/cocos/ui/UITextField.cpp +++ b/native/cocos/ui/UITextField.cpp @@ -67,10 +67,10 @@ UICCTextField * UICCTextField::create(const std::string& placeholder, const std: void UICCTextField::onEnter() { + TextFieldTTF::onEnter(); TextFieldTTF::setDelegate(this); } - bool UICCTextField::onTextFieldAttachWithIME(TextFieldTTF *pSender) { setAttachWithIME(true); @@ -368,7 +368,7 @@ void TextField::onEnter() void TextField::initRenderer() { - _textFieldRenderer = UICCTextField::create("input words here", "Thonburi", 20); + _textFieldRenderer = UICCTextField::create("", "Thonburi", 20); addProtectedChild(_textFieldRenderer, TEXTFIELD_RENDERER_Z, -1); } From 4d87be5c76541e93da0758c2f2a27d88dec01b7d Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Wed, 4 May 2016 16:08:46 +0800 Subject: [PATCH 21/25] Refine EditBox(sync from cocos2d-x) --- .../cocos2d_libs.xcodeproj/project.pbxproj | 56 +- .../cocos/ui/UIEditBox/Mac/CCUIEditBoxMac.h | 71 +++ .../cocos/ui/UIEditBox/Mac/CCUIEditBoxMac.mm | 339 +++++++++++ .../ui/UIEditBox/Mac/CCUIMultilineTextField.h | 34 ++ .../ui/UIEditBox/Mac/CCUIMultilineTextField.m | 121 ++++ .../ui/UIEditBox/Mac/CCUIPasswordTextField.h | 36 ++ .../ui/UIEditBox/Mac/CCUIPasswordTextField.m | 143 +++++ .../UIEditBox/Mac/CCUISingleLineTextField.h | 36 ++ .../UIEditBox/Mac/CCUISingleLineTextField.m | 146 +++++ .../ui/UIEditBox/Mac/CCUITextFieldFormatter.h | 35 ++ .../ui/UIEditBox/Mac/CCUITextFieldFormatter.m | 68 +++ native/cocos/ui/UIEditBox/Mac/CCUITextInput.h | 47 ++ .../ui/UIEditBox/UIEditBoxImpl-android.h | 6 +- .../ui/UIEditBox/UIEditBoxImpl-common.cpp | 8 - .../cocos/ui/UIEditBox/UIEditBoxImpl-common.h | 3 +- native/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h | 11 +- .../cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm | 72 +-- native/cocos/ui/UIEditBox/UIEditBoxImpl-mac.h | 61 +- .../cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm | 539 +++--------------- .../ui/UIEditBox/UIEditBoxImpl-win32.cpp | 294 +++++----- .../cocos/ui/UIEditBox/UIEditBoxImpl-win32.h | 13 +- .../cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.h | 3 +- .../cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm | 38 +- 23 files changed, 1424 insertions(+), 756 deletions(-) create mode 100644 native/cocos/ui/UIEditBox/Mac/CCUIEditBoxMac.h create mode 100644 native/cocos/ui/UIEditBox/Mac/CCUIEditBoxMac.mm create mode 100644 native/cocos/ui/UIEditBox/Mac/CCUIMultilineTextField.h create mode 100644 native/cocos/ui/UIEditBox/Mac/CCUIMultilineTextField.m create mode 100644 native/cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.h create mode 100644 native/cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.m create mode 100644 native/cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.h create mode 100644 native/cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.m create mode 100644 native/cocos/ui/UIEditBox/Mac/CCUITextFieldFormatter.h create mode 100644 native/cocos/ui/UIEditBox/Mac/CCUITextFieldFormatter.m create mode 100644 native/cocos/ui/UIEditBox/Mac/CCUITextInput.h diff --git a/native/build/cocos2d_libs.xcodeproj/project.pbxproj b/native/build/cocos2d_libs.xcodeproj/project.pbxproj index ad5694a606..e99b24f711 100644 --- a/native/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/native/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -622,11 +622,9 @@ 292DB14019B4574100A80320 /* UIEditBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13019B4574100A80320 /* UIEditBox.h */; }; 292DB14119B4574100A80320 /* UIEditBoxImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13119B4574100A80320 /* UIEditBoxImpl.h */; }; 292DB14219B4574100A80320 /* UIEditBoxImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13119B4574100A80320 /* UIEditBoxImpl.h */; }; - 292DB14719B4574100A80320 /* UIEditBoxImpl-ios.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13419B4574100A80320 /* UIEditBoxImpl-ios.h */; }; 292DB14819B4574100A80320 /* UIEditBoxImpl-ios.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13419B4574100A80320 /* UIEditBoxImpl-ios.h */; }; 292DB14A19B4574100A80320 /* UIEditBoxImpl-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 292DB13519B4574100A80320 /* UIEditBoxImpl-ios.mm */; }; 292DB14B19B4574100A80320 /* UIEditBoxImpl-mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13619B4574100A80320 /* UIEditBoxImpl-mac.h */; }; - 292DB14C19B4574100A80320 /* UIEditBoxImpl-mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13619B4574100A80320 /* UIEditBoxImpl-mac.h */; }; 292DB14D19B4574100A80320 /* UIEditBoxImpl-mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 292DB13719B4574100A80320 /* UIEditBoxImpl-mac.mm */; }; 29394CF019B01DBA00D2DE1A /* UIWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEC19B01DBA00D2DE1A /* UIWebView.h */; }; 29394CF119B01DBA00D2DE1A /* UIWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEC19B01DBA00D2DE1A /* UIWebView.h */; }; @@ -1147,6 +1145,17 @@ A60A9D661C200E5A0070800A /* libchipmunk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A60A9D651C200E5A0070800A /* libchipmunk.a */; }; A614E2E01C8E72360065A737 /* CCLabelTTF.h in Headers */ = {isa = PBXBuildFile; fileRef = A614E2DE1C8E72360065A737 /* CCLabelTTF.h */; }; A614E2E11C8E761D0065A737 /* CCLabelTTF.h in Headers */ = {isa = PBXBuildFile; fileRef = A614E2DE1C8E72360065A737 /* CCLabelTTF.h */; }; + A63CF0041CD9CF3500A6971D /* CCUIEditBoxMac.h in Headers */ = {isa = PBXBuildFile; fileRef = A63CEFF91CD9CF3500A6971D /* CCUIEditBoxMac.h */; }; + A63CF0051CD9CF3500A6971D /* CCUIEditBoxMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A63CEFFA1CD9CF3500A6971D /* CCUIEditBoxMac.mm */; }; + A63CF0061CD9CF3500A6971D /* CCUIMultilineTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = A63CEFFB1CD9CF3500A6971D /* CCUIMultilineTextField.h */; }; + A63CF0071CD9CF3500A6971D /* CCUIMultilineTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = A63CEFFC1CD9CF3500A6971D /* CCUIMultilineTextField.m */; }; + A63CF0081CD9CF3500A6971D /* CCUIPasswordTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = A63CEFFD1CD9CF3500A6971D /* CCUIPasswordTextField.h */; }; + A63CF0091CD9CF3500A6971D /* CCUIPasswordTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = A63CEFFE1CD9CF3500A6971D /* CCUIPasswordTextField.m */; }; + A63CF00A1CD9CF3500A6971D /* CCUISingleLineTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = A63CEFFF1CD9CF3500A6971D /* CCUISingleLineTextField.h */; }; + A63CF00B1CD9CF3500A6971D /* CCUISingleLineTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = A63CF0001CD9CF3500A6971D /* CCUISingleLineTextField.m */; }; + A63CF00C1CD9CF3500A6971D /* CCUITextFieldFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = A63CF0011CD9CF3500A6971D /* CCUITextFieldFormatter.h */; }; + A63CF00D1CD9CF3500A6971D /* CCUITextFieldFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = A63CF0021CD9CF3500A6971D /* CCUITextFieldFormatter.m */; }; + A63CF00E1CD9CF3500A6971D /* CCUITextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = A63CF0031CD9CF3500A6971D /* CCUITextInput.h */; }; A679D0D91C71D90A00620A6C /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A6A554241C2A7C4400FDD954 /* libssl.a */; }; A679D0DA1C71D93200620A6C /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A6A554221C2A7C3100FDD954 /* libcrypto.a */; }; A679D0F51C74BA3600620A6C /* CCArmature.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A679D0E71C74BA3600620A6C /* CCArmature.cpp */; }; @@ -2076,6 +2085,17 @@ A60A9D5E1C200DE10070800A /* CCPhysicsSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCPhysicsSprite.h; path = "physics-nodes/CCPhysicsSprite.h"; sourceTree = ""; }; A60A9D651C200E5A0070800A /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = ../external/ios/libs/libchipmunk.a; sourceTree = ""; }; A614E2DE1C8E72360065A737 /* CCLabelTTF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLabelTTF.h; sourceTree = ""; }; + A63CEFF91CD9CF3500A6971D /* CCUIEditBoxMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCUIEditBoxMac.h; path = Mac/CCUIEditBoxMac.h; sourceTree = ""; }; + A63CEFFA1CD9CF3500A6971D /* CCUIEditBoxMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CCUIEditBoxMac.mm; path = Mac/CCUIEditBoxMac.mm; sourceTree = ""; }; + A63CEFFB1CD9CF3500A6971D /* CCUIMultilineTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCUIMultilineTextField.h; path = Mac/CCUIMultilineTextField.h; sourceTree = ""; }; + A63CEFFC1CD9CF3500A6971D /* CCUIMultilineTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCUIMultilineTextField.m; path = Mac/CCUIMultilineTextField.m; sourceTree = ""; }; + A63CEFFD1CD9CF3500A6971D /* CCUIPasswordTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCUIPasswordTextField.h; path = Mac/CCUIPasswordTextField.h; sourceTree = ""; }; + A63CEFFE1CD9CF3500A6971D /* CCUIPasswordTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCUIPasswordTextField.m; path = Mac/CCUIPasswordTextField.m; sourceTree = ""; }; + A63CEFFF1CD9CF3500A6971D /* CCUISingleLineTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCUISingleLineTextField.h; path = Mac/CCUISingleLineTextField.h; sourceTree = ""; }; + A63CF0001CD9CF3500A6971D /* CCUISingleLineTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCUISingleLineTextField.m; path = Mac/CCUISingleLineTextField.m; sourceTree = ""; }; + A63CF0011CD9CF3500A6971D /* CCUITextFieldFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCUITextFieldFormatter.h; path = Mac/CCUITextFieldFormatter.h; sourceTree = ""; }; + A63CF0021CD9CF3500A6971D /* CCUITextFieldFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCUITextFieldFormatter.m; path = Mac/CCUITextFieldFormatter.m; sourceTree = ""; }; + A63CF0031CD9CF3500A6971D /* CCUITextInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCUITextInput.h; path = Mac/CCUITextInput.h; sourceTree = ""; }; A679D0E71C74BA3600620A6C /* CCArmature.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCArmature.cpp; path = Armature/CCArmature.cpp; sourceTree = ""; }; A679D0E81C74BA3600620A6C /* CCArmature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCArmature.h; path = Armature/CCArmature.h; sourceTree = ""; }; A679D0E91C74BA3600620A6C /* CCArmatureAnimation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCArmatureAnimation.cpp; path = Armature/CCArmatureAnimation.cpp; sourceTree = ""; }; @@ -2929,6 +2949,7 @@ 292DB12E19B4574100A80320 /* UIEditBox */ = { isa = PBXGroup; children = ( + A63CEFF81CD9CF2700A6971D /* Mac */, 2980F0161BA9A5550059E678 /* iOS */, A0E749F51BA8FD7F001A8332 /* UIEditBoxImpl-common.cpp */, A0E749F61BA8FD7F001A8332 /* UIEditBoxImpl-common.h */, @@ -3498,6 +3519,24 @@ name = PhysicsSprite; sourceTree = ""; }; + A63CEFF81CD9CF2700A6971D /* Mac */ = { + isa = PBXGroup; + children = ( + A63CEFF91CD9CF3500A6971D /* CCUIEditBoxMac.h */, + A63CEFFA1CD9CF3500A6971D /* CCUIEditBoxMac.mm */, + A63CEFFB1CD9CF3500A6971D /* CCUIMultilineTextField.h */, + A63CEFFC1CD9CF3500A6971D /* CCUIMultilineTextField.m */, + A63CEFFD1CD9CF3500A6971D /* CCUIPasswordTextField.h */, + A63CEFFE1CD9CF3500A6971D /* CCUIPasswordTextField.m */, + A63CEFFF1CD9CF3500A6971D /* CCUISingleLineTextField.h */, + A63CF0001CD9CF3500A6971D /* CCUISingleLineTextField.m */, + A63CF0011CD9CF3500A6971D /* CCUITextFieldFormatter.h */, + A63CF0021CD9CF3500A6971D /* CCUITextFieldFormatter.m */, + A63CF0031CD9CF3500A6971D /* CCUITextInput.h */, + ); + name = Mac; + sourceTree = ""; + }; A679D0E61C74BA1700620A6C /* Armature */ = { isa = PBXGroup; children = ( @@ -3642,6 +3681,7 @@ A679D1221C74BB3A00620A6C /* CCUtilMath.h in Headers */, 50ABBD461925AB0000A911A9 /* CCVertex.h in Headers */, B63990CE1A490AFE00B07923 /* CCAsyncTaskPool.h in Headers */, + A63CF0041CD9CF3500A6971D /* CCUIEditBoxMac.h in Headers */, B29A7E3119EE1B7700872B35 /* SkinnedMeshAttachment.h in Headers */, 15AE1B6F19AADA9900C27E9E /* GUIDefine.h in Headers */, A679D1141C74BB3A00620A6C /* CCDataReaderHelper.h in Headers */, @@ -3652,6 +3692,7 @@ 50ABBED31925AB6F00A911A9 /* uthash.h in Headers */, B29A7E0119EE1B7700872B35 /* extension.h in Headers */, 15AE196D19AAD35700C27E9E /* CCActionTimeline.h in Headers */, + A63CF00A1CD9CF3500A6971D /* CCUISingleLineTextField.h in Headers */, 3E2F27A719CFBFE400E7C490 /* AudioEngine.h in Headers */, 15AE18A319AAD33D00C27E9E /* CCParticleSystemQuadLoader.h in Headers */, 15FB20761AE7BF8600C31518 /* CCAutoPolygon.h in Headers */, @@ -3723,6 +3764,7 @@ 1A57011D180BC90D0088DEC7 /* CCGrabber.h in Headers */, B29A7E2B19EE1B7700872B35 /* AtlasAttachmentLoader.h in Headers */, 15AE1B6819AADA9900C27E9E /* UIScale9Sprite.h in Headers */, + A63CF00C1CD9CF3500A6971D /* CCUITextFieldFormatter.h in Headers */, 1A570121180BC90D0088DEC7 /* CCGrid.h in Headers */, 5034CA2D191D591100CE6051 /* ccShader_PositionTextureA8Color.frag in Headers */, B29A7E0F19EE1B7700872B35 /* SkeletonJson.h in Headers */, @@ -3774,6 +3816,7 @@ 50ABBD401925AB0000A911A9 /* CCMath.h in Headers */, B29A7E1F19EE1B7700872B35 /* BoneData.h in Headers */, 1A5701FD180BCBAD0088DEC7 /* CCMenuItem.h in Headers */, + A63CF00E1CD9CF3500A6971D /* CCUITextInput.h in Headers */, ED3057831BEC76C90083C3ED /* unzip.h in Headers */, 1A570204180BCBD40088DEC7 /* CCClippingNode.h in Headers */, 50643BE419BFCF1800EF68ED /* CCPlatformMacros.h in Headers */, @@ -3804,6 +3847,7 @@ 15AE188519AAD33D00C27E9E /* CCBSequence.h in Headers */, 50643BE219BFCF1800EF68ED /* CCPlatformConfig.h in Headers */, B29A7DF519EE1B7700872B35 /* Skeleton.h in Headers */, + A63CF0061CD9CF3500A6971D /* CCUIMultilineTextField.h in Headers */, 5034CA49191D591100CE6051 /* ccShader_Label_df.frag in Headers */, 292DB14119B4574100A80320 /* UIEditBoxImpl.h in Headers */, B29A7DD919EE1B7700872B35 /* SkeletonRenderer.h in Headers */, @@ -3815,7 +3859,6 @@ 5034CA3D191D591100CE6051 /* ccShader_PositionColor.frag in Headers */, A0534A6A1B87306E006B03E5 /* CCIDownloaderImpl.h in Headers */, 1A570280180BCC900088DEC7 /* CCSprite.h in Headers */, - 292DB14719B4574100A80320 /* UIEditBoxImpl-ios.h in Headers */, 15AE1B4E19AADA9900C27E9E /* UIListView.h in Headers */, 1A570284180BCC900088DEC7 /* CCSpriteBatchNode.h in Headers */, 5034CA2B191D591100CE6051 /* ccShader_PositionTextureA8Color.vert in Headers */, @@ -3944,6 +3987,7 @@ 50ABBEBD1925AB6F00A911A9 /* ccUtils.h in Headers */, A0534A651B872FFD006B03E5 /* CCDownloader-apple.h in Headers */, 50ABC0231926664800A911A9 /* CCGLViewImpl-desktop.h in Headers */, + A63CF0081CD9CF3500A6971D /* CCUIPasswordTextField.h in Headers */, 15AE188D19AAD33D00C27E9E /* CCLabelBMFontLoader.h in Headers */, 15AE1B5019AADA9900C27E9E /* UILoadingBar.h in Headers */, 4649FF021BBA9FBE0001CC6F /* CCVertexAttribBinding.h in Headers */, @@ -4100,7 +4144,6 @@ 1A570094180BC5A10088DEC7 /* CCActionTween.h in Headers */, 1A57009B180BC5C10088DEC7 /* CCAtlasNode.h in Headers */, 1A5700A1180BC5D20088DEC7 /* CCNode.h in Headers */, - 292DB14C19B4574100A80320 /* UIEditBoxImpl-mac.h in Headers */, 15AE1BF019AAE01E00C27E9E /* CCControlHuePicker.h in Headers */, 15AE18B819AAD33D00C27E9E /* CCBSequenceProperty.h in Headers */, 503DD8E41926736A00CD74DD /* CCDirectorCaller-ios.h in Headers */, @@ -4480,6 +4523,7 @@ 50ABBDB11925AB4100A911A9 /* ccShaders.cpp in Sources */, 15AE18E419AAD35000C27E9E /* CCActionFrame.cpp in Sources */, 15AE18FD19AAD35000C27E9E /* CCComAttribute.cpp in Sources */, + A63CF00D1CD9CF3500A6971D /* CCUITextFieldFormatter.m in Sources */, 50ABBE991925AB6F00A911A9 /* CCRef.cpp in Sources */, 15AE186319AAD31D00C27E9E /* CDAudioManager.m in Sources */, ED9C6A9418599AD8000A5232 /* CCNodeGrid.cpp in Sources */, @@ -4496,6 +4540,7 @@ 15AE186A19AAD31D00C27E9E /* CocosDenshion.m in Sources */, ED30579A1BEC77B70083C3ED /* ConvertUTF.c in Sources */, 15AE1B6319AADA9900C27E9E /* UICheckBox.cpp in Sources */, + A63CF0051CD9CF3500A6971D /* CCUIEditBoxMac.mm in Sources */, 15EFA211198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */, 50ABBEB71925AB6F00A911A9 /* ccUTF8.cpp in Sources */, 15AE189819AAD33D00C27E9E /* CCMenuItemLoader.cpp in Sources */, @@ -4615,6 +4660,7 @@ B29A7DD119EE1B7700872B35 /* Skin.c in Sources */, 1A5701FB180BCBAD0088DEC7 /* CCMenuItem.cpp in Sources */, 1A570202180BCBD40088DEC7 /* CCClippingNode.cpp in Sources */, + A63CF0091CD9CF3500A6971D /* CCUIPasswordTextField.m in Sources */, 1A570208180BCBDF0088DEC7 /* CCMotionStreak.cpp in Sources */, 1A570210180BCBF40088DEC7 /* CCProgressTimer.cpp in Sources */, 292DB14D19B4574100A80320 /* UIEditBoxImpl-mac.mm in Sources */, @@ -4690,6 +4736,7 @@ 5012168E1AC47380009A4BEA /* CCRenderState.cpp in Sources */, B29A7DFB19EE1B7700872B35 /* spine-cocos2dx.cpp in Sources */, A679D12B1C74BD0200620A6C /* CCProcessBase.cpp in Sources */, + A63CF00B1CD9CF3500A6971D /* CCUISingleLineTextField.m in Sources */, 50ABC0011926664800A911A9 /* CCLock-apple.cpp in Sources */, A679D1211C74BB3A00620A6C /* CCUtilMath.cpp in Sources */, 50ABBD931925AB4100A911A9 /* CCGLProgramState.cpp in Sources */, @@ -4753,6 +4800,7 @@ 50ABC0211926664800A911A9 /* CCGLViewImpl-desktop.cpp in Sources */, 50ABC00D1926664800A911A9 /* CCFileUtils.cpp in Sources */, 50ABBE4D1925AB6F00A911A9 /* CCEventCustom.cpp in Sources */, + A63CF0071CD9CF3500A6971D /* CCUIMultilineTextField.m in Sources */, B5668D7D1B3838E4003CBD5E /* UIScrollViewBar.cpp in Sources */, 50ABBE9F1925AB6F00A911A9 /* CCScheduler.cpp in Sources */, 50ABC0151926664800A911A9 /* CCImage.cpp in Sources */, diff --git a/native/cocos/ui/UIEditBox/Mac/CCUIEditBoxMac.h b/native/cocos/ui/UIEditBox/Mac/CCUIEditBoxMac.h new file mode 100644 index 0000000000..d51930889e --- /dev/null +++ b/native/cocos/ui/UIEditBox/Mac/CCUIEditBoxMac.h @@ -0,0 +1,71 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 zilongshanren + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import +#import +#include "ui/UIEditBox/UIEditBoxImpl-mac.h" +#include "ui/UIEditBox/Mac/CCUITextInput.h" + +#pragma mark - UIEditBox mac implementation + +@class NSFont; + +@interface UIEditBoxImplMac : NSObject +{ + BOOL _editState; + NSView * _textInput; + void * _editBox; +} + +@property (nonatomic, retain) NSView *textInput; +@property (nonatomic, readonly) NSWindow *window; + +@property (nonatomic, readonly, getter = isEditState) BOOL editState; +@property (nonatomic, assign) void *editBox; +@property (nonatomic, assign) NSString *text; +@property (nonatomic, assign) NSRect frameRect; +@property (nonatomic, assign) cocos2d::ui::EditBox::InputFlag dataInputMode; +@property (nonatomic, assign) cocos2d::ui::EditBox::KeyboardReturnType keyboardReturnType; + +- (instancetype)initWithFrame:(NSRect)frameRect editBox:(void *)editBox; +- (void)setMaxLength:(int)maxLength; +- (void)updateFrame:(CGRect)rect; + +- (void)openKeyboard; +- (void)closeKeyboard; + +- (NSString *)getDefaultFontName; + +- (void)setInputMode:(cocos2d::ui::EditBox::InputMode)inputMode; +- (void)setInputFlag:(cocos2d::ui::EditBox::InputFlag)inputFlag; +- (void)setReturnType:(cocos2d::ui::EditBox::KeyboardReturnType)returnType; + +- (void)setPlaceHolder:(const char *)text; +- (void)setVisible:(BOOL)visible; +- (void)setTextColor:(NSColor*)color; +- (void)setFont:(NSFont *)font; +- (void)setPlaceholderFontColor:(NSColor*)color; +- (void)setPlaceholderFont:(NSFont*)font; +@end diff --git a/native/cocos/ui/UIEditBox/Mac/CCUIEditBoxMac.mm b/native/cocos/ui/UIEditBox/Mac/CCUIEditBoxMac.mm new file mode 100644 index 0000000000..018ec66557 --- /dev/null +++ b/native/cocos/ui/UIEditBox/Mac/CCUIEditBoxMac.mm @@ -0,0 +1,339 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 zilongshanren + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "ui/UIEditBox/Mac/CCUIEditBoxMac.h" +#include "base/CCDirector.h" +#include "ui/UIEditBox/Mac/CCUISingleLineTextField.h" +#include "ui/UIEditBox/Mac/CCUIPasswordTextField.h" +#include "ui/UIEditBox/Mac/CCUIMultilineTextField.h" + +#define getEditBoxImplMac() ((cocos2d::ui::EditBoxImplMac *)_editBox) + + +@implementation UIEditBoxImplMac + +- (instancetype)initWithFrame:(NSRect)frameRect editBox:(void *)editBox +{ + self = [super init]; + + if (self) { + + _editState = NO; + self.frameRect = frameRect; + + self.editBox = editBox; + self.dataInputMode = cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_ALL_CHARACTERS; + self.keyboardReturnType = cocos2d::ui::EditBox::KeyboardReturnType::DEFAULT; + + [self createMultiLineTextField]; + } + + return self; +} + +- (void)createSingleLineTextField +{ + CCUISingleLineTextField *textField = [[[CCUISingleLineTextField alloc] initWithFrame:self.frameRect] autorelease]; + + self.textInput = textField; +} + +- (void)createMultiLineTextField +{ + CCUIMultilineTextField *textView = [[[CCUIMultilineTextField alloc] initWithFrame:self.frameRect] autorelease]; + self.textInput = textView; +} + +- (void)createPasswordTextField +{ + CCUIPasswordTextField *textField = [[[CCUIPasswordTextField alloc] initWithFrame:self.frameRect] autorelease]; + + self.textInput = textField; +} + +- (void)setTextInput:(NSView *)textInput +{ + if (_textInput == textInput) { + return; + } + + // Migrate properties + textInput.ccui_textColor = _textInput.ccui_textColor ?: [NSColor whiteColor]; + textInput.ccui_text = _textInput.ccui_text ?: @""; + textInput.ccui_placeholder = _textInput.ccui_placeholder ?: @""; + textInput.ccui_font = _textInput.ccui_font ?: [NSFont systemFontOfSize:self.frameRect.size.height*3/2]; + textInput.ccui_maxLength = getEditBoxImplMac()->getMaxLength(); + + [_textInput removeFromSuperview]; + [_textInput release]; + + _textInput = [textInput retain]; + + [_textInput performSelector:@selector(setTextColor:) withObject:_textInput.ccui_textColor]; + [_textInput performSelector:@selector(setBackgroundColor:) withObject:[NSColor clearColor]]; + + if (![_textInput isKindOfClass:[NSTextView class]]) { + [_textInput performSelector:@selector(setBordered:) + withObject:[NSNumber numberWithBool:NO]]; + } + _textInput.hidden = NO; + _textInput.wantsLayer = YES; + + [_textInput ccui_setDelegate:self]; + + [self setInputFlag:self.dataInputMode]; + [self setReturnType:self.keyboardReturnType]; +} + +- (void)updateFrame:(CGRect)rect +{ + NSRect frame = self.textInput.frame; + frame.origin.x = rect.origin.x; + frame.origin.y = rect.origin.y; + frame.size.height = rect.size.height; + frame.size.width = rect.size.width; + + self.textInput.frame = frame; +} + +- (void)dealloc +{ + self.textInput = nil; + + [super dealloc]; +} + +- (NSWindow *)window +{ + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + return glview->getCocoaWindow(); +} + +- (void)openKeyboard +{ + [self.window.contentView addSubview:self.textInput]; + if (![self.textInput isKindOfClass:[NSTextView class]]) { + [self.textInput becomeFirstResponder]; + }else { + [self.window makeFirstResponder:self.textInput]; + } + + auto editbox = getEditBoxImplMac()->getEditBox(); + auto oldPos = editbox->getPosition(); + editbox->setPosition(oldPos + cocos2d::Vec2(10,20)); + editbox->setPosition(oldPos); +} + +- (void)closeKeyboard +{ + if (![self.textInput isKindOfClass:[NSTextView class]]) { + [self.textInput resignFirstResponder]; + } + + [self.textInput removeFromSuperview]; +} + + +- (const char*) getText +{ + return [self.textInput.ccui_text UTF8String]; +} + +- (void)controlTextDidBeginEditing:(NSNotification *)notification +{ + _editState = YES; + + getEditBoxImplMac()->editBoxEditingDidBegin(); +} + +- (void)controlTextDidEndEditing:(NSNotification *)notification +{ + _editState = NO; + + getEditBoxImplMac()->editBoxEditingDidEnd([self getText]); +} + +- (void)setMaxLength:(int)length +{ + self.textInput.ccui_maxLength = length; +} + +/** + * Called each time when the text field's text has changed. + */ +- (void)controlTextDidChange:(NSNotification *)notification +{ + getEditBoxImplMac()->editBoxEditingChanged([self getText]); +} + +- (NSString *)getDefaultFontName +{ + return self.textInput.ccui_font.fontName ?: @""; +} + +- (void)setInputMode:(cocos2d::ui::EditBox::InputMode)inputMode +{ + //multiline input + if (inputMode == cocos2d::ui::EditBox::InputMode::ANY) { + if (![self.textInput isKindOfClass:[NSTextView class]]) { + [self createMultiLineTextField]; + } + } + else { + if (self.dataInputMode != cocos2d::ui::EditBox::InputFlag::PASSWORD) { + if (![self.textInput isKindOfClass:[NSTextField class]]) { + [self createSingleLineTextField]; + } + } + } +} + +- (void)setInputFlag:(cocos2d::ui::EditBox::InputFlag)inputFlag +{ + if (self.dataInputMode == inputFlag) { + return; + } + + if (self.dataInputMode == cocos2d::ui::EditBox::InputFlag::PASSWORD + && inputFlag != cocos2d::ui::EditBox::InputFlag::PASSWORD) { + [self createSingleLineTextField]; + } + + if (self.dataInputMode != cocos2d::ui::EditBox::InputFlag::PASSWORD + && inputFlag == cocos2d::ui::EditBox::InputFlag::PASSWORD) { + [self createPasswordTextField]; + } + + switch (inputFlag) + { + case cocos2d::ui::EditBox::InputFlag::PASSWORD: + self.dataInputMode = inputFlag; + break; + case cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_WORD: + CCLOG("INITIAL_CAPS_WORD not implemented"); + break; + case cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_SENTENCE: + CCLOG("INITIAL_CAPS_SENTENCE not implemented"); + break; + case cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_ALL_CHARACTERS: + CCLOG("INITIAL_CAPS_ALL_CHARACTERS not implemented"); + break; + case cocos2d::ui::EditBox::InputFlag::SENSITIVE: + CCLOG("SENSITIVE not implemented"); + break; + default: + break; + } +} + +- (void)setReturnType:(cocos2d::ui::EditBox::KeyboardReturnType)returnType +{ + CCLOG("setReturnType not implemented"); +} + +- (void)setPlaceHolder:(const char *)text +{ + self.textInput.ccui_placeholder = [NSString stringWithUTF8String:text]; +} + +- (void)setVisible:(BOOL)visible +{ + self.textInput.hidden = !visible; +} + +- (void)setTextColor:(NSColor*)color +{ + self.textInput.ccui_textColor = color; +} + +- (void)setFont:(NSFont *)font +{ + if (font != nil) { + self.textInput.ccui_font = font; + } +} + +- (void)setPlaceholderFontColor:(NSColor *)color +{ + self.textInput.ccui_placeholderColor = color; +} + +- (void)setPlaceholderFont:(NSFont*)font +{ + self.textInput.ccui_placeholderFont = font; +} +- (void)setText:(NSString *)text +{ + self.textInput.ccui_text = text; +} + +- (BOOL)textShouldBeginEditing:(NSText *)textObject; // YES means do it +{ + _editState = YES; + + getEditBoxImplMac()->editBoxEditingDidBegin(); + return YES; +} + +- (void)textDidEndEditing:(NSNotification *)notification +{ + _editState = NO; + + getEditBoxImplMac()->editBoxEditingDidEnd([self getText]); +} + +- (void)textDidChange:(NSNotification *)notification +{ + NSTextView* textView = notification.object; + + const char* inputText = [textView.string UTF8String]; + + getEditBoxImplMac()->editBoxEditingChanged(inputText); +} + +- (BOOL)textView:(NSTextView *)textView shouldChangeTextInRange:(NSRange)affectedCharRange replacementString:(NSString *)replacementString +{ + int maxLength = getEditBoxImplMac()->getMaxLength(); + if (maxLength < 0) + { + return YES; + } + + if (affectedCharRange.length + affectedCharRange.location > textView.string.length) { + return NO; + } + + NSUInteger oldLength = textView.string.length; + NSUInteger replacementLength = replacementString.length; + NSUInteger rangeLength = affectedCharRange.length; + + NSUInteger newLength = oldLength - rangeLength + replacementLength; + + return newLength <= maxLength; +} + + + +@end diff --git a/native/cocos/ui/UIEditBox/Mac/CCUIMultilineTextField.h b/native/cocos/ui/UIEditBox/Mac/CCUIMultilineTextField.h new file mode 100644 index 0000000000..43d71e1b63 --- /dev/null +++ b/native/cocos/ui/UIEditBox/Mac/CCUIMultilineTextField.h @@ -0,0 +1,34 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 zilongshanren + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import +#include "ui/UIEditBox/Mac/CCUITextInput.h" + +@interface CCUIMultilineTextField : NSTextView +{ + NSString* _placeHolder; +} + +@end diff --git a/native/cocos/ui/UIEditBox/Mac/CCUIMultilineTextField.m b/native/cocos/ui/UIEditBox/Mac/CCUIMultilineTextField.m new file mode 100644 index 0000000000..fcc0d24d8f --- /dev/null +++ b/native/cocos/ui/UIEditBox/Mac/CCUIMultilineTextField.m @@ -0,0 +1,121 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 zilongshanren + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "ui/UIEditBox/Mac/CCUIMultilineTextField.h" + +@interface CCUIMultilineTextField() +@property(nonatomic, copy)NSString* placeHolder; +@end + +@implementation CCUIMultilineTextField +{ +} + +@synthesize placeHolder = _placeHolder; + +-(void)dealloc +{ + self.placeHolder = nil; + + [super dealloc]; +} + +-(void)ccui_setPlaceholderFont:(NSFont *)font +{ + //TODO +} + +-(NSFont*)ccui_placeholderFont +{ + return NULL; +} + +-(void)ccui_setPlaceholder:(NSString *)text +{ + self.placeHolder = text; +} + +-(NSString*)ccui_placeholder +{ + return self.placeHolder; +} + +-(void)ccui_setPlaceholderColor:(NSColor *)color +{ + //TODO +} + +-(NSColor*)ccui_placeholderColor +{ + return NULL; +} + + +#pragma mark - CCUITextInput +- (NSString *)ccui_text +{ + return self.string; +} + +- (void)ccui_setText:(NSString *)ccui_text +{ + self.string = ccui_text; +} + +- (NSColor *)ccui_textColor +{ + return self.textColor; +} + +- (void)ccui_setTextColor:(NSColor *)ccui_textColor +{ + self.textColor = ccui_textColor; +} + +- (NSFont *)ccui_font +{ + return self.font; +} + +- (void)ccui_setFont:(NSFont *)ccui_font +{ + self.font = ccui_font; +} + + +- (void)ccui_setDelegate:(id)delegate +{ + self.delegate = delegate; +} + +- (void)ccui_setMaxLength:(int)ccui_maxLength +{ + //noop +} +-(int)ccui_maxLength +{ + return 0; +} +@end diff --git a/native/cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.h b/native/cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.h new file mode 100644 index 0000000000..04f6bb6c92 --- /dev/null +++ b/native/cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.h @@ -0,0 +1,36 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 zilongshanren + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import +#include "ui/UIEditBox/Mac/CCUITextInput.h" + +@interface CCUIPasswordTextField : NSSecureTextField +{ + NSMutableDictionary* _placeholderAttributes; +} + +@end + + diff --git a/native/cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.m b/native/cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.m new file mode 100644 index 0000000000..4885a8f7ea --- /dev/null +++ b/native/cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.m @@ -0,0 +1,143 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 zilongshanren + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "ui/UIEditBox/Mac/CCUIPasswordTextField.h" +#include "ui/UIEditBox/Mac/CCUITextFieldFormatter.h" + +@interface CCUIPasswordTextField() +@property (nonatomic, retain) NSMutableDictionary *placeholderAttributes; + +@end + +@implementation CCUIPasswordTextField +{ +} + +@synthesize placeholderAttributes = _placeholderAttributes; + +-(id) initWithFrame:(NSRect)frameRect +{ + if ([super initWithFrame:frameRect]) { + NSFont* font = [NSFont systemFontOfSize:frameRect.size.height * 3 /2]; + self.placeholderAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys: + font, NSFontAttributeName, + [NSColor grayColor], NSForegroundColorAttributeName, + nil]; + } + + return self; +} + +- (void)dealloc +{ + self.placeholderAttributes = nil; + + [super dealloc]; +} + +-(void)ccui_setPlaceholderFont:(NSFont *)font +{ + [self.placeholderAttributes setObject:font forKey:NSFontAttributeName]; +} + +-(NSString*)ccui_placeholder +{ + return self.placeholderString; +} + +-(NSFont*)ccui_placeholderFont +{ + return [self.placeholderAttributes objectForKey:NSFontAttributeName]; +} + +-(NSColor*)ccui_placeholderColor +{ + return [self.placeholderAttributes objectForKey:NSForegroundColorAttributeName]; +} + +-(void)ccui_setPlaceholder:(NSString *)text +{ + NSAttributedString *as = [[NSAttributedString alloc] initWithString:text + attributes:self.placeholderAttributes]; + + [[self cell] setPlaceholderAttributedString:as]; + + [as release]; +} + +-(void)ccui_setPlaceholderColor:(NSColor *)color +{ + [self.placeholderAttributes setObject:color forKey:NSForegroundColorAttributeName]; +} + +#pragma mark - CCUITextInput +- (NSString *)ccui_text +{ + return self.stringValue; +} + +- (void)ccui_setText:(NSString *)ccui_text +{ + self.stringValue = ccui_text; +} + +- (NSColor *)ccui_textColor +{ + return self.textColor; +} + +- (void)ccui_setTextColor:(NSColor *)ccui_textColor +{ + self.textColor = ccui_textColor; +} + +- (NSFont *)ccui_font +{ + return self.font; +} + +- (void)ccui_setFont:(NSFont *)ccui_font +{ + self.font = ccui_font; +} + + +- (void)ccui_setDelegate:(id)delegate +{ + self.delegate = delegate; +} + +- (void)ccui_setMaxLength:(int)length +{ + id formater = [[[CCUITextFieldFormatter alloc]init] autorelease]; + [formater setMaximumLength:length]; + [self setFormatter:formater]; +} + +- (int)ccui_maxLength +{ + return [self.formatter maximumLength]; +} +@end diff --git a/native/cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.h b/native/cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.h new file mode 100644 index 0000000000..d2d29b1593 --- /dev/null +++ b/native/cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.h @@ -0,0 +1,36 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 zilongshanren + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import +#include "ui/UIEditBox/Mac/CCUITextInput.h" + +@interface CCUISingleLineTextField : NSTextField +{ + NSMutableDictionary* _placeholderAttributes; +} + +@end + + diff --git a/native/cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.m b/native/cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.m new file mode 100644 index 0000000000..07450adef3 --- /dev/null +++ b/native/cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.m @@ -0,0 +1,146 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 zilongshanren + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "ui/UIEditBox/Mac/CCUISingleLineTextField.h" +#include "ui/UIEditBox/Mac/CCUITextFieldFormatter.h" + +@interface CCUISingleLineTextField() +@property (nonatomic, retain) NSMutableDictionary *placeholderAttributes; + +@end + +@implementation CCUISingleLineTextField +{ +} + +@synthesize placeholderAttributes = _placeholderAttributes; + +-(id) initWithFrame:(NSRect)frameRect +{ + if ([super initWithFrame:frameRect]) { + NSFont* font = [NSFont systemFontOfSize:frameRect.size.height * 3 /2]; + self.placeholderAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys: + font, NSFontAttributeName, + [NSColor grayColor], NSForegroundColorAttributeName, + nil]; + [self setLineBreakMode:NSLineBreakByTruncatingTail]; + } + + return self; +} + +- (void)dealloc +{ + self.placeholderAttributes = nil; + + [super dealloc]; +} + +-(void)ccui_setPlaceholderFont:(NSFont *)font +{ + [self.placeholderAttributes setObject:font forKey:NSFontAttributeName]; +} + + + +-(void)ccui_setPlaceholder:(NSString *)text +{ + NSAttributedString *as = [[NSAttributedString alloc] initWithString:text + attributes:self.placeholderAttributes]; + + [[self cell] setPlaceholderAttributedString:as]; + + [as release]; +} + +-(NSString*)ccui_placeholder +{ + return self.placeholderString; +} + +-(NSFont*)ccui_placeholderFont +{ + return [self.placeholderAttributes objectForKey:NSFontAttributeName]; +} + +-(NSColor*)ccui_placeholderColor +{ + return [self.placeholderAttributes objectForKey:NSForegroundColorAttributeName]; +} + +-(void)ccui_setPlaceholderColor:(NSColor *)color +{ + [self.placeholderAttributes setObject:color forKey:NSForegroundColorAttributeName]; +} + +- (NSString *)ccui_text +{ + return self.stringValue; +} + +- (void)ccui_setText:(NSString *)ccui_text +{ + self.stringValue = ccui_text; +} + +- (NSColor *)ccui_textColor +{ + return self.textColor; +} + +- (void)ccui_setTextColor:(NSColor *)ccui_textColor +{ + self.textColor = ccui_textColor; +} + +- (NSFont *)ccui_font +{ + return self.font; +} + +- (void)ccui_setFont:(NSFont *)ccui_font +{ + self.font = ccui_font; +} + + +- (void)ccui_setDelegate:(id)delegate +{ + self.delegate = delegate; +} + +- (void)ccui_setMaxLength:(int)length +{ + id formater = [[[CCUITextFieldFormatter alloc]init] autorelease]; + [formater setMaximumLength:length]; + [self setFormatter:formater]; +} + +- (int)ccui_maxLength +{ + return [self.formatter maximumLength]; +} + +@end diff --git a/native/cocos/ui/UIEditBox/Mac/CCUITextFieldFormatter.h b/native/cocos/ui/UIEditBox/Mac/CCUITextFieldFormatter.h new file mode 100644 index 0000000000..75ce35d5c0 --- /dev/null +++ b/native/cocos/ui/UIEditBox/Mac/CCUITextFieldFormatter.h @@ -0,0 +1,35 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 zilongshanren + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import + +@interface CCUITextFieldFormatter : NSFormatter +{ + int _maximumLength; +} + +@property (nonatomic, assign) int maximumLength; + +@end diff --git a/native/cocos/ui/UIEditBox/Mac/CCUITextFieldFormatter.m b/native/cocos/ui/UIEditBox/Mac/CCUITextFieldFormatter.m new file mode 100644 index 0000000000..d3422bac18 --- /dev/null +++ b/native/cocos/ui/UIEditBox/Mac/CCUITextFieldFormatter.m @@ -0,0 +1,68 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 zilongshanren + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "ui/UIEditBox/Mac/CCUITextFieldFormatter.h" + +@implementation CCUITextFieldFormatter +{ +} + +@synthesize maximumLength = _maximumLength; + +- (instancetype)init +{ + self = [super init]; + if (self) { + _maximumLength = INT_MAX; + } + + return self; +} + +- (NSString *)stringForObjectValue:(id)object +{ + return object; +} + +- (BOOL)getObjectValue:(id *)object forString:(NSString *)string errorDescription:(NSString **)error +{ + *object = string; + return YES; +} + +- (BOOL)isPartialStringValid:(NSString **)partialStringPtr + proposedSelectedRange:(NSRangePointer)proposedSelRangePtr + originalString:(NSString *)origString + originalSelectedRange:(NSRange)origSelRange + errorDescription:(NSString **)error +{ + return (*partialStringPtr).length <= self.maximumLength; +} + +- (NSAttributedString *)attributedStringForObjectValue:(id)anObject withDefaultAttributes:(NSDictionary *)attributes +{ + return nil; +} +@end diff --git a/native/cocos/ui/UIEditBox/Mac/CCUITextInput.h b/native/cocos/ui/UIEditBox/Mac/CCUITextInput.h new file mode 100644 index 0000000000..edcb78b93c --- /dev/null +++ b/native/cocos/ui/UIEditBox/Mac/CCUITextInput.h @@ -0,0 +1,47 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 zilongshanren + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#ifndef CCUITextInput_h +#define CCUITextInput_h + +/** + This protocol provides a common interface for consolidating text input method calls + */ +@protocol CCUITextInput + +@property (nonatomic, retain, setter=ccui_setText:) NSString *ccui_text; +@property (nonatomic, retain, setter=ccui_setTextColor:) NSColor *ccui_textColor; +@property (nonatomic, retain, setter=ccui_setFont:) NSFont *ccui_font; +@property (nonatomic, assign, setter=ccui_setMaxLength:)int ccui_maxLength; +@property (nonatomic, retain, setter=ccui_setPlaceholder:) NSString *ccui_placeholder; +@property (nonatomic, retain, setter=ccui_setPlaceholderColor:) NSColor *ccui_placeholderColor; +@property (nonatomic, retain, setter=ccui_setPlaceholderFont:) NSFont *ccui_placeholderFont; + +/* can only set. and not get, since the getter will only return one delegate implementation */ +- (void)ccui_setDelegate:(id)delegate; + +@end + +#endif /* CCUITextInput_h */ diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-android.h b/native/cocos/ui/UIEditBox/UIEditBoxImpl-android.h index ec7c8c2f19..5cc077f6be 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-android.h +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-android.h @@ -67,16 +67,12 @@ public: virtual void setNativePlaceHolder(const char* pText) override; virtual void setNativeVisible(bool visible) override; virtual void updateNativeFrame(const Rect& rect) override; - virtual void setNativeContentSize(const Size& size) override {}; virtual const char* getNativeDefaultFontName() override; virtual void nativeOpenKeyboard() override; virtual void nativeCloseKeyboard() override; virtual void setNativeMaxLength(int maxLength); - - + private: - virtual void doAnimationWhenKeyboardMove(float duration, float distance)override {} - int _editBoxIndex; }; diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp b/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp index 5a4c3fa9ee..984baabf9d 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp @@ -246,14 +246,6 @@ void EditBoxImplCommon::setContentSize(const Size& size) _contentSize = size; CCLOG("[Edit text] content size = (%f, %f)", size.width, size.height); placeInactiveLabels(); - - auto director = cocos2d::Director::DirectorInstance; - auto glview = director->getOpenGLView(); - Size controlSize = Size(size.width * glview->getScaleX() * _label->getNodeToWorldAffineTransform().a, - size.height * glview->getScaleY() * _label->getNodeToWorldAffineTransform().a); - - this->setNativeContentSize(controlSize); - } void EditBoxImplCommon::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.h b/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.h index d284e11267..2eff19f5b6 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.h +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.h @@ -107,7 +107,6 @@ public: virtual void setNativePlaceHolder(const char* pText) = 0; virtual void setNativeVisible(bool visible) = 0; virtual void updateNativeFrame(const Rect& rect) = 0; - virtual void setNativeContentSize(const Size& size) = 0; virtual const char* getNativeDefaultFontName() = 0; virtual void nativeOpenKeyboard() = 0; virtual void nativeCloseKeyboard() = 0; @@ -118,7 +117,7 @@ private: void initInactiveLabels(const Size& size); void setInactiveText(const char* pText); void placeInactiveLabels(); - + virtual void doAnimationWhenKeyboardMove(float duration, float distance)override {}; Label* _label; Label* _labelPlaceHolder; EditBox::InputMode _editBoxInputMode; diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h b/native/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h index bbf72dfa80..e57b7e6439 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h @@ -53,10 +53,7 @@ public: * @lua NA */ virtual ~EditBoxImplIOS(); - virtual void setPosition(const Vec2& pos) override; - virtual void setAnchorPoint(const Vec2& anchorPoint) override; - virtual void updatePosition(float dt) override; - + virtual bool isEditing() override; virtual void createNativeControl(const Rect& frame) override; virtual void setNativeFont(const char* pFontName, int fontSize) override; @@ -70,7 +67,6 @@ public: virtual void setNativePlaceHolder(const char* pText) override; virtual void setNativeVisible(bool visible) override; virtual void updateNativeFrame(const Rect& rect) override; - virtual void setNativeContentSize(const Size& size) override; virtual const char* getNativeDefaultFontName() override; virtual void nativeOpenKeyboard() override; virtual void nativeCloseKeyboard() override; @@ -81,11 +77,8 @@ public: virtual void doAnimationWhenKeyboardMove(float duration, float distance) override; private: UIFont* constructFont(const char* fontName, int fontSize); - void adjustTextFieldPosition(); - + UIEditBoxImplIOS_objc* _systemControl; - Vec2 _position; - Vec2 _anchorPoint; }; diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm b/native/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm index 93753b52f6..b54ecfaeb2 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm @@ -54,7 +54,6 @@ EditBoxImpl* __createSystemEditBox(EditBox* pEditBox) EditBoxImplIOS::EditBoxImplIOS(EditBox* pEditText) : EditBoxImplCommon(pEditText) , _systemControl(nullptr) -, _anchorPoint(Vec2(0.5f, 0.5f)) { } @@ -126,6 +125,10 @@ void EditBoxImplIOS::setNativePlaceholderFontColor(const Color4B& color) void EditBoxImplIOS::setNativeInputMode(EditBox::InputMode inputMode) { [_systemControl setInputMode:inputMode]; + + auto oldPos = _editBox->getPosition(); + _editBox->setPosition(oldPos + Vec2(10,10)); + _editBox->setPosition(oldPos); } void EditBoxImplIOS::setNativeInputFlag(EditBox::InputFlag inputFlag) @@ -170,17 +173,16 @@ void EditBoxImplIOS::setNativeVisible(bool visible) void EditBoxImplIOS::updateNativeFrame(const Rect& rect) { - //no-op -} + auto glview = cocos2d::Director::DirectorInstance->getOpenGLView(); + CCEAGLView *eaglview = (CCEAGLView *) glview->getEAGLView(); -void EditBoxImplIOS::setNativeContentSize(const Size& size) -{ - auto director = cocos2d::Director::DirectorInstance; - auto glview = director->getOpenGLView(); - CCEAGLView *eaglview = static_cast(glview->getEAGLView()); float factor = eaglview.contentScaleFactor; + + [_systemControl updateFrame:CGRectMake(rect.origin.x / factor, + rect.origin.y / factor, + rect.size.width / factor, + rect.size.height / factor)]; - [_systemControl setContentSize:CGSizeMake(size.width / factor, size.height / factor)]; } const char* EditBoxImplIOS::getNativeDefaultFontName() @@ -231,58 +233,6 @@ UIFont* EditBoxImplIOS::constructFont(const char *fontName, int fontSize) } return textFont; } - -void EditBoxImplIOS::setPosition(const Vec2& pos) -{ - _position = pos; - adjustTextFieldPosition(); -} - -void EditBoxImplIOS::setAnchorPoint(const Vec2& anchorPoint) -{ - CCLOG("[Edit text] anchor point = (%f, %f)", anchorPoint.x, anchorPoint.y); - _anchorPoint = anchorPoint; - setPosition(_position); -} - -void EditBoxImplIOS::updatePosition(float dt) -{ - if (nullptr != _systemControl) { - this->adjustTextFieldPosition(); - } -} - -static CGPoint convertDesignCoordToScreenCoord(const Vec2& designCoord) -{ - auto glview = cocos2d::Director::DirectorInstance->getOpenGLView(); - CCEAGLView *eaglview = (CCEAGLView *) glview->getEAGLView(); - - float viewH = (float)[eaglview getHeight]; - - Vec2 visiblePos = Vec2(designCoord.x * glview->getScaleX(), designCoord.y * glview->getScaleY()); - Vec2 screenGLPos = visiblePos + glview->getViewPortRect().origin; - - CGPoint screenPos = CGPointMake(screenGLPos.x, viewH - screenGLPos.y); - - float factor = eaglview.contentScaleFactor; - screenPos.x = screenPos.x / factor; - screenPos.y = screenPos.y / factor; - - CCLOGINFO("[EditBox] pos x = %f, y = %f", screenGLPos.x, screenGLPos.y); - return screenPos; -} - - -void EditBoxImplIOS::adjustTextFieldPosition() -{ - Size contentSize = _editBox->getContentSize(); - Rect rect = Rect(0, 0, contentSize.width, contentSize.height); - rect = RectApplyTransform(rect, _editBox->getNodeToWorldTransform()); - - Vec2 designCoord = Vec2(rect.origin.x, rect.origin.y + rect.size.height); - [_systemControl setPosition:convertDesignCoordToScreenCoord(designCoord)]; -} - } NS_CC_END diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-mac.h b/native/cocos/ui/UIEditBox/UIEditBoxImpl-mac.h index d168c452c2..fdd77c3af5 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-mac.h +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-mac.h @@ -30,9 +30,10 @@ #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) -#include "UIEditBoxImpl.h" +#include "ui/UIEditBox/UIEditBoxImpl-common.h" @class UIEditBoxImplMac; +@class NSFont; NS_CC_BEGIN @@ -40,7 +41,7 @@ namespace ui { class EditBox; -class EditBoxImplMac : public EditBoxImpl +class EditBoxImplMac : public EditBoxImplCommon { public: /** @@ -52,48 +53,28 @@ public: * @lua NA */ virtual ~EditBoxImplMac(); - - virtual bool initWithSize(const Size& size) override; - virtual void setFont(const char* pFontName, int fontSize) override; - virtual void setFontColor(const Color4B& color) override; - virtual void setPlaceholderFont(const char* pFontName, int fontSize) override; - virtual void setPlaceholderFontColor(const Color4B& color) override; - virtual void setInputMode(EditBox::InputMode inputMode) override; - virtual void setInputFlag(EditBox::InputFlag inputFlag) override; - virtual void setMaxLength(int maxLength) override; - virtual int getMaxLength() override; - virtual void setReturnType(EditBox::KeyboardReturnType returnType) override; + virtual bool isEditing() override; + virtual void createNativeControl(const Rect& frame) override; + virtual void setNativeFont(const char* pFontName, int fontSize) override; + virtual void setNativeFontColor(const Color4B& color) override; + virtual void setNativePlaceholderFont(const char* pFontName, int fontSize) override; + virtual void setNativePlaceholderFontColor(const Color4B& color) override; + virtual void setNativeInputMode(EditBox::InputMode inputMode) override; + virtual void setNativeInputFlag(EditBox::InputFlag inputFlag) override; + virtual void setNativeReturnType(EditBox::KeyboardReturnType returnType)override; + virtual void setNativeText(const char* pText) override; + virtual void setNativePlaceHolder(const char* pText) override; + virtual void setNativeVisible(bool visible) override; + virtual void updateNativeFrame(const Rect& rect) override; + virtual const char* getNativeDefaultFontName() override; + virtual void nativeOpenKeyboard() override; + virtual void nativeCloseKeyboard() override; + virtual void setNativeMaxLength(int maxLength) override; - virtual void setText(const char* pText) override; - virtual const char* getText() override; - virtual void setPlaceHolder(const char* pText) override; - virtual void setPosition(const Vec2& pos) override; - virtual void setVisible(bool visible) override; - virtual void setContentSize(const Size& size) override; - virtual void setAnchorPoint(const Vec2& anchorPoint) override; - /** - * @js NA - * @lua NA - */ - virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)override; - virtual void doAnimationWhenKeyboardMove(float duration, float distance) override; - virtual void openKeyboard() override; - virtual void closeKeyboard() override; - virtual void updatePosition(float dt) override; - /** - * @js NA - * @lua NA - */ - virtual void onEnter() override; private: - NSPoint convertDesignCoordToScreenCoord(const Vec2& designCoord, bool bInRetinaMode); - void adjustTextFieldPosition(); NSFont* constructFont(const char* fontName, int fontSize); - Size _contentSize; - Vec2 _position; - Vec2 _anchorPoint; - int _maxTextLength; + bool _inRetinaMode; UIEditBoxImplMac* _sysEdit; }; diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm b/native/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm index 14bb445e4c..c3413a1f43 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm @@ -23,288 +23,14 @@ THE SOFTWARE. ****************************************************************************/ -#include "UIEditBoxImpl-mac.h" - +#include "platform/CCPlatformConfig.h" #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) +#include "ui/UIEditBox/UIEditBoxImpl-mac.h" #include "base/CCDirector.h" #include "UIEditBox.h" #include "base/CCString.h" - -#import -#import - -#define getEditBoxImplMac() ((cocos2d::ui::EditBoxImplMac *)_editBox) - -#pragma mark - internal classes - -/** TODO: Missing doc - What does "CustomTextFieldFormatter" do? - */ -@interface CustomTextFieldFormatter : NSFormatter - -@property (nonatomic, assign) int maximumLength; - -@end - -@implementation CustomTextFieldFormatter - -- (instancetype)init -{ - self = [super init]; - if (self) { - _maximumLength = INT_MAX; - } - - return self; -} - -- (NSString *)stringForObjectValue:(id)object -{ - return object; -} - -- (BOOL)getObjectValue:(id *)object forString:(NSString *)string errorDescription:(NSString **)error -{ - *object = string; - return YES; -} - -- (BOOL)isPartialStringValid:(NSString **)partialStringPtr - proposedSelectedRange:(NSRangePointer)proposedSelRangePtr - originalString:(NSString *)origString - originalSelectedRange:(NSRange)origSelRange - errorDescription:(NSString **)error -{ - return (*partialStringPtr).length <= self.maximumLength; -} - -- (NSAttributedString *)attributedStringForObjectValue:(id)anObject withDefaultAttributes:(NSDictionary *)attributes -{ - return nil; -} - -@end - -#pragma mark - UIEditBox mac implementation - -@interface UIEditBoxImplMac : NSObject - -@property (nonatomic, retain) NSTextField* textField; -@property (nonatomic, retain) NSSecureTextField *secureTextField; -@property (nonatomic, retain) NSMutableDictionary *placeholderAttributes; -@property (nonatomic, readonly) NSWindow *window; - -@property (nonatomic, readonly, getter = isEditState) BOOL editState; -@property (nonatomic, assign, getter = isSecure) BOOL secure; -@property (nonatomic, assign) void *editBox; - -- (instancetype)initWithFrame:(NSRect)frameRect editBox:(void *)editBox; - -- (void)doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance; -- (void)setPosition:(NSPoint)pos; - -- (void)openKeyboard; -- (void)closeKeyboard; - -@end - - -@implementation UIEditBoxImplMac - -- (instancetype)initWithFrame:(NSRect)frameRect editBox:(void *)editBox -{ - self = [super init]; - - if (self) { - - _editState = NO; - _secure = NO; - - self.textField = [[[NSTextField alloc] initWithFrame:frameRect] autorelease]; - self.secureTextField = [[[NSSecureTextField alloc] initWithFrame:frameRect] autorelease]; - - //TODO: need to delete hard code here. - NSFont *font = [NSFont systemFontOfSize:frameRect.size.height*2/3]; - _textField.font = font; - _secureTextField.font = font; - - [self setupTextField:_textField]; - [self setupTextField:_secureTextField]; - - self.editBox = editBox; - self.placeholderAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys: - font, NSFontAttributeName, - [NSColor grayColor], NSForegroundColorAttributeName, - nil]; - - [self.window.contentView addSubview:_textField]; - } - - return self; -} - -- (void)dealloc -{ - [_textField resignFirstResponder]; - [_textField removeFromSuperview]; - [_textField release]; - - [_secureTextField resignFirstResponder]; - [_secureTextField removeFromSuperview]; - [_secureTextField release]; - - [_placeholderAttributes release]; - - [super dealloc]; -} - -- (NSWindow *)window -{ - auto glview = cocos2d::Director::getInstance()->getOpenGLView(); - return glview->getCocoaWindow(); -} - -- (void)setPosition:(NSPoint)pos -{ - NSRect frame = _textField.frame; - frame.origin = pos; - - _textField.frame = frame; - _secureTextField.frame = frame; -} - -- (void)setupTextField:(NSTextField *)textField -{ - textField.textColor = [NSColor whiteColor]; - textField.backgroundColor = [NSColor clearColor]; - textField.bordered = NO; - textField.hidden = NO; - textField.wantsLayer = YES; - textField.delegate = self; - - [textField setLineBreakMode:NSLineBreakByTruncatingTail]; -} - -- (void)doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance -{ - [self.window.contentView doAnimationWhenKeyboardMoveWithDuration:duration distance:distance]; -} - -- (void)setSecure:(BOOL)secure -{ - NSAssert(secure, @"Can only set this flag to true"); - - _secure = secure; - - [_textField.superview addSubview:_secureTextField]; - [_textField removeFromSuperview]; -} - -- (void)openKeyboard -{ - NSView *contentView = self.window.contentView; - - if (!_secure) { - [contentView addSubview:_textField]; - [_textField becomeFirstResponder]; - } - else { - [contentView addSubview:_secureTextField]; - [_secureTextField becomeFirstResponder]; - } -} - -- (void)closeKeyboard -{ - if ([_textField superview]) { - [_textField resignFirstResponder]; - [_textField removeFromSuperview]; - } - else { - [_secureTextField resignFirstResponder]; - [_secureTextField removeFromSuperview]; - } -} - -- (BOOL)textFieldShouldReturn:(NSTextField *)sender -{ - if (sender == _textField || sender == _secureTextField) { - [sender resignFirstResponder]; - } - return NO; -} - -- (void)controlTextDidBeginEditing:(NSNotification *)notification -{ - _editState = YES; - cocos2d::ui::EditBoxDelegate* pDelegate = getEditBoxImplMac()->getDelegate(); - if (pDelegate != NULL) - { - pDelegate->editBoxEditingDidBegin(getEditBoxImplMac()->getEditBox()); - } - -#if CC_ENABLE_SCRIPT_BINDING - cocos2d::ui::EditBox* pEditBox= getEditBoxImplMac()->getEditBox(); - if (nullptr != pEditBox && 0 != pEditBox->getScriptEditBoxHandler() && cocos2d::ScriptEngineManager::ShareInstance) - { - cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox); - cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data); - cocos2d::ScriptEngineManager::ShareInstance->getScriptEngine()->sendEvent(&event); - } -#endif -} - -- (void)controlTextDidEndEditing:(NSNotification *)notification -{ - _editState = NO; - cocos2d::ui::EditBoxDelegate* pDelegate = getEditBoxImplMac()->getDelegate(); - if (pDelegate != NULL) - { - pDelegate->editBoxEditingDidEnd(getEditBoxImplMac()->getEditBox()); - pDelegate->editBoxReturn(getEditBoxImplMac()->getEditBox()); - } - -#if CC_ENABLE_SCRIPT_BINDING - cocos2d::ui::EditBox* pEditBox= getEditBoxImplMac()->getEditBox(); - if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler() && cocos2d::ScriptEngineManager::ShareInstance) - { - cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox); - cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data); - cocos2d::ScriptEngineManager::ShareInstance->getScriptEngine()->sendEvent(&event); - memset(data.eventName, 0, sizeof(data.eventName)); - strncpy(data.eventName, "return", sizeof(data.eventName)); - event.data = (void*)&data; - cocos2d::ScriptEngineManager::ShareInstance->getScriptEngine()->sendEvent(&event); - } -#endif -} - - -/** - * Called each time when the text field's text has changed. - */ -- (void)controlTextDidChange:(NSNotification *)notification -{ - cocos2d::ui::EditBoxDelegate* pDelegate = getEditBoxImplMac()->getDelegate(); - if (pDelegate != NULL) - { - pDelegate->editBoxTextChanged(getEditBoxImplMac()->getEditBox(), getEditBoxImplMac()->getText()); - } - -#if CC_ENABLE_SCRIPT_BINDING - cocos2d::ui::EditBox* pEditBox= getEditBoxImplMac()->getEditBox(); - if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler() && cocos2d::ScriptEngineManager::ShareInstance) - { - cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox); - cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data); - cocos2d::ScriptEngineManager::ShareInstance->getScriptEngine()->sendEvent(&event); - } -#endif -} - -@end - - +#include "ui/UIEditBox/Mac/CCUIEditBoxMac.h" NS_CC_BEGIN namespace ui { @@ -315,9 +41,7 @@ EditBoxImpl* __createSystemEditBox(EditBox* pEditBox) } EditBoxImplMac::EditBoxImplMac(EditBox* pEditText) -: EditBoxImpl(pEditText) -, _anchorPoint(Vec2(0.5f, 0.5f)) -, _maxTextLength(-1) +: EditBoxImplCommon(pEditText) , _sysEdit(nullptr) { //! TODO: Retina on Mac @@ -330,29 +54,21 @@ EditBoxImplMac::~EditBoxImplMac() [_sysEdit release]; } -void EditBoxImplMac::doAnimationWhenKeyboardMove(float duration, float distance) +void EditBoxImplMac::createNativeControl(const cocos2d::Rect &frame) { - if ([_sysEdit isEditState] || distance < 0.0f) - [_sysEdit doAnimationWhenKeyboardMoveWithDuration:duration distance:distance]; -} - -bool EditBoxImplMac::initWithSize(const Size& size) -{ - GLView* eglView = Director::getInstance()->getOpenGLView(); - - NSRect rect = NSMakeRect(0, 0, size.width * eglView->getScaleX(),size.height * eglView->getScaleY()); - - if (_inRetinaMode) { - rect.size.width /= 2.0f; - rect.size.height /= 2.0f; - } - + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + Size size = frame.size; + NSRect rect = NSMakeRect(0, 0, + size.width * glview->getScaleX(), + size.height * glview->getScaleY()); + + float factor = cocos2d::Director::getInstance()->getContentScaleFactor(); + + rect.size.width /= factor; + rect.size.height /= factor; + _sysEdit = [[UIEditBoxImplMac alloc] initWithFrame:rect editBox:this]; - - if (!_sysEdit) - return false; - - return true; + this->setNativeVisible(false); } NSFont* EditBoxImplMac::constructFont(const char *fontName, int fontSize) @@ -365,7 +81,7 @@ NSFont* EditBoxImplMac::constructFont(const char *fontName, int fontSize) if (fontSize == -1) { - NSRect frameRect = [_sysEdit.textField frame]; + NSRect frameRect = [_sysEdit.textInput frame]; fontSize = frameRect.size.height*2/3; } else @@ -386,96 +102,64 @@ NSFont* EditBoxImplMac::constructFont(const char *fontName, int fontSize) return textFont; } -void EditBoxImplMac::setFont(const char* pFontName, int fontSize) +void EditBoxImplMac::setNativeFont(const char *pFontName, int fontSize) { NSFont* textFont = constructFont(pFontName, fontSize); - if (textFont != nil) { - [_sysEdit.textField setFont:textFont]; - [_sysEdit.secureTextField setFont:textFont]; - } + [_sysEdit setFont:textFont]; } -void EditBoxImplMac::setPlaceholderFont(const char* pFontName, int fontSize) +void EditBoxImplMac::setNativePlaceholderFont(const char *pFontName, int fontSize) { NSFont *textFont = constructFont(pFontName, fontSize); - + if (!textFont) { CCLOGWARN("Font not found: %s", pFontName); return; } - - [_sysEdit.placeholderAttributes setObject:textFont forKey:NSFontAttributeName]; - - /* reload placeholder */ - const char *placeholder = [_sysEdit.textField.cell placeholderAttributedString].string.UTF8String; - if (placeholder) { - setPlaceHolder(placeholder); - } + [_sysEdit setPlaceholderFont:textFont]; } -void EditBoxImplMac::setFontColor(const Color4B& color) +void EditBoxImplMac::setNativeFontColor(const cocos2d::Color4B &color) { - NSColor *newColor = [NSColor colorWithCalibratedRed:color.r / 255.0f green:color.g / 255.0f blue:color.b / 255.0f alpha:color.a / 255.f]; - _sysEdit.textField.textColor = newColor; - _sysEdit.secureTextField.textColor = newColor; + NSColor *newColor = [NSColor colorWithCalibratedRed:color.r / 255.0f + green:color.g / 255.0f + blue:color.b / 255.0f + alpha:color.a / 255.f]; + + [_sysEdit setTextColor:newColor]; +} + +void EditBoxImplMac::setNativePlaceholderFontColor(const cocos2d::Color4B &color) +{ + NSColor *newColor = [NSColor colorWithCalibratedRed:color.r/255.f + green:color.g / 255.f + blue:color.b / 255.f + alpha:color.a / 255.f]; + [_sysEdit setPlaceholderFontColor:newColor]; } -void EditBoxImplMac::setPlaceholderFontColor(const Color4B& color) +void EditBoxImplMac::setNativeInputMode(EditBox::InputMode inputMode) { - NSColor *nsColor = [NSColor colorWithCalibratedRed:color.r/255.f green:color.g / 255.f blue:color.b / 255.f alpha:color.a / 255.f]; - [_sysEdit.placeholderAttributes setObject:nsColor forKey:NSForegroundColorAttributeName]; - - /* reload placeholder */ - const char *placeholder = [_sysEdit.textField.cell placeholderAttributedString].string.UTF8String; - if (placeholder) { - setPlaceHolder(placeholder); - } + [_sysEdit setInputMode:inputMode]; + auto oldPosition = _editBox->getPosition(); + _editBox->setPosition(_editBox->getPosition() + Vec2(10,10)); + _editBox->setPosition(oldPosition); } -void EditBoxImplMac::setInputMode(EditBox::InputMode inputMode) +void EditBoxImplMac::setNativeMaxLength(int maxLength) { + [_sysEdit setMaxLength:maxLength]; } -void EditBoxImplMac::setMaxLength(int maxLength) + +void EditBoxImplMac::setNativeInputFlag(EditBox::InputFlag inputFlag) { - _maxTextLength = maxLength; - id formater = [[[CustomTextFieldFormatter alloc]init] autorelease]; - [formater setMaximumLength:maxLength]; - [_sysEdit.secureTextField setFormatter:formater]; - [_sysEdit.textField setFormatter:formater]; + [_sysEdit setInputFlag:inputFlag]; } -int EditBoxImplMac::getMaxLength() -{ - return _maxTextLength; -} - -void EditBoxImplMac::setInputFlag(EditBox::InputFlag inputFlag) -{ - switch (inputFlag) - { - case EditBox::InputFlag::PASSWORD: - _sysEdit.secure = YES; - break; - case EditBox::InputFlag::INITIAL_CAPS_WORD: - CCLOGWARN("INITIAL_CAPS_WORD not implemented"); - break; - case EditBox::InputFlag::INITIAL_CAPS_SENTENCE: - CCLOGWARN("INITIAL_CAPS_SENTENCE not implemented"); - break; - case EditBox::InputFlag::INITIAL_CAPS_ALL_CHARACTERS: - CCLOGWARN("INITIAL_CAPS_ALL_CHARACTERS not implemented"); - break; - case EditBox::InputFlag::SENSITIVE: - CCLOGWARN("SENSITIVE not implemented"); - break; - default: - break; - } -} - -void EditBoxImplMac::setReturnType(EditBox::KeyboardReturnType returnType) +void EditBoxImplMac::setNativeReturnType(EditBox::KeyboardReturnType returnType) { + [_sysEdit setReturnType:returnType]; } bool EditBoxImplMac::isEditing() @@ -483,118 +167,51 @@ bool EditBoxImplMac::isEditing() return [_sysEdit isEditState] ? true : false; } -void EditBoxImplMac::setText(const char* pText) +void EditBoxImplMac::setNativeText(const char *pText) { - NSString *string = [NSString stringWithUTF8String:pText]; - _sysEdit.textField.stringValue = string; - _sysEdit.secureTextField.stringValue = string; + NSString *text = [NSString stringWithUTF8String:pText]; + [_sysEdit setText:text]; +} + +void EditBoxImplMac::setNativePlaceHolder(const char* pText) +{ + [_sysEdit setPlaceHolder:pText]; } -const char* EditBoxImplMac::getText() +void EditBoxImplMac::setNativeVisible(bool visible) { - if (_sysEdit.secureTextField.superview) { - return [_sysEdit.secureTextField.stringValue UTF8String]; - } - - return [_sysEdit.textField.stringValue UTF8String]; + [_sysEdit setVisible:visible]; } -void EditBoxImplMac::setPlaceHolder(const char* pText) +void EditBoxImplMac::updateNativeFrame(const cocos2d::Rect &rect) { - NSAttributedString *as = [[NSAttributedString alloc] initWithString:[NSString stringWithUTF8String:pText] - attributes:_sysEdit.placeholderAttributes]; - - [[_sysEdit.textField cell] setPlaceholderAttributedString:as]; - [[_sysEdit.secureTextField cell] setPlaceholderAttributedString:as]; - [as release]; -} - -NSPoint EditBoxImplMac::convertDesignCoordToScreenCoord(const Vec2& designCoord, bool bInRetinaMode) -{ - NSRect frame = [_sysEdit.textField frame]; - CGFloat height = frame.size.height; - GLView* eglView = Director::getInstance()->getOpenGLView(); - - Vec2 visiblePos = Vec2(designCoord.x * eglView->getScaleX(), designCoord.y * eglView->getScaleY()); - Vec2 screenGLPos = visiblePos + eglView->getViewPortRect().origin; - - //TODO: I don't know why here needs to substract `height`. - NSPoint screenPos = NSMakePoint(screenGLPos.x, screenGLPos.y-height); - - if (bInRetinaMode) { - screenPos.x = screenPos.x / 2.0f; - screenPos.y = screenPos.y / 2.0f; - } - - CCLOGINFO("[EditBox] pos x = %f, y = %f", screenGLPos.x, screenGLPos.y); - return screenPos; + auto viewPortRect = eglView->getViewPortRect(); + // Coordinate System on OSX has its origin at the lower left corner. +// https://developer.apple.com/library/ios/documentation/General/Conceptual/Devpedia-CocoaApp/CoordinateSystem.html + auto screenPosY = viewPortRect.size.height - rect.origin.y - rect.size.height; + [_sysEdit updateFrame:CGRectMake(rect.origin.x, + screenPosY, + rect.size.width, rect.size.height)]; +} + +const char* EditBoxImplMac::getNativeDefaultFontName() +{ + return [[_sysEdit getDefaultFontName] UTF8String]; } -void EditBoxImplMac::updatePosition(float dt) -{ - if(nullptr != _sysEdit) - { - adjustTextFieldPosition(); - } -} - -void EditBoxImplMac::adjustTextFieldPosition() -{ - Size contentSize = _editBox->getContentSize(); - Rect rect = Rect(0, 0, contentSize.width, contentSize.height); - - rect = RectApplyTransform(rect, _editBox->getNodeToWorldTransform()); - - Vec2 designCoord = Vec2(rect.origin.x, rect.origin.y + rect.size.height); - [_sysEdit setPosition:convertDesignCoordToScreenCoord(designCoord, _inRetinaMode)]; -} - -void EditBoxImplMac::setPosition(const Vec2& pos) -{ - _position = pos; - adjustTextFieldPosition(); -} - -void EditBoxImplMac::setVisible(bool visible) -{ - [_sysEdit.textField setHidden:!visible]; - [_sysEdit.secureTextField setHidden:!visible]; -} - -void EditBoxImplMac::setContentSize(const Size& size) -{ - _contentSize = size; - CCLOG("[Edit text] content size = (%f, %f)", size.width, size.height); -} - -void EditBoxImplMac::setAnchorPoint(const Vec2& anchorPoint) -{ - CCLOG("[Edit text] anchor point = (%f, %f)", anchorPoint.x, anchorPoint.y); - _anchorPoint = anchorPoint; - setPosition(_position); -} - -void EditBoxImplMac::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) -{ - -} - -void EditBoxImplMac::openKeyboard() + +void EditBoxImplMac::nativeOpenKeyboard() { + [_sysEdit setVisible:YES]; [_sysEdit openKeyboard]; } -void EditBoxImplMac::closeKeyboard() +void EditBoxImplMac::nativeCloseKeyboard() { [_sysEdit closeKeyboard]; } -void EditBoxImplMac::onEnter() -{ - adjustTextFieldPosition(); -} - } NS_CC_END diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp b/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp index 1b02c73151..b5440c056c 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp @@ -37,10 +37,6 @@ #pragma warning (disable: 4312) -class CWin32InputBox; - -typedef void (*Win32InputBoxTextChange)(const char *pText, cocos2d::ui::EditBoxImplWin *ctx); - // Structure used to orient the inputbox behavior struct WIN32INPUTBOX_PARAM { @@ -72,12 +68,6 @@ struct WIN32INPUTBOX_PARAM IN DWORD nMaxLength; - IN OPTIONAL cocos2d::ui::EditBox::KeyboardReturnType eReturnType; - IN OPTIONAL cocos2d::ui::EditBox::InputMode eInputMode; - IN OPTIONAL cocos2d::ui::EditBox::InputFlag eInputFlag; - IN OPTIONAL Win32InputBoxTextChange lpfnOnTextChange; - IN OPTIONAL cocos2d::ui::EditBoxImplWin* lpCtx; - // Owner window HWND hwndOwner; HINSTANCE hInstance; @@ -96,17 +86,29 @@ private: static LRESULT CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM); HWND _hwndEditCtrl; int _recursionDepth; + HHOOK _getMsgHook; + + cocos2d::ui::EditBox::KeyboardReturnType _returnType; + cocos2d::ui::EditBox::InputMode _inputMode; + cocos2d::ui::EditBox::InputFlag _inputFlag; + std::function _onTextChange; + std::function _onClose; void InitDialog(); - void SetParam(WIN32INPUTBOX_PARAM *); - WIN32INPUTBOX_PARAM * GetParam(); + static LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam); public: CWin32InputBox(WIN32INPUTBOX_PARAM *); ~CWin32InputBox(); - static INT_PTR InputBoxEx(WIN32INPUTBOX_PARAM *); + static INT_PTR InputBoxEx(WIN32INPUTBOX_PARAM *, + cocos2d::ui::EditBox::KeyboardReturnType eReturnType, + cocos2d::ui::EditBox::InputMode eInputMode, + cocos2d::ui::EditBox::InputFlag eInputFlag, + const std::function &onTextChange, + const std::function &onClose); + static INT_PTR InputBox( LPCSTR szTitle, LPCSTR szPrompt, @@ -117,16 +119,13 @@ public: cocos2d::ui::EditBox::KeyboardReturnType eReturnType, cocos2d::ui::EditBox::InputMode eInputMode, cocos2d::ui::EditBox::InputFlag eInputFlag, - Win32InputBoxTextChange lpfnOnTextChange, - cocos2d::ui::EditBoxImplWin *ctx); + const std::function &onTextChange, + const std::function &onClose); void SetText(const char *pText); - void Close(); + void Close(INT_PTR buttonId); }; - - - typedef struct _MSDN_DLGTEMPLATEEX { WORD dlgVer; @@ -221,27 +220,23 @@ WIN32INPUTBOX_PARAM::WIN32INPUTBOX_PARAM() CWin32InputBox::CWin32InputBox(WIN32INPUTBOX_PARAM *param) { - _param = param; + _param = new (std::nothrow) WIN32INPUTBOX_PARAM(*param); _hwndEditCtrl = NULL; _recursionDepth = 0; + _getMsgHook = NULL; } CWin32InputBox::~CWin32InputBox() { - + CC_SAFE_DELETE(_param); } -void CWin32InputBox::SetParam(WIN32INPUTBOX_PARAM *param) -{ - _param = param; -} - -WIN32INPUTBOX_PARAM *CWin32InputBox::GetParam() -{ - return _param; -} - -INT_PTR CWin32InputBox::InputBoxEx(WIN32INPUTBOX_PARAM *param) +INT_PTR CWin32InputBox::InputBoxEx(WIN32INPUTBOX_PARAM *param, + cocos2d::ui::EditBox::KeyboardReturnType eReturnType, + cocos2d::ui::EditBox::InputMode eInputMode, + cocos2d::ui::EditBox::InputFlag eInputFlag, + const std::function &onTextChange, + const std::function &onClose) { // Check mandatory parameters if (param->pstrResult == nullptr) @@ -309,15 +304,20 @@ INT_PTR CWin32InputBox::InputBoxEx(WIN32INPUTBOX_PARAM *param) dlgTemplate->y = param->yPos; } - CWin32InputBox inputbox(param); - s_win32InputBox = &inputbox; + CCAssert(s_win32InputBox == nullptr, "Only one instance of Win32InputBox allowed"); - // Resize dialog and SHOW or HIDE multiline - INT_PTR r = ::DialogBoxIndirectParam(param->hInstance, dlgTemplate, param->hwndOwner, (DLGPROC)DlgProc, (LPARAM)&inputbox); - param->hDlg = NULL; - s_win32InputBox = nullptr; + s_win32InputBox = new (std::nothrow) CWin32InputBox(param); + s_win32InputBox->_returnType = eReturnType; + s_win32InputBox->_inputMode = eInputMode; + s_win32InputBox->_inputFlag = eInputFlag; + s_win32InputBox->_onTextChange = onTextChange; + s_win32InputBox->_onClose = onClose; - return r; + HWND hDlg = ::CreateDialogIndirectParam(param->hInstance, dlgTemplate, param->hwndOwner, (DLGPROC)DlgProc, (LPARAM)s_win32InputBox); + ::ShowWindow(hDlg, SW_SHOW); + ::EnableWindow(param->hwndOwner, FALSE); + + return TRUE; } INT_PTR CWin32InputBox::InputBox( @@ -330,8 +330,8 @@ INT_PTR CWin32InputBox::InputBox( cocos2d::ui::EditBox::KeyboardReturnType eReturnType, cocos2d::ui::EditBox::InputMode eInputMode, cocos2d::ui::EditBox::InputFlag eInputFlag, - Win32InputBoxTextChange lpfnOnTextChange, - cocos2d::ui::EditBoxImplWin *ctx) + const std::function &onTextChange, + const std::function &onClose) { WIN32INPUTBOX_PARAM param; @@ -341,18 +341,14 @@ INT_PTR CWin32InputBox::InputBox( param.nMaxLength = nResultSize; param.bMultiline = bMultiLine; param.hwndOwner = hwndParent; - param.eReturnType = eReturnType; - param.eInputMode = eInputMode; - param.eInputFlag = eInputFlag; - param.lpfnOnTextChange = lpfnOnTextChange; - param.lpCtx = ctx; - return InputBoxEx(¶m); + + return InputBoxEx(¶m, eReturnType, eInputMode, eInputFlag, onTextChange, onClose); } void CWin32InputBox::InitDialog() { // Set the button captions, associated with ReturnType - switch (_param->eReturnType) + switch (_returnType) { case cocos2d::ui::EditBox::KeyboardReturnType::DEFAULT: ::SetDlgItemTextW(_param->hDlg, IDOK, L"OK"); @@ -419,7 +415,6 @@ void CWin32InputBox::InitDialog() rectDlg.right - rectDlg.left, rectDlg.bottom - rectDlg.top - (rectEdit1.bottom - rectEdit1.top), SWP_NOMOVE); - } else { @@ -444,7 +439,7 @@ void CWin32InputBox::InitDialog() ::SendMessageW(hwndEdit2, EM_LIMITTEXT, (WPARAM)_param->nMaxLength, 0); } - switch (_param->eInputFlag) + switch (_inputFlag) { case cocos2d::ui::EditBox::InputFlag::PASSWORD: // Sets a password character displayed in a edit control when the user types text. @@ -468,7 +463,7 @@ void CWin32InputBox::InitDialog() break; } - switch (_param->eInputMode) + switch (_inputMode) { case cocos2d::ui::EditBox::InputMode::ANY: break; @@ -492,83 +487,92 @@ void CWin32InputBox::InitDialog() default: break; } + CCAssert(_getMsgHook == NULL, "Windows Message hook already set"); + + // To make the enter key work, here need a Windows Message hook. + // Please refer to https://support.microsoft.com/en-us/kb/187988 + _getMsgHook = ::SetWindowsHookEx(WH_GETMESSAGE, &CWin32InputBox::GetMsgProc, ::GetModuleHandle(nullptr), ::GetCurrentThreadId()); } -#define REDNERING_TIMER_ID 2015 +LRESULT CALLBACK CWin32InputBox::GetMsgProc(int code, WPARAM wParam, LPARAM lParam) +{ + if (code == HC_ACTION) + { + LPMSG lpMsg = (LPMSG)lParam; + if (lpMsg->message == WM_KEYDOWN) + { + if (lpMsg->wParam == VK_RETURN) // User has hit the ENTER key. + { + // Translate the message manually. + lpMsg->hwnd = s_win32InputBox->_param->hDlg; + lpMsg->message = WM_COMMAND; + lpMsg->wParam = IDOK; + } + } + } + return ::CallNextHookEx(s_win32InputBox->_getMsgHook, code, wParam, lParam); +} // Message handler for about box. LRESULT CALLBACK CWin32InputBox::DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { CWin32InputBox *_this = (CWin32InputBox *) ::GetWindowLongPtr(hDlg, GWLP_USERDATA); - WIN32INPUTBOX_PARAM *param = _this ? _this->GetParam() : 0; switch (message) { - case WM_INITDIALOG: - { - SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)lParam); + case WM_INITDIALOG: + { + SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)lParam); + + _this = (CWin32InputBox *)lParam; + _this->_param->hDlg = hDlg; + _this->InitDialog(); + return TRUE; + } - _this = (CWin32InputBox *)lParam; - _this->_param->hDlg = hDlg; - _this->InitDialog(); - - // Set timer for rendering - TIMERPROC lpTimerFunc = [](HWND, UINT, UINT, DWORD) { - auto director = cocos2d::Director::getInstance(); - auto glview = director->getOpenGLView(); - director->mainLoop(); - glview->pollEvents(); - }; - ::SetTimer(hDlg, REDNERING_TIMER_ID, USER_TIMER_MINIMUM, lpTimerFunc); - return TRUE; - } - - case WM_COMMAND: - { + case WM_COMMAND: + { #ifdef _MY_DEBUG - CHAR buf[1024]; - static int i = 0; - sprintf(buf, "WM_COMMAND: %09d wParam=%08X lParam=%08X\n", i++, wParam, lParam); - OutputDebugStringA(buf); + CHAR buf[1024]; + static int i = 0; + sprintf(buf, "WM_COMMAND: %09d wParam=%08X lParam=%08X\n", i++, wParam, lParam); + OutputDebugStringA(buf); #endif - INT_PTR buttonId = LOWORD(wParam); - if (buttonId == IDOK || buttonId == IDCANCEL) - { - // Yes! Just close the dialog box simply, - // because the text of EditBox has been already synced at the moment of text altered in the edit control - ::EndDialog(hDlg, buttonId); - return TRUE; - } - - // text altered in the edit control - // Please refer to https://msdn.microsoft.com/en-us/library/bb761676%28v=vs.85%29.aspx - if (HIWORD(wParam) == EN_CHANGE && _this->_recursionDepth == 0 && _this->_param->lpfnOnTextChange != nullptr) - { - std::u16string wstrResult; - std::string utf8Result; - - int inputLength = ::GetWindowTextLengthW(_this->_hwndEditCtrl); - wstrResult.resize(inputLength); - - ::GetWindowTextW( - _this->_hwndEditCtrl, - (LPWSTR) const_cast(wstrResult.c_str()), - inputLength+1); - - bool conversionResult = cocos2d::StringUtils::UTF16ToUTF8(wstrResult, utf8Result); - _this->_param->pstrResult->clear(); - ++_this->_recursionDepth; // Prevent recursive calls - if (conversionResult) - { - *(_this->_param->pstrResult) = std::move(utf8Result); - } - // Invoke editBoxTextChanged indirectly - _this->_param->lpfnOnTextChange(_this->_param->pstrResult->c_str(), _this->_param->lpCtx); - --_this->_recursionDepth; - return TRUE; - } - } - break; + INT_PTR buttonId = LOWORD(wParam); + if (buttonId == IDOK || buttonId == IDCANCEL) + { + // Yes! Just close the dialog box simply, + // because the text of EditBox has been already synced at the moment of text altered in the edit control + _this->Close(buttonId); + return TRUE; + } + + // text altered in the edit control + // Please refer to https://msdn.microsoft.com/en-us/library/bb761676%28v=vs.85%29.aspx + if (HIWORD(wParam) == EN_CHANGE && _this->_recursionDepth == 0) + { + std::u16string wstrResult; + std::string utf8Result; + + int inputLength = ::GetWindowTextLengthW(_this->_hwndEditCtrl); + wstrResult.resize(inputLength); + + ::GetWindowTextW(_this->_hwndEditCtrl, (LPWSTR) const_cast(wstrResult.c_str()), inputLength+1); + bool conversionResult = cocos2d::StringUtils::UTF16ToUTF8(wstrResult, utf8Result); + _this->_param->pstrResult->clear(); + ++_this->_recursionDepth; // Prevent recursive calls + if (conversionResult) + { + *(_this->_param->pstrResult) = std::move(utf8Result); + } + + // Invoke editBoxTextChanged indirectly + _this->_onTextChange(_this->_param->pstrResult->c_str()); + --_this->_recursionDepth; + return TRUE; + } + break; + } } return FALSE; } @@ -592,12 +596,22 @@ void CWin32InputBox::SetText(const char* pText) } } -void CWin32InputBox::Close() +void CWin32InputBox::Close(INT_PTR buttonId) { + if (_getMsgHook != NULL) + { + ::UnhookWindowsHookEx(_getMsgHook); + _getMsgHook = NULL; + } + if (_param->hDlg != NULL) { - ::EndDialog(_param->hDlg, IDCANCEL); + ::EnableWindow(_param->hwndOwner, TRUE); + ::SetFocus(_param->hwndOwner); + ::DestroyWindow(_param->hDlg); _param->hDlg = NULL; + + _onClose(buttonId); } } @@ -663,7 +677,7 @@ void EditBoxImplWin::setFont(const char* pFontName, int fontSize) { if (_label != nullptr) { - if(strlen(pFontName) > 0) + if (pFontName[0] != '\0') // To determine whether a string is empty quickly { _label->setSystemFontName(pFontName); } @@ -675,7 +689,7 @@ void EditBoxImplWin::setFont(const char* pFontName, int fontSize) if (_labelPlaceHolder != nullptr) { - if(strlen(pFontName) > 0) + if (pFontName[0] != '\0') // To determine whether a string is empty quickly { _labelPlaceHolder->setSystemFontName(pFontName); } @@ -696,7 +710,7 @@ void EditBoxImplWin::setPlaceholderFont(const char* pFontName, int fontSize) { if (_labelPlaceHolder != nullptr) { - if(strlen(pFontName) > 0) + if (pFontName[0] != '\0') // To determine whether a string is empty quickly { _labelPlaceHolder->setSystemFontName(pFontName); } @@ -833,6 +847,11 @@ void EditBoxImplWin::draw(Renderer *renderer, const Mat4 &transform, uint32_t fl void EditBoxImplWin::openKeyboard() { + if (s_win32InputBox != nullptr) + { + return; + } + if (_delegate != nullptr) { _delegate->editBoxEditingDidBegin(_editBox); @@ -853,16 +872,23 @@ void EditBoxImplWin::openKeyboard() if (placeHolder.length() == 0) placeHolder = "Enter value"; - std::string text = getText(); - std::string originalText = text; + _editingText = getText(); + _originalText = _editingText; auto glView = Director::getInstance()->getOpenGLView(); HWND hwnd = glView->getWin32Window(); - bool didChange = CWin32InputBox::InputBox("Input", placeHolder.c_str(), &text, _maxLength, false, hwnd, + CWin32InputBox::InputBox("Input", placeHolder.c_str(), &_editingText, _maxLength, false, hwnd, _keyboardReturnType, _editBoxInputMode, _editBoxInputFlag, - &EditBoxImplWin::onWin32InputBoxTextChange, this) == IDOK; + std::bind(&EditBoxImplWin::onWin32InputBoxTextChange, this, std::placeholders::_1), + std::bind(&EditBoxImplWin::onWin32InputBoxClose, this, std::placeholders::_1)); +} + +void EditBoxImplWin::onWin32InputBoxClose(INT_PTR buttonId) +{ + bool didChange = buttonId == IDOK; + CC_SAFE_DELETE(s_win32InputBox); _isEditing = false; - setText(didChange ? text.c_str() : originalText.c_str()); + setText(didChange ? _editingText.c_str() : _originalText.c_str()); if (_delegate != nullptr) { @@ -889,23 +915,21 @@ void EditBoxImplWin::openKeyboard() #endif // #if CC_ENABLE_SCRIPT_BINDING } -void EditBoxImplWin::onWin32InputBoxTextChange(const char *pText, EditBoxImplWin* thiz) +void EditBoxImplWin::onWin32InputBoxTextChange(const char *pText) { thiz->_isEditing = false; // Prevent recursive calls thiz->setText(pText); thiz->_isEditing = true; - auto delegate = thiz->getDelegate(); - if (delegate != nullptr) + if (_delegate != nullptr) { - delegate->editBoxTextChanged(thiz->_editBox, thiz->_text); + _delegate->editBoxTextChanged(_editBox, _text); } #if CC_ENABLE_SCRIPT_BINDING - auto editBox = thiz->getEditBox(); - if (nullptr != editBox && 0 != editBox->getScriptEditBoxHandler() && ScriptEngineManager::ShareInstance) + if (nullptr != _editBox && 0 != _editBox->getScriptEditBoxHandler()) { - CommonScriptData data(editBox->getScriptEditBoxHandler(), "changed", editBox); + CommonScriptData data(_editBox->getScriptEditBoxHandler(), "changed", _editBox); ScriptEvent event(kCommonEvent, (void*)&data); ScriptEngineManager::ShareInstance->getScriptEngine()->sendEvent(&event); } @@ -917,15 +941,14 @@ void EditBoxImplWin::closeKeyboard() // close the running Win32InputBox if (s_win32InputBox != nullptr) { - s_win32InputBox->Close(); - s_win32InputBox = nullptr; + s_win32InputBox->Close(IDCANCEL); + CC_SAFE_DELETE(s_win32InputBox); _isEditing = false; } } void EditBoxImplWin::onEnter() { - } } @@ -933,4 +956,3 @@ void EditBoxImplWin::onEnter() NS_CC_END #endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */ - diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.h b/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.h index e79460408c..0a3ca1f679 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.h +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.h @@ -100,15 +100,13 @@ private: int _maxLength; Size _editSize; - /* - Size _contentSize; - HWND _sysEdit; - int _maxTextLength; - */ + std::string _editingText; + std::string _originalText; bool _isEditing; - static void onWin32InputBoxTextChange(const char *pText, EditBoxImplWin *thiz); -}; + void onWin32InputBoxTextChange(const char *pText); + void onWin32InputBoxClose(INT_PTR buttonId); +}; } @@ -117,4 +115,3 @@ NS_CC_END #endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */ #endif /* __UIEditBoxIMPLWIN_H__ */ - diff --git a/native/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.h b/native/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.h index c07a9a3a04..ea628aa054 100644 --- a/native/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.h +++ b/native/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.h @@ -53,8 +53,7 @@ - (void)setVisible:(BOOL)visible; - (void)setTextColor:(UIColor*)color; - (void)setFont:(UIFont *)font; -- (void)setPosition:(CGPoint)pos; -- (void)setContentSize:(CGSize)size; +- (void)updateFrame:(CGRect)rect; - (void)openKeyboard; - (void)closeKeyboard; diff --git a/native/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm b/native/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm index 0e6c65857c..794e869dbf 100644 --- a/native/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm +++ b/native/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm @@ -274,18 +274,12 @@ [eaglview doAnimationWhenKeyboardMoveWithDuration:duration distance:distance]; } -- (void)setPosition:(CGPoint)pos -{ - // TODO: Handle anchor point? - CGRect frame = self.textInput.frame; - frame.origin = pos; - self.textInput.frame = frame; -} - -- (void)setContentSize:(CGSize)size +- (void)updateFrame:(CGRect)rect { CGRect frame = self.textInput.frame; - frame.size = size; + frame.origin = rect.origin; + frame.size = rect.size; + self.textInput.frame = frame; } @@ -375,12 +369,14 @@ - (void)textViewDidChange:(UITextView *)textView { int maxLength = getEditBoxImplIOS()->getMaxLength(); - if (textView.text.length > maxLength) { - textView.text = [textView.text substringToIndex:maxLength]; + if (textView.markedTextRange == nil) { + if (textView.text.length > maxLength) { + textView.text = [textView.text substringToIndex:maxLength]; + } + + const char* inputText = [textView.text UTF8String]; + getEditBoxImplIOS()->editBoxEditingChanged(inputText); } - - const char* inputText = [textView.text UTF8String]; - getEditBoxImplIOS()->editBoxEditingChanged(inputText); } @@ -391,12 +387,14 @@ - (void)textChanged:(UITextField *)textField { int maxLength = getEditBoxImplIOS()->getMaxLength(); - if (textField.text.length > maxLength) { - textField.text = [textField.text substringToIndex:maxLength]; + if (textField.markedTextRange == nil) { + if (textField.text.length > maxLength) { + textField.text = [textField.text substringToIndex:maxLength]; + } + + const char* inputText = [textField.text UTF8String]; + getEditBoxImplIOS()->editBoxEditingChanged(inputText); } - - const char* inputText = [textField.text UTF8String]; - getEditBoxImplIOS()->editBoxEditingChanged(inputText); } - (BOOL)textFieldShouldBeginEditing:(UITextField *)sender // return NO to disallow editing. From e3431f9259df9d0d6a6385449b8322c760ba993d Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Fri, 6 May 2016 11:21:11 +0800 Subject: [PATCH 22/25] Avoid creating short-term temporary `Vec2` objects --- native/cocos/2d/CCActionGrid3D.cpp | 8 ++--- native/cocos/2d/CCFastTMXLayer.cpp | 2 +- native/cocos/2d/CCLayer.cpp | 2 +- native/cocos/2d/CCMenu.cpp | 2 +- native/cocos/2d/CCMenuItem.cpp | 6 ++-- native/cocos/2d/CCParticleExamples.cpp | 12 +++---- native/cocos/2d/CCProgressTimer.cpp | 24 +++++++------- native/cocos/2d/CCSprite.cpp | 2 +- native/cocos/2d/CCTransition.cpp | 18 +++++------ native/cocos/2d/CCTransitionProgress.cpp | 32 +++++++++---------- .../cocostudio/Armature/CCDisplayManager.cpp | 4 +-- .../cocostudio/CCActionFrame.cpp | 2 +- .../editor-support/creator/CCScale9Sprite.cpp | 4 +-- native/cocos/ui/UIEditBox/UIEditBox.cpp | 4 +-- .../ui/UIEditBox/UIEditBoxImpl-common.cpp | 4 +-- .../ui/UIEditBox/UIEditBoxImpl-win32.cpp | 4 +-- native/cocos/ui/UILoadingBar.cpp | 10 +++--- native/cocos/ui/UIScale9Sprite.cpp | 2 +- native/cocos/ui/UISlider.cpp | 4 +-- native/cocos/ui/UIWidget.cpp | 2 +- .../CCControlExtension/CCControlButton.cpp | 4 +-- .../CCControlColourPicker.cpp | 2 +- .../CCControlExtension/CCControlHuePicker.cpp | 4 +-- .../CCControlSaturationBrightnessPicker.cpp | 8 ++--- .../CCControlExtension/CCControlSlider.cpp | 4 +-- .../CCControlExtension/CCControlSwitch.cpp | 2 +- .../GUI/CCScrollView/CCScrollView.cpp | 4 +-- .../GUI/CCScrollView/CCTableView.cpp | 4 +-- 28 files changed, 90 insertions(+), 90 deletions(-) diff --git a/native/cocos/2d/CCActionGrid3D.cpp b/native/cocos/2d/CCActionGrid3D.cpp index e748e819fe..045d486ad5 100644 --- a/native/cocos/2d/CCActionGrid3D.cpp +++ b/native/cocos/2d/CCActionGrid3D.cpp @@ -130,8 +130,8 @@ void FlipX3D::update(float time) Vec3 v0, v1, v, diff; - v0 = getOriginalVertex(Vec2(1.0f, 1.0f)); - v1 = getOriginalVertex(Vec2()); + v0 = getOriginalVertex(Vec2::ONE); + v1 = getOriginalVertex(Vec2::ZERO); float x0 = v0.x; float x1 = v1.x; @@ -224,8 +224,8 @@ void FlipY3D::update(float time) Vec3 v0, v1, v, diff; - v0 = getOriginalVertex(Vec2(1.0f, 1.0f)); - v1 = getOriginalVertex(Vec2()); + v0 = getOriginalVertex(Vec2::ONE); + v1 = getOriginalVertex(Vec2::ZERO); float y0 = v0.y; float y1 = v1.y; diff --git a/native/cocos/2d/CCFastTMXLayer.cpp b/native/cocos/2d/CCFastTMXLayer.cpp index 1fa1974c11..0ba9c6914a 100644 --- a/native/cocos/2d/CCFastTMXLayer.cpp +++ b/native/cocos/2d/CCFastTMXLayer.cpp @@ -823,7 +823,7 @@ void TMXLayer::setupTileSprite(Sprite* sprite, Vec2 pos, int gid) if (gid & kTMXTileDiagonalFlag) { // put the anchor in the middle for ease of rotation. - sprite->setAnchorPoint(Vec2(0.5f,0.5f)); + sprite->setAnchorPoint(Vec2::ANCHOR_MIDDLE); sprite->setPosition(getPositionAt(pos).x + sprite->getContentSize().height/2, getPositionAt(pos).y + sprite->getContentSize().width/2 ); diff --git a/native/cocos/2d/CCLayer.cpp b/native/cocos/2d/CCLayer.cpp index ea7dfbe587..aca805a0b0 100644 --- a/native/cocos/2d/CCLayer.cpp +++ b/native/cocos/2d/CCLayer.cpp @@ -48,7 +48,7 @@ NS_CC_BEGIN Layer::Layer() { _ignoreAnchorPointForPosition = true; - setAnchorPoint(Vec2(0.5f, 0.5f)); + setAnchorPoint(Vec2::ANCHOR_MIDDLE); } Layer::~Layer() diff --git a/native/cocos/2d/CCMenu.cpp b/native/cocos/2d/CCMenu.cpp index 91f4ea0be9..77daa4947b 100644 --- a/native/cocos/2d/CCMenu.cpp +++ b/native/cocos/2d/CCMenu.cpp @@ -137,7 +137,7 @@ bool Menu::initWithArray(const Vector& arrayOfItems) Size s = _director->getWinSize(); this->ignoreAnchorPointForPosition(true); - setAnchorPoint(Vec2(0.5f, 0.5f)); + setAnchorPoint(Vec2::ANCHOR_MIDDLE); this->setContentSize(s); setPosition(s.width/2, s.height/2); diff --git a/native/cocos/2d/CCMenuItem.cpp b/native/cocos/2d/CCMenuItem.cpp index 819bdb365c..44899a0f51 100644 --- a/native/cocos/2d/CCMenuItem.cpp +++ b/native/cocos/2d/CCMenuItem.cpp @@ -60,7 +60,7 @@ MenuItem* MenuItem::create( const ccMenuCallback& callback) bool MenuItem::initWithCallback(const ccMenuCallback& callback) { - setAnchorPoint(Vec2(0.5f, 0.5f)); + setAnchorPoint(Vec2::ANCHOR_MIDDLE); _callback = callback; _enabled = true; _selected = false; @@ -404,7 +404,7 @@ void MenuItemSprite::setSelectedImage(Node* image) if (image) { addChild(image); - image->setAnchorPoint(Vec2(0, 0)); + image->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT); } if (_selectedImage) @@ -424,7 +424,7 @@ void MenuItemSprite::setDisabledImage(Node* image) if (image) { addChild(image); - image->setAnchorPoint(Vec2(0, 0)); + image->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT); } if (_disabledImage) diff --git a/native/cocos/2d/CCParticleExamples.cpp b/native/cocos/2d/CCParticleExamples.cpp index bbb4e93c8a..2e91304f16 100644 --- a/native/cocos/2d/CCParticleExamples.cpp +++ b/native/cocos/2d/CCParticleExamples.cpp @@ -307,7 +307,7 @@ bool ParticleSun::initWithTotalParticles(int numberOfParticles) setEmitterMode(Mode::GRAVITY); // Gravity Mode: gravity - setGravity(Vec2(0,0)); + setGravity(Vec2::ZERO); // Gravity mode: radial acceleration setRadialAccel(0); @@ -411,7 +411,7 @@ bool ParticleGalaxy::initWithTotalParticles(int numberOfParticles) setEmitterMode(Mode::GRAVITY); // Gravity Mode: gravity - setGravity(Vec2(0,0)); + setGravity(Vec2::ZERO); // Gravity Mode: speed of particles setSpeed(60); @@ -520,7 +520,7 @@ bool ParticleFlower::initWithTotalParticles(int numberOfParticles) setEmitterMode(Mode::GRAVITY); // Gravity Mode: gravity - setGravity(Vec2(0,0)); + setGravity(Vec2::ZERO); // Gravity Mode: speed of particles setSpeed(80); @@ -737,7 +737,7 @@ bool ParticleSpiral::initWithTotalParticles(int numberOfParticles) setEmitterMode(Mode::GRAVITY); // Gravity Mode: gravity - setGravity(Vec2(0,0)); + setGravity(Vec2::ZERO); // Gravity Mode: speed of particles setSpeed(150); @@ -845,7 +845,7 @@ bool ParticleExplosion::initWithTotalParticles(int numberOfParticles) setEmitterMode(Mode::GRAVITY); // Gravity Mode: gravity - setGravity(Vec2(0,0)); + setGravity(Vec2::ZERO); // Gravity Mode: speed of particles setSpeed(70); @@ -954,7 +954,7 @@ bool ParticleSmoke::initWithTotalParticles(int numberOfParticles) setEmitterMode(Mode::GRAVITY); // Gravity Mode: gravity - setGravity(Vec2(0,0)); + setGravity(Vec2::ZERO); // Gravity Mode: radial acceleration setRadialAccel(0); diff --git a/native/cocos/2d/CCProgressTimer.cpp b/native/cocos/2d/CCProgressTimer.cpp index 493720d646..8bb058c3ca 100644 --- a/native/cocos/2d/CCProgressTimer.cpp +++ b/native/cocos/2d/CCProgressTimer.cpp @@ -73,11 +73,11 @@ bool ProgressTimer::initWithSprite(Sprite* sp) _vertexData = nullptr; _vertexDataCount = 0; - setAnchorPoint(Vec2(0.5f,0.5f)); + setAnchorPoint(Vec2::ANCHOR_MIDDLE); _type = Type::RADIAL; _reverseDirection = false; - setMidpoint(Vec2(0.5f, 0.5f)); - setBarChangeRate(Vec2(1,1)); + setMidpoint(Vec2::ANCHOR_MIDDLE); + setBarChangeRate(Vec2::ONE); setSprite(sp); // shader state @@ -246,7 +246,7 @@ GLubyte ProgressTimer::getOpacity() const void ProgressTimer::setMidpoint(const Vec2& midPoint) { - _midpoint = midPoint.getClampPoint(Vec2::ZERO, Vec2(1, 1)); + _midpoint = midPoint.getClampPoint(Vec2::ZERO, Vec2::ONE); } /// @@ -448,20 +448,20 @@ void ProgressTimer::updateBar() _vertexData = (V2F_C4B_T2F*)malloc(_vertexDataCount * sizeof(V2F_C4B_T2F)); CCASSERT( _vertexData, "CCProgressTimer. Not enough memory"); // TOPLEFT 1 - _vertexData[0].texCoords = textureCoordFromAlphaPoint(Vec2(0,1)); - _vertexData[0].vertices = vertexFromAlphaPoint(Vec2(0,1)); + _vertexData[0].texCoords = textureCoordFromAlphaPoint(Vec2::UNIT_Y); + _vertexData[0].vertices = vertexFromAlphaPoint(Vec2::UNIT_Y); // BOTLEFT 1 - _vertexData[1].texCoords = textureCoordFromAlphaPoint(Vec2(0,0)); - _vertexData[1].vertices = vertexFromAlphaPoint(Vec2(0,0)); + _vertexData[1].texCoords = textureCoordFromAlphaPoint(Vec2::ZERO); + _vertexData[1].vertices = vertexFromAlphaPoint(Vec2::ZERO); // TOPRIGHT 2 - _vertexData[6].texCoords = textureCoordFromAlphaPoint(Vec2(1,1)); - _vertexData[6].vertices = vertexFromAlphaPoint(Vec2(1,1)); + _vertexData[6].texCoords = textureCoordFromAlphaPoint(Vec2::ONE); + _vertexData[6].vertices = vertexFromAlphaPoint(Vec2::ONE); // BOTRIGHT 2 - _vertexData[7].texCoords = textureCoordFromAlphaPoint(Vec2(1,0)); - _vertexData[7].vertices = vertexFromAlphaPoint(Vec2(1,0)); + _vertexData[7].texCoords = textureCoordFromAlphaPoint(Vec2::UNIT_X); + _vertexData[7].vertices = vertexFromAlphaPoint(Vec2::UNIT_X); } // TOPRIGHT 1 diff --git a/native/cocos/2d/CCSprite.cpp b/native/cocos/2d/CCSprite.cpp index c72f2ffeb5..5e0240a5ca 100644 --- a/native/cocos/2d/CCSprite.cpp +++ b/native/cocos/2d/CCSprite.cpp @@ -253,7 +253,7 @@ bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect, bool rotated) _flippedX = _flippedY = false; // default transform anchor: center - setAnchorPoint(Vec2(0.5f, 0.5f)); + setAnchorPoint(Vec2::ANCHOR_MIDDLE); // zwoptex default values _offsetPosition.setZero(); diff --git a/native/cocos/2d/CCTransition.cpp b/native/cocos/2d/CCTransition.cpp index 4eb28a1c69..f61971eca6 100644 --- a/native/cocos/2d/CCTransition.cpp +++ b/native/cocos/2d/CCTransition.cpp @@ -279,8 +279,8 @@ void TransitionRotoZoom:: onEnter() _inScene->setScale(0.001f); _outScene->setScale(1.0f); - _inScene->setAnchorPoint(Vec2(0.5f, 0.5f)); - _outScene->setAnchorPoint(Vec2(0.5f, 0.5f)); + _inScene->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + _outScene->setAnchorPoint(Vec2::ANCHOR_MIDDLE); ActionInterval *rotozoom = (ActionInterval*)(Sequence::create ( @@ -335,8 +335,8 @@ void TransitionJumpZoom::onEnter() _inScene->setScale(0.5f); _inScene->setPosition(s.width, 0); - _inScene->setAnchorPoint(Vec2(0.5f, 0.5f)); - _outScene->setAnchorPoint(Vec2(0.5f, 0.5f)); + _inScene->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + _outScene->setAnchorPoint(Vec2::ANCHOR_MIDDLE); ActionInterval *jump = JumpBy::create(_duration/4, Vec2(-s.width,0), s.width/4, 2); ActionInterval *scaleIn = ScaleTo::create(_duration/4, 1.0f); @@ -403,7 +403,7 @@ void TransitionMoveInL::onEnter() ActionInterval* TransitionMoveInL::action() { - return MoveTo::create(_duration, Vec2(0,0)); + return MoveTo::create(_duration, Vec2::ZERO); } ActionInterval* TransitionMoveInL::easeActionWithAction(ActionInterval* action) @@ -1308,9 +1308,9 @@ void TransitionCrossFade::onEnter() return; } - inTexture->getSprite()->setAnchorPoint( Vec2(0.5f,0.5f) ); + inTexture->getSprite()->setAnchorPoint( Vec2::ANCHOR_MIDDLE ); inTexture->setPosition(size.width/2, size.height/2); - inTexture->setAnchorPoint( Vec2(0.5f,0.5f) ); + inTexture->setAnchorPoint( Vec2::ANCHOR_MIDDLE ); // render inScene to its texturebuffer inTexture->begin(); @@ -1319,9 +1319,9 @@ void TransitionCrossFade::onEnter() // create the second render texture for outScene RenderTexture* outTexture = RenderTexture::create((int)size.width, (int)size.height,Texture2D::PixelFormat::RGBA8888,GL_DEPTH24_STENCIL8); - outTexture->getSprite()->setAnchorPoint( Vec2(0.5f,0.5f) ); + outTexture->getSprite()->setAnchorPoint( Vec2::ANCHOR_MIDDLE ); outTexture->setPosition(size.width/2, size.height/2); - outTexture->setAnchorPoint( Vec2(0.5f,0.5f) ); + outTexture->setAnchorPoint( Vec2::ANCHOR_MIDDLE ); // render outScene to its texturebuffer outTexture->begin(); diff --git a/native/cocos/2d/CCTransitionProgress.cpp b/native/cocos/2d/CCTransitionProgress.cpp index 284d9b1bf3..ed4c2d941b 100644 --- a/native/cocos/2d/CCTransitionProgress.cpp +++ b/native/cocos/2d/CCTransitionProgress.cpp @@ -72,9 +72,9 @@ void TransitionProgress::onEnter() // create the second render texture for outScene RenderTexture *texture = RenderTexture::create((int)size.width, (int)size.height,Texture2D::PixelFormat::RGBA8888,GL_DEPTH24_STENCIL8); - texture->getSprite()->setAnchorPoint(Vec2(0.5f,0.5f)); + texture->getSprite()->setAnchorPoint(Vec2::ANCHOR_MIDDLE); texture->setPosition(size.width/2, size.height/2); - texture->setAnchorPoint(Vec2(0.5f,0.5f)); + texture->setAnchorPoint(Vec2::ANCHOR_MIDDLE); // render outScene to its texturebuffer texture->beginWithClear(0, 0, 0, 1); @@ -145,7 +145,7 @@ ProgressTimer* TransitionProgressRadialCCW::progressTimerNodeWithRenderTexture(R node->setReverseDirection(false); node->setPercentage(100); node->setPosition(size.width/2, size.height/2); - node->setAnchorPoint(Vec2(0.5f,0.5f)); + node->setAnchorPoint(Vec2::ANCHOR_MIDDLE); return node; } @@ -189,7 +189,7 @@ ProgressTimer* TransitionProgressRadialCW::progressTimerNodeWithRenderTexture(Re node->setReverseDirection(true); node->setPercentage(100); node->setPosition(size.width/2, size.height/2); - node->setAnchorPoint(Vec2(0.5f,0.5f)); + node->setAnchorPoint(Vec2::ANCHOR_MIDDLE); return node; } @@ -217,12 +217,12 @@ ProgressTimer* TransitionProgressHorizontal::progressTimerNodeWithRenderTexture( node->getSprite()->setFlippedY(true); node->setType( ProgressTimer::Type::BAR); - node->setMidpoint(Vec2(1, 0)); - node->setBarChangeRate(Vec2(1,0)); + node->setMidpoint(Vec2::UNIT_X); + node->setBarChangeRate(Vec2::UNIT_X); node->setPercentage(100); node->setPosition(size.width/2, size.height/2); - node->setAnchorPoint(Vec2(0.5f,0.5f)); + node->setAnchorPoint(Vec2::ANCHOR_MIDDLE); return node; } @@ -250,12 +250,12 @@ ProgressTimer* TransitionProgressVertical::progressTimerNodeWithRenderTexture(Re node->getSprite()->setFlippedY(true); node->setType(ProgressTimer::Type::BAR); - node->setMidpoint(Vec2(0, 0)); - node->setBarChangeRate(Vec2(0,1)); + node->setMidpoint(Vec2::ZERO); + node->setBarChangeRate(Vec2::UNIT_Y); node->setPercentage(100); node->setPosition(size.width/2, size.height/2); - node->setAnchorPoint(Vec2(0.5f,0.5f)); + node->setAnchorPoint(Vec2::ANCHOR_MIDDLE); return node; } @@ -296,12 +296,12 @@ ProgressTimer* TransitionProgressInOut::progressTimerNodeWithRenderTexture(Rende node->getSprite()->setFlippedY(true); node->setType( ProgressTimer::Type::BAR); - node->setMidpoint(Vec2(0.5f, 0.5f)); - node->setBarChangeRate(Vec2(1, 1)); + node->setMidpoint(Vec2::ANCHOR_MIDDLE); + node->setBarChangeRate(Vec2::ONE); node->setPercentage(0); node->setPosition(size.width/2, size.height/2); - node->setAnchorPoint(Vec2(0.5f,0.5f)); + node->setAnchorPoint(Vec2::ANCHOR_MIDDLE); return node; } @@ -330,12 +330,12 @@ ProgressTimer* TransitionProgressOutIn::progressTimerNodeWithRenderTexture(Rende node->getSprite()->setFlippedY(true); node->setType( ProgressTimer::Type::BAR ); - node->setMidpoint(Vec2(0.5f, 0.5f)); - node->setBarChangeRate(Vec2(1, 1)); + node->setMidpoint(Vec2::ANCHOR_MIDDLE); + node->setBarChangeRate(Vec2::ONE); node->setPercentage(100); node->setPosition(size.width/2, size.height/2); - node->setAnchorPoint(Vec2(0.5f,0.5f)); + node->setAnchorPoint(Vec2::ANCHOR_MIDDLE); return node; } diff --git a/native/cocos/editor-support/cocostudio/Armature/CCDisplayManager.cpp b/native/cocos/editor-support/cocostudio/Armature/CCDisplayManager.cpp index 669219bc9b..b65616d65e 100644 --- a/native/cocos/editor-support/cocostudio/Armature/CCDisplayManager.cpp +++ b/native/cocos/editor-support/cocostudio/Armature/CCDisplayManager.cpp @@ -436,13 +436,13 @@ Rect DisplayManager::getBoundingBox() const Vec2 DisplayManager::getAnchorPoint() const { - CS_RETURN_IF(!_displayRenderNode) Vec2(0, 0); + CS_RETURN_IF(!_displayRenderNode) Vec2::ANCHOR_BOTTOM_LEFT; return _displayRenderNode->getAnchorPoint(); } Vec2 DisplayManager::getAnchorPointInPoints() const { - CS_RETURN_IF(!_displayRenderNode) Vec2(0, 0); + CS_RETURN_IF(!_displayRenderNode) Vec2::ANCHOR_BOTTOM_LEFT; return _displayRenderNode->getAnchorPointInPoints(); } diff --git a/native/cocos/editor-support/cocostudio/CCActionFrame.cpp b/native/cocos/editor-support/cocostudio/CCActionFrame.cpp index b7e0973405..52730332a2 100644 --- a/native/cocos/editor-support/cocostudio/CCActionFrame.cpp +++ b/native/cocos/editor-support/cocostudio/CCActionFrame.cpp @@ -221,7 +221,7 @@ ActionInterval* ActionFrame::getEasingAction(ActionInterval* action) ////////////////////////////////////////////////////////////////////////// ActionMoveFrame::ActionMoveFrame() - : _position(Vec2(0.0f,0.0f)) + : _position(Vec2::ZERO) { _frameType = (int)kKeyframeMove; } diff --git a/native/cocos/editor-support/creator/CCScale9Sprite.cpp b/native/cocos/editor-support/creator/CCScale9Sprite.cpp index b9a9fbc671..231e63ba8e 100644 --- a/native/cocos/editor-support/creator/CCScale9Sprite.cpp +++ b/native/cocos/editor-support/creator/CCScale9Sprite.cpp @@ -857,12 +857,12 @@ _quadsDirty(true), _isTriangle(false), _isTrimmedContentSize(true), _fillType(Scale9SpriteV2::FillType::HORIZONTAL), -_fillCenter(cocos2d::Vec2(0,0)), +_fillCenter(cocos2d::Vec2::ZERO), _fillStart(0), _fillRange(0), _needRebuildRenderCommand(true) { - this->setAnchorPoint(cocos2d::Vec2(0.5,0.5)); + this->setAnchorPoint(cocos2d::Vec2::ANCHOR_MIDDLE); this->setGLProgramState(cocos2d::GLProgramState::getOrCreateWithGLProgramName(cocos2d::GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP)); } diff --git a/native/cocos/ui/UIEditBox/UIEditBox.cpp b/native/cocos/ui/UIEditBox/UIEditBox.cpp index c882dbeffc..0d803a8f32 100644 --- a/native/cocos/ui/UIEditBox/UIEditBox.cpp +++ b/native/cocos/ui/UIEditBox/UIEditBox.cpp @@ -113,7 +113,7 @@ bool EditBox::initWithSizeAndBackgroundSprite(const cocos2d::Size &size, cocos2d _backgroundSprite = pNormal9SpriteBg; this->setContentSize(size); - this->setPosition(Vec2(0, 0)); + this->setPosition(Vec2::ZERO); _backgroundSprite->setPosition(Vec2(_contentSize.width/2, _contentSize.height/2)); _backgroundSprite->setContentSize(size); @@ -148,7 +148,7 @@ bool EditBox::initWithSizeAndBackgroundSprite(const Size& size, _backgroundSprite = Scale9Sprite::createWithSpriteFrameName(pNormal9SpriteBg); } this->setContentSize(size); - this->setPosition(Vec2(0, 0)); + this->setPosition(Vec2::ZERO); _backgroundSprite->setPosition(Vec2(_contentSize.width/2, _contentSize.height/2)); _backgroundSprite->setContentSize(size); diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp b/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp index 984baabf9d..92e80d76f4 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp @@ -79,13 +79,13 @@ void EditBoxImplCommon::initInactiveLabels(const Size& size) const char* pDefaultFontName = this->getNativeDefaultFontName(); _label = Label::create(); - _label->setAnchorPoint(Vec2(0, 0.5f)); + _label->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); _label->setColor(Color3B::WHITE); _label->setVisible(false); _editBox->addChild(_label, kLabelZOrder); _labelPlaceHolder = Label::create(); - _labelPlaceHolder->setAnchorPoint(Vec2(0, 0.5f)); + _labelPlaceHolder->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); _labelPlaceHolder->setColor(Color3B::GRAY); _editBox->addChild(_labelPlaceHolder, kLabelZOrder); diff --git a/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp b/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp index b5440c056c..4398a3b0a4 100644 --- a/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp +++ b/native/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp @@ -655,7 +655,7 @@ bool EditBoxImplWin::initWithSize(const Size& size) _label = Label::create(); _label->setSystemFontSize(size.height-12); // align the text vertically center - _label->setAnchorPoint(Vec2(0, 0.5f)); + _label->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); _label->setPosition(Vec2(CC_EDIT_BOX_PADDING, size.height / 2.0f)); _label->setTextColor(_colText); _editBox->addChild(_label); @@ -663,7 +663,7 @@ bool EditBoxImplWin::initWithSize(const Size& size) _labelPlaceHolder = Label::create(); _labelPlaceHolder->setSystemFontSize(size.height-12); // align the text vertically center - _labelPlaceHolder->setAnchorPoint(Vec2(0, 0.5f)); + _labelPlaceHolder->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); _labelPlaceHolder->setPosition(CC_EDIT_BOX_PADDING, size.height / 2.0f); _labelPlaceHolder->setVisible(false); _labelPlaceHolder->setTextColor(_colPlaceHolder); diff --git a/native/cocos/ui/UILoadingBar.cpp b/native/cocos/ui/UILoadingBar.cpp index c58afda297..4cdf5fc187 100644 --- a/native/cocos/ui/UILoadingBar.cpp +++ b/native/cocos/ui/UILoadingBar.cpp @@ -92,7 +92,7 @@ void LoadingBar::initRenderer() _barRenderer = Scale9Sprite::create(); _barRenderer->setScale9Enabled(false); addProtectedChild(_barRenderer, BAR_RENDERER_Z, -1); - _barRenderer->setAnchorPoint(Vec2(0.0,0.5)); + _barRenderer->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); } @@ -107,11 +107,11 @@ void LoadingBar::setDirection(cocos2d::ui::LoadingBar::Direction direction) switch (_direction) { case Direction::LEFT: - _barRenderer->setAnchorPoint(Vec2(0.0f,0.5f)); + _barRenderer->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); _barRenderer->setPosition(Vec2(0,_contentSize.height*0.5f)); break; case Direction::RIGHT: - _barRenderer->setAnchorPoint(Vec2(1.0f,0.5f)); + _barRenderer->setAnchorPoint(Vec2::ANCHOR_MIDDLE_RIGHT); _barRenderer->setPosition(Vec2(_totalLength,_contentSize.height*0.5f)); break; } @@ -163,10 +163,10 @@ void LoadingBar::setupTexture() switch (_direction) { case Direction::LEFT: - _barRenderer->setAnchorPoint(Vec2(0.0f,0.5f)); + _barRenderer->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); break; case Direction::RIGHT: - _barRenderer->setAnchorPoint(Vec2(1.0f,0.5f)); + _barRenderer->setAnchorPoint(Vec2::ANCHOR_MIDDLE_RIGHT); break; } handleSpriteFlipX(); diff --git a/native/cocos/ui/UIScale9Sprite.cpp b/native/cocos/ui/UIScale9Sprite.cpp index 94ee8bf05f..99fcad442b 100644 --- a/native/cocos/ui/UIScale9Sprite.cpp +++ b/native/cocos/ui/UIScale9Sprite.cpp @@ -56,7 +56,7 @@ namespace ui { ,_renderingType(RenderingType::SLICE) ,_insideBounds(true) { - this->setAnchorPoint(Vec2(0.5,0.5)); + this->setAnchorPoint(Vec2::ANCHOR_MIDDLE); #if CC_SPRITE_DEBUG_DRAW _debugDrawNode = DrawNode::create(); addChild(_debugDrawNode); diff --git a/native/cocos/ui/UISlider.cpp b/native/cocos/ui/UISlider.cpp index cbd2bdd59f..8ae32cef7b 100644 --- a/native/cocos/ui/UISlider.cpp +++ b/native/cocos/ui/UISlider.cpp @@ -122,7 +122,7 @@ void Slider::initRenderer() _barRenderer->setScale9Enabled(false); _progressBarRenderer->setScale9Enabled(false); - _progressBarRenderer->setAnchorPoint(Vec2(0.0f, 0.5f)); + _progressBarRenderer->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); addProtectedChild(_barRenderer, BASEBAR_RENDERER_Z, -1); addProtectedChild(_progressBarRenderer, PROGRESSBAR_RENDERER_Z, -1); @@ -219,7 +219,7 @@ void Slider::loadProgressBarTexture(SpriteFrame* spriteframe) void Slider::setupProgressBarTexture() { this->updateChildrenDisplayedRGBA(); - _progressBarRenderer->setAnchorPoint(Vec2(0.0f, 0.5f)); + _progressBarRenderer->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); _progressBarTextureSize = _progressBarRenderer->getContentSize(); _progressBarRendererDirty = true; } diff --git a/native/cocos/ui/UIWidget.cpp b/native/cocos/ui/UIWidget.cpp index 36c5da8998..8842f82b2e 100644 --- a/native/cocos/ui/UIWidget.cpp +++ b/native/cocos/ui/UIWidget.cpp @@ -210,7 +210,7 @@ bool Widget::init() setBright(true); onFocusChanged = CC_CALLBACK_2(Widget::onFocusChange,this); onNextFocusedWidget = nullptr; - this->setAnchorPoint(Vec2(0.5f, 0.5f)); + this->setAnchorPoint(Vec2::ANCHOR_MIDDLE); ignoreContentAdaptWithSize(true); diff --git a/native/extensions/GUI/CCControlExtension/CCControlButton.cpp b/native/extensions/GUI/CCControlExtension/CCControlButton.cpp index 642844ed89..e9ebe9b27e 100644 --- a/native/extensions/GUI/CCControlExtension/CCControlButton.cpp +++ b/native/extensions/GUI/CCControlExtension/CCControlButton.cpp @@ -367,7 +367,7 @@ void ControlButton::setTitleLabelForState(Node* titleLabel, State state) _titleLabelDispatchTable.insert((int)state, titleLabel); titleLabel->setVisible(false); - titleLabel->setAnchorPoint(Vec2(0.5f, 0.5f)); + titleLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE); addChild(titleLabel, 1); // If the current state if equal to the given state we update the layout @@ -466,7 +466,7 @@ void ControlButton::setBackgroundSpriteForState(ui::Scale9Sprite* sprite, State _backgroundSpriteDispatchTable.insert((int)state, sprite); sprite->setVisible(false); - sprite->setAnchorPoint(Vec2(0.5f, 0.5f)); + sprite->setAnchorPoint(Vec2::ANCHOR_MIDDLE); addChild(sprite); if (this->_preferredSize.width != 0 || this->_preferredSize.height != 0) diff --git a/native/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp b/native/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp index 577b5a4156..2eb53f5a6c 100644 --- a/native/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp +++ b/native/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp @@ -76,7 +76,7 @@ bool ControlColourPicker::init() _hsv.v = 0; // Add image - _background=ControlUtils::addSpriteToTargetWithPosAndAnchor("menuColourPanelBackground.png", spriteSheet, Vec2::ZERO, Vec2(0.5f, 0.5f)); + _background=ControlUtils::addSpriteToTargetWithPosAndAnchor("menuColourPanelBackground.png", spriteSheet, Vec2::ZERO, Vec2::ANCHOR_MIDDLE); if(!_background) return false; CC_SAFE_RETAIN(_background); diff --git a/native/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp b/native/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp index efcfd01345..d14a0384b4 100644 --- a/native/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp +++ b/native/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp @@ -63,8 +63,8 @@ bool ControlHuePicker::initWithTargetAndPos(Node* target, Vec2 pos) if (Control::init()) { // Add background and slider sprites - this->setBackground(ControlUtils::addSpriteToTargetWithPosAndAnchor("huePickerBackground.png", target, pos, Vec2(0.0f, 0.0f))); - this->setSlider(ControlUtils::addSpriteToTargetWithPosAndAnchor("colourPicker.png", target, pos, Vec2(0.5f, 0.5f))); + this->setBackground(ControlUtils::addSpriteToTargetWithPosAndAnchor("huePickerBackground.png", target, pos, Vec2::ZERO)); + this->setSlider(ControlUtils::addSpriteToTargetWithPosAndAnchor("colourPicker.png", target, pos, Vec2::ANCHOR_MIDDLE)); _slider->setPosition(pos.x, pos.y + _background->getBoundingBox().size.height * 0.5f); _startPos=pos; diff --git a/native/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp b/native/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp index ad35edaa01..4daaef8dd5 100644 --- a/native/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp +++ b/native/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp @@ -61,10 +61,10 @@ bool ControlSaturationBrightnessPicker::initWithTargetAndPos(Node* target, Vec2 if (Control::init()) { // Add background and slider sprites - _background=ControlUtils::addSpriteToTargetWithPosAndAnchor("colourPickerBackground.png", target, pos, Vec2(0.0f, 0.0f)); - _overlay=ControlUtils::addSpriteToTargetWithPosAndAnchor("colourPickerOverlay.png", target, pos, Vec2(0.0f, 0.0f)); - _shadow=ControlUtils::addSpriteToTargetWithPosAndAnchor("colourPickerShadow.png", target, pos, Vec2(0.0f, 0.0f)); - _slider=ControlUtils::addSpriteToTargetWithPosAndAnchor("colourPicker.png", target, pos, Vec2(0.5f, 0.5f)); + _background=ControlUtils::addSpriteToTargetWithPosAndAnchor("colourPickerBackground.png", target, pos, Vec2::ZERO); + _overlay=ControlUtils::addSpriteToTargetWithPosAndAnchor("colourPickerOverlay.png", target, pos, Vec2::ZERO); + _shadow=ControlUtils::addSpriteToTargetWithPosAndAnchor("colourPickerShadow.png", target, pos, Vec2::ZERO); + _slider=ControlUtils::addSpriteToTargetWithPosAndAnchor("colourPicker.png", target, pos, Vec2::ANCHOR_MIDDLE); _startPos=pos; // starting position of the colour picker boxPos = 35; // starting position of the virtual box area for picking a colour diff --git a/native/extensions/GUI/CCControlExtension/CCControlSlider.cpp b/native/extensions/GUI/CCControlExtension/CCControlSlider.cpp index 1900ad1807..78db9d3cf8 100644 --- a/native/extensions/GUI/CCControlExtension/CCControlSlider.cpp +++ b/native/extensions/GUI/CCControlExtension/CCControlSlider.cpp @@ -139,12 +139,12 @@ bool ControlSlider::initWithSprites(Sprite * backgroundSprite, Sprite* progressS setContentSize(Size(maxRect.size.width, maxRect.size.height)); // Add the slider background - _backgroundSprite->setAnchorPoint(Vec2(0.5f, 0.5f)); + _backgroundSprite->setAnchorPoint(Vec2::ANCHOR_MIDDLE); _backgroundSprite->setPosition(this->getContentSize().width / 2, this->getContentSize().height / 2); addChild(_backgroundSprite); // Add the progress bar - _progressSprite->setAnchorPoint(Vec2(0.0f, 0.5f)); + _progressSprite->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); _progressSprite->setPosition(0.0f, this->getContentSize().height / 2); addChild(_progressSprite); diff --git a/native/extensions/GUI/CCControlExtension/CCControlSwitch.cpp b/native/extensions/GUI/CCControlExtension/CCControlSwitch.cpp index f0cf9410a2..74f22d0269 100644 --- a/native/extensions/GUI/CCControlExtension/CCControlSwitch.cpp +++ b/native/extensions/GUI/CCControlExtension/CCControlSwitch.cpp @@ -334,7 +334,7 @@ bool ControlSwitch::initWithMaskSprite(Sprite *maskSprite, Sprite * onSprite, Sp addChild(_switchSprite); ignoreAnchorPointForPosition(false); - setAnchorPoint(Vec2(0.5f, 0.5f)); + setAnchorPoint(Vec2::ANCHOR_MIDDLE); setContentSize(_switchSprite->getContentSize()); return true; } diff --git a/native/extensions/GUI/CCScrollView/CCScrollView.cpp b/native/extensions/GUI/CCScrollView/CCScrollView.cpp index 701f9cf31f..9e80978867 100644 --- a/native/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/native/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -113,7 +113,7 @@ bool ScrollView::initWithViewSize(Size size, Node *container/* = nullptr*/) { _container = Layer::create(); _container->ignoreAnchorPointForPosition(false); - _container->setAnchorPoint(Vec2(0.0f, 0.0f)); + _container->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT); } this->setViewSize(size); @@ -348,7 +348,7 @@ void ScrollView::setContainer(Node * pContainer) this->_container = pContainer; this->_container->ignoreAnchorPointForPosition(false); - this->_container->setAnchorPoint(Vec2(0.0f, 0.0f)); + this->_container->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT); this->addChild(this->_container); diff --git a/native/extensions/GUI/CCScrollView/CCTableView.cpp b/native/extensions/GUI/CCScrollView/CCTableView.cpp index 5cdd81f860..3635e179a2 100644 --- a/native/extensions/GUI/CCScrollView/CCTableView.cpp +++ b/native/extensions/GUI/CCScrollView/CCTableView.cpp @@ -292,7 +292,7 @@ void TableView::_updateContentSize() { if (_direction == Direction::HORIZONTAL) { - this->setContentOffset(Vec2(0,0)); + this->setContentOffset(Vec2::ZERO); } else { @@ -418,7 +418,7 @@ void TableView::_moveCellOutOfSight(TableViewCell *cell) void TableView::_setIndexForCell(ssize_t index, TableViewCell *cell) { - cell->setAnchorPoint(Vec2(0.0f, 0.0f)); + cell->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT); cell->setPosition(this->_offsetFromIndex(index)); cell->setIdx(index); } From 52332dce9ebaf115936e54357fe137ab477db635 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Mon, 9 May 2016 16:37:55 +0800 Subject: [PATCH 23/25] Fixed possible crash on exit. --- native/cocos/renderer/CCGroupCommand.cpp | 3 ++- native/cocos/ui/UIRichText.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/native/cocos/renderer/CCGroupCommand.cpp b/native/cocos/renderer/CCGroupCommand.cpp index ff17683178..4398e830cd 100644 --- a/native/cocos/renderer/CCGroupCommand.cpp +++ b/native/cocos/renderer/CCGroupCommand.cpp @@ -87,7 +87,8 @@ void GroupCommand::init(float globalOrder) GroupCommand::~GroupCommand() { - Director::DirectorInstance->getRenderer()->getGroupCommandManager()->releaseGroupID(_renderQueueID); + if(Director::DirectorInstance) + Director::DirectorInstance->getRenderer()->getGroupCommandManager()->releaseGroupID(_renderQueueID); } NS_CC_END diff --git a/native/cocos/ui/UIRichText.cpp b/native/cocos/ui/UIRichText.cpp index e985e95732..4fd38728b9 100644 --- a/native/cocos/ui/UIRichText.cpp +++ b/native/cocos/ui/UIRichText.cpp @@ -64,7 +64,8 @@ namespace ui { virtual ~ListenerComponent() { - Director::DirectorInstance->getEventDispatcher()->removeEventListener(_touchListener); + if (Director::DirectorInstance) + Director::DirectorInstance->getEventDispatcher()->removeEventListener(_touchListener); _touchListener->release(); } From adc2a7c8b7afdc30554d4621c2858fdfeb4561e6 Mon Sep 17 00:00:00 2001 From: zilongshanren Date: Tue, 10 May 2016 14:17:32 +0800 Subject: [PATCH 24/25] update js bindings --- .../auto/api/jsb_cocos2dx_auto_api.js | 20 +++++------ .../js-bindings/auto/jsb_cocos2dx_auto.cpp | 33 ++++++++----------- .../js-bindings/auto/jsb_cocos2dx_auto.hpp | 2 +- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js b/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js index a288e07768..56905a9bf5 100644 --- a/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js +++ b/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js @@ -2385,16 +2385,6 @@ pause : function ( { }, -/** - * @method isPurgeDirectorInNextLoop - * @return {bool} - */ -isPurgeDirectorInNextLoop : function ( -) -{ - return false; -}, - /** * @method setEventDispatcher * @param {cc.EventDispatcher} arg0 @@ -3005,6 +2995,16 @@ getActionManager : function ( return cc.ActionManager; }, +/** + * @method isPurgeDirectorInNextLoop + * @return {bool} + */ +isPurgeDirectorInNextLoop : function ( +) +{ + return false; +}, + /** * @method getInstance * @return {cc.Director} diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp index e8fca71c23..6c57dea304 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp @@ -6076,24 +6076,6 @@ bool js_cocos2dx_Director_pause(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Director_pause : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_Director_isPurgeDirectorInNextLoop(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_isPurgeDirectorInNextLoop : Invalid Native Object"); - if (argc == 0) { - bool ret = cobj->isPurgeDirectorInNextLoop(); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Director_isPurgeDirectorInNextLoop : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_Director_setEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -7371,6 +7353,19 @@ bool js_cocos2dx_Director_getActionManager(JSContext *cx, uint32_t argc, jsval * JS_ReportError(cx, "js_cocos2dx_Director_getActionManager : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_Director_isPurgeDirectorInNextLoop(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (argc == 0) { + bool ret = cocos2d::Director::isPurgeDirectorInNextLoop(); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + JS_ReportError(cx, "js_cocos2dx_Director_isPurgeDirectorInNextLoop : wrong number of arguments"); + return false; +} bool js_cocos2dx_Director_getInstance(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -7415,7 +7410,6 @@ void js_register_cocos2dx_Director(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("pause", js_cocos2dx_Director_pause, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("isPurgeDirectorInNextLoop", js_cocos2dx_Director_isPurgeDirectorInNextLoop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setEventDispatcher", js_cocos2dx_Director_setEventDispatcher, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setContentScaleFactor", js_cocos2dx_Director_setContentScaleFactor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getContentScaleFactor", js_cocos2dx_Director_getContentScaleFactor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -7483,6 +7477,7 @@ void js_register_cocos2dx_Director(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec st_funcs[] = { + JS_FN("isPurgeDirectorInNextLoop", js_cocos2dx_Director_isPurgeDirectorInNextLoop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getInstance", js_cocos2dx_Director_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp index 19c5ca51df..48b3cd6a9d 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp @@ -307,7 +307,6 @@ void js_cocos2dx_Director_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_Director(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_Director_pause(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Director_isPurgeDirectorInNextLoop(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Director_setEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Director_setContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Director_getContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp); @@ -371,6 +370,7 @@ bool js_cocos2dx_Director_getEventDispatcher(JSContext *cx, uint32_t argc, jsval bool js_cocos2dx_Director_replaceScene(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Director_setAnimationInterval(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Director_getActionManager(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Director_isPurgeDirectorInNextLoop(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Director_getInstance(JSContext *cx, uint32_t argc, jsval *vp); extern JSClass *jsb_cocos2d_Scheduler_class; From cfb0b363431ae51c7db22ab72c6f59ed4b844a97 Mon Sep 17 00:00:00 2001 From: zilongshanren Date: Tue, 10 May 2016 14:57:43 +0800 Subject: [PATCH 25/25] fix generate templates json file scripts --- native/templates/cocos2dx_files.json | 475 +++++++++++++++--- native/tools/travis-scripts/config.gitingore | 1 - .../travis-scripts/generate-template-files.py | 23 +- 3 files changed, 406 insertions(+), 93 deletions(-) diff --git a/native/templates/cocos2dx_files.json b/native/templates/cocos2dx_files.json index 65cb03466a..894a859a6e 100644 --- a/native/templates/cocos2dx_files.json +++ b/native/templates/cocos2dx_files.json @@ -1,7 +1,9 @@ { "common": [ "README.md", + "build/cocos2d-win32.sln", "build/cocos2d_libs.xcodeproj/project.pbxproj", + "build/cocos2d_libs.xcodeproj/project.xcworkspace/xcshareddata/cocos2d_libs.xcscmblueprint", "cocos/2d/CCAction.cpp", "cocos/2d/CCAction.h", "cocos/2d/CCActionCamera.cpp", @@ -396,8 +398,6 @@ "cocos/editor-support/cocostudio/Armature/CCTween.h", "cocos/editor-support/cocostudio/Armature/CCUtilMath.cpp", "cocos/editor-support/cocostudio/Armature/CCUtilMath.h", - "cocos/editor-support/cocostudio/Armature/DictionaryHelper.cpp", - "cocos/editor-support/cocostudio/Armature/DictionaryHelper.h", "cocos/editor-support/cocostudio/CCActionFrame.cpp", "cocos/editor-support/cocostudio/CCActionFrame.h", "cocos/editor-support/cocostudio/CCActionFrameEasing.cpp", @@ -430,6 +430,9 @@ "cocos/editor-support/cocostudio/DictionaryHelper.h", "cocos/editor-support/cocostudio/WidgetCallBackHandlerProtocol.cpp", "cocos/editor-support/cocostudio/WidgetCallBackHandlerProtocol.h", + "cocos/editor-support/creator/Android.mk", + "cocos/editor-support/creator/CCScale9Sprite.cpp", + "cocos/editor-support/creator/CCScale9Sprite.h", "cocos/editor-support/spine/Android.mk", "cocos/editor-support/spine/Animation.c", "cocos/editor-support/spine/Animation.h", @@ -495,9 +498,6 @@ "cocos/editor-support/spine/spine-cocos2dx.cpp", "cocos/editor-support/spine/spine-cocos2dx.h", "cocos/editor-support/spine/spine.h", - "cocos/editor-support/creator/CCScale9Sprite.h", - "cocos/editor-support/creator/CCScale9Sprite.cpp", - "cocos/editor-support/creator/Android.mk", "cocos/math/CCAffineTransform.cpp", "cocos/math/CCAffineTransform.h", "cocos/math/CCGeometry.cpp", @@ -597,12 +597,12 @@ "cocos/platform/android/ControllerManualAdapter/src/org/cocos2dx/lib/inputmanagercompat/InputManagerCompat.java", "cocos/platform/android/ControllerManualAdapter/src/org/cocos2dx/lib/inputmanagercompat/InputManagerV16.java", "cocos/platform/android/ControllerManualAdapter/src/org/cocos2dx/lib/inputmanagercompat/InputManagerV9.java", - "cocos/platform/android/java/project.properties", "cocos/platform/android/java/.classpath", "cocos/platform/android/java/.project", "cocos/platform/android/java/AndroidManifest.xml", "cocos/platform/android/java/build.xml", "cocos/platform/android/java/proguard-project.txt", + "cocos/platform/android/java/project.properties", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxAccelerometer.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java", @@ -776,6 +776,17 @@ "cocos/ui/UIButton.h", "cocos/ui/UICheckBox.cpp", "cocos/ui/UICheckBox.h", + "cocos/ui/UIEditBox/Mac/CCUIEditBoxMac.h", + "cocos/ui/UIEditBox/Mac/CCUIEditBoxMac.mm", + "cocos/ui/UIEditBox/Mac/CCUIMultilineTextField.h", + "cocos/ui/UIEditBox/Mac/CCUIMultilineTextField.m", + "cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.h", + "cocos/ui/UIEditBox/Mac/CCUIPasswordTextField.m", + "cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.h", + "cocos/ui/UIEditBox/Mac/CCUISingleLineTextField.m", + "cocos/ui/UIEditBox/Mac/CCUITextFieldFormatter.h", + "cocos/ui/UIEditBox/Mac/CCUITextFieldFormatter.m", + "cocos/ui/UIEditBox/Mac/CCUITextInput.h", "cocos/ui/UIEditBox/UIEditBox.cpp", "cocos/ui/UIEditBox/UIEditBox.h", "cocos/ui/UIEditBox/UIEditBoxImpl-android.cpp", @@ -2101,11 +2112,11 @@ "external/ios/include/spidermonkey/mozilla/Vector.h", "external/ios/include/spidermonkey/mozilla/WeakPtr.h", "external/ios/include/websockets/libwebsockets.h", - "external/ios/include/websockets/lws_config.h", - "external/ios/libs/libchipmunk.a", - "external/ios/libs/libfreetype.a", - "external/ios/libs/libjs_static.a", - "external/ios/libs/libwebsockets.a", + "external/ios/include/websockets/lws_config.h", + "external/ios/libs/libchipmunk.a", + "external/ios/libs/libfreetype.a", + "external/ios/libs/libjs_static.a", + "external/ios/libs/libwebsockets.a", "external/mac/include/chipmunk/chipmunk.h", "external/mac/include/chipmunk/chipmunk_ffi.h", "external/mac/include/chipmunk/chipmunk_private.h", @@ -2314,18 +2325,18 @@ "external/mac/include/websockets/lws_config.h", "external/mac/include/zlib/zconf.h", "external/mac/include/zlib/zlib.h", - "external/mac/libs/libchipmunk.a", - "external/mac/libs/libcrypto.a", - "external/mac/libs/libcurl.a", - "external/mac/libs/libfreetype.a", - "external/mac/libs/libglfw3.a", - "external/mac/libs/libjpeg.a", - "external/mac/libs/libjs_static.a", - "external/mac/libs/libpng.a", - "external/mac/libs/libssl.a", - "external/mac/libs/libtiff.a", - "external/mac/libs/libwebsockets.a", - "external/mac/libs/libz.a", + "external/mac/libs/libchipmunk.a", + "external/mac/libs/libcrypto.a", + "external/mac/libs/libcurl.a", + "external/mac/libs/libfreetype.a", + "external/mac/libs/libglfw3.a", + "external/mac/libs/libjpeg.a", + "external/mac/libs/libjs_static.a", + "external/mac/libs/libpng.a", + "external/mac/libs/libssl.a", + "external/mac/libs/libtiff.a", + "external/mac/libs/libwebsockets.a", + "external/mac/libs/libz.a", "external/sources/ConvertUTF/ConvertUTF.c", "external/sources/ConvertUTF/ConvertUTF.h", "external/sources/ConvertUTF/ConvertUTFWrapper.cpp", @@ -2709,47 +2720,294 @@ "external/win32/include/websockets/win32helpers/gettimeofday.h", "external/win32/include/websockets/win32helpers/websock-w32.h", "external/win32/include/zlib/zconf.h", - "external/win32/include/zlib/zlib.h", - "external/win32/libs/Debug/libchipmunk-2015.lib", - "external/win32/libs/Debug/libchipmunk.lib", - "external/win32/libs/freetype.lib", - "external/win32/libs/glew32.dll", - "external/win32/libs/glew32.lib", - "external/win32/libs/glfw3-2015.lib", - "external/win32/libs/glfw3.lib", - "external/win32/libs/iconv.dll", - "external/win32/libs/libchipmunk-2015.lib", - "external/win32/libs/libchipmunk.lib", - "external/win32/libs/libcurl_imp.lib", - "external/win32/libs/libcurl.dll", - "external/win32/libs/libeay32.lib", - "external/win32/libs/libiconv.lib", - "external/win32/libs/libjpeg-2015.lib", - "external/win32/libs/libjpeg.lib", - "external/win32/libs/libmpg123.dll", - "external/win32/libs/libmpg123.lib", - "external/win32/libs/libogg.dll", - "external/win32/libs/libogg.lib", - "external/win32/libs/libpng-2015.lib", - "external/win32/libs/libpng.lib", - "external/win32/libs/libtiff-2015.lib", - "external/win32/libs/libtiff.dll", - "external/win32/libs/libtiff.lib", - "external/win32/libs/libvorbis.dll", - "external/win32/libs/libvorbis.lib", - "external/win32/libs/libvorbisfile.dll", - "external/win32/libs/libvorbisfile.lib", - "external/win32/libs/libzlib.lib", - "external/win32/libs/mozjs-33.dll", - "external/win32/libs/mozjs-33.lib", - "external/win32/libs/OpenAL32.dll", - "external/win32/libs/OpenAL32.lib", - "external/win32/libs/sqlite3.dll", - "external/win32/libs/sqlite3.lib", - "external/win32/libs/ssleay32.lib", - "external/win32/libs/websockets.dll", - "external/win32/libs/websockets.lib", - "external/win32/libs/zlib1.dll" + "external/win32/include/zlib/zlib.h", + "external/win32/libs/OpenAL32.dll", + "external/win32/libs/OpenAL32.lib", + "external/win32/libs/freetype.lib", + "external/win32/libs/glew32.dll", + "external/win32/libs/glew32.lib", + "external/win32/libs/glfw3-2015.lib", + "external/win32/libs/glfw3.lib", + "external/win32/libs/iconv.dll", + "external/win32/libs/libchipmunk-2015.lib", + "external/win32/libs/libchipmunk.lib", + "external/win32/libs/libcurl.dll", + "external/win32/libs/libcurl_imp.lib", + "external/win32/libs/libeay32.lib", + "external/win32/libs/libiconv.lib", + "external/win32/libs/libjpeg-2015.lib", + "external/win32/libs/libjpeg.lib", + "external/win32/libs/libmpg123.dll", + "external/win32/libs/libmpg123.lib", + "external/win32/libs/libogg.dll", + "external/win32/libs/libogg.lib", + "external/win32/libs/libpng-2015.lib", + "external/win32/libs/libpng.lib", + "external/win32/libs/libtiff-2015.lib", + "external/win32/libs/libtiff.dll", + "external/win32/libs/libtiff.lib", + "external/win32/libs/libvorbis.dll", + "external/win32/libs/libvorbis.lib", + "external/win32/libs/libvorbisfile.dll", + "external/win32/libs/libvorbisfile.lib", + "external/win32/libs/libzlib.lib", + "external/win32/libs/mozjs-33.dll", + "external/win32/libs/mozjs-33.lib", + "external/win32/libs/sqlite3.dll", + "external/win32/libs/sqlite3.lib", + "external/win32/libs/ssleay32.lib", + "external/win32/libs/websockets.lib", + "external/win32/libs/zlib1.dll", + "gulpfile.js", + "licenses/LICENSE_CCBReader.txt", + "licenses/LICENSE_CCControlExtension.txt", + "licenses/LICENSE_SpiderMonkey.txt", + "licenses/LICENSE_chipmunk.txt", + "licenses/LICENSE_cocos2d-x.txt", + "licenses/LICENSE_cocosdenshion.txt", + "licenses/LICENSE_curl.txt", + "licenses/LICENSE_js.txt", + "licenses/LICENSE_libjpeg.txt", + "licenses/LICENSE_libpng.txt", + "licenses/LICENSE_libtiff.txt", + "licenses/LICENSE_libwebsockets.txt", + "licenses/LICENSE_libxml2.txt", + "licenses/LICENSE_llvm.txt", + "licenses/LICENSE_ogg_vorbis.txt", + "licenses/LICENSE_spine.txt", + "licenses/LICENSE_unicode.txt", + "licenses/LICENSE_zlib.txt", + "package.json", + "simulator/mac/Simulator.app/Contents/Info.plist", + "simulator/mac/Simulator.app/Contents/MacOS/Simulator", + "simulator/mac/Simulator.app/Contents/PkgInfo", + "simulator/mac/Simulator.app/Contents/Resources/Base.lproj/ConsoleWindow.nib", + "simulator/mac/Simulator.app/Contents/Resources/Base.lproj/MainMenu.nib", + "simulator/mac/Simulator.app/Contents/Resources/Icon.icns", + "simulator/mac/Simulator.app/Contents/Resources/config.json", + "simulator/mac/Simulator.app/Contents/Resources/lang", + "simulator/mac/Simulator.app/Contents/Resources/zh-Hans.lproj/ConsoleWindow.strings", + "simulator/mac/Simulator.app/Contents/Resources/zh-Hans.lproj/MainMenu.nib", + "tools/coding-style/tailing-spaces.py", + "tools/simulator/.cocos-project.json", + "tools/simulator/.project", + "tools/simulator/config.json", + "tools/simulator/frameworks/runtime-src/Classes/AppDelegate.cpp", + "tools/simulator/frameworks/runtime-src/Classes/AppDelegate.h", + "tools/simulator/frameworks/runtime-src/Classes/ide-support/CodeIDESupport.h", + "tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.cpp", + "tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.h", + "tools/simulator/frameworks/runtime-src/Classes/ide-support/lang", + "tools/simulator/frameworks/runtime-src/proj.android/.classpath", + "tools/simulator/frameworks/runtime-src/proj.android/.project", + "tools/simulator/frameworks/runtime-src/proj.android/.settings/org.eclipse.jdt.core.prefs", + "tools/simulator/frameworks/runtime-src/proj.android/AndroidManifest.xml", + "tools/simulator/frameworks/runtime-src/proj.android/ant.properties", + "tools/simulator/frameworks/runtime-src/proj.android/build-cfg.json", + "tools/simulator/frameworks/runtime-src/proj.android/build.xml", + "tools/simulator/frameworks/runtime-src/proj.android/jni/Android.mk", + "tools/simulator/frameworks/runtime-src/proj.android/jni/Application.mk", + "tools/simulator/frameworks/runtime-src/proj.android/jni/hellolua/main.cpp", + "tools/simulator/frameworks/runtime-src/proj.android/proguard-project.txt", + "tools/simulator/frameworks/runtime-src/proj.android/project.properties", + "tools/simulator/frameworks/runtime-src/proj.android/res/drawable-hdpi/icon.png", + "tools/simulator/frameworks/runtime-src/proj.android/res/drawable-ldpi/icon.png", + "tools/simulator/frameworks/runtime-src/proj.android/res/drawable-mdpi/icon.png", + "tools/simulator/frameworks/runtime-src/proj.android/res/values/strings.xml", + "tools/simulator/frameworks/runtime-src/proj.android/src/org/cocos2dx/lua/AppActivity.java", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/AppController.h", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/AppController.mm", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-568h@2x.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-667h@2x.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-736h@3x.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default@2x.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-100.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-114.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-120.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-144.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-152.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-29.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-40.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-50.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-57.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-58.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-72.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-76.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-80.png", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Info.plist", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/RootViewController.h", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/RootViewController.mm", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/build-cfg.json", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/main.m", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Base.lproj/ConsoleWindow.xib", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Base.lproj/MainMenu.xib", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/ConsoleWindowController.h", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/ConsoleWindowController.m", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Icon.icns", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Prefix.pch", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.h", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/build-cfg.json", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/en.lproj/MainMenu.xib", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/main.m", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/zh-Hans.lproj/ConsoleWindow.strings", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/zh-Hans.lproj/MainMenu.xib", + "tools/simulator/frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj/project.pbxproj", + "tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp", + "tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.h", + "tools/simulator/frameworks/runtime-src/proj.win32/build-cfg.json", + "tools/simulator/frameworks/runtime-src/proj.win32/game.rc", + "tools/simulator/frameworks/runtime-src/proj.win32/main.cpp", + "tools/simulator/frameworks/runtime-src/proj.win32/main.h", + "tools/simulator/frameworks/runtime-src/proj.win32/res/game.ico", + "tools/simulator/frameworks/runtime-src/proj.win32/resource.h", + "tools/simulator/frameworks/runtime-src/proj.win32/simulator.sln", + "tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj", + "tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj.filters", + "tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj.user", + "tools/simulator/frameworks/runtime-src/proj.win32/stdafx.cpp", + "tools/simulator/frameworks/runtime-src/proj.win32/stdafx.h", + "tools/simulator/frameworks/runtime-src/proj.win32/targetver.h", + "tools/simulator/libsimulator/lib/AppEvent.cpp", + "tools/simulator/libsimulator/lib/AppEvent.h", + "tools/simulator/libsimulator/lib/AppLang.cpp", + "tools/simulator/libsimulator/lib/AppLang.h", + "tools/simulator/libsimulator/lib/DeviceEx.h", + "tools/simulator/libsimulator/lib/PlayerEditBoxServiceProtocol.h", + "tools/simulator/libsimulator/lib/PlayerFileDialogServiceProtocol.h", + "tools/simulator/libsimulator/lib/PlayerMacros.h", + "tools/simulator/libsimulator/lib/PlayerMenuServiceProtocol.cpp", + "tools/simulator/libsimulator/lib/PlayerMenuServiceProtocol.h", + "tools/simulator/libsimulator/lib/PlayerMessageBoxServiceProtocol.h", + "tools/simulator/libsimulator/lib/PlayerProtocol.cpp", + "tools/simulator/libsimulator/lib/PlayerProtocol.h", + "tools/simulator/libsimulator/lib/PlayerServiceProtocol.cpp", + "tools/simulator/libsimulator/lib/PlayerServiceProtocol.h", + "tools/simulator/libsimulator/lib/PlayerSettings.cpp", + "tools/simulator/libsimulator/lib/PlayerSettings.h", + "tools/simulator/libsimulator/lib/PlayerTaskServiceProtocol.cpp", + "tools/simulator/libsimulator/lib/PlayerTaskServiceProtocol.h", + "tools/simulator/libsimulator/lib/PlayerUtils.cpp", + "tools/simulator/libsimulator/lib/PlayerUtils.h", + "tools/simulator/libsimulator/lib/ProjectConfig/ProjectConfig.cpp", + "tools/simulator/libsimulator/lib/ProjectConfig/ProjectConfig.h", + "tools/simulator/libsimulator/lib/ProjectConfig/SimulatorConfig.cpp", + "tools/simulator/libsimulator/lib/ProjectConfig/SimulatorConfig.h", + "tools/simulator/libsimulator/lib/SimulatorExport.h", + "tools/simulator/libsimulator/lib/cocos2dx_extra.h", + "tools/simulator/libsimulator/lib/network/CCHTTPRequest.cpp", + "tools/simulator/libsimulator/lib/network/CCHTTPRequest.h", + "tools/simulator/libsimulator/lib/network/CCHTTPRequestDelegate.h", + "tools/simulator/libsimulator/lib/platform/mac/DeviceEx-mac.mm", + "tools/simulator/libsimulator/lib/platform/mac/PlayerEditBoxServiceMac.h", + "tools/simulator/libsimulator/lib/platform/mac/PlayerEditBoxServiceMac.mm", + "tools/simulator/libsimulator/lib/platform/mac/PlayerFileDialogServiceMac.h", + "tools/simulator/libsimulator/lib/platform/mac/PlayerFileDialogServiceMac.mm", + "tools/simulator/libsimulator/lib/platform/mac/PlayerMac.h", + "tools/simulator/libsimulator/lib/platform/mac/PlayerMac.mm", + "tools/simulator/libsimulator/lib/platform/mac/PlayerMenuServiceMac.h", + "tools/simulator/libsimulator/lib/platform/mac/PlayerMenuServiceMac.mm", + "tools/simulator/libsimulator/lib/platform/mac/PlayerMessageBoxServiceMac.h", + "tools/simulator/libsimulator/lib/platform/mac/PlayerMessageBoxServiceMac.mm", + "tools/simulator/libsimulator/lib/platform/mac/PlayerTaskServiceMac.h", + "tools/simulator/libsimulator/lib/platform/mac/PlayerTaskServiceMac.mm", + "tools/simulator/libsimulator/lib/platform/mac/Runtime_ios-mac.mm", + "tools/simulator/libsimulator/lib/platform/mac/openudid/OpenUDIDMac.h", + "tools/simulator/libsimulator/lib/platform/mac/openudid/OpenUDIDMac.m", + "tools/simulator/libsimulator/lib/platform/win32/DeviceEx-win32.cpp", + "tools/simulator/libsimulator/lib/platform/win32/PlayerEditBoxServiceWin.cpp", + "tools/simulator/libsimulator/lib/platform/win32/PlayerEditBoxServiceWin.h", + "tools/simulator/libsimulator/lib/platform/win32/PlayerFileDialogServiceWin.cpp", + "tools/simulator/libsimulator/lib/platform/win32/PlayerFileDialogServiceWin.h", + "tools/simulator/libsimulator/lib/platform/win32/PlayerMenuServiceWin.cpp", + "tools/simulator/libsimulator/lib/platform/win32/PlayerMenuServiceWin.h", + "tools/simulator/libsimulator/lib/platform/win32/PlayerMessageBoxServiceWin.cpp", + "tools/simulator/libsimulator/lib/platform/win32/PlayerMessageBoxServiceWin.h", + "tools/simulator/libsimulator/lib/platform/win32/PlayerTaskServiceWin.cpp", + "tools/simulator/libsimulator/lib/platform/win32/PlayerTaskServiceWin.h", + "tools/simulator/libsimulator/lib/platform/win32/PlayerWin.cpp", + "tools/simulator/libsimulator/lib/platform/win32/PlayerWin.h", + "tools/simulator/libsimulator/lib/platform/win32/SimulatorWin.cpp", + "tools/simulator/libsimulator/lib/protobuf-lite/config.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/extension_set.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/extension_set.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/generated_message_util.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/generated_message_util.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/io/coded_stream.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/io/coded_stream.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/io/coded_stream_inl.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/io/zero_copy_stream.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/io/zero_copy_stream.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/io/zero_copy_stream_impl.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/io/zero_copy_stream_impl_lite.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/io/zero_copy_stream_impl_lite.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/message_lite.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/message_lite.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/repeated_field.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/repeated_field.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/atomicops.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/atomicops_internals_arm_gcc.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/atomicops_internals_atomicword_compat.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/atomicops_internals_generic_gcc.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/atomicops_internals_macosx.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/atomicops_internals_x86_gcc.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/atomicops_internals_x86_gcc.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/atomicops_internals_x86_msvc.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/atomicops_internals_x86_msvc.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/common.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/common.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/hash.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/map-util.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/once.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/once.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/platform_macros.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/stl_util.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/stringprintf.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/stringprintf.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/template_util.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/stubs/type_traits.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/wire_format_lite.cc", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/wire_format_lite.h", + "tools/simulator/libsimulator/lib/protobuf-lite/google/protobuf/wire_format_lite_inl.h", + "tools/simulator/libsimulator/lib/runtime/ConfigParser.cpp", + "tools/simulator/libsimulator/lib/runtime/ConfigParser.h", + "tools/simulator/libsimulator/lib/runtime/ConnectWaitLayer.cpp", + "tools/simulator/libsimulator/lib/runtime/ConnectWaitLayer.h", + "tools/simulator/libsimulator/lib/runtime/ConsoleCommand.cpp", + "tools/simulator/libsimulator/lib/runtime/ConsoleCommand.h", + "tools/simulator/libsimulator/lib/runtime/FileServer.cpp", + "tools/simulator/libsimulator/lib/runtime/FileServer.h", + "tools/simulator/libsimulator/lib/runtime/Landscape_png.cpp", + "tools/simulator/libsimulator/lib/runtime/PlayDisable_png.cpp", + "tools/simulator/libsimulator/lib/runtime/PlayEnable_png.cpp", + "tools/simulator/libsimulator/lib/runtime/Portrait_png.cpp", + "tools/simulator/libsimulator/lib/runtime/Protos.pb.cc", + "tools/simulator/libsimulator/lib/runtime/Protos.pb.h", + "tools/simulator/libsimulator/lib/runtime/ResData.h", + "tools/simulator/libsimulator/lib/runtime/Runtime.cpp", + "tools/simulator/libsimulator/lib/runtime/Runtime.h", + "tools/simulator/libsimulator/lib/runtime/RuntimeProtocol.cpp", + "tools/simulator/libsimulator/lib/runtime/RuntimeProtocol.h", + "tools/simulator/libsimulator/lib/runtime/Shine_png.cpp", + "tools/simulator/libsimulator/lib/runtime/VisibleRect.cpp", + "tools/simulator/libsimulator/lib/runtime/VisibleRect.h", + "tools/simulator/libsimulator/lib/runtime/Widget_mac.h", + "tools/simulator/libsimulator/lib/runtime/Widget_mac.mm", + "tools/simulator/libsimulator/proj.android/Android.mk", + "tools/simulator/libsimulator/proj.android/hellolua/Runtime_android.cpp", + "tools/simulator/libsimulator/proj.android/prebuilt-mk/Android.mk", + "tools/simulator/libsimulator/proj.ios_mac/ios/Prefix.pch", + "tools/simulator/libsimulator/proj.ios_mac/libsimulator.xcodeproj/project.pbxproj", + "tools/simulator/libsimulator/proj.ios_mac/mac/Prefix.pch", + "tools/simulator/libsimulator/proj.win32/Runtime_win32.cpp", + "tools/simulator/libsimulator/proj.win32/libsimulator.vcxproj", + "tools/simulator/libsimulator/proj.win32/libsimulator.vcxproj.filters", + "tools/simulator/libsimulator/proj.win32/stdafx.cpp", + "tools/simulator/libsimulator/proj.win32/stdafx.h", + "tools/simulator/libsimulator/proj.win32/targetver.h" ], "js": [ "cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_auto_api.js", @@ -2765,6 +3023,7 @@ "cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js", "cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_studio_auto_api.js", "cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js", + "cocos/scripting/js-bindings/auto/api/jsb_creator_auto_api.js", "cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp", "cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.hpp", "cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp", @@ -2787,9 +3046,6 @@ "cocos/scripting/js-bindings/auto/jsb_creator_auto.hpp", "cocos/scripting/js-bindings/manual/ScriptingCore.cpp", "cocos/scripting/js-bindings/manual/ScriptingCore.h", - "cocos/scripting/js-bindings/manual/js_module_register.cpp", - "cocos/scripting/js-bindings/manual/js_module_register.h", - "cocos/scripting/js-bindings/manual/js-BindingsExport.h", "cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_auto_classes.cpp", "cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_auto_classes.h", "cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_auto_classes_registration.h", @@ -2817,6 +3073,7 @@ "cocos/scripting/js-bindings/manual/experimental/jsb_cocos2dx_experimental_webView_manual.h", "cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp", "cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.h", + "cocos/scripting/js-bindings/manual/js-BindingsExport.h", "cocos/scripting/js-bindings/manual/js_bindings_config.h", "cocos/scripting/js-bindings/manual/js_bindings_core.cpp", "cocos/scripting/js-bindings/manual/js_bindings_core.h", @@ -2824,6 +3081,8 @@ "cocos/scripting/js-bindings/manual/js_bindings_opengl.h", "cocos/scripting/js-bindings/manual/js_manual_conversions.cpp", "cocos/scripting/js-bindings/manual/js_manual_conversions.h", + "cocos/scripting/js-bindings/manual/js_module_register.cpp", + "cocos/scripting/js-bindings/manual/js_module_register.h", "cocos/scripting/js-bindings/manual/jsb_event_dispatcher_manual.cpp", "cocos/scripting/js-bindings/manual/jsb_event_dispatcher_manual.h", "cocos/scripting/js-bindings/manual/jsb_helper.h", @@ -2872,9 +3131,9 @@ "cocos/scripting/js-bindings/script/debugger/actors/utils/TabSources.js", "cocos/scripting/js-bindings/script/debugger/actors/webconsole.js", "cocos/scripting/js-bindings/script/debugger/core/promise.js", - "cocos/scripting/js-bindings/script/debugger/event-emitter.js", + "cocos/scripting/js-bindings/script/debugger/event-emitter.js", "cocos/scripting/js-bindings/script/debugger/main.js", - "cocos/scripting/js-bindings/script/debugger/transport.js", + "cocos/scripting/js-bindings/script/debugger/transport.js", "cocos/scripting/js-bindings/script/debugger/webconsole/utils.js", "cocos/scripting/js-bindings/script/extension/jsb_cocos2d_extension.js", "cocos/scripting/js-bindings/script/extension/jsb_ext_create_apis.js", @@ -2912,6 +3171,77 @@ "cocos/scripting/js-bindings/script/studio/parsers/timelineParser-1.x.js", "cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js", "cocos/scripting/js-bindings/script/studio/parsers/uiParser-1.x.js", + "tools/bindings-generator/AUTHORS", + "tools/bindings-generator/README.md", + "tools/bindings-generator/backup/clang-llvm-3.3-pybinding/__init__.py", + "tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py", + "tools/bindings-generator/backup/clang-llvm-3.3-pybinding/enumerations.py", + "tools/bindings-generator/clang/__init__.py", + "tools/bindings-generator/clang/cindex.py", + "tools/bindings-generator/clang/enumerations.py", + "tools/bindings-generator/generator", + "tools/bindings-generator/generator.py", + "tools/bindings-generator/libclang/VERSION.txt", + "tools/bindings-generator/libclang/libclang.dll", + "tools/bindings-generator/libclang/libclang.dylib", + "tools/bindings-generator/libclang/libclang.so", + "tools/bindings-generator/targets/lua/conversions.yaml", + "tools/bindings-generator/targets/lua/templates/apidoc_classfoot.script", + "tools/bindings-generator/targets/lua/templates/apidoc_classhead.script", + "tools/bindings-generator/targets/lua/templates/apidoc_function.script", + "tools/bindings-generator/targets/lua/templates/apidoc_function_foot.script", + "tools/bindings-generator/targets/lua/templates/apidoc_function_head.script", + "tools/bindings-generator/targets/lua/templates/apidoc_function_overload.script", + "tools/bindings-generator/targets/lua/templates/apidoc_ns.script", + "tools/bindings-generator/targets/lua/templates/apidoc_ns_foot.script", + "tools/bindings-generator/targets/lua/templates/function.h", + "tools/bindings-generator/targets/lua/templates/ifunction.c", + "tools/bindings-generator/targets/lua/templates/ifunction_overloaded.c", + "tools/bindings-generator/targets/lua/templates/lambda.c", + "tools/bindings-generator/targets/lua/templates/layout_foot.c", + "tools/bindings-generator/targets/lua/templates/layout_foot.h", + "tools/bindings-generator/targets/lua/templates/layout_head.c", + "tools/bindings-generator/targets/lua/templates/layout_head.h", + "tools/bindings-generator/targets/lua/templates/prelude.c", + "tools/bindings-generator/targets/lua/templates/prelude.h", + "tools/bindings-generator/targets/lua/templates/public_field.c", + "tools/bindings-generator/targets/lua/templates/register.c", + "tools/bindings-generator/targets/lua/templates/sfunction.c", + "tools/bindings-generator/targets/lua/templates/sfunction_overloaded.c", + "tools/bindings-generator/targets/spidermonkey/conversions.yaml", + "tools/bindings-generator/targets/spidermonkey/templates/apidoc_classfoot.script", + "tools/bindings-generator/targets/spidermonkey/templates/apidoc_classhead.script", + "tools/bindings-generator/targets/spidermonkey/templates/apidoc_function.script", + "tools/bindings-generator/targets/spidermonkey/templates/apidoc_function_overload.script", + "tools/bindings-generator/targets/spidermonkey/templates/apidoc_ns.script", + "tools/bindings-generator/targets/spidermonkey/templates/constructor.c", + "tools/bindings-generator/targets/spidermonkey/templates/ctor.c", + "tools/bindings-generator/targets/spidermonkey/templates/function.h", + "tools/bindings-generator/targets/spidermonkey/templates/ifunction.c", + "tools/bindings-generator/targets/spidermonkey/templates/ifunction_overloaded.c", + "tools/bindings-generator/targets/spidermonkey/templates/lambda.c", + "tools/bindings-generator/targets/spidermonkey/templates/layout_foot.c", + "tools/bindings-generator/targets/spidermonkey/templates/layout_foot.h", + "tools/bindings-generator/targets/spidermonkey/templates/layout_head.c", + "tools/bindings-generator/targets/spidermonkey/templates/layout_head.h", + "tools/bindings-generator/targets/spidermonkey/templates/prelude.c", + "tools/bindings-generator/targets/spidermonkey/templates/prelude.h", + "tools/bindings-generator/targets/spidermonkey/templates/public_field.c", + "tools/bindings-generator/targets/spidermonkey/templates/register.c", + "tools/bindings-generator/targets/spidermonkey/templates/sfunction.c", + "tools/bindings-generator/targets/spidermonkey/templates/sfunction_overloaded.c", + "tools/bindings-generator/test/simple_test/simple_class.cpp", + "tools/bindings-generator/test/simple_test/simple_class.h", + "tools/bindings-generator/test/test.bat", + "tools/bindings-generator/test/test.ini", + "tools/bindings-generator/test/test.sh", + "tools/bindings-generator/test/user.cfg.sample", + "tools/bindings-generator/test/userconf.ini.sample", + "tools/bindings-generator/tools/win32/", + "tools/bindings-generator/tools/win32/cygiconv-2.dll", + "tools/bindings-generator/tools/win32/cygintl-8.dll", + "tools/bindings-generator/tools/win32/cygwin1.dll", + "tools/bindings-generator/tools/win32/dos2unix.exe", "tools/tojs/README.mdown", "tools/tojs/cocos2dx.ini", "tools/tojs/cocos2dx_audioengine.ini", @@ -2922,7 +3252,8 @@ "tools/tojs/cocos2dx_spine.ini", "tools/tojs/cocos2dx_studio.ini", "tools/tojs/cocos2dx_ui.ini", - "tools/tojs/genbindings.py" - ], - "lua": [] + "tools/tojs/creator.ini", + "tools/tojs/genbindings.py", + "tools/tojs/userconf.ini" + ] } \ No newline at end of file diff --git a/native/tools/travis-scripts/config.gitingore b/native/tools/travis-scripts/config.gitingore index 6f96a20116..ba81fcc818 100644 --- a/native/tools/travis-scripts/config.gitingore +++ b/native/tools/travis-scripts/config.gitingore @@ -63,7 +63,6 @@ ipch/ *.opensdf # Ignore files build by ndk and eclipse -libs/ bin/ obj/ gen/ diff --git a/native/tools/travis-scripts/generate-template-files.py b/native/tools/travis-scripts/generate-template-files.py index 64964d2ed3..eb484deaca 100755 --- a/native/tools/travis-scripts/generate-template-files.py +++ b/native/tools/travis-scripts/generate-template-files.py @@ -41,10 +41,8 @@ class CocosFileList: self.inludeConfig=[] self.rootDir = "" self.fileList_com=[] - self.fileList_lua=[] self.fileList_js=[] - self.luaPath = ["cocos/scripting/lua-bindings", "external/lua", "tools/bindings-generator", "tools/tolua"] self.jsPath = ["cocos/scripting/js-bindings", "external/spidermonkey", "tools/bindings-generator", "tools/tojs" ] def readIngoreFile(self, fileName): @@ -90,11 +88,6 @@ class CocosFileList: self.__bInclude(item) or self.__bInclude("%s/" %item) ): - foundLuaModule = False - # for luaPath in self.luaPath: - # if relativePath.upper().find(luaPath.upper()) == 0: - # foundLuaModule = True - # break foundJSModule = False for jsPath in self.jsPath: @@ -102,9 +95,7 @@ class CocosFileList: foundJSModule = True break - if foundLuaModule: - self.fileList_lua.append("%s/" %relativePath) - elif foundJSModule: + if foundJSModule: self.fileList_js.append("%s/" %relativePath) else: self.fileList_com.append("%s/" %relativePath) @@ -129,11 +120,6 @@ class CocosFileList: ): continue # print(relativePath) - foundLuaModule = False - # for luaPath in self.luaPath: - # if relativePath.upper().find(luaPath.upper()) == 0: - # foundLuaModule = True - # break foundJSModule = False for jsPath in self.jsPath: @@ -141,9 +127,7 @@ class CocosFileList: foundJSModule = True break - if foundLuaModule: - self.fileList_lua.append(relativePath) - elif foundJSModule: + if foundJSModule: self.fileList_js.append(relativePath) else: self.fileList_com.append(relativePath) @@ -170,9 +154,8 @@ class CocosFileList: """ f = open(fileName,"w") self.fileList_com.sort() - # self.fileList_lua.sort() self.fileList_js.sort() - content ={'common':self.fileList_com,'lua':self.fileList_lua,'js':self.fileList_js} + content ={'common':self.fileList_com,'js':self.fileList_js} json.dump(content,f,sort_keys=True,indent=4) f.close() return True