diff --git a/AUTHORS b/AUTHORS index 1fb0ec6e9e..3b4476539a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -45,6 +45,9 @@ Developers: DarraghCoy Fix a potential crash SimpleAudioEngineOpenSL::playEffect + Fix some bugs with Set class + Add ccDrawSolidCircle + Add Rect::unionWithRect silverscania Pass correct parameter to glPixelStorei when creating a texture @@ -434,6 +437,7 @@ Developers: Fix for broken of ccArrayGetIndexOfObject after merging this commit(076f38c). Explicitly initialising CCAcceleration structure. Add support to save/retrieve CCData into/from CCUserDefault. + Text Shadows fix MarcelBloemendaal Adding secureTextEntry property to CCTextFieldTTF. diff --git a/cocos2dx/cocoa/CCGeometry.cpp b/cocos2dx/cocoa/CCGeometry.cpp index 23e4a932d2..5a3cb9db75 100644 --- a/cocos2dx/cocoa/CCGeometry.cpp +++ b/cocos2dx/cocoa/CCGeometry.cpp @@ -271,4 +271,44 @@ bool Rect::intersectsRect(const Rect& rect) const rect.getMaxY() < getMinY()); } +Rect Rect::unionWithRect(const Rect & rect) const +{ + float thisLeftX = origin.x; + float thisRightX = origin.x + size.width; + float thisTopY = origin.y + size.height; + float thisBottomY = origin.y; + + if (thisRightX < thisLeftX) + { + std::swap(thisRightX, thisLeftX); // This rect has negative width + } + + if (thisTopY < thisBottomY) + { + std::swap(thisTopY, thisBottomY); // This rect has negative height + } + + float otherLeftX = rect.origin.x; + float otherRightX = rect.origin.x + rect.size.width; + float otherTopY = rect.origin.y + rect.size.height; + float otherBottomY = rect.origin.y; + + if (otherRightX < otherLeftX) + { + std::swap(otherRightX, otherLeftX); // Other rect has negative width + } + + if (otherTopY < otherBottomY) + { + std::swap(otherTopY, otherBottomY); // Other rect has negative height + } + + float combinedLeftX = std::min(thisLeftX, otherLeftX); + float combinedRightX = std::max(thisRightX, otherRightX); + float combinedTopY = std::max(thisTopY, otherTopY); + float combinedBottomY = std::min(thisBottomY, otherBottomY); + + return Rect(combinedLeftX, combinedBottomY, combinedRightX - combinedLeftX, combinedTopY - combinedBottomY); +} + NS_CC_END diff --git a/cocos2dx/cocoa/CCGeometry.h b/cocos2dx/cocoa/CCGeometry.h index 680d330b55..cc254ccb4b 100644 --- a/cocos2dx/cocoa/CCGeometry.h +++ b/cocos2dx/cocoa/CCGeometry.h @@ -245,6 +245,7 @@ public: bool equals(const Rect& rect) const; bool containsPoint(const Point& point) const; bool intersectsRect(const Rect& rect) const; + Rect unionWithRect(const Rect & rect) const; }; diff --git a/cocos2dx/cocoa/CCObject.h b/cocos2dx/cocoa/CCObject.h index c28947e9b7..b1b4dd5550 100644 --- a/cocos2dx/cocoa/CCObject.h +++ b/cocos2dx/cocoa/CCObject.h @@ -100,14 +100,14 @@ typedef void (Object::*SEL_MenuHandler)(Object*); typedef void (Object::*SEL_EventHandler)(Event*); typedef int (Object::*SEL_Compare)(Object*); -#define schedule_selector(_SELECTOR) (SEL_SCHEDULE)(&_SELECTOR) -#define callfunc_selector(_SELECTOR) (SEL_CallFunc)(&_SELECTOR) -#define callfuncN_selector(_SELECTOR) (SEL_CallFuncN)(&_SELECTOR) -#define callfuncND_selector(_SELECTOR) (SEL_CallFuncND)(&_SELECTOR) -#define callfuncO_selector(_SELECTOR) (SEL_CallFuncO)(&_SELECTOR) -#define menu_selector(_SELECTOR) (SEL_MenuHandler)(&_SELECTOR) -#define event_selector(_SELECTOR) (SEL_EventHandler)(&_SELECTOR) -#define compare_selector(_SELECTOR) (SEL_Compare)(&_SELECTOR) +#define schedule_selector(_SELECTOR) static_cast(&_SELECTOR) +#define callfunc_selector(_SELECTOR) static_cast(&_SELECTOR) +#define callfuncN_selector(_SELECTOR) static_cast(&_SELECTOR) +#define callfuncND_selector(_SELECTOR) static_cast(&_SELECTOR) +#define callfuncO_selector(_SELECTOR) static_cast(&_SELECTOR) +#define menu_selector(_SELECTOR) static_cast(&_SELECTOR) +#define event_selector(_SELECTOR) static_cast(&_SELECTOR) +#define compare_selector(_SELECTOR) static_cast(&_SELECTOR) // new callbacks based on C++11 #define CC_CALLBACK_0(__selector__,__target__, ...) std::bind(&__selector__,__target__, ##__VA_ARGS__) diff --git a/cocos2dx/cocoa/CCSet.cpp b/cocos2dx/cocoa/CCSet.cpp index d906283499..c957dedffb 100644 --- a/cocos2dx/cocoa/CCSet.cpp +++ b/cocos2dx/cocoa/CCSet.cpp @@ -92,27 +92,37 @@ int Set::count(void) void Set::addObject(Object *pObject) { - CC_SAFE_RETAIN(pObject); - _set->insert(pObject); + if (_set->count(pObject) == 0) + { + CC_SAFE_RETAIN(pObject); + _set->insert(pObject); + } } void Set::removeObject(Object *pObject) { - _set->erase(pObject); - CC_SAFE_RELEASE(pObject); + if (_set->erase(pObject) > 0) + { + CC_SAFE_RELEASE(pObject); + } } void Set::removeAllObjects() { - SetIterator it; - for (it = _set->begin(); it != _set->end(); ++it) + SetIterator it = _set->begin(); + SetIterator tmp; + + while (it != _set->end()) { - if (! (*it)) + if (!(*it)) { break; } - - (*it)->release(); + + tmp = it; + ++tmp; + _set->erase(it); + it = tmp; } } diff --git a/cocos2dx/draw_nodes/CCDrawingPrimitives.cpp b/cocos2dx/draw_nodes/CCDrawingPrimitives.cpp index 30632f8958..8e55c894ad 100644 --- a/cocos2dx/draw_nodes/CCDrawingPrimitives.cpp +++ b/cocos2dx/draw_nodes/CCDrawingPrimitives.cpp @@ -383,6 +383,52 @@ void CC_DLL ccDrawCircle( const Point& center, float radius, float angle, unsign ccDrawCircle(center, radius, angle, segments, drawLineToCenter, 1.0f, 1.0f); } +void ccDrawSolidCircle( const Point& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY) +{ + lazy_init(); + + const float coef = 2.0f * (float)M_PI/segments; + + GLfloat *vertices = (GLfloat*)calloc( sizeof(GLfloat)*2*(segments+2), 1); + if( ! vertices ) + return; + + for(unsigned int i = 0;i <= segments; i++) { + float rads = i*coef; + GLfloat j = radius * cosf(rads + angle) * scaleX + center.x; + GLfloat k = radius * sinf(rads + angle) * scaleY + center.y; + + vertices[i*2] = j; + vertices[i*2+1] = k; + } + vertices[(segments+1)*2] = center.x; + vertices[(segments+1)*2+1] = center.y; + + s_pShader->use(); + s_pShader->setUniformsForBuiltins(); + s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1); + + ccGLEnableVertexAttribs( kVertexAttribFlag_Position ); + +#ifdef EMSCRIPTEN + setGLBufferData(vertices, sizeof(GLfloat)*2*(segments+2)); + glVertexAttribPointer(kVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else + glVertexAttribPointer(kVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices); +#endif // EMSCRIPTEN + + glDrawArrays(GL_TRIANGLE_FAN, 0, (GLsizei) segments+1); + + free( vertices ); + + CC_INCREMENT_GL_DRAWS(1); +} + +void CC_DLL ccDrawSolidCircle( const Point& center, float radius, float angle, unsigned int segments) +{ + ccDrawSolidCircle(center, radius, angle, segments, 1.0f, 1.0f); +} + void ccDrawQuadBezier(const Point& origin, const Point& control, const Point& destination, unsigned int segments) { lazy_init(); diff --git a/cocos2dx/draw_nodes/CCDrawingPrimitives.h b/cocos2dx/draw_nodes/CCDrawingPrimitives.h index 8949aed7ab..d2cd24af75 100644 --- a/cocos2dx/draw_nodes/CCDrawingPrimitives.h +++ b/cocos2dx/draw_nodes/CCDrawingPrimitives.h @@ -113,6 +113,10 @@ void CC_DLL ccDrawSolidPoly( const Point *poli, unsigned int numberOfPoints, ccC void CC_DLL ccDrawCircle( const Point& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY); void CC_DLL ccDrawCircle( const Point& center, float radius, float angle, unsigned int segments, bool drawLineToCenter); +/** draws a solid circle given the center, radius and number of segments. */ +void CC_DLL ccDrawSolidCircle( const Point& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY); +void CC_DLL ccDrawSolidCircle( const Point& center, float radius, float angle, unsigned int segments); + /** draws a quad bezier path @warning This function could be pretty slow. Use it only for debugging purposes. @since v0.8 diff --git a/cocos2dx/misc_nodes/CCMotionStreak.cpp b/cocos2dx/misc_nodes/CCMotionStreak.cpp index 569ad430be..0ee045c9c1 100644 --- a/cocos2dx/misc_nodes/CCMotionStreak.cpp +++ b/cocos2dx/misc_nodes/CCMotionStreak.cpp @@ -65,7 +65,7 @@ MotionStreak::~MotionStreak() CC_SAFE_FREE(_texCoords); } -MotionStreak* MotionStreak::create(float fade, float minSeg, float stroke, ccColor3B color, const char* path) +MotionStreak* MotionStreak::create(float fade, float minSeg, float stroke, const ccColor3B& color, const char* path) { MotionStreak *pRet = new MotionStreak(); if (pRet && pRet->initWithFade(fade, minSeg, stroke, color, path)) @@ -78,7 +78,7 @@ MotionStreak* MotionStreak::create(float fade, float minSeg, float stroke, ccCol return NULL; } -MotionStreak* MotionStreak::create(float fade, float minSeg, float stroke, ccColor3B color, Texture2D* texture) +MotionStreak* MotionStreak::create(float fade, float minSeg, float stroke, const ccColor3B& color, Texture2D* texture) { MotionStreak *pRet = new MotionStreak(); if (pRet && pRet->initWithFade(fade, minSeg, stroke, color, texture)) @@ -91,7 +91,7 @@ MotionStreak* MotionStreak::create(float fade, float minSeg, float stroke, ccCol return NULL; } -bool MotionStreak::initWithFade(float fade, float minSeg, float stroke, ccColor3B color, const char* path) +bool MotionStreak::initWithFade(float fade, float minSeg, float stroke, const ccColor3B& color, const char* path) { CCAssert(path != NULL, "Invalid filename"); @@ -99,7 +99,7 @@ bool MotionStreak::initWithFade(float fade, float minSeg, float stroke, ccColor3 return initWithFade(fade, minSeg, stroke, color, texture); } -bool MotionStreak::initWithFade(float fade, float minSeg, float stroke, ccColor3B color, Texture2D* texture) +bool MotionStreak::initWithFade(float fade, float minSeg, float stroke, const ccColor3B& color, Texture2D* texture) { Node::setPosition(PointZero); setAnchorPoint(PointZero); @@ -143,7 +143,7 @@ void MotionStreak::setPosition(const Point& position) _positionR = position; } -void MotionStreak::tintWithColor(ccColor3B colors) +void MotionStreak::tintWithColor(const ccColor3B& colors) { setColor(colors); diff --git a/cocos2dx/misc_nodes/CCMotionStreak.h b/cocos2dx/misc_nodes/CCMotionStreak.h index be8d7ff6da..47d5591fd3 100644 --- a/cocos2dx/misc_nodes/CCMotionStreak.h +++ b/cocos2dx/misc_nodes/CCMotionStreak.h @@ -53,17 +53,17 @@ public: virtual ~MotionStreak(); /** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture filename */ - static MotionStreak* create(float fade, float minSeg, float stroke, ccColor3B color, const char* path); + static MotionStreak* create(float fade, float minSeg, float stroke, const ccColor3B& color, const char* path); /** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture */ - static MotionStreak* create(float fade, float minSeg, float stroke, ccColor3B color, Texture2D* texture); + static MotionStreak* create(float fade, float minSeg, float stroke, const ccColor3B& color, Texture2D* texture); /** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture filename */ - bool initWithFade(float fade, float minSeg, float stroke, ccColor3B color, const char* path); + bool initWithFade(float fade, float minSeg, float stroke, const ccColor3B& color, const char* path); /** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture */ - bool initWithFade(float fade, float minSeg, float stroke, ccColor3B color, Texture2D* texture); + bool initWithFade(float fade, float minSeg, float stroke, const ccColor3B& color, Texture2D* texture); /** color used for the tint */ - void tintWithColor(ccColor3B colors); + void tintWithColor(const ccColor3B& colors); /** Remove all living segments of the ribbon */ void reset(); diff --git a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java index fcd4598cde..2a0a915a02 100644 --- a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java +++ b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java @@ -128,7 +128,7 @@ public class Cocos2dxBitmap { if ( shadow ) { - int shadowColor = 0xff7d7d7d; + int shadowColor = 0x54000000; paint.setShadowLayer(shadowBlur, shadowDX, shadowDY, shadowColor); bitmapPaddingX = Math.abs(shadowDX); diff --git a/cocos2dx/platform/ios/CCImage.mm b/cocos2dx/platform/ios/CCImage.mm index cdd3a8a2c4..6c5f7e0a8c 100644 --- a/cocos2dx/platform/ios/CCImage.mm +++ b/cocos2dx/platform/ios/CCImage.mm @@ -365,10 +365,14 @@ static bool _initWithString(const char * pText, cocos2d::Image::ETextAlign eAlig textOrigingY = startH - shadowStrokePaddingY; } + CGRect rect = CGRectMake(textOriginX, textOrigingY, textWidth, textHeight); + CGContextBeginTransparencyLayerWithRect(context, rect, NULL); // actually draw the text in the context // XXX: ios7 casting - [str drawInRect:CGRectMake(textOriginX, textOrigingY, textWidth, textHeight) withFont:font lineBreakMode:NSLineBreakByWordWrapping alignment:(NSTextAlignment)align]; + [str drawInRect: rect withFont:font lineBreakMode:NSLineBreakByWordWrapping alignment:(NSTextAlignment)align]; + + CGContextEndTransparencyLayer(context); // pop the context UIGraphicsPopContext(); diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index f1c62c7145..fcdde05bb6 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -182,6 +182,9 @@ bool Sprite::initWithTexture(Texture2D *pTexture, const Rect& rect, bool rotated _quad.tl.colors = tmpColor; _quad.tr.colors = tmpColor; + // shader program + setShaderProgram(ShaderCache::sharedShaderCache()->programForKey(kShader_PositionTextureColor)); + // update texture (calls updateBlendFunc) setTexture(pTexture); setTextureRect(rect, rotated, rect.size); @@ -547,17 +550,22 @@ void Sprite::draw(void) CCAssert(!_batchNode, "If Sprite is being rendered by SpriteBatchNode, Sprite#draw SHOULD NOT be called"); - CC_NODE_DRAW_SETUP(); - ccGLBlendFunc( _blendFunc.src, _blendFunc.dst ); if (_texture != NULL) { + CC_NODE_DRAW_SETUP(); ccGLBindTexture2D( _texture->getName() ); ccGLEnableVertexAttribs( kVertexAttribFlag_PosColorTex ); } else { + // If the texture is invalid, uses the PositionColor shader instead. + // TODO: PostionTextureColor shader should support empty texture. In that way, we could get rid of next three lines. + GLProgram* prog = ShaderCache::sharedShaderCache()->programForKey(kShader_PositionColor); + prog->use(); + prog->setUniformsForBuiltins(); + ccGLBindTexture2D(0); ccGLEnableVertexAttribs( kVertexAttribFlag_Position | kVertexAttribFlag_Color ); } @@ -1081,16 +1089,6 @@ void Sprite::setTexture(Texture2D *texture) CCAssert(! _batchNode || texture->getName() == _batchNode->getTexture()->getName(), "CCSprite: Batched sprites should use the same texture as the batchnode"); // accept texture==nil as argument CCAssert( !texture || dynamic_cast(texture), "setTexture expects a Texture2D. Invalid argument"); - - // shader program - if (texture) - { - setShaderProgram(ShaderCache::sharedShaderCache()->programForKey(kShader_PositionTextureColor)); - } - else - { - setShaderProgram(ShaderCache::sharedShaderCache()->programForKey(kShader_PositionColor)); - } if (!_batchNode && _texture != texture) { diff --git a/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp b/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp index 81703d69da..ba1452b45f 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp @@ -226,7 +226,11 @@ void TMXLayer::parseInternalProperties() GLint alphaValueLocation = glGetUniformLocation(getShaderProgram()->getProgram(), kUniformAlphaTestValue); // NOTE: alpha test shader is hard-coded to use the equivalent of a glAlphaFunc(GL_GREATER) comparison + + // use shader program to set uniform + getShaderProgram()->use(); getShaderProgram()->setUniformLocationWith1f(alphaValueLocation, alphaFuncValue); + CHECK_GL_ERROR_DEBUG(); } else { diff --git a/samples/Cpp/TestCpp/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp b/samples/Cpp/TestCpp/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp index a3a72e8622..bd35b80d5c 100644 --- a/samples/Cpp/TestCpp/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp +++ b/samples/Cpp/TestCpp/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp @@ -172,6 +172,13 @@ void DrawPrimitivesTest::draw() CHECK_GL_ERROR_DEBUG(); + // draw a pink solid circle with 50 segments + glLineWidth(2); + ccDrawColor4B(255, 0, 255, 255); + ccDrawSolidCircle( VisibleRect::center() + ccp(140,0), 40, CC_DEGREES_TO_RADIANS(90), 50, 1.0f, 1.0f); + + CHECK_GL_ERROR_DEBUG(); + // open yellow poly ccDrawColor4B(255, 255, 0, 255); glLineWidth(10); diff --git a/samples/Javascript/Shared b/samples/Javascript/Shared index 38374930ae..e4b1b15b70 160000 --- a/samples/Javascript/Shared +++ b/samples/Javascript/Shared @@ -1 +1 @@ -Subproject commit 38374930ae707c70611ad1fcb3a5af91d50d72d0 +Subproject commit e4b1b15b70075dee1f20afff4741eb0be88b0a8b diff --git a/samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj b/samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj index 677f53aa3e..c5d8940979 100644 --- a/samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj +++ b/samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 15A3D5631682F20C002FB0C5 /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 15A3D4621682F14C002FB0C5 /* main.js */; }; 15A3D5651682F20C002FB0C5 /* tests_resources-jsb.js in Resources */ = {isa = PBXBuildFile; fileRef = 15A3D4711682F14C002FB0C5 /* tests_resources-jsb.js */; }; 15A3D5681682F20C002FB0C5 /* tests-main.js in Resources */ = {isa = PBXBuildFile; fileRef = 15A3D4741682F14C002FB0C5 /* tests-main.js */; }; + 1A42C7A81782CEA100F738F6 /* MotionStreakTest in Resources */ = {isa = PBXBuildFile; fileRef = 1A42C7A71782CEA100F738F6 /* MotionStreakTest */; }; 1A4C3F1317784B6000EDFB3B /* libchipmunk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A4C3F0E17784B6000EDFB3B /* libchipmunk.a */; }; 1A4C3F1417784B6000EDFB3B /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A4C3F0F17784B6000EDFB3B /* libcocos2dx.a */; }; 1A4C3F1517784B6000EDFB3B /* libCocosDenshion.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A4C3F1017784B6000EDFB3B /* libCocosDenshion.a */; }; @@ -117,6 +118,7 @@ 15A3D4621682F14C002FB0C5 /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = main.js; path = ../../Shared/tests/main.js; sourceTree = ""; }; 15A3D4711682F14C002FB0C5 /* tests_resources-jsb.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = "tests_resources-jsb.js"; path = "../../Shared/tests/tests_resources-jsb.js"; sourceTree = ""; }; 15A3D4741682F14C002FB0C5 /* tests-main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = "tests-main.js"; path = "../../Shared/tests/tests-main.js"; sourceTree = ""; }; + 1A42C7A71782CEA100F738F6 /* MotionStreakTest */ = {isa = PBXFileReference; lastKnownFileType = folder; name = MotionStreakTest; path = ../../Shared/tests/MotionStreakTest; sourceTree = ""; }; 1A4C3F0E17784B6000EDFB3B /* libchipmunk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libchipmunk.a; sourceTree = BUILT_PRODUCTS_DIR; }; 1A4C3F0F17784B6000EDFB3B /* libcocos2dx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libcocos2dx.a; sourceTree = BUILT_PRODUCTS_DIR; }; 1A4C3F1017784B6000EDFB3B /* libCocosDenshion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libCocosDenshion.a; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -333,14 +335,13 @@ D401B5FC16FB169100F2529D /* js_src_raw */ = { isa = PBXGroup; children = ( - A22656EE1743DCBB00598A2C /* ClippingNodeTest */, - A218F7DB1743D97E00F65883 /* XHRTest */, 1AA51A7816F708FA000FDF05 /* ActionManagerTest */, 1AA51A7916F708FA000FDF05 /* ActionsTest */, 1AA51A7A16F708FA000FDF05 /* BaseTestLayer */, 1AA51A7B16F708FA000FDF05 /* Box2dTest */, 1AA51A7C16F708FA000FDF05 /* ChipmunkTest */, 1AA51A7D16F708FA000FDF05 /* ClickAndMoveTest */, + A22656EE1743DCBB00598A2C /* ClippingNodeTest */, 1AA51A7E16F708FA000FDF05 /* CocosDenshionTest */, 1AA51A7F16F708FA000FDF05 /* CocosNodeTest */, 1AA51A8016F708FA000FDF05 /* CurrentLanguageTest */, @@ -355,7 +356,9 @@ 1AA51A8816F708FA000FDF05 /* IntervalTest */, 1AA51A8916F708FA000FDF05 /* LabelTest */, 1AA51A8A16F708FA000FDF05 /* LayerTest */, + 15A3D4621682F14C002FB0C5 /* main.js */, 1AA51A8B16F708FA000FDF05 /* MenuTest */, + 1A42C7A71782CEA100F738F6 /* MotionStreakTest */, 1AA51A8C16F708FA000FDF05 /* OpenGLTest */, 1AA51A8D16F708FA000FDF05 /* ParallaxTest */, 1AA51A8E16F708FA000FDF05 /* ParticleTest */, @@ -368,16 +371,16 @@ 1AA51A9616F708FA000FDF05 /* SchedulerTest */, 1AA51A9716F708FA000FDF05 /* SpriteTest */, 1AA51A9816F708FA000FDF05 /* SysTest */, + D401B6DE16FC071100F2529D /* tests-boot-jsb.js */, + 15A3D4741682F14C002FB0C5 /* tests-main.js */, + 15A3D4711682F14C002FB0C5 /* tests_resources-jsb.js */, 1AA51A9916F708FA000FDF05 /* TextInputTest */, 1AA51A9A16F708FA000FDF05 /* TextureCacheTest */, 1AA51A9B16F708FA000FDF05 /* TileMapTest */, 1AA51A9C16F708FA000FDF05 /* TouchesTest */, 1AA51A9D16F708FA000FDF05 /* TransitionsTest */, 1AA51A9E16F708FA000FDF05 /* UnitTest */, - 15A3D4621682F14C002FB0C5 /* main.js */, - D401B6DE16FC071100F2529D /* tests-boot-jsb.js */, - 15A3D4741682F14C002FB0C5 /* tests-main.js */, - 15A3D4711682F14C002FB0C5 /* tests_resources-jsb.js */, + A218F7DB1743D97E00F65883 /* XHRTest */, ); name = js_src_raw; sourceTree = ""; @@ -549,6 +552,7 @@ 1A80332C1728F1FB00240CC3 /* res in Resources */, A218F7DC1743D97E00F65883 /* XHRTest in Resources */, A22656EF1743DCBB00598A2C /* ClippingNodeTest in Resources */, + 1A42C7A81782CEA100F738F6 /* MotionStreakTest in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id b/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id index 2fd19b673d..7c93b3b955 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id @@ -1 +1 @@ -b30514e90b5ed9a70853c63f20e9204052679459 \ No newline at end of file +2fe7237c56cf52c3ca577e33fc39aa5c9e2469ba \ No newline at end of file diff --git a/scripting/javascript/bindings/cocos2d_specifics.hpp b/scripting/javascript/bindings/cocos2d_specifics.hpp index 8e816cdb9c..8501a71b92 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.hpp +++ b/scripting/javascript/bindings/cocos2d_specifics.hpp @@ -101,9 +101,9 @@ public: const jsval& getJSCallbackThis() const; const jsval& getJSExtraData() const; protected: - jsval jsCallback; - jsval jsThisObj; - jsval extraData; + jsval _jsCallback; + jsval _jsThisObj; + jsval _extraData; }; @@ -112,13 +112,13 @@ public: JSCCBAnimationWrapper() {} virtual ~JSCCBAnimationWrapper() {} - void animationCompleteCallback() const { + void animationCompleteCallback() { JSContext *cx = ScriptingCore::getInstance()->getGlobalContext(); jsval retval = JSVAL_NULL; - if(!JSVAL_IS_VOID(jsCallback) && !JSVAL_IS_VOID(jsThisObj)) { - JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsCallback, 0, NULL, &retval); + if(!JSVAL_IS_VOID(_jsCallback) && !JSVAL_IS_VOID(_jsThisObj)) { + JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(_jsThisObj), _jsCallback, 0, NULL, &retval); } } @@ -135,7 +135,7 @@ public: static void setTargetForNativeNode(Node *pNode, JSCallFuncWrapper *target); static Array * getTargetForNativeNode(Node *pNode); - void callbackFunc(Node *node) const; + void callbackFunc(Node *node); }; @@ -162,7 +162,7 @@ public: void pause(); - void scheduleFunc(float dt) const; + void scheduleFunc(float dt); virtual void update(float dt); Object* getTarget(); diff --git a/scripting/javascript/bindings/generated b/scripting/javascript/bindings/generated index 1aef083d39..5df9199315 160000 --- a/scripting/javascript/bindings/generated +++ b/scripting/javascript/bindings/generated @@ -1 +1 @@ -Subproject commit 1aef083d3959574072f234cd31c5a53ac52b58a9 +Subproject commit 5df9199315b9e9972da23e478808a2e9152e9980 diff --git a/tools/bindings-generator b/tools/bindings-generator index 6a45a0770c..b09d920cdb 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 6a45a0770c4e6075f20d5049c88e3cb5f8aa83eb +Subproject commit b09d920cdb2523ba7ee1a5ee4419fe11f1bc5e7b diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index 14ec24745a..1adc23b24c 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos2dx/include/cocos2d.h %(cocosdir)s/CocosDenshion/inc # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". -classes = Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Data SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode +classes = Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Data SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also @@ -35,17 +35,17 @@ classes = Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* # will apply to all class names. This is a convenience wildcard to be able to skip similar named # functions from all classes. -skip = Node::[convertToWindowSpace ^setPosition$ getGrid setGLServerState description getUserObject .*UserData getGLServerState .*schedule], +skip = Node::[^setPosition$ getGrid setGLServerState description getUserObject .*UserData getGLServerState .*schedule], Sprite::[getQuad displayFrame getBlendFunc ^setPosition$ setBlendFunc setSpriteBatchNode getSpriteBatchNode], SpriteBatchNode::[getBlendFunc setBlendFunc], - MotionStreak::[getBlendFunc setBlendFunc], + MotionStreak::[getBlendFunc setBlendFunc draw update], AtlasNode::[getBlendFunc setBlendFunc], ParticleBatchNode::[getBlendFunc setBlendFunc], LayerColor::[getBlendFunc setBlendFunc], ParticleSystem::[getBlendFunc setBlendFunc], DrawNode::[getBlendFunc setBlendFunc drawPolygon], Director::[getAccelerometer (g|s)et.*Dispatcher getOpenGLView getProjection getClassTypeInfo], - Layer.*::[didAccelerate (g|s)etBlendFunc], + Layer.*::[didAccelerate (g|s)etBlendFunc keyPressed keyReleased unregisterScriptKeypadHandler], Menu.*::[.*Target getSubItems create initWithItems alignItemsInRows alignItemsInColumns], MenuItem.*::[create setCallback initWithCallback], Copying::[*],