Add a check to the CCNode destructor to catch a common cocos2d-x programming mistake - forgetting to call base class onExit() in derived class onExit() implementations. We can check for this invalid API usage by checking if the node is still marked as running on destruction. If the node still thinks it's running then it's likely the cleanup logic performed by Node::onExit() was not done.
1: Add a fix to prevent events from being sent to scene nodes which are destroyed. Previously when a node was being destroyed it would try to unregister any event listeners it would have. This process would fail however in the case where event dispatching was already underway because we can't modify the listeners list while we are iterating through it. This is a pretty common occurrence since we often tear down & switch scenes in response to button clicks etc. Fix the problem by nulling out the slot for the listener we are removing in this case, so that it's node no longer receives any events after it is destroyed. The event dispatching code will cleanup this unused/nulled slot once the event processing loop has terminated.
2: When removing an event listener in cocos2d::EventDispatcher, ensure immediately it gets removed from the node priority map and dirty nodes set in order to ensure we don't inadvertently access any dangling pointers to nodes.
3: Add debug checks to ensure nodes have no associated event listeners after they are destroyed. This check will catch the problem fixed by (1) if it is still present.
4: Add some extra debug sanity checks in the event dispatcher to ensure nodes are not added to the lists twice and that they are being properly removed from the lists under certain conditions.
5: In cocos2d::Node's destructor NULL out members after releasing them in case they somehow happen to be accessed during the destructor. Move the release of the event dispatcher to the very end, since we need to check against it in debug.
This funciton is useful, but the code is buggy.
In should check the parents' position instead of Director::Size()
Let's do it correctly, and then re-add this function
* Timer is an abstract class now.
* Adds three new timers ( `TimerTargetSelector`, `TimerTargetCallback`, `TimerScriptHandler`) which are inherited from Timer.
* Adds new API 'scheduleCallback` / `unscheduleCallbackForKey', and callback's target could be any classes since we're using `void*` to identify target.
* `Scheduler::scheduleCallback` use `std::function`, therefore, it supports passing `lambda`, `member_function` and `global_function`.
* The old selector API is still kept since it's very useful when schedule callback is a member function, it doesn't need a `key` to identify the callback function. (+1 squashed commit)
* Adds relevant test cases.
`visit()` and `draw()` are improved.
they both receive:
- `Renderer`
- `kmMat4` for transformation
- `bool` whether or not the transform changed from the previous frame
Although `draw` and `visit` are not using the 3 new parameters,
they will start using it in the coming days (or weeks, or months).
Those parameters are needed for:
- `Renderer` shouldn't be a singleton. There should be one renderer per Director. There could be more than one renderer
- we should get rid of `kmGLXXX` functions since nodoby knows what is happening. the `kmMat4` is for that.
- whenever possible, we should try to optimize the multiplications. the `dirty` flag is for that.
We need those changes, so, it is better to change the API now, and not right after v3.0-final is released.
OrbitCamera: added getters (public). Setters moved from `protected` to `public
: Improved API. Instead of using "out" parameters for getters, it returns a `kmVec3`
: Setters receives `kmVec3` as well. Old API is still supported
Node: `setAdditionalTransform` doesn't get `dirty` on the next frame.
Instead, once the additional transform is set, in order to remove it the user needs to pass
the identity matrix
Node correctly sets the Z vertex in getNodeToParentTransform(),
and not in transform().
This is the correct thing to do, and also fixes possible collisions
with the additionalTransform (eg: Camera)
* develop: (105 commits)
update armature to new render
iOS & Mac project fix.
[AUTO] : updating submodule reference to latest autogenerated bindings
use size_t replace unsigned int for record redeque::size returned value.
issue #2171: Updates CMakeLists.txt.
issue #2171: Binds New renderer classes, ignores NewTextureAtlas.
issue #2171: Adds header files of renderer in cocos2d.h.
issue #2171: Reorder renderer files for iOS & mac project.
issue #2171: small fix in ccTypes.h
issue #2171: Don’t ‘using namespace std;’ in header file.
[AUTO] : updating submodule reference to latest autogenerated bindings
issue #2171: Ignores Director::getFrustum.
issue #2171: Fixing compilation errors for Linux port.
issue #2171: NULL —> nullptr for Android warning of CCBAnimationManager.cpp.
issue #2171: [New Renderer] Fixing compilation errors for Android.
[Win32] fix argument type. - argument of interface is ssize_t.
Update AUTHORS [ci skip]
Update CHANGELOG [ci skip]
Add mouse scrolling support for extension test
issue #3341:fix Incorrect at TextureCache::addImageAsync for repeatedly execute for the same image
...
Conflicts:
cocos/2d/CCNode.cpp
cocos/2d/cocos2d.vcxproj.filters
samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp
* develop:
fix compile error related to ssize_t.
issue #2771: add and change some physics API, and add more documents
[AUTO] : updating submodule reference to latest autogenerated bindings
Some fixes for XXX:getDescription.
Reverts CCSpriteBatchNode.h
size_t —> ssize_t in CCTMXLayer.cpp
issue #2771: add PhysicsWorld function set/getUpdateRate and set/getSpeed. Change name PhysicsQueryRectCallbackFunc and PhysicsPointQueryCallbackFunc to PhysicsRectQueryCallbackFunc and PhysicsQueryPointCallbackFunc
Fix:Add lua binding of ’registerScriptHandler’、’unregisterScriptHandler’ and ’removeObjectAllHandlers’ of ScriptHandlerMgr and some constants define
[AUTO] : updating submodule reference to latest autogenerated bindings
More renames of description() to getDescription()
getDescription() works as expected
fix compiling error after fixing conflicts
fix compiling error after fixing conflicts
use ssize_t for index
use ssize_t for index and capacity
use ssize_t for capacity and index in containers
Fix:Remove some needless lua binding functions and resolve a bug