Commit Graph

210 Commits

Author SHA1 Message Date
Ricardo Quesada 487f65af2e Replaces `Dictionary` with `std::unordered_map`
I did some performance tests, and `std::unordered_map` is more performant than `Dictionary`.

I need to do more tests, but so far, the results are good.

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-09-06 22:55:11 -07:00
Ricardo Quesada bf6750067f little optimization.
string is created when needed
2013-09-06 19:00:12 -07:00
Ricardo Quesada b78382d5e5 Performance improvements in FileUtils / TextureCache
Added common "apple" platform to avoid duplicate files in FileUtils and other common files
Improves performance in fetching files.
2013-09-06 15:33:28 -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
godyZ 8c0f2dfed1 issue #2533: resolve some conflicts 2013-08-16 14:27:13 +08:00
minggo 77f89956a3 Merge pull request #3414 from boyu0/iss2522_unpackccz
closed #2522: Let Image::initWithImageData() support the packed data.
2013-08-15 21:44:43 -07:00
godyZ 424b4140a2 Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into Atitc_decode 2013-08-16 11:14:47 +08:00
godyZ e8809b2b15 issue #2533:add ATITC compressed texture support
soft decode test in Win32, ios, Mac. device decode test in HTC G14
Adreno 220 GPU.
2013-08-16 11:02:44 +08:00
carlo morgantini 47be4ff58a Merge remote-tracking branch 'originGithub/develop' into new_develop_merge_clean
Conflicts:
	cocos2dx/label_nodes/CCFontAtlas.cpp
	cocos2dx/label_nodes/CCFontAtlas.h
	cocos2dx/label_nodes/CCFontAtlasCache.cpp
	cocos2dx/label_nodes/CCFontAtlasFactory.cpp
	cocos2dx/label_nodes/CCFontAtlasFactory.h
	cocos2dx/label_nodes/CCFontDefinition.cpp
	cocos2dx/label_nodes/CCFontFreeType.cpp
	cocos2dx/label_nodes/CCLabel.cpp
	cocos2dx/label_nodes/CCLabel.h
	cocos2dx/label_nodes/CCStringBMFont.h
	cocos2dx/label_nodes/CCStringTTF.cpp
	samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp
2013-08-13 11:28:54 -07:00
carlo morgantini d15d84c05f samples cleaned up 2013-08-12 15:09:28 -07:00
boyu0 fc923aac93 closed #2522: Fix compile error. 2013-08-12 18:18:09 +08:00
boyu0 94f9921d5e issue #2345: edit linux command to link the libpng12-dev.lib instead of use ourselves. Move ccTexParams into CCTexture2D 2013-08-06 11:34:48 +08:00
boyu0 cecfc13bc4 Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into 2345 2013-07-27 22:06:30 +08:00
boyu0 02bdfbf169 Combine CCTextureETC to CCImage and CCTexture2D. 2013-07-26 17:34:44 +08:00
Ricardo Quesada d683e10808 More constant fixes
Transition::ORIENTATION_XXX -> Transition::Orientation::XXX
Image::FORMAT_XXX -> Image::Format::XXX
Image::_function() -> Image::function() // private methods should not start with '_'
DrawPrimitives::drawColor() -> DrawPrimitives::setDrawColor()

And fixes Premultiplied Alpha in PVR v3 images
And tests are updated with the new functions
2013-07-25 14:49:43 -07:00
Ricardo Quesada 16d0b43181 Constant fixes
Director::PROJECTION_2D, 3D,... -> Director::Projection::_2D, _3D, ...
Label::TEXT_ALIGNMENT_... -> Label::HAlignment::...
Label::TEXT_VERTICAL_ALIGNMENT_... -> Label::VAlignment::...
Texture2D::PIXEL_FORMAT_... -> Texture2D::PixelFormat::...
BlendFunc::BLEND_FUNC_DISABLE -> BlendFunc::DISABLE

Also adds more constant for BlendFunc
2013-07-25 13:36:19 -07:00
minggo 17946c084a issue #2430:fix android compiling error 2013-07-25 21:59:37 +08:00
minggo 4d7ac6c800 issue #2430:fix conflict 2013-07-25 21:37:12 +08:00
boyu0 a2b611d8c3 Refactor Image and Texture2D, combine TexturePVR to Image and Texture2D, and delete TexturePVR 2013-07-25 21:35:00 +08:00
minggo 2bb577be8b issue #2430:change Image enum item to upper letter 2013-07-25 20:29:53 +08:00
minggo 77afae124b issue #2430:move Texture2D enum into class 2013-07-25 19:52:44 +08:00
James Chen 6a0a4ed0f9 #issue #2404: Using Texture2D::getDefaultAlphaPixelFormat instead of Texture2D::defaultAlphaPixelFormat in TextureCache. 2013-07-25 15:05:56 +08:00
minggo f6cfe3007f issue #2412:fix merging conflict 2013-07-23 10:41:11 +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
Ricardo Quesada 1f0dac4ed0 Removes CC_PROPERTY / CC_SYNTHESIZE from some parts of the code
As agreed previously, CC_PROPERTY_XXX and CC_SYNTHESIZE_XXX should
not be used in the code.
This patch removes some of them. There are still many more to remove
2013-07-19 13:16:38 -07:00
boyu0 948acd6e29 Refactor CCTexture2D and CCImage 2013-07-19 15:37:54 +08:00
minggo 7704ab9161 issue #2412:remove platform.cpp/.h 2013-07-19 13:42:45 +08:00
boyu0 76e05ee802 Merge https://github.com/cocos2d/cocos2d-x into 2345 2013-07-18 17:47:43 +08:00
Ricardo Quesada 6e25301b43 more best practices fixes
- Adds more `const` in getters
- Overriden methods have the `override` keyword
- Reorganizes the structure of the class:
  # creators first, then constructor, destructors, init
  # then overridden methods
  # variables at the end
- removes Hungarian notation from parts of the code
2013-07-17 16:56:19 -07:00
boyu0 70140bb4cb refactor CCImage and CCTexture2D 2013-07-17 17:12:04 +08:00
James Chen 510b29a2ff Merge branch 'android-textures-fix' of https://github.com/jotel/cocos2d-x into shared-codes
Conflicts:
	cocos2dx/textures/CCTextureCache.cpp
2013-07-16 16:33:02 +08:00
minggo 6abe6fce78 closed #2393: fix conflicts 2013-07-12 18:04:32 +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
James Chen ad8a3ac1b5 issue #2388: One more static_cast. 2013-07-10 10:08:07 +08:00
Jaroslaw Lewandowski 626ba2686f Solving 'black screen' on android 2013-07-09 21:21:43 +01: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
Ricardo Quesada c65b6f1417 Adds const to more getters
adds `const` to more getters.
2013-07-06 22:01:21 -07:00
Ricardo Quesada 1d011510af setTexParams() is passed as a const reference
All structs (PODs), should be passed as const reference.
eg: Size, Point, ccTexParams, etc... should be passed as const reference.
2013-07-03 17:59:22 -07:00
minggo ca2966745e closed #2305: fix a running time error 2013-06-26 15:11:13 +08:00
minggo 9d44b52ebf issue #2305:use c++11 thread correctly 2013-06-26 14:48:19 +08:00
minggo b434190a70 issue #2305: tab -> 4 spaces 2013-06-21 15:49:45 +08:00
minggo ef7fd16f76 issue #2305: tab -> 4 spaces 2013-06-21 15:43:17 +08:00
minggo 68559dfa00 issue #2305: use c++11 thread instead of pthread in CCTextureCache 2013-06-21 15:29:21 +08:00
James Chen 93b6328303 issue #2129: Removing CC prefix for cocos2dx module. 2013-06-20 14:13:12 +08:00
James Chen 1eadcd8b38 fixed #2301: Merge branch 'emscriptenate' of https://github.com/j4m3z0r/cocos2d-x into j4m3z0r-emscriptenate
Conflicts:
	cocos2dx/proj.emscripten/cocos2dx.mk
2013-06-19 13:03:51 +08:00
James Gregory ad90fe88a8 Merge remote-tracking branch 'origin/master' into emscriptenate 2013-06-17 20:30:36 -07:00
James Chen c0d44cb2e4 fixed #2129: Rename m_iVar to _var, remove CC prefixes. 2013-06-15 14:03:30 +08:00
James Gregory 872be8e964 Initial commit of browser accelerated async image-loading code for Emscripten. 2013-06-12 14:46:32 -07:00
James Gregory cdb63898d9 Simplify AsyncStruct slightly -- make it a class, add a constructor. 2013-06-12 10:03:12 -07:00