Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3_3_new_module

This commit is contained in:
samuele3hu 2014-08-21 15:05:31 +08:00
commit 1ed4c4eab8
57 changed files with 485 additions and 238 deletions

View File

@ -805,6 +805,8 @@ Developers:
Add support of software PVRTC v1 decompression
Fixed a bug that ttf font have not effect on Mac OS X
Fixed a bug that before touchMove Touch::_prevPoint contains junk
Added Device::setKeepScreenOn()
Fixed Label performance problem
youknowone
Adds iOS-like elastic bounceback support for cocos2d::extension::ScrollView
@ -915,6 +917,7 @@ Developers:
Fix a bug that crash happened when try to remove videoView(STATE_PLAYBACK_COMPLETED) in android
Fix video scale issue in iOS
Fix iOS VideoPlayer memory leak
Added c++11 random library support
billtt
Fixed a bug that Node::setScale(float) may not work properly
@ -922,6 +925,7 @@ Developers:
Teivaz
Custom uniform search optimization
Fixed compiling error on WP8.
Added method for custom precompiled shader program loading on WP8
chareice
Make `setup.py` work on zsh
@ -979,6 +983,9 @@ Developers:
zaWasp
Added support for applicationDidEnterBackground / applicationWillEnterForeground on win32
xiangxw
Fixed the bug that Console::sendPrompt() will send extra `\0`
Retired Core Developers:
WenSheng Yang

View File

@ -1,9 +1,11 @@
cocos2d-x-3.3 ??
[NEW] Added submesh support, and support attaching a Sprite3D object to a bone
[NEW] Added UIScale9Sprite
[NEW] Added Camera, AABB, OBB and Ray
[NEW] Added render primitive and render primitive command, support passing point, line and triangle data
[NEW] Added support for applicationDidEnterBackground / applicationWillEnterForeground on desktop
[NEW] Added method for custom precompiled shader program loading on WP8
[NEW] Added c++11 random support
[NEW] Device: added setKeepScreenOn() for iOS and Android
[NEW] EventMouse: support getDelta, getDeltaX, getDeltaY functions
[NEW] FileUtils: add isDirectoryExist(), createDirectory(), removeDirectory(), removeFile(), renameFile()
getFileSize()

View File

@ -1356,6 +1356,10 @@
299754F5193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; };
299754F6193EC95400A54AC3 /* ObjectFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 299754F3193EC95400A54AC3 /* ObjectFactory.h */; };
299754F7193EC95400A54AC3 /* ObjectFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 299754F3193EC95400A54AC3 /* ObjectFactory.h */; };
299CF1FB19A434BC00C378C1 /* ccRandom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299CF1F919A434BC00C378C1 /* ccRandom.cpp */; };
299CF1FC19A434BC00C378C1 /* ccRandom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299CF1F919A434BC00C378C1 /* ccRandom.cpp */; };
299CF1FD19A434BC00C378C1 /* ccRandom.h in Headers */ = {isa = PBXBuildFile; fileRef = 299CF1FA19A434BC00C378C1 /* ccRandom.h */; };
299CF1FE19A434BC00C378C1 /* ccRandom.h in Headers */ = {isa = PBXBuildFile; fileRef = 299CF1FA19A434BC00C378C1 /* ccRandom.h */; };
3E6176681960F89B00DE83F5 /* CCController-iOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E6176551960F89B00DE83F5 /* CCController-iOS.mm */; };
3E6176691960F89B00DE83F5 /* CCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E6176561960F89B00DE83F5 /* CCController.h */; };
3E6176741960F89B00DE83F5 /* CCEventController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E6176611960F89B00DE83F5 /* CCEventController.cpp */; };
@ -2281,6 +2285,8 @@
2986667918B1B079000E39CA /* CCTweenFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTweenFunction.h; sourceTree = "<group>"; };
299754F2193EC95400A54AC3 /* ObjectFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjectFactory.cpp; path = ../base/ObjectFactory.cpp; sourceTree = "<group>"; };
299754F3193EC95400A54AC3 /* ObjectFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjectFactory.h; path = ../base/ObjectFactory.h; sourceTree = "<group>"; };
299CF1F919A434BC00C378C1 /* ccRandom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ccRandom.cpp; path = ../base/ccRandom.cpp; sourceTree = "<group>"; };
299CF1FA19A434BC00C378C1 /* ccRandom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ccRandom.h; path = ../base/ccRandom.h; sourceTree = "<group>"; };
29BDBA52195D597A003225C9 /* UIDeprecated.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIDeprecated.cpp; sourceTree = "<group>"; };
29CB8F4A1929D1BB00C841D6 /* UILayoutManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UILayoutManager.cpp; sourceTree = "<group>"; };
29CB8F4B1929D1BB00C841D6 /* UILayoutManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILayoutManager.h; sourceTree = "<group>"; };
@ -3104,6 +3110,8 @@
1A5700A2180BC5E60088DEC7 /* base */ = {
isa = PBXGroup;
children = (
299CF1F919A434BC00C378C1 /* ccRandom.cpp */,
299CF1FA19A434BC00C378C1 /* ccRandom.h */,
3EA3EDBA1991CDFA00645534 /* CCCamera.cpp */,
3EA3EDBB1991CDFA00645534 /* CCCamera.h */,
464AD6E3197EBB1400E502D8 /* pvr.cpp */,
@ -5385,6 +5393,7 @@
3EA3EDBE1991CDFA00645534 /* CCCamera.h in Headers */,
50ABBE8F1925AB6F00A911A9 /* CCPlatformConfig.h in Headers */,
50ABBE291925AB6F00A911A9 /* CCAutoreleasePool.h in Headers */,
299CF1FD19A434BC00C378C1 /* ccRandom.h in Headers */,
50ABBE471925AB6F00A911A9 /* CCEvent.h in Headers */,
B257B4501989D5E800D9A687 /* CCPrimitive.h in Headers */,
50ABBE6B1925AB6F00A911A9 /* CCEventListenerFocus.h in Headers */,
@ -5899,6 +5908,7 @@
1A01C69718F57BE800EFE3A6 /* CCInteger.h in Headers */,
50ABBEBE1925AB6F00A911A9 /* ccUtils.h in Headers */,
50ABBE801925AB6F00A911A9 /* CCEventTouch.h in Headers */,
299CF1FE19A434BC00C378C1 /* ccRandom.h in Headers */,
50ABBDBC1925AB4100A911A9 /* CCTextureAtlas.h in Headers */,
50ABBE541925AB6F00A911A9 /* CCEventDispatcher.h in Headers */,
1A12775A18DFCC4F0005F345 /* CCTweenFunction.h in Headers */,
@ -6286,6 +6296,7 @@
50ABBEAB1925AB6F00A911A9 /* ccTypes.cpp in Sources */,
1A570069180BC5A10088DEC7 /* CCActionCatmullRom.cpp in Sources */,
B257B44E1989D5E800D9A687 /* CCPrimitive.cpp in Sources */,
299CF1FB19A434BC00C378C1 /* ccRandom.cpp in Sources */,
1A57006D180BC5A10088DEC7 /* CCActionEase.cpp in Sources */,
1A570071180BC5A10088DEC7 /* CCActionGrid.cpp in Sources */,
B37510761823AC9F00B3BA6A /* CCPhysicsJointInfo_chipmunk.cpp in Sources */,
@ -6757,6 +6768,7 @@
1A5701A2180BCB590088DEC7 /* CCFontAtlas.cpp in Sources */,
3E61781D1966A5A300DE83F5 /* CCController.cpp in Sources */,
50ABC00E1926664800A911A9 /* CCFileUtils.cpp in Sources */,
299CF1FC19A434BC00C378C1 /* ccRandom.cpp in Sources */,
50ABBE241925AB6F00A911A9 /* base64.cpp in Sources */,
1A5701A6180BCB590088DEC7 /* CCFontAtlasCache.cpp in Sources */,
1A5701B2180BCB590088DEC7 /* CCFontFNT.cpp in Sources */,

View File

@ -1023,7 +1023,8 @@ void Label::updateFont()
void Label::drawTextSprite(Renderer *renderer, uint32_t parentFlags)
{
if (_fontDefinition._fontFillColor != _textColor)
if (_fontDefinition._fontFillColor.r != _textColor.r || _fontDefinition._fontFillColor.g != _textColor.g
|| _fontDefinition._fontFillColor.b != _textColor.b)
{
updateContent();
}

View File

@ -315,6 +315,7 @@
<ClCompile Include="..\base\atitc.cpp" />
<ClCompile Include="..\base\base64.cpp" />
<ClCompile Include="..\base\CCAutoreleasePool.cpp" />
<ClCompile Include="..\base\CCCamera.cpp" />
<ClCompile Include="..\base\ccCArray.cpp" />
<ClCompile Include="..\base\CCConfiguration.cpp" />
<ClCompile Include="..\base\CCConsole.cpp" />
@ -345,6 +346,7 @@
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="..\base\CCIMEDispatcher.cpp" />
<ClCompile Include="..\base\CCModuleManager.cpp" />
<ClCompile Include="..\base\CCNS.cpp" />
<ClCompile Include="..\base\CCProfiling.cpp" />
<ClCompile Include="..\base\CCRef.cpp" />
@ -423,6 +425,8 @@
<ClCompile Include="..\renderer\ccGLStateCache.cpp" />
<ClCompile Include="..\renderer\CCGroupCommand.cpp" />
<ClCompile Include="..\renderer\CCMeshCommand.cpp" />
<ClCompile Include="..\renderer\CCPrimitive.cpp" />
<ClCompile Include="..\renderer\CCPrimitiveCommand.cpp" />
<ClCompile Include="..\renderer\CCQuadCommand.cpp" />
<ClCompile Include="..\renderer\CCRenderCommand.cpp" />
<ClCompile Include="..\renderer\CCRenderer.cpp" />
@ -430,6 +434,8 @@
<ClCompile Include="..\renderer\CCTexture2D.cpp" />
<ClCompile Include="..\renderer\CCTextureAtlas.cpp" />
<ClCompile Include="..\renderer\CCTextureCache.cpp" />
<ClCompile Include="..\renderer\CCVertexIndexBuffer.cpp" />
<ClCompile Include="..\renderer\CCVertexIndexData.cpp" />
<ClCompile Include="CCAction.cpp" />
<ClCompile Include="CCActionCamera.cpp" />
<ClCompile Include="CCActionCatmullRom.cpp" />
@ -507,6 +513,7 @@
<ClInclude Include="..\base\atitc.h" />
<ClInclude Include="..\base\base64.h" />
<ClInclude Include="..\base\CCAutoreleasePool.h" />
<ClInclude Include="..\base\CCCamera.h" />
<ClInclude Include="..\base\ccCArray.h" />
<ClInclude Include="..\base\ccConfig.h" />
<ClInclude Include="..\base\CCConfiguration.h" />
@ -535,6 +542,7 @@
<ClInclude Include="..\base\CCIMEDispatcher.h" />
<ClInclude Include="..\base\ccMacros.h" />
<ClInclude Include="..\base\CCMap.h" />
<ClInclude Include="..\base\CCModuleManager.h" />
<ClInclude Include="..\base\CCNS.h" />
<ClInclude Include="..\base\CCPlatformConfig.h" />
<ClInclude Include="..\base\CCPlatformMacros.h" />
@ -627,6 +635,8 @@
<ClInclude Include="..\renderer\ccGLStateCache.h" />
<ClInclude Include="..\renderer\CCGroupCommand.h" />
<ClInclude Include="..\renderer\CCMeshCommand.h" />
<ClInclude Include="..\renderer\CCPrimitive.h" />
<ClInclude Include="..\renderer\CCPrimitiveCommand.h" />
<ClInclude Include="..\renderer\CCQuadCommand.h" />
<ClInclude Include="..\renderer\CCRenderCommand.h" />
<ClInclude Include="..\renderer\CCRenderCommandPool.h" />
@ -635,6 +645,8 @@
<ClInclude Include="..\renderer\CCTexture2D.h" />
<ClInclude Include="..\renderer\CCTextureAtlas.h" />
<ClInclude Include="..\renderer\CCTextureCache.h" />
<ClInclude Include="..\renderer\CCVertexIndexBuffer.h" />
<ClInclude Include="..\renderer\CCVertexIndexData.h" />
<ClInclude Include="CCAction.h" />
<ClInclude Include="CCActionCamera.h" />
<ClInclude Include="CCActionCatmullRom.h" />

View File

@ -581,6 +581,24 @@
<ClCompile Include="..\base\pvr.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\base\CCCamera.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\base\CCModuleManager.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCPrimitiveCommand.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCPrimitive.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCVertexIndexBuffer.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCVertexIndexData.cpp">
<Filter>renderer</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\cocos2d.h" />
@ -1188,6 +1206,24 @@
<ClInclude Include="..\base\pvr.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\base\CCCamera.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\base\CCModuleManager.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCPrimitiveCommand.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCPrimitive.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCVertexIndexBuffer.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCVertexIndexData.h">
<Filter>renderer</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\base\CCUserDefault.mm">

View File

@ -222,6 +222,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\3d\CCAABB.cpp" />
<ClCompile Include="..\3d\CCAnimate3D.cpp" />
<ClCompile Include="..\3d\CCAnimation3D.cpp" />
<ClCompile Include="..\3d\CCAttachNode.cpp" />
@ -229,7 +230,9 @@
<ClCompile Include="..\3d\CCBundleReader.cpp" />
<ClCompile Include="..\3d\CCMesh.cpp" />
<ClCompile Include="..\3d\CCMeshSkin.cpp" />
<ClCompile Include="..\3d\CCOBB.cpp" />
<ClCompile Include="..\3d\CCObjLoader.cpp" />
<ClCompile Include="..\3d\CCRay.cpp" />
<ClCompile Include="..\3d\CCSkeleton3D.cpp" />
<ClCompile Include="..\3d\CCSprite3D.cpp" />
<ClCompile Include="..\3d\CCSprite3DMaterial.cpp" />
@ -280,6 +283,7 @@
<ClCompile Include="..\base\CCModuleManager.cpp" />
<ClCompile Include="..\base\CCNS.cpp" />
<ClCompile Include="..\base\CCProfiling.cpp" />
<ClCompile Include="..\base\ccRandom.cpp" />
<ClCompile Include="..\base\CCRef.cpp" />
<ClCompile Include="..\base\CCScheduler.cpp" />
<ClCompile Include="..\base\CCScriptSupport.cpp" />
@ -442,6 +446,7 @@
<ClInclude Include="..\..\external\unzip\ioapi.h" />
<ClInclude Include="..\..\external\unzip\unzip.h" />
<ClInclude Include="..\..\external\xxhash\xxhash.h" />
<ClInclude Include="..\3d\CCAABB.h" />
<ClInclude Include="..\3d\CCAnimate3D.h" />
<ClInclude Include="..\3d\CCAnimation3D.h" />
<ClInclude Include="..\3d\CCAnimationCurve.h" />
@ -451,7 +456,9 @@
<ClInclude Include="..\3d\CCBundleReader.h" />
<ClInclude Include="..\3d\CCMesh.h" />
<ClInclude Include="..\3d\CCMeshSkin.h" />
<ClInclude Include="..\3d\CCOBB.h" />
<ClInclude Include="..\3d\CCObjLoader.h" />
<ClInclude Include="..\3d\CCRay.h" />
<ClInclude Include="..\3d\CCSkeleton3D.h" />
<ClInclude Include="..\3d\CCSprite3D.h" />
<ClInclude Include="..\3d\CCSprite3DMaterial.h" />
@ -495,6 +502,7 @@
<ClInclude Include="..\base\CCPlatformMacros.h" />
<ClInclude Include="..\base\CCProfiling.h" />
<ClInclude Include="..\base\CCProtocols.h" />
<ClInclude Include="..\base\ccRandom.h" />
<ClInclude Include="..\base\CCRef.h" />
<ClInclude Include="..\base\CCRefPtr.h" />
<ClInclude Include="..\base\CCScheduler.h" />

View File

@ -650,6 +650,18 @@
<ClCompile Include="..\base\CCModuleManager.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\base\ccRandom.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\3d\CCAABB.cpp">
<Filter>3d</Filter>
</ClCompile>
<ClCompile Include="..\3d\CCOBB.cpp">
<Filter>3d</Filter>
</ClCompile>
<ClCompile Include="..\3d\CCRay.cpp">
<Filter>3d</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h">
@ -1328,6 +1340,18 @@
<ClInclude Include="..\base\CCModuleManager.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\base\ccRandom.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\3d\CCAABB.h">
<Filter>3d</Filter>
</ClInclude>
<ClInclude Include="..\3d\CCOBB.h">
<Filter>3d</Filter>
</ClInclude>
<ClInclude Include="..\3d\CCRay.h">
<Filter>3d</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\math\Mat4.inl">

View File

@ -213,6 +213,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<ClCompile Include="..\base\CCModuleManager.cpp" />
<ClCompile Include="..\base\CCNS.cpp" />
<ClCompile Include="..\base\CCProfiling.cpp" />
<ClCompile Include="..\base\ccRandom.cpp" />
<ClCompile Include="..\base\CCRef.cpp" />
<ClCompile Include="..\base\CCScheduler.cpp" />
<ClCompile Include="..\base\CCScriptSupport.cpp" />
@ -399,6 +400,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<ClInclude Include="..\base\CCPlatformMacros.h" />
<ClInclude Include="..\base\CCProfiling.h" />
<ClInclude Include="..\base\CCProtocols.h" />
<ClInclude Include="..\base\ccRandom.h" />
<ClInclude Include="..\base\CCRef.h" />
<ClInclude Include="..\base\CCRefPtr.h" />
<ClInclude Include="..\base\CCScheduler.h" />

View File

@ -586,6 +586,9 @@
<ClCompile Include="..\base\CCModuleManager.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\base\ccRandom.cpp">
<Filter>base</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h">
@ -1189,6 +1192,9 @@
<ClInclude Include="..\base\CCModuleManager.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\base\ccRandom.h">
<Filter>base</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\math\Mat4.inl">

View File

@ -117,6 +117,7 @@ base/CCIMEDispatcher.cpp \
base/CCModuleManager.cpp \
base/CCNS.cpp \
base/CCProfiling.cpp \
base/ccRandom.cpp \
base/CCRef.cpp \
base/CCScheduler.cpp \
base/CCScriptSupport.cpp \
@ -210,10 +211,10 @@ LOCAL_EXPORT_LDLIBS := -lGLESv2 \
-lz \
-landroid
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_freetype2_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dxandroid_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_png_static
LOCAL_STATIC_LIBRARIES := cocos_freetype2_static
LOCAL_STATIC_LIBRARIES += chipmunk_static
LOCAL_STATIC_LIBRARIES += cocos_png_static
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dxandroid_static
# define the macro to compile through support/zip_support/ioapi.c
LOCAL_CFLAGS := -DUSE_FILE32API

View File

@ -131,7 +131,7 @@ static ssize_t mydprintf(int sock, const char *format, ...)
static void sendPrompt(int fd)
{
const char prompt[] = "> ";
send(fd, prompt, sizeof(prompt),0);
send(fd, prompt, strlen(prompt),0);
}
static int printSceneGraph(int fd, Node* node, int level)

View File

@ -25,6 +25,7 @@ set(COCOS_BASE_SRC
base/CCModuleManager.cpp
base/CCNS.cpp
base/CCProfiling.cpp
base/ccRandom.cpp
base/CCRef.cpp
base/CCScheduler.cpp
base/CCScriptSupport.cpp

View File

@ -69,16 +69,17 @@ simple macro that swaps 2 variables
x = y; y = temp; \
}
#include "base/ccRandom.h"
/** @def CCRANDOM_MINUS1_1
returns a random float between -1 and 1
*/
#define CCRANDOM_MINUS1_1() ((2.0f*((float)rand()/RAND_MAX))-1.0f)
#define CCRANDOM_MINUS1_1() cocos2d::rand_minus1_1()
/** @def CCRANDOM_0_1
returns a random float between 0 and 1
*/
#define CCRANDOM_0_1() ((float)rand()/RAND_MAX)
#define CCRANDOM_0_1() cocos2d::rand_0_1()
/** @def CC_DEGREES_TO_RADIANS
converts degrees to radians

32
cocos/base/ccRandom.cpp Normal file
View File

@ -0,0 +1,32 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "ccRandom.h"
std::mt19937 &cocos2d::RandomHelper::getEngine() {
static std::random_device seed_gen;
static std::mt19937 engine(seed_gen());
return engine;
}

99
cocos/base/ccRandom.h Normal file
View File

@ -0,0 +1,99 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __ccRandom_H_
#define __ccRandom_H_
#include "base/CCPlatformMacros.h"
#include <random>
NS_CC_BEGIN
class CC_DLL RandomHelper {
public:
template<typename T>
static inline T random_real(T min, T max) {
std::uniform_real_distribution<T> dist(min, max);
auto &mt = RandomHelper::getEngine();
return dist(mt);
}
template<typename T>
static inline T random_int(T min, T max) {
std::uniform_int_distribution<> dist(min, max);
auto &mt = RandomHelper::getEngine();
return dist(mt);
}
private:
static std::mt19937 &getEngine();
};
/**
* returns a random value between `min` and `max`
*/
template<typename T>
inline T random(T min, T max) {
return RandomHelper::random_int(min, max);
}
template<>
inline float random(float min, float max) {
return RandomHelper::random_real(min, max);
}
template<>
inline long double random(long double min, long double max) {
return RandomHelper::random_real(min, max);
}
template<>
inline double random(double min, double max) {
return RandomHelper::random_real(min, max);
}
/**
* returns a random int between 0 and RAND_MAX
*/
inline int random() {
return cocos2d::random(0, RAND_MAX);
};
/**
* returns a random float between -1 and 1
*/
inline float rand_minus1_1() {
return cocos2d::random(-1.f, 1.f);
};
/**
* returns a random float between 0 and 1
*/
inline float rand_0_1() {
return cocos2d::random(0.f, 1.f);
};
NS_CC_END
#endif //__ccRandom_H_

View File

@ -348,6 +348,11 @@ struct CC_DLL BlendFunc
return src == a.src && dst == a.dst;
}
bool operator!=(const BlendFunc &a) const
{
return src != a.src || dst != a.dst;
}
bool operator<(const BlendFunc &a) const
{
return src < a.src || (src == a.src && dst < a.dst);

View File

@ -31,7 +31,7 @@ NS_CC_BEGIN
CC_DLL const char* cocos2dVersion()
{
return "cocos2d-x 3.2";
return "cocos2d-x 3.3";
}
NS_CC_END

View File

@ -29,8 +29,8 @@ THE SOFTWARE.
#define __COCOS2D_H__
// 0x00 HI ME LO
// 00 03 02 00
#define COCOS2D_VERSION 0x00030200
// 00 03 03 00
#define COCOS2D_VERSION 0x00030300
//
// all cocos2d include files
@ -154,6 +154,10 @@ THE SOFTWARE.
#include "renderer/ccShaders.h"
#include "renderer/CCTexture2D.h"
#include "renderer/CCTextureCache.h"
#include "renderer/CCVertexIndexBuffer.h"
#include "renderer/CCVertexIndexData.h"
#include "renderer/CCPrimitive.h"
#include "renderer/CCPrimitiveCommand.h"
// physics
#include "physics/CCPhysicsBody.h"

View File

@ -36,7 +36,7 @@ $(LOCAL_PATH) \
$(LOCAL_PATH)/../../..
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_extension_static
LOCAL_STATIC_LIBRARIES := cocos_extension_static
include $(BUILD_STATIC_LIBRARY)

View File

@ -516,9 +516,6 @@ void ColorFrame::onEnter(Frame *nextFrame)
_betweenGreen = color.g - _color.g;
_betweenBlue = color.b - _color.b;
}
_node->setCascadeColorEnabled(true);
_node->setCascadeOpacityEnabled(true);
}
void ColorFrame::apply(float percent)

View File

@ -71,8 +71,8 @@ $(LOCAL_PATH)/../..
LOCAL_CFLAGS += -fexceptions
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_ui_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_STATIC_LIBRARIES := cocos_ui_static
LOCAL_STATIC_LIBRARIES += cocosdenshion_static
include $(BUILD_STATIC_LIBRARY)

View File

@ -36,7 +36,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/..
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../.. \
$(LOCAL_PATH)/..
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_STATIC_LIBRARIES := cocos2dx_static
include $(BUILD_STATIC_LIBRARY)

View File

@ -16,9 +16,9 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../.. \
$(LOCAL_PATH)/..
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_curl_static
LOCAL_WHOLE_STATIC_LIBRARIES += libwebsockets_static
LOCAL_STATIC_LIBRARIES := cocos2dx_static
LOCAL_STATIC_LIBRARIES += cocos_curl_static
LOCAL_STATIC_LIBRARIES += libwebsockets_static
include $(BUILD_STATIC_LIBRARY)

View File

@ -65,6 +65,8 @@ public:
static void setAccelerometerInterval(float interval);
static Data getTextureDataForText(const char * text, const FontDefinition& textDefinition, TextAlign align, int &width, int &height, bool& hasPremultipliedAlpha);
static void setKeepScreenOn(bool value);
private:
CC_DISALLOW_IMPLICIT_CONSTRUCTORS(Device);

View File

@ -202,6 +202,12 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
return ret;
}
void Device::setKeepScreenOn(bool value)
{
setKeepScreenOnJni(value);
}
NS_CC_END
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID

View File

@ -34,6 +34,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.util.Log;
import android.widget.FrameLayout;
import android.preference.PreferenceManager.OnActivityResultListener;
@ -58,6 +59,16 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
return sContext;
}
public void setKeepScreenOn(boolean value) {
final boolean newValue = value;
runOnUiThread(new Runnable() {
@Override
public void run() {
mGLSurfaceView.setKeepScreenOn(newValue);
}
});
}
protected void onLoadNativeLibraries() {
try {
ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);

View File

@ -167,6 +167,10 @@ public class Cocos2dxHelper {
Cocos2dxHelper.sAccelerometerEnabled = false;
Cocos2dxHelper.sCocos2dxAccelerometer.disable();
}
public static void setKeepScreenOn(boolean value) {
((Cocos2dxActivity)sActivity).setKeepScreenOn(value);
}
public static void preloadBackgroundMusic(final String pPath) {
Cocos2dxHelper.sCocos2dMusic.preloadBackgroundMusic(pPath);

View File

@ -209,6 +209,16 @@ void disableAccelerometerJni() {
}
}
void setKeepScreenOnJni(bool value) {
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setKeepScreenOn", "(Z)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, value);
t.env->DeleteLocalRef(t.classID);
}
}
// functions for UserDefault
bool getBoolForKeyJNI(const char* key, bool defaultValue)
{

View File

@ -39,6 +39,7 @@ extern std::string getFileDirectoryJNI();
extern void enableAccelerometerJni();
extern void disableAccelerometerJni();
extern void setAccelerometerIntervalJni(float interval);
extern void setKeepScreenOnJni(bool value);
// functions for UserDefault
extern bool getBoolForKeyJNI(const char* key, bool defaultValue);
extern int getIntegerForKeyJNI(const char* key, int defaultValue);

View File

@ -477,6 +477,11 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
return ret;
}
void Device::setKeepScreenOn(bool value)
{
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
}
NS_CC_END
#endif // CC_PLATFORM_IOS

View File

@ -499,6 +499,10 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
return ret;
}
void Device::setKeepScreenOn(bool value)
{
}
NS_CC_END
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_LINUX

View File

@ -247,6 +247,11 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
return ret;
}
void Device::setKeepScreenOn(bool value)
{
}
NS_CC_END
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_MAC

View File

@ -451,6 +451,10 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
return ret;
}
void Device::setKeepScreenOn(bool value)
{
}
NS_CC_END
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WIN32

View File

@ -163,6 +163,10 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
return ret;
}
void Device::setKeepScreenOn(bool value)
{
}
NS_CC_END
#endif // (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)

View File

@ -53,7 +53,7 @@ static void _checkPath()
if (s_pszResourcePath.empty())
{
// TODO: needs to be tested
s_pszResourcePath = convertPathFormatToUnixStyle(CCFileUtilsWinRT::getAppPath() + '\\' + "Assets\\Resources" + '\\');
s_pszResourcePath = convertPathFormatToUnixStyle(CCFileUtilsWinRT::getAppPath() + '\\' + "Assets\\res" + '\\');
}
}

View File

@ -135,6 +135,25 @@ void CCPrecompiledShaders::loadPrecompiledPrograms()
#endif
}
void CCPrecompiledShaders::addPrecompiledProgram(const char* key, const unsigned char* program, int programLength)
{
std::string id = key;
PrecompiledProgram* p = nullptr;
auto it = m_precompiledPrograms.find(id);
if (it != m_precompiledPrograms.end())
{
p = it->second;
}
else
{
p = new PrecompiledProgram();
m_precompiledPrograms[id] = p;
}
p->key = key;
p->program = program;
p->length = programLength;
}
bool CCPrecompiledShaders::loadProgram(GLuint program, const GLchar* vShaderByteArray, const GLchar* fShaderByteArray)
{
std::string id = computeHash(vShaderByteArray, fShaderByteArray);

View File

@ -70,6 +70,7 @@ public:
*/
static CCPrecompiledShaders* getInstance();
void addPrecompiledProgram(const char* key, const unsigned char* program, int programLength);
std::string addShaders(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray);
bool addProgram(GLuint program, const std::string& id);

View File

@ -55,8 +55,8 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../external/lua/tolua \
$(LOCAL_PATH)/../manual/cocos2d
LOCAL_WHOLE_STATIC_LIBRARIES := luajit_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_STATIC_LIBRARIES := luajit_static
LOCAL_STATIC_LIBRARIES += cocos2dx_static
include $(BUILD_STATIC_LIBRARY)
@ -76,8 +76,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../auto \
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../manual/3d
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos3d_static
LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_STATIC_LIBRARIES += cocos3d_static
include $(BUILD_STATIC_LIBRARY)
@ -97,8 +97,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../auto \
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../manual/cocosdenshion
LOCAL_WHOLE_STATIC_LIBRARIES := cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2d_lua_static
LOCAL_STATIC_LIBRARIES := cocosdenshion_static
LOCAL_STATIC_LIBRARIES += cocos2d_lua_static
include $(BUILD_STATIC_LIBRARY)
@ -134,8 +134,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../manual/network \
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../manual/network
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static
LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_STATIC_LIBRARIES += cocos_network_static
include $(BUILD_STATIC_LIBRARY)
@ -156,8 +156,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../manual/cocosbuilder \
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../manual/cocosbuilder
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosbuilder_static
LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_STATIC_LIBRARIES += cocosbuilder_static
include $(BUILD_STATIC_LIBRARY)
@ -179,8 +179,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../manual/cocostudio \
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../manual/cocostudio
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static
LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_STATIC_LIBRARIES += cocostudio_static
include $(BUILD_STATIC_LIBRARY)
@ -201,8 +201,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../manual/spine \
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../manual/spine
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += spine_static
LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_STATIC_LIBRARIES += spine_static
include $(BUILD_STATIC_LIBRARY)
@ -223,8 +223,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../manual/extension \
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../manual/extension
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_STATIC_LIBRARIES += cocos_extension_static
include $(BUILD_STATIC_LIBRARY)
@ -246,8 +246,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../manual/ui \
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../manual/ui
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_ui_static
LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_STATIC_LIBRARIES += cocos_ui_static
include $(BUILD_STATIC_LIBRARY)

View File

@ -17,7 +17,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../..
LOCAL_CFLAGS += -Wno-psabi
LOCAL_EXPORT_CFLAGS += -Wno-psabi
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_STATIC_LIBRARIES := cocos2dx_static
include $(BUILD_STATIC_LIBRARY)

View File

@ -42,8 +42,8 @@ $(LOCAL_PATH)/../.. \
$(LOCAL_PATH)/../editor-support
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
LOCAL_STATIC_LIBRARIES := cocos2dx_static
LOCAL_STATIC_LIBRARIES += cocos_extension_static
include $(BUILD_STATIC_LIBRARY)

View File

@ -533,6 +533,7 @@ void PageView::interceptTouchEvent(TouchEventType event, Widget *sender, Touch *
{
case TouchEventType::BEGAN:
{
_touchBeganPosition = touch->getLocation();
_isInterceptTouch = true;
}
break;
@ -540,6 +541,7 @@ void PageView::interceptTouchEvent(TouchEventType event, Widget *sender, Touch *
{
float offset = 0;
offset = fabs(sender->getTouchBeganPosition().x - touchPoint.x);
_touchMovePosition = touch->getLocation();
if (offset > _childFocusCancelOffset)
{
sender->setHighlighted(false);
@ -550,6 +552,7 @@ void PageView::interceptTouchEvent(TouchEventType event, Widget *sender, Touch *
case TouchEventType::CANCELED:
case TouchEventType::ENDED:
{
_touchEndPosition = touch->getLocation();
handleReleaseLogic(touch);
if (sender->isSwallowTouches())
{

View File

@ -1573,10 +1573,10 @@ void ScrollView::interceptTouchEvent(Widget::TouchEventType event, Widget *sende
case TouchEventType::MOVED:
{
float offset = (sender->getTouchBeganPosition() - touchPoint).getLength();
_touchMovePosition = touch->getLocation();
if (offset > _childFocusCancelOffset)
{
sender->setHighlighted(false);
_touchMovePosition = touch->getLocation();
handleMoveLogic(touch);
}
}

View File

@ -1,4 +1,4 @@
# cocos2d-x v3.2 Release Notes #
# cocos2d-x v3.3alpha0 Release Notes #
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
@ -28,9 +28,7 @@
# Misc Information
* Download: http://cdn.cocos2d-x.org/cocos2d-x-3.2.zip
* Full Changelog: https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.2/CHANGELOG
* API Reference: http://www.cocos2d-x.org/reference/native-cpp/V3.2/index.html
* Full Changelog: https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.3alpha0/CHANGELOG
* v3.0 Release Notes can be found here: [v3.0 Release Notes](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.0/docs/RELEASE_NOTES.md)
# Requirements
@ -49,7 +47,7 @@
* Xcode 5.1 or newer for iOS or Mac
* gcc 4.9 or newer for Linux
* ndk-r9d or newer for Android
* ndk-r9d for Android
* Visual Studio 2012 or newer for Windows (win32)
* Visual Studio 2012 or newer for Windows Phone 8
@ -117,179 +115,77 @@ Run
Please refer to this document: [ReadMe](../README.md)
# Highlights of v3.2
# Highlights of v3.3alpha0
* `Animation3D`/`Animate3D`, new nodes for 3d animation
* `fbx-conv` supports generating binary format which is supported by `Sprite3D`
* Game controller support
* Fast tilemap support
* Added `utils::cpatureScreen` to take screenshot
* Physics body supports scale and rotation
* Added `Node::enumerateChildren` and `utils::findChildren`, and support c++ 11 regular expression
* Added `Node::setNormalizedPosition`, `Node`'s position in pixel will be calculated according its parent's content size
# Documents
* [Sprite3D & Animation3D](http://cocos2d-x.org/wiki/Sprite3D)
* [Game controller](http://www.cocos2d-x.org/wiki/Game_Controller)
* [How to compile shader on WP8](http://cocos2d-x.org/wiki/How_to_update_wp8_shader)
# Toolchain requirement changed
`Node::enumerateChildren()` uses `std::regex` which will cause crash using gcc v4.8 or lower version.
Because `OTHER_LDFLAGS` can not work in Xcode6 beta3. So we used fat library(including 64-bit libaries) on iOS. But Xcode 5.0 or lower version has building problem by this way.
So
* NDK r9d or newer version is required for Android building
* gcc 4.9 is required for linux building
* Xcode 5.1 or newer is required on iOS
# atof issue on Android
We found a bug of `atof` on Android when using libc++. The bug is that, the return value of `atof` may be `-inf` when passing some valid digit string.
For example
```c++
atof("90.099998474121094"); // -> return value is -inf
```
We have reported it to google guys, and they confirmed that it is a bug. In order to work around this issue, we added `utils::atof()`.
The corresponding pull request for this issue is [here](https://github.com/cocos2d/cocos2d-x/pull/7440). You can refer to this pull request for demail information.
* 3d: `Camera`, `AABB`, `OBB` and `Ray`
* ui: added `Scale9Sprite`
* FileUitls: added `isDirectoryExist()`, `createDirectory()`, `removeDirectory()`, `removeFile()`, `renameFile()` and `getFileSize()`
* Device: added `setKeepScreenOn()` on iOS and Android
* Added c++11 random support
* RenderTexture: added a call back function for `saveToFile()`
* SpriteFrameCache: support loading from plist file content data
* Many other small features added and many bugs fixed
# Features in detail
## Sprite3D & Animation3D
## Camera
This version of camera is powerful then previous one. And you can add it as a child anywhere. If you want to let a Node to be visited by a camera, Node's camera mask should include Camera's flag:
Sample code to use binary version
```c++
auto sprite3d = Sprite3D::create("filename.c3b");
addChild(sprite3d);
auto animation3d = Animation3D("filename.c3b");
auto animate3d = Animate3D::create(animation3d);
sprite3d->runAction(RepeatForEver::create(animate));
// let sprite to be visited by a camera
auto sprite = Sprite::create("myFile.png");
sprite->setCameraMask(CameraFlag::USER1);
auto camera = Camera::createPerspective(60, winSize.width/winSize.height, 1, 1000);
camera->setCameraFlag(CameraFlag::USER1);
scene->addChild(camera);
```
Detail information please refer to [Sprite3D & Animation3D](http://cocos2d-x.org/wiki/Sprite3D).
If you have many Nodes that want to be visited by a camera, there is a convenient way:
### `fbx-conv` usage
* Mac OS X
```
$ cd COCOS2DX_ROOT/tools/fbx-conv/mac
$ ./fbx-conv [-a|-b|-t] FBXFile
```
* Windows
```
cd COCOS2DX_ROOT/tools/fbx-conv/windows
fbx-conv [-a|-b|-t] FBXFile
```
Options:
* -a: export both text and binary format
* -b: export binary format
* -t: export text format
## Game controller
Supported controller type:
* Android standard controllers
* Amazon tv
* OUYA
* Moga
* Nibiru
* iOS standard controllers
Sample codes
```c++
// register event listener
auto listener = EventListenerController::create();
listner->onKeyDown = ...
auto layer = Layer::create();
auto sprite1 = Sprite::create();
auto sprite2 = Sprite::create();
layer->addChild(sprite1);
layer->addChild(sprite2);
// it will set camera mask for all its children
layer->setCameraMask(CameraFlg::USER1);
auto camera = Camera::createPerspective();
camera->setCameraFlag(CameraFlag::USER1);
scene->addChild(camera);
```
Full test case please refer to `tests/cpp-tests/res/Camera3DTest/Camera3DTest.cpp`.
## AABB, OBB and Ray
TBD
## ui::Scale9Sprite
TBD
## c++11 random support
Since `rand()` is not good(refer to [this document](http://c-faq.com/lib/randrange.html)), we use c++11 random library to do generate random number, and provide a function to easily using:
```c++
int randInt = cocos2d::random(1, 10);
float randFloat = cocos2d::random(1.f, 10.f);
```
## RenderTexture save function
`RenderTexture::saveToFile()` will not save rendertexture when the function returns, because it just send render command to renderer. The file will be saved after render command is executed. It is not convenient if you want to use the saved file to do some work. So we added a parameter in `RenderTexture::saveToFile()` to set a call back function when the file is saved.
```c++
renderTexture->begin();
...
eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
renderTexture->end();
// start connecting controller
Controller::startDiscoveryController();
renderTexture->saveToFile("myFile.png", true, callback);
// handler key down/ key up event
void GameControllerTest::onKeyDown(Controller *controller, int keyCode, Event *event)
{
switch (keyCode)
{
case Controller::Key::BUTTON_A:
...
break;
...
}
}
```
Detail information please refer to [Game controller](http://www.cocos2d-x.org/wiki/Game_Controller).
## Fast tilemap
Fast tilemap has the same API as `TMXTiledMap` without deprecated functions.
Sample code
```c++
auto tilemap = cocos2d::experimental::TMXTiledMap::create("MyFile.tmx");
addChild(tilemap);
```
Full demo please refer to `COCOS2DX_ROOT/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp`.
## Node::enumerateChildren
This functions is used to enumerate children of a `Node`. It supports c++ 11 regular expression.
```c++
// Find nodes whose name is 'nameToFind' and end with digits.
node->enumerateChildren("nameToFind[[:digit:]]+", [](Node* node) -> bool {
...
return false; // return true to stop at first match
});
// Find nodes whose name is 'nameToFind' and end with digits recursively.
node->enumerateChildren("nameToFind[[:digit:]]+", [](Node* node) -> bool {
...
return false; // return true to stop at first match
});
```
Full test please refer to `NodeNameTest` in `COCOS2DX_ROOT/tests/cpp-tests/NodeTest/NodeTest.cpp`.
Because this function uses `std::regex` which is not supported well in gcc 4.8 or lower version. So we use `clang` and `stdc++` instead for Android building. This lead to the result that `NDK r9d` or newer is required. And `gcc 4.9` is required on linux.
## utils::findChildren
This is a helper function to find children of a `Node` share a name. The implementation of this function bases on `Node::enumerateChildren`.
```c++
auto children = utils::findChildren(node, "nameToFind");
...
```
## Node::setNormalizedPosition
Can use this function to set Node's position(x,y) using value between 0 and 1. `Can use this function when it has a parent node.` The positions in pixels is calculated like the following:
```c++
// pseudo code
void setNormalizedPosition(Vec2 pos)
{
Size s = getParent()->getContentSize();
_position = pos * s;
}
```
Full test please refer to `NodeNormalizedPositionTest1/2` in `tests/cpp-tests/Classes/NodeTest/NodeTest.cpp`.

View File

@ -393,6 +393,8 @@
"cocos/base/ccFPSImages.c",
"cocos/base/ccFPSImages.h",
"cocos/base/ccMacros.h",
"cocos/base/ccRandom.cpp",
"cocos/base/ccRandom.h",
"cocos/base/ccTypes.cpp",
"cocos/base/ccTypes.h",
"cocos/base/ccUTF8.cpp",

View File

@ -27,6 +27,7 @@
"proj.win32/PROJECT_NAME.sln",
"proj.win32/main.cpp",
"proj.wp8-xaml/App/PROJECT_NAME.csproj",
"proj.wp8-xaml/App/Properties/WMAppManifest.xml",
"proj.wp8-xaml/PROJECT_NAME.sln",
"proj.android/.project",
"proj.android/.cproject",

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2012/deployment" AppPlatformVersion="8.0">
<DefaultLanguage xmlns="" code="en-US" />
<App xmlns="" ProductID="{83cc88fe-7e79-4e1e-a129-742987130b5c}" Title="PhoneDirect3DXamlAppInterop" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="PhoneDirect3DXamlAppInterop author" Description="Sample description" Publisher="PhoneDirect3DXamlAppInterop" PublisherID="{ebf6c0e1-80a3-41f1-8553-4aaab70da912}">
<App xmlns="" ProductID="{83cc88fe-7e79-4e1e-a129-742987130b5c}" Title="HelloCpp" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="PhoneDirect3DXamlAppInterop author" Description="Sample description" Publisher="PhoneDirect3DXamlAppInterop" PublisherID="{ebf6c0e1-80a3-41f1-8553-4aaab70da912}">
<IconPath IsRelative="true" IsResource="false">Assets\ApplicationIcon.png</IconPath>
<Capabilities>
<Capability Name="ID_CAP_NETWORKING"/>

View File

@ -12,7 +12,7 @@ LOCAL_SRC_FILES := main.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static
LOCAL_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static
include $(BUILD_SHARED_LIBRARY)

View File

@ -188,14 +188,14 @@ Classes/ZwoptexTest/ZwoptexTest.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/Classes
LOCAL_WHOLE_STATIC_LIBRARIES := cocosbuilder_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += spine_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos3d_static
LOCAL_STATIC_LIBRARIES := cocosbuilder_static
LOCAL_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_STATIC_LIBRARIES += spine_static
LOCAL_STATIC_LIBRARIES += cocostudio_static
LOCAL_STATIC_LIBRARIES += cocos_network_static
LOCAL_STATIC_LIBRARIES += cocos_extension_static
LOCAL_STATIC_LIBRARIES += box2d_static
LOCAL_STATIC_LIBRARIES += cocos3d_static
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/Classes

View File

@ -10,7 +10,7 @@ LOCAL_SRC_FILES := main.cpp
LOCAL_C_INCLUDES := ../../Classes
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_cpp_tests_common
LOCAL_STATIC_LIBRARIES := cocos_cpp_tests_common
include $(BUILD_SHARED_LIBRARY)

View File

@ -185,6 +185,7 @@
<ClCompile Include="..\..\..\..\cocos\platform\wp8-xaml\cpp\EditBoxEvent.cpp" />
<ClCompile Include="..\..\Classes\BaseTest.cpp" />
<ClCompile Include="..\..\Classes\BugsTest\Bug-Child.cpp" />
<ClCompile Include="..\..\Classes\Camera3DTest\Camera3DTest.cpp" />
<ClCompile Include="..\..\Classes\ChipmunkTest\ChipmunkTest.cpp" />
<ClCompile Include="..\..\Classes\ClippingNodeTest\ClippingNodeTest.cpp" />
<ClCompile Include="..\..\Classes\ConfigurationTest\ConfigurationTest.cpp" />
@ -228,6 +229,7 @@
<ClCompile Include="..\..\Classes\ReleasePoolTest\ReleasePoolTest.cpp" />
<ClCompile Include="..\..\Classes\ShaderTest\ShaderTest2.cpp" />
<ClCompile Include="..\..\Classes\SpineTest\SpineTest.cpp" />
<ClCompile Include="..\..\Classes\Sprite3DTest\DrawNode3D.cpp" />
<ClCompile Include="..\..\Classes\Sprite3DTest\Sprite3DTest.cpp" />
<ClCompile Include="..\..\Classes\TexturePackerEncryptionTest\TextureAtlasEncryptionTest.cpp" />
<ClCompile Include="..\..\Classes\TileMapTest\TileMapTest2.cpp" />
@ -383,6 +385,7 @@
<ClInclude Include="..\..\Classes\Box2DTestBed\Tests\MobileBalanced.h" />
<ClInclude Include="..\..\Classes\Box2DTestBed\Tests\MotorJoint.h" />
<ClInclude Include="..\..\Classes\BugsTest\Bug-Child.h" />
<ClInclude Include="..\..\Classes\Camera3DTest\Camera3DTest.h" />
<ClInclude Include="..\..\Classes\ChipmunkTest\ChipmunkTest.h" />
<ClInclude Include="..\..\Classes\ClippingNodeTest\ClippingNodeTest.h" />
<ClInclude Include="..\..\Classes\ConfigurationTest\ConfigurationTest.h" />
@ -429,6 +432,7 @@
<ClInclude Include="..\..\Classes\ReleasePoolTest\ReleasePoolTest.h" />
<ClInclude Include="..\..\Classes\ShaderTest\ShaderTest2.h" />
<ClInclude Include="..\..\Classes\SpineTest\SpineTest.h" />
<ClInclude Include="..\..\Classes\Sprite3DTest\DrawNode3D.h" />
<ClInclude Include="..\..\Classes\Sprite3DTest\Sprite3DTest.h" />
<ClInclude Include="..\..\Classes\TexturePackerEncryptionTest\TextureAtlasEncryptionTest.h" />
<ClInclude Include="..\..\Classes\TileMapTest\TileMapTest2.h" />

View File

@ -325,6 +325,9 @@
<Filter Include="Classes\ExtensionsTest\CocoStudioActionTimelineTest">
<UniqueIdentifier>{dff38415-43e7-4aff-98ec-c6094899d142}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\Camera3DTest">
<UniqueIdentifier>{d17dc00f-2b4d-46af-a1ff-c3f4d937d621}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\Classes\AppDelegate.cpp">
@ -858,6 +861,12 @@
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\UIScale9SpriteTest.cpp">
<Filter>Classes\UITest\CocosStudioGUITest</Filter>
</ClCompile>
<ClCompile Include="..\..\Classes\Sprite3DTest\DrawNode3D.cpp">
<Filter>Classes\Sprite3DTest</Filter>
</ClCompile>
<ClCompile Include="..\..\Classes\Camera3DTest\Camera3DTest.cpp">
<Filter>Classes\Camera3DTest</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Classes\AppDelegate.h">
@ -1590,6 +1599,12 @@
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\UIScale9SpriteTest.h">
<Filter>Classes\UITest\CocosStudioGUITest</Filter>
</ClInclude>
<ClInclude Include="..\..\Classes\Sprite3DTest\DrawNode3D.h">
<Filter>Classes\Sprite3DTest</Filter>
</ClInclude>
<ClInclude Include="..\..\Classes\Camera3DTest\Camera3DTest.h">
<Filter>Classes\Camera3DTest</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\..\external\curl\prebuilt\wp8\arm\libcurl.dll" />

View File

@ -13,7 +13,7 @@ LOCAL_SRC_FILES := main.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../../../external
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static
LOCAL_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static
include $(BUILD_SHARED_LIBRARY)

View File

@ -12,9 +12,9 @@ LOCAL_SRC_FILES := main.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../../../../external/lua/tolua \
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += network_lua_static
LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_STATIC_LIBRARIES += cocosdenshion_lua_static
LOCAL_STATIC_LIBRARIES += network_lua_static
include $(BUILD_SHARED_LIBRARY)

View File

@ -17,8 +17,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../../../../cocos/scripting/lua-bindings/manual\controller \
$(LOCAL_PATH)/../../../../../cocos/base
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_STATIC_LIBRARIES += cocosdenshion_static
include $(BUILD_SHARED_LIBRARY)

View File

@ -13,15 +13,15 @@ LOCAL_SRC_FILES += main.cpp \
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../Classes
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += network_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosbuilder_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += spine_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += extension_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += ui_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos3d_lua_static
LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_STATIC_LIBRARIES += cocosdenshion_lua_static
LOCAL_STATIC_LIBRARIES += network_lua_static
LOCAL_STATIC_LIBRARIES += cocosbuilder_lua_static
LOCAL_STATIC_LIBRARIES += cocostudio_lua_static
LOCAL_STATIC_LIBRARIES += spine_lua_static
LOCAL_STATIC_LIBRARIES += extension_lua_static
LOCAL_STATIC_LIBRARIES += ui_lua_static
LOCAL_STATIC_LIBRARIES += cocos3d_lua_static
include $(BUILD_SHARED_LIBRARY)

@ -1 +1 @@
Subproject commit b2a0338f0a6d51878ce96c4e0521d083e232e67b
Subproject commit fb44ec8cf77f6f51503987c3a1a0964580b5d88f