Commit Graph

40 Commits

Author SHA1 Message Date
James Chen 757425c54b issue #4165: Scheduler::scheduleCallback -> Scheduler::schedule, Scheduler::scheduleSelector -> Scheduler::schedule. APIs are clear for c++ developers now. 2014-03-03 11:00:30 +08:00
James Chen e6d2c4ec73 Refactors Scheduler class.
* 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.
2014-03-01 14:09:09 +08:00
James Chen 5e6130c92c issue #4058: Get rid of Object ,rename it to Ref. 2014-02-20 10:53:49 +08:00
minggo 4381685a9d deprecated some functions in Object 2014-01-22 13:47:29 +08:00
Ricardo Quesada f0537f17da ooops 2014-01-14 18:55:14 -08:00
Ricardo Quesada c267c479db Performance Test fixes
* SpritePerfTest: 3 new tests added
* SpritePerfTest: random() always use the same seed
* SpritePerfTest: Fixed tests 8 and 9 on retina display machines
* Console: Added 3 new commands: 'config', 'fileutils dump', 'textures'
2014-01-14 17:22:45 -08:00
Dhilan007 fe7d5cbdfb update If Construct 2014-01-09 09:46:17 +08:00
Dhilan007 d18da42695 fix addImageAsync bad judgment of generate image for the first ImageFile. 2014-01-08 23:42:54 +08:00
walzer 64af0de648 update copyrights for 2014, in cocos/2d/ folder 2014-01-07 11:25:07 +08:00
Dhilan007 49d8b76b9e fix crash related to not support the z length modifier for size_t on vs 2014-01-05 11:59:32 +08:00
minggo ded3e753f3 use std::function for call back 2014-01-02 17:23:00 +08:00
James Chen febc19ea8d Some warning fixes on linux. 2013-12-26 23:06:16 -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
boyu0 f2e18f32a9 fix android compile error 2013-12-25 13:57:17 +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
James Chen 17a6dbebb6 Compilation error fixes. 2013-12-24 19:05:35 +08:00
James Chen 1f5611ae05 Adds missing ‘)’. 2013-12-24 18:23:36 +08:00
James Chen 0ff85852cc Don’t use FileUtils::getInstance()->getFileData, please use getStringFromFile and getDataFromFile instead. 2013-12-24 18:08:40 +08:00
boyu0 6e6ccbd5f9 change some const char* to const std::string& 2013-12-24 15:49:58 +08:00
boyu0 e07c4ffec1 Change NULL to nullptr, edit hungarian notation. 2013-12-18 17:47:20 +08:00
LinWenhai 649e6b8065 use size_t replace unsigned int for record redeque::size returned value. 2013-12-17 16:04:48 +08:00
Dhilan007 f7a448814c issue #3341:fix Incorrect at TextureCache::addImageAsync for repeatedly execute for the same image 2013-12-16 17:12:53 +08:00
Ricardo Quesada f4c68e4eef More renames of description() to getDescription() 2013-12-12 14:38:12 -08:00
minggo 1502fef7e4 use Schedule::performFunctionInCocosThread 2013-12-06 14:15:01 +08:00
minggo b67d567a79 replace long with int or ssize_t 2013-12-05 17:22:22 +08:00
minggo eded94ef76 don't create a pool, since it doesn't invoke any iOS dependent codes 2013-11-27 17:43:54 +08:00
minggo bcb131262c add helper funcion to invoke a function in gl thread 2013-11-27 16:49:07 +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
minggo d3cf36ba37 Merge pull request #4171 from dumganhar/jsb-64bit-fix
[ci skip]Jsb 64bit fix
2013-11-11 02:17:42 -08:00
James Chen 0151ac60ba fix 64bit warning. unsigned int (int) —> long. 2013-11-11 16:45:44 +08:00
Huabing.Xu dfcae4ed0d issue #3025: change TextureCache::purgeSharedTextureCache() and TextureCache::sharedTextureCache() to do not call deprecate function anymore 2013-11-11 16:04:34 +08:00
Huabing.Xu 3fc16256ab issue #3025: move deprecated texture cache implementation to cpp file 2013-11-11 15:40:12 +08:00
Huabing.Xu 02da3a29cc issue #3025: deprecate TextureCache::reloadAllTextures, call VolatileTextureMgr::reloadAllTextures instead 2013-11-11 11:38:02 +08:00
Huabing.Xu b726c6fd2c issue #3025: move VolatileTexture static function to VolatileTextureMgr 2013-11-08 16:47:33 +08:00
Huabing.Xu 935d472979 issue #3025: remove TextureCache::_sharedTextureCache 2013-11-08 11:36:27 +08:00
Huabing.Xu 99546cef46 issue #3025: add getTextureCache() in CCdirector() 2013-11-07 18:52:36 +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
minggo 95acb1b9e3 issue #2905: helloworld build ok on android 2013-10-14 14:01:00 +08:00
minggo 49d7bbd600 issue #2905: remove sub folders except platform 2013-10-12 15:41:45 +08:00