Commit Graph

325 Commits

Author SHA1 Message Date
minggo 5834fc2f37 Merge pull request #3470 from boyu0/iss2494_Point_isSegmentIntersect_bug
closed #2494: Fix bug when two line is incident, the Point::isSegmentIntersect() may return wrong result
2013-08-26 23:27:00 -07:00
Ricardo Quesada 62c578667b API compliant with cocos2d-x best practices
Uses `int` instead of `unsigned int` as described in the cocos2d-x best practices

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-08-26 18:07:40 -07:00
Ricardo Quesada b3b3583583 CCNode perf improvements
AffineTransforms uses a const global variable for the `IDENTITY`
`removeObject` only seeks the index once

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-08-26 18:04:51 -07:00
boyu0 1e452bf0bc closed #2494: add isLineOverlap, isLineParallel, isSegmentOverlap method to Point. 2013-08-26 13:45:45 +08:00
Ricardo Quesada ea8eb601af Uses std::sort()
Uses std::sort() for inserting the nodes.

This code is not final, but preliminary results show that std::sort() is 60% faster

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-08-24 10:56:07 -07:00
Ricardo Quesada 364288cf66 Adds "Sort all Children" perf test
Adds a new perf tests: "sortAllChildren"

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-08-23 13:14:57 -07:00
boyu0 9a3a03d6ef closed #2494: Fix some typo 2013-08-23 14:41:49 +08:00
boyu0 3f23a4a661 closed #2494: Fix bug when two line is incident, the Point::isSegmentIntersect() may return wrong result 2013-08-23 14:37:56 +08:00
Ricardo Quesada d7590affda Merge branch 'develop' into dictionary_array_fixes
Conflicts:
	cocos2dx/cocoa/CCArray.cpp
	cocos2dx/cocoa/CCArray.h
	cocos2dx/label_nodes/CCLabel.cpp
	extensions/CCArmature/datas/CCDatas.cpp
	extensions/CCArmature/display/CCDisplayManager.cpp
2013-08-21 21:27:44 -07:00
Ricardo Quesada 29d0bab0d3 fixes memory leak!
and double-autorelease on Dicts (on mac)
2013-08-21 21:12:32 -07:00
Ricardo Quesada 2e221ee6cc Array & Dictionary fixes
In many places `Dictionary` and `Array` are not being initialized. In fact `Dictionary` doesn't  have the `init()` method creating potential leaks.
Also in objects like `Armature` and the new `LabelTTF`, the `Array` object is not being used a pointer. So it doesn't use the 2 phase initialization, creating potential leaks.

This patch fixes all those issues.

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-08-21 20:12:09 -07:00
Ricardo Quesada 4104cdc20e Better destructors logs
Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-08-21 20:08:51 -07:00
Ricardo Quesada 967eb4b08f Adds more asserts
The instance methods cannot be used if the instance was not `init()`

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-08-21 20:04:30 -07:00
Ricardo Quesada 4dc18029b7 Removed Iterator class
There is no need to implement `Array::Iterator`.
It is replaced by returning `end()` and `begin()`

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-08-21 20:03:45 -07:00
minggo 2de8963a0a fix warnings caused by deprecating some functions of Array 2013-08-22 10:45:47 +08:00
minggo 3476a843e2 Array can be use in stl::sort() when not using vector inside 2013-08-22 10:18:59 +08:00
Ricardo Quesada f7241ea533 Default capacity of Array is 10
plus better documentation

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-08-20 16:06:04 -07:00
Ricardo Quesada 4d6d2d0dfa Better default values for auto-release pool
150 is a reasonable number for auto-release pool.
By using 150, it prevents the unneeded re-alloc of the pool.

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-08-20 14:17:26 -07:00
Ricardo Quesada 5225758c5c CCArray: performance improvements
CCArray:

- Iterator uses position for iterator. MUCH faster.
- Do not double init the array. performance improvements in memory.

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-08-20 14:16:43 -07:00
Ricardo Quesada 511ec1cc5d Compiles with improved CCArray
Compiles both with std::vector or ccCArray
2013-08-19 17:09:28 -07:00
James Chen 175316f2c6 Merge pull request #3404 from timothyqiu/docfix
Documentation fix: broken links and wrong encoding in the doc...
2013-08-18 19:35:47 -07:00
minggo baa9e0a1e4 issue #2525:add iterator for Array and make Array can be used in range-based loop 2013-08-16 18:23:41 +08:00
Timothy Qiu 2bb119baef Documentation & Cocos2d-x C++ Style 2013-08-09 12:40:20 +08:00
Timothy Qiu bc10c2a01f Change some doc due to the change of source code.
Fixed some incorrect use of doxygen command.
2013-08-01 17:47:37 +08:00
Timothy Qiu 978fc634be Use C++ code in C++ comments.
Removed Hungarian notation from parts of the code.
2013-08-01 16:40:56 +08:00
minggo afc0e4bf8f make Point -> Size & Size -> Point explicit 2013-07-31 14:36:52 +08:00
Timothy Qiu 149a844dbc Remove unnecessary/wrong use of \a in comment.
\a is meant to refer to arguments. Links to class/function names are
automatic generated in doxygen.
2013-07-30 10:56:13 +08:00
Ricardo Quesada 058935aa8d Removes Hungarian notation
Removes Hungarian notation from the code.
2013-07-25 15:53:24 -07:00
Ricardo Quesada 1f37d4d00a More best practices fixes and other bug fixes
- Adds `CC_REQUIRES_NULL_TERMINATION` to methods that require a NULL at the end
- Removes more Hungarian notations in samples
- s/sprite/scene: fix from previous commit
- `CCLog` -> `log`
- `getLayerNamed` -> `getLayer`
- `getPropertyNamed` -> `getProperty`
- and other small fixes
2013-07-23 15:20:22 -07:00
James Chen 1db847ad7c issue #2344: ScriptEngineManager::sharedManager --> ScriptEngineManager::getInstance, ScriptEngineManager::purgeSharedManager --> ScriptEngineManager::destroyInstance 2013-07-22 17:24:54 +08:00
Ricardo Quesada 89d210bdb3 CCAssert -> CCASSERT
and other best pracitces like:

capacity and "index" are ints and not unsigned int (google's recomendation).
 It is easier to detect underflow bugs like this

plus other minor improvements
2013-07-19 22:01:27 -07:00
James Chen 9270a28275 issue #2404: return nullptr in Clonable::copy(). 2013-07-19 11:56:01 +08:00
James Chen 2ed5a40a36 Merge pull request #3146 from tks2shimizu/develop
closed 2408: Add componentsSeparatedByString function for String class.
2013-07-15 23:00:12 -07:00
minggo eada29ee40 issue #2404:created CCDprecated.h and move all global functions and variables into it 2013-07-15 16:14:26 +08:00
Tomoaki Shimizu 5e285add28 Add componentsSeparatedByString function for String class.
For String Class and string, there is no function to split the string.
So, I added componentsSeparatedByString function.
The function name is the same as NSString.
2013-07-14 17:56:34 +09:00
minggo 249e67d1f7 closed #2393:fix a compiling error 2013-07-12 18:25:36 +08:00
minggo 6abe6fce78 closed #2393: fix conflicts 2013-07-12 18:04:32 +08:00
minggo 58fe3c7563 closed #2393: fixed conflicts 2013-07-12 15:07:44 +08:00
minggo 5d9fea1416 issue #2393:mark PointZero RectZero and SizeZero as deprecated 2013-07-12 14:47:36 +08:00
minggo 15096b0716 issue #2393:mark CCPointMake CCSizeMake CCRectMake as deprecated 2013-07-12 14:30:26 +08:00
Ricardo Quesada cf262c28e2 getInstance() / destroyInstance() are used...
... instead of sharedXXX / purgeXXX.
They are more C++ friendly, and also easier to remember.

common files + Mac files + iOS files + tests/samples files were updated.

The old methods are deprecated now.
2013-07-11 15:24:23 -07:00
minggo c37af8fa77 issue #2393:mark functions in CCPointExtensions deprecated 2013-07-11 16:38:58 +08:00
James Chen f414803e92 Minor fix of PR 3128. 2013-07-11 15:36:00 +08:00
Ricardo Quesada 48b1ed9f8f re adds copy() as a deprecated method
...in order to make easier the port to v3.0
2013-07-10 18:11:37 -07:00
Tomoaki Shimizu eca7db6a50 Add append function for String class.
The append function is useful when adding a string.
So, I added it to String class.
2013-07-10 10:50:13 +09:00
James Chen a517e68c59 closed #2379: Removing CCZone.h/.cpp. 2013-07-09 14:50:31 +08:00
James Chen 596c4c3cf2 issue #2387: Using static_cast instead of C style cast while iterating CCDictionary. 2013-07-09 14:40:43 +08:00
James Chen 9b9fe67d25 issue #2387: Using static_cast instead of C style cast in iteration of CCArray. 2013-07-09 14:29:51 +08:00
James Chen 976d4ad11e Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into remove-copywithzone
Conflicts:
	cocos2dx/actions/CCActionInterval.cpp
	cocos2dx/cocoa/CCDictionary.cpp
	samples/Cpp/TestCpp/Classes/NodeTest/NodeTest.cpp
2013-07-09 09:48:41 +08:00
Ricardo Quesada 9fe9341646 From C++ best practices
Uses static_cast<> instead of C casting.
2013-07-08 14:38:14 -07:00