Commit Graph

274 Commits

Author SHA1 Message Date
luocker fc655162fa Update CCString.cpp
we can't change _string value after get Array.
2013-12-27 00:26:02 +08:00
James Chen 17ff6ef764 Renames: IntValueMap —> ValueMapIntKey 2013-12-26 22:07:20 +08:00
James Chen a8d93ddf72 Restricts the element type for Vector<T> and Map<K, V>, it has to be `Object*` or `ObjectSubClass*`. 2013-12-26 21:49:40 +08:00
James Chen 55b0ef85d8 Merge pull request #4631 from boyu0/const_char_star_to_std_string
Change const char* to const std::string&
2013-12-24 22:34:34 -08:00
James Chen 6fce4f9061 Don’t use ‘String::createWithFormat’ in our codes, use StringUtils::format() instead. 2013-12-25 11:00:51 +08:00
boyu0 62fc889a54 Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into const_char_star_to_std_string
Conflicts:
	cocos/2d/platform/CCFileUtils.cpp
	cocos/2d/platform/CCFileUtils.h
	cocos/2d/platform/CCImageCommon_cpp.h
	cocos/2d/platform/CCSAXParser.cpp
	cocos/2d/platform/CCSAXParser.h
2013-12-25 10:41:37 +08:00
boyu0 3344c5243c change some const char* to const std::string& 2013-12-24 10:51:47 +08:00
James Chen 4ed988b8c5 Fixes linux build failure. 2013-12-23 13:45:31 +08:00
James Chen b504d817b5 Small bug fix in CCData. 2013-12-20 21:41:20 +08:00
James Chen 21a9f05110 Merge branch 'develop' of git://github.com/cocos2d/cocos2d-x into data-refactor
Conflicts:
	cocos/2d/CCUserDefault.cpp
	cocos/2d/CCUserDefault.mm
	cocos/2d/CCUserDefaultAndroid.cpp
	cocos/2d/ZipUtils.cpp
	cocos/2d/platform/CCFileUtils.h
	cocos/2d/platform/CCSAXParser.cpp
2013-12-20 21:12:11 +08:00
James Chen 3dba88c5c9 #include <algorithm> for std::find in CCVector.h. 2013-12-20 10:12:07 +08:00
Ricardo Quesada 59fee6b8d2 replaces std::for_each with for()
replaces `std::for_each` with C++11 `for( : )`
2013-12-19 13:34:41 -08:00
James Chen ddc1328e6b Small fix in CCValue.cpp. visitMap is a template that supports IntValueMap and ValueMap. IntValueMap is confused. ValueMapIntKey seems better. 2013-12-18 17:01:57 +08:00
James Chen 2892e8be3f Refactors Data class, adds FileUtils::getStringFromFile, FileUtils::getDataFromFile and deprecates FileUtils::getFileData. 2013-12-18 14:58:17 +08:00
James Chen 3829f841e7 Small fix for Vector::insert(const Vector<T>& other), renames it to Vector::pushBack(const Vector<T>& other). 2013-12-17 18:09:07 +08:00
James Chen c85f9877bb Reverts Vector::eraseObject, not need to return iterator. 2013-12-17 17:54:38 +08:00
James Chen d16fa07661 Removes Vector<T>::forEach, please use std::for_each instead. The same as Vector<T>::sort. 2013-12-17 17:45:29 +08:00
Ricardo Quesada 3838268fd0 Merge branch 'develop' into newRenderer 2013-12-14 19:28:01 -08:00
James Chen bb5ef615dd Merge branch 'develop' of git://github.com/cocos2d/cocos2d-x into pr4479
Conflicts:
	cocos/2d/CCSpriteBatchNode.h
2013-12-13 16:44:22 +08:00
Ricardo Quesada 61cc365d9e Merge branch 'develop' into newRenderer
Conflicts:
	cocos/2d/CCGLProgram.h
	cocos/2d/CCLabelTTF.h
2013-12-12 14:41:42 -08:00
Ricardo Quesada a8c317bd83 getDescription() works as expected
renames `description` to `getDescription`. Adds `virtual`  to it.
Adds `getDescription` to missing nodes.
2013-12-12 14:30:22 -08:00
Ricardo Quesada 29a15c885a Merge branch 'develop' into newRenderer 2013-12-12 11:44:09 -08:00
minggo 21e2b341f1 fix compiling error after fixing conflicts 2013-12-12 14:59:33 +08:00
minggo 16efe94946 fix compiling error after fixing conflicts 2013-12-12 14:48:27 +08:00
minggo 1e9c763b40 use ssize_t for index and capacity 2013-12-12 14:48:26 +08:00
minggo ab23b47043 use ssize_t for capacity and index in containers 2013-12-12 14:48:26 +08:00
James Chen 3649c12d37 issue #2790: Compilation error fix in CCMap.h. 2013-12-12 14:36:59 +08:00
James Chen 93bd45cefd issue #2790: Adds comments for Vector<T>.
Signed-off-by: James Chen <jianhua.chen@cocos2d-x.org>
2013-12-12 14:22:49 +08:00
James Chen 3fc9c93102 issue #2790: Comment fix for Map<K, V>::clear.
Signed-off-by: James Chen <jianhua.chen@cocos2d-x.org>
2013-12-12 12:58:01 +08:00
James Chen 6264336809 issue #2790: Updates comments for Map<K, V> container.
Signed-off-by: James Chen <jianhua.chen@cocos2d-x.org>
2013-12-12 11:54:03 +08:00
James Chen 5c62fe8f3f issue #2790: Reverts comments in CCString.h 2013-12-12 10:34:41 +08:00
James Chen 92a7aa03de issue #2790: Reverts comments in CCDictionary.h 2013-12-12 09:53:50 +08:00
James Chen 976bef8b68 issue #2790: StringUtils::toStringWithFormat —> StringUtils::format. 2013-12-12 09:37:56 +08:00
Ricardo Quesada 6d1abc7d4d Merge branch 'develop' into newRenderer 2013-12-11 15:28:05 -08:00
James Chen ce61fa4d9b issue #2790: const_iterator —> iterator to fix android build errors. 2013-12-11 22:09:22 +08:00
James Chen 36fd873257 issue #2790: Adds Vector::find. 2013-12-11 18:08:07 +08:00
James Chen cc567a3077 issue #2790: Vector::remove —> Vector::erase. 2013-12-11 18:08:06 +08:00
James Chen 093e310cab issue #2790: Vector::remove —> Vector::erase. 2013-12-11 18:08:06 +08:00
James Chen b66fccb5ab issue #2790: Removes Map::erase(first, last). 2013-12-11 18:08:06 +08:00
James Chen be9bb6998b issue #2790: Deprecates Dictionary, Array, String, Integer, Bool, Float, Double classes.
Also renames Map::remove to Map::erase.
2013-12-11 18:08:06 +08:00
James Chen 1a1cef9342 issue #2790: Addes Value::Null variable. 2013-12-11 18:08:05 +08:00
James Chen 2cda34d59a issue #2790: Deprecates CCDictionary, uses ValueMap for pure base data. Adds StringUtils class . 2013-12-11 18:08:05 +08:00
Ricardo Quesada 3b66d09bf5 Merge branch 'develop' into newRenderer 2013-12-10 11:10:55 -08:00
Ricardo Quesada 23222923bf Migrated code to Matrix4 2013-12-10 11:07:15 -08:00
Dhilan007 abef5b59fa fix compile error for vs project 2013-12-10 21:20:52 +08:00
boyu0 083a0eea2a Remove all std::move in function returns. 2013-12-10 16:06:05 +08:00
boyu0 698cdc5591 add std::move to Vector move constructor and move equal operator overloading function. 2013-12-10 15:58:13 +08:00
Ricardo Quesada 0222c6544e Migration to Mat4x4
Armature not migrated yet

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-12-09 17:32:51 -08:00
James Chen f6dc9bf9b6 issue #2790: Adds more ‘assignment operator’ method for CCValue. 2013-12-09 17:55:56 +08:00
James Chen f16068e621 issue #2790: Bug fix in CCMap.h 2013-12-09 17:55:56 +08:00
James Chen abbcd45c58 issue #2790: CCLOG —> CCLOGINFO in CCMap.h 2013-12-07 23:32:29 +08:00
James Chen beb6bb6c8d issue #2790: Bug fix in CCMap.h 2013-12-07 16:14:22 +08:00
James Chen 365f6faabb issue #2790: Warning fixes for CCDictionary.cpp and CCString.cpp 2013-12-07 14:26:52 +08:00
James Chen 06e6d38ab0 issue #2790: Initializes Value when empty constructor was invoked. 2013-12-07 14:26:17 +08:00
James Chen cd72813389 issue #2790: Autorelease pool is using Vector<T> now. 2013-12-07 14:23:29 +08:00
James Chen 6f13a111ae issue #2790: Adds Vector<T>::sort method, adds Vector::removeObject(object, toRemoved). 2013-12-07 14:18:42 +08:00
James Chen 165cdf7fe6 issue #2790: Deprecates CCArray. 2013-12-07 10:48:02 +08:00
James Chen 23ad9f4e1a issue #2790: Adds const version of Vector<T>::forEach. 2013-12-07 10:46:40 +08:00
James Chen 6cd573fa7f issue #2790: Deprecates CCSet. 2013-12-06 18:16:58 +08:00
minggo fa7c97171b fix some warnings 2013-12-06 16:32:06 +08:00
minggo 19c86c0e4f Merge pull request #4434 from martell/msys2
Msys2 and Mingw added fixed x64 cocos/audio on Windows for MSVC and MinGW
2013-12-05 22:23:45 -08:00
minggo 9676821479 use int in Vector 2013-12-05 17:38:08 +08:00
minggo b67d567a79 replace long with int or ssize_t 2013-12-05 17:22:22 +08:00
James Chen 6aa2e5b257 Updates comments that vs2012 doesn’t support initializer list. 2013-12-05 16:49:05 +08:00
James Chen b4b50f3491 Compilation fix for windows. 2013-12-05 16:33:13 +08:00
James Chen 79700118db Merge commit 'refs/pull/4433/head' of git://github.com/cocos2d/cocos2d-x into ccconsole
Conflicts:
	cocos/base/CCConsole.cpp
	cocos/base/CCConsole.h
2013-12-05 16:26:04 +08:00
James Chen 2b857ebb52 Fixing compilation errors on windows. 2013-12-05 16:09:38 +08:00
Ricardo Quesada c617eee505 Uses the new Vector<>. Code is more robust! 2013-12-04 22:07:23 -08:00
Ricardo Quesada 6a034a91f1 Merge branch 'develop' into console
Conflicts:
	cocos/scripting/auto-generated
2013-12-04 21:58:11 -08:00
Ricardo Quesada 73321199b9 Console: commands receives the char*
The char* is passed in case the commands
need to sub-parse the arguments.
Very useful for QA.
For example, the could create a command called "click", and the command could
receive arguments.
2013-12-04 21:51:08 -08:00
James Chen b0af2667f8 Merge commit 'refs/pull/4433/head' of git://github.com/cocos2d/cocos2d-x into ccconsole
Conflicts:
	cocos/scripting/auto-generated
2013-12-05 12:48:32 +08:00
James 373c3b01bf issue #2790: Fixing compilation errors on linux. 2013-12-05 11:44:37 +08:00
martell e5ada6f377 added support for msys2 mingwtoolchains and fix x64 cocos/audio on windows platform for MSVC and Mingw. Also fixed a few very bad type casts very important for future Arm64 bit processors 2013-12-05 03:37:27 +00:00
Ricardo Quesada e0bf32d881 dprintf is not defined on Android
using my own  dprintf
2013-12-04 19:33:50 -08:00
Ricardo Quesada 49b25231f2 Compiles on Android 2013-12-04 19:16:01 -08:00
James Chen 944160210c issue #2790: Renames functions in Map<K, V>. 2013-12-05 10:59:43 +08:00
James Chen 499a0404d4 issue #2790: Renames some functions in Vector<T>. Makes it more like stl vector. 2013-12-05 10:35:10 +08:00
Ricardo Quesada 15321a58df fixes compiler errors on Linux 2013-12-04 18:28:09 -08:00
Ricardo Quesada b52d535a42 fixes indentation issues
and some compilations issues on Linux
2013-12-04 18:19:51 -08:00
Ricardo Quesada f42aef0af8 Moves CCConsole.* to base/ 2013-12-04 18:09:23 -08:00
James Chen c9767b8ea0 issue #2790: fileToValueDict —> getValueMapFromFile, fileToValueArray —> getValueVectorFromFile. 2013-12-04 17:50:57 +08:00
James Chen 54289276de issue #2790: ValueArray —> ValueVector, ValueDict —> ValueMap, IntValueDict —> IntValueMap. 2013-12-04 17:46:57 +08:00
James Chen 736c70704b issue #2790: Some FIXME fixes. 2013-12-04 17:28:14 +08:00
James Chen bbeec97b48 issue #2790: Bug fixes in CCValue.cpp. 2013-12-04 16:38:12 +08:00
James Chen 82cc795ecf issue #2790: Adds more move functions. 2013-12-04 16:37:48 +08:00
James Chen 293ba0210b issue #2790: CCLOG —> CCLOGINFO for CCMap.h and CCVector.h 2013-12-04 16:37:08 +08:00
James Chen 60874ece64 issue #2790: Updates Makefile, Moves some codes to CCValue.cpp. 2013-12-04 16:18:22 +08:00
James Chen ceaa1f26bb issue #2790: Windows run ok with ValueDict for FileUtils. 2013-12-04 16:02:54 +08:00
James Chen 35b96602d3 issue #2790: includes <algorithm> for std::for_each. 2013-12-04 16:02:53 +08:00
James Chen 5eb9446b80 issue #2790: Uses const reference instead of value for std::for_each ’s argument. 2013-12-04 16:02:53 +08:00
James Chen 3fc5fffd26 issue #2790: const char* —> const std::string& for CCNS.h/.cpp. 2013-12-04 16:02:53 +08:00
James Chen 2d6e6dbdb0 issue #2790: Assert fix for Vector<T>::insertObject. 2013-12-04 16:02:52 +08:00
James Chen 4ec6e50cc4 issue #2790: Pure base data from Dictionary* to ValueDict, Array* to ValueArray. 2013-12-04 16:02:52 +08:00
James Chen d2bddee11e issue #2790: Adds CCMap.h. 2013-12-04 16:01:56 +08:00
James Chen 9928e8bef1 issue #2790: Uses Vector<T>::getObjectAtIndex instead of Vector<T>[] operator to avoid some mistakes. 2013-12-04 16:01:55 +08:00
James Chen cb215bc931 issue #2790: Vector<T> replaces Array* finished. 2013-12-04 16:01:55 +08:00
James Chen 8aef092005 issue #2790: TestCpp with new Vector<>. 2013-12-04 16:01:54 +08:00
James Chen 1d5984b29a issue #2790: Vector::makeObjectsPerformCallback —> Vector::forEach 2013-12-04 16:01:02 +08:00
James Chen d4d864216b issue #2790: Deletes Vector::init, adds Vector::setCapacity. 2013-12-04 16:00:18 +08:00
James Chen 90062b656d issue #2790: Node::_children is Vector<Node*> now. 2013-12-04 16:00:17 +08:00
James Chen c152652c5b issue #2790: Vector<FiniteTimeAction*> for Sequence::create(arr) and Spawn::create(arr). 2013-12-04 15:56:08 +08:00
James Chen 80004548c8 issue #2790: Adds CCVector.h to Xcode project. int —> long 2013-12-04 15:56:08 +08:00
James Chen 52af153a81 issue #2790: Commit CCVector.h from Riq’s repo(https://github.com/ricardoquesada/cocos2d-x/blob/template_vector/cocos2dx/cocoa/CCVector.h). 2013-12-04 15:56:08 +08:00
minggo 608e3bfa1b Merge pull request #4410 from signmotion/corrected_DISALLOW_COPY_AND_ASSIGN
[ci skip]Corrected "disallow copy and assign"
2013-12-03 19:21:45 -08:00
minggo 225348cdde use size_t instead of long in Array 2013-12-03 11:09:39 +08:00
martell f369606d77 fix cocos2d-x for vs2013 2013-11-30 08:05:39 +00:00
signmotion 03d64e0689 - Corrected CC_DISALLOW_COPY_AND_ASSIGN. 2013-11-29 20:34:15 +02:00
Ricardo Quesada 9b52af010d Macro CC_DISABLE_COPY is renamed to CC_DISALLOW_COPY_AND_ASSIGN
and the old CC_DISALLOW_COPY_AND_ASSIGN is removed
2013-11-22 16:09:05 -08:00
Ricardo Quesada be64dd97cf replaces `delete[]` with `free()` in C-based API
API that returns a newly allocated buffer as an output argument (not return value) are error-prone.

- Users forget to release the newly allocated buffer
- Or the call `delete` instead of `delete[]`

But some of those API need to call `realloc` on the buffer.
But `realloc` is only valid if the buffer was previously allocated with `malloc`.
If a buffer needs to be re-allocated using a C++ API, then `std::vector<char*>` should be used instead...

So, this patch does:

- Migrates the API from  `new []` / `delete[]` to  `malloc()` / `free()`
- Fixes all the memory issues: incorrect deallocs and memory leaks
- Updates the documentation
- And fixes misc issues with the API: removes `cc` from the ZipUtils class.
2013-11-11 18:09:47 -08:00
boyu0 6c1144ee79 issue #2770: fix some warning 2013-11-11 12:49:38 +08:00
Dhilan007 314f2ac62e use float instead for create point object 2013-11-08 14:13:39 +08:00
minggo d1f94e0d9d Merge pull request #4111 from boyu0/iss2771_physical
[ci skip]issue #2771: physical
2013-11-07 18:51:15 -08:00
minggo 167242e540 Merge pull request #4127 from Dhilan007/ANCHOR_XXX
[ci skip]Point: Adds ANCHOR_XXX constants like ANCHOR_MIDDLE, ANCHOR_TOP_RIGHT, e...
2013-11-07 18:45:50 -08:00
Dhilan007 916361af3f Point: Adds ANCHOR_XXX constants like ANCHOR_MIDDLE, ANCHOR_TOP_RIGHT, etc. 2013-11-07 23:40:33 +08:00
boyu0 7363be0697 Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into iss2771_physical 2013-11-07 17:37:33 +08:00
Ricardo Quesada 84a6aa29cd Adds more 64-bit fixes
Replaces more `int` with `long` where it makes sense.

Also , it repalces some `unsigned long` with `long` for "lenght"
values as described in our c++ guideline
2013-11-05 17:36:44 -08:00
boyu0 af129e25f0 issue #2771: change some coding style 2013-11-05 20:02:58 +08:00
Ricardo Quesada ba7ed6e578 Fixes some compiler warnings
The warnings are related to:

* 64-to-32-bit conversion
* shadow variables
2013-11-04 16:31:36 -08:00
James Chen 9be8ca3714 [cmake] output lib to root/lib 2013-11-04 21:03:08 +08:00
James Chen 8676523433 Adding CMakeLists.txt 2013-11-04 21:03:07 +08:00
boyu0 b2951b70ff issue #2771: enhance Listener use EventListener mechanism 2013-11-01 14:50:06 +08:00
boyu0 d12ee5f120 Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into iss2771_physical 2013-10-18 15:34:13 +08:00
minggo 95acb1b9e3 issue #2905: helloworld build ok on android 2013-10-14 14:01:00 +08:00
minggo 8eeb911e8f issue #2905: adjust folder structure 2013-10-12 15:25:45 +08:00