diff --git a/.gitignore b/.gitignore
index 1f241f7eb9..eb159dc67d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -113,9 +113,14 @@ build/build/
cocos/scripting/lua-bindings/proj.ios_mac/build/
tests/*/runtime/
tests/*/publish/
+tests/*/project/proj.android-studio/app/build.xml
+tests/*/project/proj.android-studio/app/proguard-project.txt
+tests/*/proj.android-studio/app/build.xml
+tests/*/proj.android-studio/app/proguard-project.txt
# Android
project.properties
+*.iml
# Ignore prebuilt libraries folder
/external/*
@@ -130,3 +135,4 @@ tests/cpp-tests/Resources/audio
/tests/lua-game-controller-test/src/cocos/
/tests/lua-tests/src/cocos/
/tests/js-tests/res/
+/tools/framework-compile/
diff --git a/AUTHORS b/AUTHORS
index 604a521487..a64e2a8252 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -833,6 +833,7 @@ Developers:
flashjay
Remove deprecated code in lua tests & template
+ luaLoadChunksFromZip should just remove .lua or .luac extension
zukkun
Fixed incorrect function invocation in PhysicsBody::setAngularVelocityLimit
@@ -1127,6 +1128,9 @@ Developers:
tankorsmash
Fixed the bug that ProgressTimer::setSprite() doesn't take effect
+ namezero111111
+ ui: TextField add `getTextColor`, `getTextHorizontalAlignment` and `getTextVerticalAlignment` API
+
Retired Core Developers:
WenSheng Yang
Author of windows port, CCTextField,
diff --git a/CHANGELOG b/CHANGELOG
index e9681bb743..eaf7753da9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,13 +1,32 @@
cocos2d-x-3.7 ??
+ [NEW] android: Add Samsung API for cocos, please refer to the release note for more details.
+ [NEW] 3rd: updated rapidjson to v1.0.2
[NEW] 3d: added physics3d support
+ [NEW] console: support build & run Android Studio project
+ [NEW] Audio: added support on WP8.1, now it supports wav format
[NEW] C++: added ActionFloat
- [NEW] C++: support physical keyboard on WinRT
+ [NEW] C++: supported physical keyboard on WinRT
+ [NEW] C++: added Android Studio support
[NEW] FileUtils: checked filename case characters on windows
[NEW] FileUitls: added supporting loading files that which file path include utf-8 characters
[NEW] PhysicsShape: added sensor property
-
+ [NEW] Scale9Sprite: added Android 9-patch image support
+ [NEW] Sprite: used triangle command
+ [NEW] 3d: add `getFarPlane` and `getNearPlane` in `Camera` class
+ [NEW] 3d: add opengl version project/unproject function in camera.
+ [NEW] ui: button add BMFont title support
+ [NEW] ui: TextField add `getTextColor`, `getTextHorizontalAlignment` and `getTextVerticalAlignment` API
+ [NEW] audio: Added MP3 support to winrt audio
+
+ [FIX] audio: Fixed program may freeze if `AudioEngine::stop` or `AudioEngine::stopAll()` is invoked frequently on Android
+ [FIX] audio: Fixed audio can't resume if it is interrupted by an incoming phone call.
+ [FIX] audio: Fixed SimpleAudioEngine::playEffect() lagged on Android 5.0.x
+ [FIX] ui: TextField scale factor is wrong with multiline text.
+ [FIX] 3d: skybox can't move to other position except origin point in world space
+ [FIX] 3d: terrain can't move to other position except origin point in world space
[FIX] 3rd: fix PIE link error on iOS caused by libpng and libtiff
[FIX] AssetsManager: crashed issue
+ [FIX] Audio: can not play large ogg files on windows
[FIX] EaseRateAction: no way to create an `EaseRateAction` instance
[FIX] Label: crashed if invoking `setString(text` after `getLetter(letterIndex)` and `letterIndex` is greater than the length of text
[FIX] Label: position is wrong if label content is changed after invoking `getLetter(letterIndex)`
@@ -15,9 +34,13 @@ cocos2d-x-3.7 ??
[FIX] Label: outline effect doesn't match characters well
[FIX] ProgressTimer: `setSprite()` doesn't take effect
[FIX] Sprite3D: setGLProgram() does not work
+ [FIX] Sprite3D: transition breaks when there is a Sprite3D in the scene
[FIX] Terrain: terrain is on top of particles, particles can not be seen
+ [FIX] TextureCache: unbindImageAsync failed to unbind all asynchronous callback for a specified bound image
+ [FIX] TileMap: crashed if a layer contains nothing
[FIX] WebView: memory leak on iOS
[FIX] WebView: crashed if url contains illegal characters on Android
+ [FIX] Lua: luaLoadChunksFromZip should just remove .lua or .luac extension
cocos2d-x-3.6 Apr.30 2015
[NEW] 3rd: update chipmunk to v 6.2.2 on Windows 8.1 Universal App
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d1c40c3b19..dad20ba10b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,8 +58,8 @@ endif()
set(BUILD_CPP_TESTS_DEFAULT ON)
set(BUILD_LUA_LIBS_DEFAULT ON)
set(BUILD_LUA_TESTS_DEFAULT ON)
-set(BUILD_JS_LIBS_DEFAULT OFF)
-set(BUILD_JS_TESTS_DEFAULT OFF)
+set(BUILD_JS_LIBS_DEFAULT ON)
+set(BUILD_JS_TESTS_DEFAULT ON)
# TODO: fix test samples for MSVC
if(MSVC)
set(BUILD_CPP_TESTS_DEFAULT OFF)
diff --git a/README.md b/README.md
index de6121afb0..d0fcd5fcda 100644
--- a/README.md
+++ b/README.md
@@ -186,7 +186,7 @@ $ bin/lua-empty-test/lua-empty-test
* For Windows
-Open the `cocos2d-x/build/cocos2d-win32.vc2013.sln`
+Open the `cocos2d-x/build/cocos2d-win32.sln`
* For Windows 8.1 Universal Apps (Phone and Store)
diff --git a/build/android-build.py b/build/android-build.py
index 47ffe5930e..bca7221447 100755
--- a/build/android-build.py
+++ b/build/android-build.py
@@ -4,12 +4,12 @@
import sys
import os, os.path
-import shutil
from optparse import OptionParser
CPP_SAMPLES = ['cpp-empty-test', 'cpp-tests', 'game-controller-test']
LUA_SAMPLES = ['lua-empty-test', 'lua-tests', 'lua-game-controller-test']
-ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES
+JS_SAMPLES = ['js-tests']
+ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES + JS_SAMPLES
def caculate_built_samples(args):
''' Compute the sampels to be built
@@ -27,6 +27,9 @@ def caculate_built_samples(args):
if 'lua' in args:
targets += LUA_SAMPLES
args.remove('lua')
+ if 'js' in args:
+ targets += JS_SAMPLES
+ args.remove('js')
targets += args
@@ -36,8 +39,8 @@ def caculate_built_samples(args):
return list(targets)
def do_build(app_android_root, build_mode):
-
- command = 'cocos compile -p android -s %s --ndk-mode %s' % (app_android_root, build_mode)
+
+ command = 'cocos compile -p android -s %s --ndk-mode %s' % (app_android_root, build_mode)
print command
if os.system(command) != 0:
@@ -49,7 +52,7 @@ def build_samples(target, build_mode):
build_mode = 'debug'
elif build_mode != 'release':
build_mode = 'debug'
-
+
build_targets = caculate_built_samples(target)
app_android_root = ''
@@ -60,7 +63,8 @@ def build_samples(target, build_mode):
"cpp-tests": "tests/cpp-tests",
"lua-empty-test": "tests/lua-empty-test",
"lua-tests": "tests/lua-tests",
- "lua-game-controller-test": "tests/lua-game-controller-test"
+ "lua-game-controller-test": "tests/lua-game-controller-test",
+ "js-tests": "tests/js-tests"
}
cocos_root = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
@@ -81,7 +85,7 @@ if __name__ == '__main__':
usage = """
This script is mainy used for building tests built-in with cocos2d-x.
- Usage: %prog [options] [cpp-empty-test|cpp-tests|lua-empty-test|lua-tests|cpp|lua|all]
+ Usage: %prog [options] [cpp-empty-test|cpp-tests|lua-empty-test|lua-tests|js-tests|cpp|lua|all]
If you are new to cocos2d-x, I recommend you start with cpp-empty-test, lua-empty-test.
@@ -93,13 +97,15 @@ if __name__ == '__main__':
parser = OptionParser(usage=usage)
parser.add_option("-n", "--ndk", dest="ndk_build_param",
- help='It is not used anymore, because cocos console does not support it.')
+ help='It is not used anymore, because cocos console does not support it.')
parser.add_option("-p", "--platform", dest="android_platform",
- help='This parameter is not used any more, just keep compatible.')
+ help='This parameter is not used any more, just keep compatible.')
parser.add_option("-b", "--build", dest="build_mode",
- help='The build mode for java project,debug[default] or release. Get more information,please refer to http://developer.android.com/tools/building/building-cmdline.html')
+ help='The build mode for java project,debug[default] or release. \
+ Get more information, \
+ please refer to http://developer.android.com/tools/building/building-cmdline.html')
(opts, args) = parser.parse_args()
-
+
if len(args) == 0:
parser.print_help()
sys.exit(1)
diff --git a/build/cocos2d-js-win32.vc2013.sln b/build/cocos2d-js-win32.sln
similarity index 100%
rename from build/cocos2d-js-win32.vc2013.sln
rename to build/cocos2d-js-win32.sln
diff --git a/build/cocos2d-js-win8.1-universal.sln b/build/cocos2d-js-win8.1-universal.sln
index c7e811fd33..0b34f599a9 100644
--- a/build/cocos2d-js-win8.1-universal.sln
+++ b/build/cocos2d-js-win8.1-universal.sln
@@ -45,6 +45,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjscocos2d.Windows", "..\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjscocos2d.WindowsPhone", "..\cocos\scripting\js-bindings\proj.win8.1-universal\libjscocos2d\libjscocos2d.WindowsPhone\libjscocos2d.WindowsPhone.vcxproj", "{CA082EC4-17CE-430B-8207-D1E947A5D1E9}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libbullet", "libbullet", "{9A66AB4C-057B-4675-849D-5D69B98C728C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet.Shared", "..\external\bullet\proj.win8.1-universal\libbullet.Shared\libbullet.Shared.vcxitems", "{16AF311F-74CA-45A3-A82D-6334200FB124}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet.Windows", "..\external\bullet\proj.win8.1-universal\libbullet.Windows\libbullet.Windows.vcxproj", "{EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet.WindowsPhone", "..\external\bullet\proj.win8.1-universal\libbullet.WindowsPhone\libbullet.WindowsPhone.vcxproj", "{E35634BD-B91B-4A6D-B957-96F56DD065F9}"
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\tests\js-tests\project\proj.win8.1-universal\App.Shared\js-tests.Shared.vcxitems*{ae6763f6-1549-441e-afb5-377be1c776dc}*SharedItemsImports = 9
@@ -53,7 +61,10 @@ Global
..\tests\js-tests\project\proj.win8.1-universal\App.Shared\js-tests.Shared.vcxitems*{70914fc8-7709-4cd6-b86b-c63fde5478db}*SharedItemsImports = 4
..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{cc1da216-a80d-4be4-b309-acb6af313aff}*SharedItemsImports = 4
..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{4a3c6ba8-c227-498b-aa21-40bda27b461f}*SharedItemsImports = 9
+ ..\external\bullet\proj.win8.1-universal\libbullet.Shared\libbullet.Shared.vcxitems*{e35634bd-b91b-4a6d-b957-96f56dd065f9}*SharedItemsImports = 4
+ ..\external\bullet\proj.win8.1-universal\libbullet.Shared\libbullet.Shared.vcxitems*{ec2b1292-2d8c-4feb-a84b-2550b32c1ae7}*SharedItemsImports = 4
..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{adafd00d-a0d6-46ef-9f0b-ea2880bfe1de}*SharedItemsImports = 9
+ ..\external\bullet\proj.win8.1-universal\libbullet.Shared\libbullet.Shared.vcxitems*{16af311f-74ca-45a3-a82d-6334200fb124}*SharedItemsImports = 9
..\cocos\scripting\js-bindings\proj.win8.1-universal\libjscocos2d\libjscocos2d.Shared\libjscocos2d.Shared.vcxitems*{ca082ec4-17ce-430b-8207-d1e947a5d1e9}*SharedItemsImports = 4
..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{5d6f020f-7e72-4494-90a0-2df11d235df9}*SharedItemsImports = 9
..\cocos\scripting\js-bindings\proj.win8.1-universal\libjscocos2d\libjscocos2d.Shared\libjscocos2d.Shared.vcxitems*{bea66276-51dd-4c53-92a8-f3d1fea50892}*SharedItemsImports = 9
@@ -192,6 +203,28 @@ Global
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|Win32.ActiveCfg = Release|Win32
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|Win32.Build.0 = Release|Win32
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|x64.ActiveCfg = Release|Win32
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Debug|ARM.ActiveCfg = Debug|ARM
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Debug|ARM.Build.0 = Debug|ARM
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Debug|Win32.Build.0 = Debug|Win32
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Debug|x64.ActiveCfg = Debug|x64
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Debug|x64.Build.0 = Debug|x64
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Release|ARM.ActiveCfg = Release|ARM
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Release|ARM.Build.0 = Release|ARM
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Release|Win32.ActiveCfg = Release|Win32
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Release|Win32.Build.0 = Release|Win32
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Release|x64.ActiveCfg = Release|x64
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Release|x64.Build.0 = Release|x64
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Debug|ARM.ActiveCfg = Debug|ARM
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Debug|ARM.Build.0 = Debug|ARM
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Debug|Win32.Build.0 = Debug|Win32
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Debug|x64.ActiveCfg = Debug|Win32
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Release|ARM.ActiveCfg = Release|ARM
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Release|ARM.Build.0 = Release|ARM
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Release|Win32.ActiveCfg = Release|Win32
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Release|Win32.Build.0 = Release|Win32
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -214,5 +247,9 @@ Global
{BEA66276-51DD-4C53-92A8-F3D1FEA50892} = {60DCAEA9-E344-40C0-B90C-82FB8E671BD5}
{BCF5546D-66A0-4998-AFD6-C5514F618930} = {60DCAEA9-E344-40C0-B90C-82FB8E671BD5}
{CA082EC4-17CE-430B-8207-D1E947A5D1E9} = {60DCAEA9-E344-40C0-B90C-82FB8E671BD5}
+ {9A66AB4C-057B-4675-849D-5D69B98C728C} = {85630454-74EA-4B5B-9B62-0E459B4476CB}
+ {16AF311F-74CA-45A3-A82D-6334200FB124} = {9A66AB4C-057B-4675-849D-5D69B98C728C}
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7} = {9A66AB4C-057B-4675-849D-5D69B98C728C}
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9} = {9A66AB4C-057B-4675-849D-5D69B98C728C}
EndGlobalSection
EndGlobal
diff --git a/build/cocos2d-win10.sln b/build/cocos2d-win10.sln
new file mode 100644
index 0000000000..07f54c2bc2
--- /dev/null
+++ b/build/cocos2d-win10.sln
@@ -0,0 +1,123 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.22823.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{17093B03-00CA-402F-981A-D8C84B2922B5}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\cocos\editor-support\spine\proj.win10\libSpine.vcxproj", "{4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d", "..\external\Box2D\proj-win10\libbox2d.vcxproj", "{0C32D479-46D5-46C3-9AA9-0A8FF8320516}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos\2d\libcocos2d_win10\libcocos2d.vcxproj", "{07C2895D-720C-487D-B7B4-12C293EA533F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-empty-test", "..\tests\cpp-empty-test\proj.win10\cpp-empty-test.vcxproj", "{87ED86E7-A850-433F-88D5-D5F65CFF7BF5}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-tests", "..\tests\cpp-tests\proj.win10\cpp-tests.vcxproj", "{C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet", "..\external\bullet\proj.win10\libbullet.vcxproj", "{ECEE1119-CE2E-4F7E-83A8-1932EA48E893}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|ARM = Debug|ARM
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|ARM = Release|ARM
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}.Debug|ARM.ActiveCfg = Debug|ARM
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}.Debug|ARM.Build.0 = Debug|ARM
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}.Debug|x64.ActiveCfg = Debug|x64
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}.Debug|x64.Build.0 = Debug|x64
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}.Debug|x86.ActiveCfg = Debug|Win32
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}.Debug|x86.Build.0 = Debug|Win32
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}.Release|ARM.ActiveCfg = Release|ARM
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}.Release|ARM.Build.0 = Release|ARM
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}.Release|x64.ActiveCfg = Release|x64
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}.Release|x64.Build.0 = Release|x64
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}.Release|x86.ActiveCfg = Release|Win32
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8}.Release|x86.Build.0 = Release|Win32
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516}.Debug|ARM.ActiveCfg = Debug|ARM
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516}.Debug|ARM.Build.0 = Debug|ARM
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516}.Debug|x64.ActiveCfg = Debug|x64
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516}.Debug|x64.Build.0 = Debug|x64
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516}.Debug|x86.ActiveCfg = Debug|Win32
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516}.Debug|x86.Build.0 = Debug|Win32
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516}.Release|ARM.ActiveCfg = Release|ARM
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516}.Release|ARM.Build.0 = Release|ARM
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516}.Release|x64.ActiveCfg = Release|x64
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516}.Release|x64.Build.0 = Release|x64
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516}.Release|x86.ActiveCfg = Release|Win32
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516}.Release|x86.Build.0 = Release|Win32
+ {07C2895D-720C-487D-B7B4-12C293EA533F}.Debug|ARM.ActiveCfg = Debug|ARM
+ {07C2895D-720C-487D-B7B4-12C293EA533F}.Debug|ARM.Build.0 = Debug|ARM
+ {07C2895D-720C-487D-B7B4-12C293EA533F}.Debug|x64.ActiveCfg = Debug|x64
+ {07C2895D-720C-487D-B7B4-12C293EA533F}.Debug|x64.Build.0 = Debug|x64
+ {07C2895D-720C-487D-B7B4-12C293EA533F}.Debug|x86.ActiveCfg = Debug|Win32
+ {07C2895D-720C-487D-B7B4-12C293EA533F}.Debug|x86.Build.0 = Debug|Win32
+ {07C2895D-720C-487D-B7B4-12C293EA533F}.Release|ARM.ActiveCfg = Release|ARM
+ {07C2895D-720C-487D-B7B4-12C293EA533F}.Release|ARM.Build.0 = Release|ARM
+ {07C2895D-720C-487D-B7B4-12C293EA533F}.Release|x64.ActiveCfg = Release|x64
+ {07C2895D-720C-487D-B7B4-12C293EA533F}.Release|x64.Build.0 = Release|x64
+ {07C2895D-720C-487D-B7B4-12C293EA533F}.Release|x86.ActiveCfg = Release|Win32
+ {07C2895D-720C-487D-B7B4-12C293EA533F}.Release|x86.Build.0 = Release|Win32
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Debug|ARM.ActiveCfg = Debug|ARM
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Debug|ARM.Build.0 = Debug|ARM
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Debug|ARM.Deploy.0 = Debug|ARM
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Debug|x64.ActiveCfg = Debug|x64
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Debug|x64.Build.0 = Debug|x64
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Debug|x64.Deploy.0 = Debug|x64
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Debug|x86.ActiveCfg = Debug|Win32
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Debug|x86.Build.0 = Debug|Win32
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Debug|x86.Deploy.0 = Debug|Win32
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Release|ARM.ActiveCfg = Release|ARM
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Release|ARM.Build.0 = Release|ARM
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Release|ARM.Deploy.0 = Release|ARM
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Release|x64.ActiveCfg = Release|x64
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Release|x64.Build.0 = Release|x64
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Release|x64.Deploy.0 = Release|x64
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Release|x86.ActiveCfg = Release|Win32
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Release|x86.Build.0 = Release|Win32
+ {87ED86E7-A850-433F-88D5-D5F65CFF7BF5}.Release|x86.Deploy.0 = Release|Win32
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Debug|ARM.ActiveCfg = Debug|ARM
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Debug|ARM.Build.0 = Debug|ARM
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Debug|ARM.Deploy.0 = Debug|ARM
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Debug|x64.ActiveCfg = Debug|x64
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Debug|x64.Build.0 = Debug|x64
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Debug|x64.Deploy.0 = Debug|x64
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Debug|x86.ActiveCfg = Debug|Win32
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Debug|x86.Build.0 = Debug|Win32
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Debug|x86.Deploy.0 = Debug|Win32
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Release|ARM.ActiveCfg = Release|ARM
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Release|ARM.Build.0 = Release|ARM
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Release|ARM.Deploy.0 = Release|ARM
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Release|x64.ActiveCfg = Release|x64
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Release|x64.Build.0 = Release|x64
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Release|x64.Deploy.0 = Release|x64
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Release|x86.ActiveCfg = Release|Win32
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Release|x86.Build.0 = Release|Win32
+ {C1307B42-D00A-4B88-BCDD-0A16A81FF4C1}.Release|x86.Deploy.0 = Release|Win32
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893}.Debug|ARM.ActiveCfg = Debug|ARM
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893}.Debug|ARM.Build.0 = Debug|ARM
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893}.Debug|x64.ActiveCfg = Debug|x64
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893}.Debug|x64.Build.0 = Debug|x64
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893}.Debug|x86.ActiveCfg = Debug|Win32
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893}.Debug|x86.Build.0 = Debug|Win32
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893}.Release|ARM.ActiveCfg = Release|ARM
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893}.Release|ARM.Build.0 = Release|ARM
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893}.Release|x64.ActiveCfg = Release|x64
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893}.Release|x64.Build.0 = Release|x64
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893}.Release|x86.ActiveCfg = Release|Win32
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {4B3BA10A-941F-4E08-8A50-8A7FCB822BB8} = {17093B03-00CA-402F-981A-D8C84B2922B5}
+ {0C32D479-46D5-46C3-9AA9-0A8FF8320516} = {17093B03-00CA-402F-981A-D8C84B2922B5}
+ {ECEE1119-CE2E-4F7E-83A8-1932EA48E893} = {17093B03-00CA-402F-981A-D8C84B2922B5}
+ EndGlobalSection
+EndGlobal
diff --git a/build/cocos2d-win32.vc2013.sln b/build/cocos2d-win32.sln
similarity index 100%
rename from build/cocos2d-win32.vc2013.sln
rename to build/cocos2d-win32.sln
diff --git a/build/cocos2d-win8.1-universal.sln b/build/cocos2d-win8.1-universal.sln
index 4ef61407d8..e850e1c542 100644
--- a/build/cocos2d-win8.1-universal.sln
+++ b/build/cocos2d-win8.1-universal.sln
@@ -45,6 +45,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloCpp.Windows", "..\test
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloCpp.WindowsPhone", "..\tests\cpp-empty-test\proj.win8.1-universal\HelloCpp.WindowsPhone\HelloCpp.WindowsPhone.vcxproj", "{396FE85E-BB05-4B92-BCCB-F89AED4EA41A}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libbullet", "libbullet", "{0500043C-7E95-4351-97D6-0382A8C92DD3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet.Shared", "..\external\bullet\proj.win8.1-universal\libbullet.Shared\libbullet.Shared.vcxitems", "{16AF311F-74CA-45A3-A82D-6334200FB124}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet.Windows", "..\external\bullet\proj.win8.1-universal\libbullet.Windows\libbullet.Windows.vcxproj", "{EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet.WindowsPhone", "..\external\bullet\proj.win8.1-universal\libbullet.WindowsPhone\libbullet.WindowsPhone.vcxproj", "{E35634BD-B91B-4A6D-B957-96F56DD065F9}"
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{9335005f-678e-4e8e-9b84-50037216aec8}*SharedItemsImports = 4
@@ -52,9 +60,12 @@ Global
..\tests\cpp-empty-test\proj.win8.1-universal\HelloCpp.Shared\HelloCpp.Shared.vcxitems*{a3ad93e4-0b2f-4c58-9181-69bed2e42e3e}*SharedItemsImports = 9
..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{cc1da216-a80d-4be4-b309-acb6af313aff}*SharedItemsImports = 4
..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{4a3c6ba8-c227-498b-aa21-40bda27b461f}*SharedItemsImports = 9
+ ..\external\bullet\proj.win8.1-universal\libbullet.Shared\libbullet.Shared.vcxitems*{e35634bd-b91b-4a6d-b957-96f56dd065f9}*SharedItemsImports = 4
..\tests\cpp-empty-test\proj.win8.1-universal\HelloCpp.Shared\HelloCpp.Shared.vcxitems*{79a8fcda-4b12-4dd1-b676-ff148d651638}*SharedItemsImports = 4
+ ..\external\bullet\proj.win8.1-universal\libbullet.Shared\libbullet.Shared.vcxitems*{ec2b1292-2d8c-4feb-a84b-2550b32c1ae7}*SharedItemsImports = 4
..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{adafd00d-a0d6-46ef-9f0b-ea2880bfe1de}*SharedItemsImports = 9
..\tests\cpp-tests\proj.win8.1-universal\cpp-tests.Shared\cpp-tests.Shared.vcxitems*{be3a1791-5bce-4cea-92cd-0e2d86dde27a}*SharedItemsImports = 9
+ ..\external\bullet\proj.win8.1-universal\libbullet.Shared\libbullet.Shared.vcxitems*{16af311f-74ca-45a3-a82d-6334200fb124}*SharedItemsImports = 9
..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{5d6f020f-7e72-4494-90a0-2df11d235df9}*SharedItemsImports = 9
..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{3b26a12d-3a44-47ea-82d2-282660fc844d}*SharedItemsImports = 4
..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{22f3b9df-1209-4574-8331-003966f562bf}*SharedItemsImports = 4
@@ -202,6 +213,28 @@ Global
{396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|Win32.Build.0 = Release|Win32
{396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|Win32.Deploy.0 = Release|Win32
{396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|x64.ActiveCfg = Release|Win32
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Debug|ARM.ActiveCfg = Debug|ARM
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Debug|ARM.Build.0 = Debug|ARM
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Debug|Win32.Build.0 = Debug|Win32
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Debug|x64.ActiveCfg = Debug|x64
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Debug|x64.Build.0 = Debug|x64
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Release|ARM.ActiveCfg = Release|ARM
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Release|ARM.Build.0 = Release|ARM
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Release|Win32.ActiveCfg = Release|Win32
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Release|Win32.Build.0 = Release|Win32
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Release|x64.ActiveCfg = Release|x64
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7}.Release|x64.Build.0 = Release|x64
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Debug|ARM.ActiveCfg = Debug|ARM
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Debug|ARM.Build.0 = Debug|ARM
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Debug|Win32.Build.0 = Debug|Win32
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Debug|x64.ActiveCfg = Debug|Win32
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Release|ARM.ActiveCfg = Release|ARM
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Release|ARM.Build.0 = Release|ARM
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Release|Win32.ActiveCfg = Release|Win32
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Release|Win32.Build.0 = Release|Win32
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -224,5 +257,9 @@ Global
{A3AD93E4-0B2F-4C58-9181-69BED2E42E3E} = {B70EF25E-E352-4020-BCDF-388973E44637}
{79A8FCDA-4B12-4DD1-B676-FF148D651638} = {B70EF25E-E352-4020-BCDF-388973E44637}
{396FE85E-BB05-4B92-BCCB-F89AED4EA41A} = {B70EF25E-E352-4020-BCDF-388973E44637}
+ {0500043C-7E95-4351-97D6-0382A8C92DD3} = {85630454-74EA-4B5B-9B62-0E459B4476CB}
+ {16AF311F-74CA-45A3-A82D-6334200FB124} = {0500043C-7E95-4351-97D6-0382A8C92DD3}
+ {EC2B1292-2D8C-4FEB-A84B-2550B32C1AE7} = {0500043C-7E95-4351-97D6-0382A8C92DD3}
+ {E35634BD-B91B-4A6D-B957-96F56DD065F9} = {0500043C-7E95-4351-97D6-0382A8C92DD3}
EndGlobalSection
EndGlobal
diff --git a/build/cocos2d_js_tests.xcodeproj/project.pbxproj b/build/cocos2d_js_tests.xcodeproj/project.pbxproj
index f69655eb62..ddbf43fb28 100644
--- a/build/cocos2d_js_tests.xcodeproj/project.pbxproj
+++ b/build/cocos2d_js_tests.xcodeproj/project.pbxproj
@@ -596,7 +596,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "#!/bin/bash\ncocos_dir=${SRCROOT}/../tests/js-tests/res\nif [ -d \"${cocos_dir}\" ]; then\nrm -rv \"${cocos_dir}\"\nmkdir \"${cocos_dir}\"\nelse\nmkdir \"${cocos_dir}\"\nfi\n\ncp -r \"${SRCROOT}/../tests/cpp-tests/Resources/\" \"${cocos_dir}\"";
+ shellScript = "#!/bin/bash\ncocos_dir=${SRCROOT}/../tests/js-tests/res\nif [ -d \"${cocos_dir}\" ]; then\nrm -rv \"${cocos_dir}\"\nmkdir \"${cocos_dir}\"\nelse\nmkdir \"${cocos_dir}\"\nfi\n\ncp -r \"${SRCROOT}/../tests/cpp-tests/Resources/\" \"${cocos_dir}\"\ncp -r \"${SRCROOT}/../tests/js-tests/resjs/\" \"${cocos_dir}\"";
};
EDCA13EE1AEA4E7B00F445CA /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@@ -609,7 +609,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "#!/bin/bash\ncocos_dir=${SRCROOT}/../tests/js-tests/res\nif [ -d \"${cocos_dir}\" ]; then\nrm -rv \"${cocos_dir}\"\nmkdir \"${cocos_dir}\"\nelse\nmkdir \"${cocos_dir}\"\nfi\n\ncp -r \"${SRCROOT}/../tests/cpp-tests/Resources/\" \"${cocos_dir}\"";
+ shellScript = "#!/bin/bash\ncocos_dir=${SRCROOT}/../tests/js-tests/res\nif [ -d \"${cocos_dir}\" ]; then\nrm -rv \"${cocos_dir}\"\nmkdir \"${cocos_dir}\"\nelse\nmkdir \"${cocos_dir}\"\nfi\n\ncp -r \"${SRCROOT}/../tests/cpp-tests/Resources/\" \"${cocos_dir}\"\ncp -r \"${SRCROOT}/../tests/js-tests/resjs/\" \"${cocos_dir}\"";
};
/* End PBXShellScriptBuildPhase section */
@@ -821,7 +821,7 @@
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
- USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/base $(SRCROOT)/../cocos/physics $(SRCROOT)/../cocos/math/kazmath $(SRCROOT)/../cocos/2d $(SRCROOT)/../cocos/gui $(SRCROOT)/../cocos/network $(SRCROOT)/../cocos/audio/include $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../extensions $(SRCROOT)/../external $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../cocos/scripting/js-bindings/auto $(SRCROOT)/../cocos/scripting/js-bindings/manual";
+ USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/base $(SRCROOT)/../cocos/2d $(SRCROOT)/../cocos/gui $(SRCROOT)/../cocos/network $(SRCROOT)/../cocos/audio/include $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../extensions $(SRCROOT)/../external $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../cocos/scripting/js-bindings/auto $(SRCROOT)/../cocos/scripting/js-bindings/manual";
};
name = Debug;
};
@@ -845,7 +845,7 @@
HEADER_SEARCH_PATHS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
- USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/base $(SRCROOT)/../cocos/physics $(SRCROOT)/../cocos/math/kazmath $(SRCROOT)/../cocos/2d $(SRCROOT)/../cocos/gui $(SRCROOT)/../cocos/network $(SRCROOT)/../cocos/audio/include $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../extensions $(SRCROOT)/../external $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../cocos/scripting/js-bindings/auto $(SRCROOT)/../cocos/scripting/js-bindings/manual";
+ USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/base $(SRCROOT)/../cocos/2d $(SRCROOT)/../cocos/gui $(SRCROOT)/../cocos/network $(SRCROOT)/../cocos/audio/include $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../extensions $(SRCROOT)/../external $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../cocos/scripting/js-bindings/auto $(SRCROOT)/../cocos/scripting/js-bindings/manual";
};
name = Release;
};
diff --git a/build/cocos2d_js_tests.xcodeproj/xcshareddata/xcschemes/js-tests Mac.xcscheme b/build/cocos2d_js_tests.xcodeproj/xcshareddata/xcschemes/js-tests Mac.xcscheme
new file mode 100644
index 0000000000..76f33cd18d
--- /dev/null
+++ b/build/cocos2d_js_tests.xcodeproj/xcshareddata/xcschemes/js-tests Mac.xcscheme
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/cocos2d_js_tests.xcodeproj/xcshareddata/xcschemes/js-tests iOS.xcscheme b/build/cocos2d_js_tests.xcodeproj/xcshareddata/xcschemes/js-tests iOS.xcscheme
new file mode 100644
index 0000000000..97cb029f2e
--- /dev/null
+++ b/build/cocos2d_js_tests.xcodeproj/xcshareddata/xcschemes/js-tests iOS.xcscheme
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj
index a4e01596e4..87be2384e6 100644
--- a/build/cocos2d_libs.xcodeproj/project.pbxproj
+++ b/build/cocos2d_libs.xcodeproj/project.pbxproj
@@ -1190,6 +1190,10 @@
1AC0269D1914068200FA920D /* ConvertUTF.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC026991914068200FA920D /* ConvertUTF.h */; };
29031E0719BFE8D400EFA1DF /* libchipmunk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 29031E0619BFE8D400EFA1DF /* libchipmunk.a */; };
29031E0919BFE8DE00EFA1DF /* libchipmunk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 29031E0819BFE8DE00EFA1DF /* libchipmunk.a */; };
+ 291901431B05895600F8B4BA /* CCNinePatchImageParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 291901411B05895600F8B4BA /* CCNinePatchImageParser.h */; };
+ 291901441B05895600F8B4BA /* CCNinePatchImageParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 291901411B05895600F8B4BA /* CCNinePatchImageParser.h */; };
+ 291901451B05895600F8B4BA /* CCNinePatchImageParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 291901421B05895600F8B4BA /* CCNinePatchImageParser.cpp */; };
+ 291901461B05895600F8B4BA /* CCNinePatchImageParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 291901421B05895600F8B4BA /* CCNinePatchImageParser.cpp */; };
292DB13D19B4574100A80320 /* UIEditBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292DB12F19B4574100A80320 /* UIEditBox.cpp */; };
292DB13E19B4574100A80320 /* UIEditBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292DB12F19B4574100A80320 /* UIEditBox.cpp */; };
292DB13F19B4574100A80320 /* UIEditBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13019B4574100A80320 /* UIEditBox.h */; };
@@ -3921,6 +3925,8 @@
2905FA1318CF08D100240AA3 /* UIWidget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIWidget.cpp; sourceTree = ""; };
2905FA1418CF08D100240AA3 /* UIWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidget.h; sourceTree = ""; };
29080DEB191B82CE0066F8DF /* UIDeprecated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIDeprecated.h; sourceTree = ""; };
+ 291901411B05895600F8B4BA /* CCNinePatchImageParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCNinePatchImageParser.h; path = ../base/CCNinePatchImageParser.h; sourceTree = ""; };
+ 291901421B05895600F8B4BA /* CCNinePatchImageParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCNinePatchImageParser.cpp; path = ../base/CCNinePatchImageParser.cpp; sourceTree = ""; };
292DB12F19B4574100A80320 /* UIEditBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIEditBox.cpp; sourceTree = ""; };
292DB13019B4574100A80320 /* UIEditBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEditBox.h; sourceTree = ""; };
292DB13119B4574100A80320 /* UIEditBoxImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEditBoxImpl.h; sourceTree = ""; };
@@ -5620,6 +5626,8 @@
1A5700A2180BC5E60088DEC7 /* base */ = {
isa = PBXGroup;
children = (
+ 291901411B05895600F8B4BA /* CCNinePatchImageParser.h */,
+ 291901421B05895600F8B4BA /* CCNinePatchImageParser.cpp */,
505385001B01887A00793096 /* CCProperties.h */,
505385011B01887A00793096 /* CCProperties.cpp */,
B63990CA1A490AFE00B07923 /* CCAsyncTaskPool.cpp */,
@@ -9408,6 +9416,7 @@
50ABBE211925AB6F00A911A9 /* atitc.h in Headers */,
15AE19A519AAD39600C27E9E /* TextFieldReader.h in Headers */,
B665E3401AA80A6500DDB1C5 /* CCPUOnEventFlagObserverTranslator.h in Headers */,
+ 291901431B05895600F8B4BA /* CCNinePatchImageParser.h in Headers */,
B24AA98B195A675C007B4522 /* CCFastTMXTiledMap.h in Headers */,
B665E3A01AA80A6500DDB1C5 /* CCPUPositionEmitter.h in Headers */,
B29594B61926D5EC003EEF37 /* CCMeshCommand.h in Headers */,
@@ -10210,6 +10219,7 @@
50ABBE481925AB6F00A911A9 /* CCEvent.h in Headers */,
5027253B190BF1B900AAF4ED /* cocos2d.h in Headers */,
15AE1A9719AAD40300C27E9E /* b2Draw.h in Headers */,
+ 291901441B05895600F8B4BA /* CCNinePatchImageParser.h in Headers */,
3E6176691960F89B00DE83F5 /* CCController.h in Headers */,
B6CAB43E1AF9AA1A00B9B856 /* btGpuDefines.h in Headers */,
3823841D1A2590D2002C4610 /* ComAudioReader.h in Headers */,
@@ -10682,6 +10692,7 @@
50ED2BD919BE5D5D00A0AB90 /* CCEventListenerController.cpp in Sources */,
B665E2321AA80A6500DDB1C5 /* CCPUBoxEmitter.cpp in Sources */,
B257B460198A353E00D9A687 /* CCPrimitiveCommand.cpp in Sources */,
+ 291901451B05895600F8B4BA /* CCNinePatchImageParser.cpp in Sources */,
15AE19A419AAD39600C27E9E /* TextFieldReader.cpp in Sources */,
50ED2BDB19BE76D500A0AB90 /* UIVideoPlayer-ios.mm in Sources */,
B665E32A1AA80A6500DDB1C5 /* CCPUOnCountObserver.cpp in Sources */,
@@ -11642,6 +11653,7 @@
15AE19AA19AAD39700C27E9E /* ListViewReader.cpp in Sources */,
1A5701C8180BCB5A0088DEC7 /* CCLabelTextFormatter.cpp in Sources */,
1A5701CC180BCB5A0088DEC7 /* CCLabelTTF.cpp in Sources */,
+ 291901461B05895600F8B4BA /* CCNinePatchImageParser.cpp in Sources */,
B665E39B1AA80A6500DDB1C5 /* CCPUPointEmitterTranslator.cpp in Sources */,
382384291A2590F9002C4610 /* NodeReader.cpp in Sources */,
15AE193419AAD35100C27E9E /* CCActionObject.cpp in Sources */,
diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj
index 0911ac3177..c51f3af656 100644
--- a/build/cocos2d_tests.xcodeproj/project.pbxproj
+++ b/build/cocos2d_tests.xcodeproj/project.pbxproj
@@ -60,6 +60,10 @@
15B3709819EE5DBA00ABE682 /* AssetsManagerExTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B3709619EE5DBA00ABE682 /* AssetsManagerExTest.cpp */; };
15B3709919EE5DBA00ABE682 /* AssetsManagerExTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B3709619EE5DBA00ABE682 /* AssetsManagerExTest.cpp */; };
15B3709A19EE5EED00ABE682 /* Manifests in Resources */ = {isa = PBXBuildFile; fileRef = 15B3709219EE5D1000ABE682 /* Manifests */; };
+ 15B914481B156A3700C6B95B /* Materials in Resources */ = {isa = PBXBuildFile; fileRef = 5046AB5A1AF2C4180060550B /* Materials */; };
+ 15B914491B15721400C6B95B /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
+ 15B9144A1B15A18C00C6B95B /* Materials in Resources */ = {isa = PBXBuildFile; fileRef = 5046AB5A1AF2C4180060550B /* Materials */; };
+ 15B9144B1B15A18C00C6B95B /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
15C64825165F3934007D4F18 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64824165F3934007D4F18 /* OpenGL.framework */; };
15C64827165F394E007D4F18 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64826165F394E007D4F18 /* QuartzCore.framework */; };
15C64829165F396B007D4F18 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64828165F396B007D4F18 /* OpenAL.framework */; };
@@ -4438,6 +4442,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 15B914491B15721400C6B95B /* Shaders3D in Resources */,
+ 15B914481B156A3700C6B95B /* Materials in Resources */,
1531B2501AE013DE0075DB94 /* Test.html in Resources */,
1502702E1AD3BDC90089CD03 /* TerrainTest in Resources */,
157B08EC1A90864100B7BEA4 /* Particle3D in Resources */,
@@ -4485,6 +4491,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 15B9144A1B15A18C00C6B95B /* Materials in Resources */,
+ 15B9144B1B15A18C00C6B95B /* Shaders3D in Resources */,
1531B2511AE013F00075DB94 /* Test.html in Resources */,
1502702D1AD3BDBC0089CD03 /* TerrainTest in Resources */,
157B08ED1A90865600B7BEA4 /* Particle3D in Resources */,
@@ -5787,6 +5795,7 @@
"$(inherited)",
CC_TARGET_OS_MAC,
);
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
INFOPLIST_FILE = "$(SRCROOT)/../tests/cpp-tests/proj.mac/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../external/glfw3/include/mac";
@@ -5802,6 +5811,7 @@
"$(inherited)",
CC_TARGET_OS_MAC,
);
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
INFOPLIST_FILE = "$(SRCROOT)/../tests/cpp-tests/proj.mac/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../external/glfw3/include/mac";
@@ -5890,6 +5900,7 @@
"$(inherited)",
CC_TARGET_OS_IPHONE,
);
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
INFOPLIST_FILE = "$(SRCROOT)/../tests/cpp-tests/proj.ios/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
LIBRARY_SEARCH_PATHS = (
@@ -5913,6 +5924,7 @@
"$(inherited)",
CC_TARGET_OS_IPHONE,
);
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
INFOPLIST_FILE = "$(SRCROOT)/../tests/cpp-tests/proj.ios/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
LIBRARY_SEARCH_PATHS = (
diff --git a/cocos/2d/CCActionCamera.h b/cocos/2d/CCActionCamera.h
index 4ab7c1eac7..2dcc6c25e9 100644
--- a/cocos/2d/CCActionCamera.h
+++ b/cocos/2d/CCActionCamera.h
@@ -125,9 +125,9 @@ public:
* @param t Duration in seconds.
* @param radius The start radius.
* @param deltaRadius The delta radius.
- * @param angleZ The start Angel in Z.
+ * @param angleZ The start angle in Z.
* @param deltaAngleZ The delta angle in Z.
- * @param angleX The start Angel in X.
+ * @param angleX The start angle in X.
* @param deltaAngleX The delta angle in X.
* @return An OrbitCamera.
*/
diff --git a/cocos/2d/CCCamera.cpp b/cocos/2d/CCCamera.cpp
index 2659dd9c64..a4f880a971 100644
--- a/cocos/2d/CCCamera.cpp
+++ b/cocos/2d/CCCamera.cpp
@@ -245,11 +245,42 @@ Vec2 Camera::project(const Vec3& src) const
return screenPos;
}
+Vec2 Camera::projectGL(const Vec3& src) const
+{
+ Vec2 screenPos;
+
+ auto viewport = Director::getInstance()->getWinSize();
+ Vec4 clipPos;
+ getViewProjectionMatrix().transformVector(Vec4(src.x, src.y, src.z, 1.0f), &clipPos);
+
+ CCASSERT(clipPos.w != 0.0f, "");
+ float ndcX = clipPos.x / clipPos.w;
+ float ndcY = clipPos.y / clipPos.w;
+
+ screenPos.x = (ndcX + 1.0f) * 0.5f * viewport.width;
+ screenPos.y = (ndcY + 1.0f) * 0.5f * viewport.height;
+ return screenPos;
+}
+
Vec3 Camera::unproject(const Vec3& src) const
{
- auto viewport = Director::getInstance()->getWinSize();
+ Vec3 dst;
+ unproject(Director::getInstance()->getWinSize(), &src, &dst);
+ return dst;
+}
- Vec4 screen(src.x / viewport.width, ((viewport.height - src.y)) / viewport.height, src.z, 1.0f);
+Vec3 Camera::unprojectGL(const Vec3& src) const
+{
+ Vec3 dst;
+ unprojectGL(Director::getInstance()->getWinSize(), &src, &dst);
+ return dst;
+}
+
+void Camera::unproject(const Size& viewport, const Vec3* src, Vec3* dst) const
+{
+ CCASSERT(src && dst, "vec3 can not be null");
+
+ Vec4 screen(src->x / viewport.width, ((viewport.height - src->y)) / viewport.height, src->z, 1.0f);
screen.x = screen.x * 2.0f - 1.0f;
screen.y = screen.y * 2.0f - 1.0f;
screen.z = screen.z * 2.0f - 1.0f;
@@ -262,14 +293,14 @@ Vec3 Camera::unproject(const Vec3& src) const
screen.z /= screen.w;
}
- return Vec3(screen.x, screen.y, screen.z);
+ dst->set(screen.x, screen.y, screen.z);
}
-void Camera::unproject(const Size& viewport, const Vec3* src, Vec3* dst) const
+void Camera::unprojectGL(const Size& viewport, const Vec3* src, Vec3* dst) const
{
CCASSERT(src && dst, "vec3 can not be null");
- Vec4 screen(src->x / viewport.width, ((viewport.height - src->y)) / viewport.height, src->z, 1.0f);
+ Vec4 screen(src->x / viewport.width, src->y / viewport.height, src->z, 1.0f);
screen.x = screen.x * 2.0f - 1.0f;
screen.y = screen.y * 2.0f - 1.0f;
screen.z = screen.z * 2.0f - 1.0f;
diff --git a/cocos/2d/CCCamera.h b/cocos/2d/CCCamera.h
index 34ecac77ee..37493af08c 100644
--- a/cocos/2d/CCCamera.h
+++ b/cocos/2d/CCCamera.h
@@ -61,6 +61,7 @@ enum class CameraFlag
class CC_DLL Camera :public Node
{
friend class Scene;
+ friend class EventDispatcher;
public:
/**
* The type of camera.
@@ -128,30 +129,60 @@ public:
/**get view projection matrix*/
const Mat4& getViewProjectionMatrix() const;
- /* convert the specified point of viewport from world-space coordinates into the screen-space coordinates.
+ /* convert the specified point in 3D world-space coordinates into the screen-space coordinates.
*
+ * Origin point at left top corner in screen-space.
* @param src The world-space position.
* @return The screen-space position.
*/
Vec2 project(const Vec3& src) const;
- /**
- * Convert the specified point of viewport from screen-space coordinate into the world-space coordinate.
+ /* convert the specified point in 3D world-space coordinates into the GL-screen-space coordinates.
*
+ * Origin point at left bottom corner in GL-screen-space.
+ * @param src The 3D world-space position.
+ * @return The GL-screen-space position.
+ */
+ Vec2 projectGL(const Vec3& src) const;
+
+ /**
+ * Convert the specified point of screen-space coordinate into the 3D world-space coordinate.
+ *
+ * Origin point at left top corner in screen-space.
* @param src The screen-space position.
- * @return The world-space position.
+ * @return The 3D world-space position.
*/
Vec3 unproject(const Vec3& src) const;
-
- /**
- * Convert the specified point of viewport from screen-space coordinate into the world-space coordinate.
- *
- * @param viewport The viewport size to use.
- * @param src The screen-space position.
- * @param dst The world-space position.
- */
- void unproject(const Size& viewport, const Vec3* src, Vec3* dst) const;
+ /**
+ * Convert the specified point of GL-screen-space coordinate into the 3D world-space coordinate.
+ *
+ * Origin point at left bottom corner in GL-screen-space.
+ * @param src The GL-screen-space position.
+ * @return The 3D world-space position.
+ */
+ Vec3 unprojectGL(const Vec3& src) const;
+
+ /**
+ * Convert the specified point of screen-space coordinate into the 3D world-space coordinate.
+ *
+ * Origin point at left top corner in screen-space.
+ * @param size The window size to use.
+ * @param src The screen-space position.
+ * @param dst The 3D world-space position.
+ */
+ void unproject(const Size& size, const Vec3* src, Vec3* dst) const;
+
+ /**
+ * Convert the specified point of GL-screen-space coordinate into the 3D world-space coordinate.
+ *
+ * Origin point at left bottom corner in GL-screen-space.
+ * @param size The window size to use.
+ * @param src The GL-screen-space position.
+ * @param dst The 3D world-space position.
+ */
+ void unprojectGL(const Size& size, const Vec3* src, Vec3* dst) const;
+
/**
* Is this aabb visible in frustum
*/
@@ -172,6 +203,16 @@ public:
*/
int getDepth() const { return _depth; }
+ /**
+ * Get the frustum's far plane.
+ */
+ float getFarPlane() const { return _farPlane; }
+
+ /**
+ * Get the frustum's near plane.
+ */
+ float getNearPlane() const { return _nearPlane; }
+
//override
virtual void onEnter() override;
virtual void onExit() override;
diff --git a/cocos/2d/CCDrawNode.h b/cocos/2d/CCDrawNode.h
index 00236f8da1..712fc8ac3b 100644
--- a/cocos/2d/CCDrawNode.h
+++ b/cocos/2d/CCDrawNode.h
@@ -118,7 +118,7 @@ public:
*
* @param center The circle center point.
* @param radius The circle rotate of radius.
- * @param angle The circle angel.
+ * @param angle The circle angle.
* @param segments The number of segments.
* @param drawLineToCenter Whether or not draw the line from the origin to center.
* @param scaleX The scale value in x.
@@ -131,7 +131,7 @@ public:
*
* @param center The circle center point.
* @param radius The circle rotate of radius.
- * @param angle The circle angel.
+ * @param angle The circle angle.
* @param segments The number of segments.
* @param drawLineToCenter Whether or not draw the line from the origin to center.
* @param color Set the circle color.
@@ -216,7 +216,7 @@ public:
/** Draws a solid circle given the center, radius and number of segments.
* @param center The circle center point.
* @param radius The circle rotate of radius.
- * @param angle The circle angel.
+ * @param angle The circle angle.
* @param segments The number of segments.
* @param scaleX The scale value in x.
* @param scaleY The scale value in y.
@@ -228,7 +228,7 @@ public:
/** Draws a solid circle given the center, radius and number of segments.
* @param center The circle center point.
* @param radius The circle rotate of radius.
- * @param angle The circle angel.
+ * @param angle The circle angle.
* @param segments The number of segments.
* @param color The solid circle color.
* @js NA
diff --git a/cocos/2d/CCDrawingPrimitives.h b/cocos/2d/CCDrawingPrimitives.h
index eb13fb8348..38379c027d 100644
--- a/cocos/2d/CCDrawingPrimitives.h
+++ b/cocos/2d/CCDrawingPrimitives.h
@@ -153,7 +153,7 @@ namespace DrawPrimitives
*
* @param center The circle center point.
* @param radius The circle rotate of radius.
- * @param angle The circle angel.
+ * @param angle The circle angle.
* @param segments The number of segments.
* @param drawLineToCenter Whether or not draw the line from the origin to center.
* @param scaleX The scale value in x.
@@ -165,7 +165,7 @@ namespace DrawPrimitives
*
* @param center The circle center point.
* @param radius The circle rotate of radius.
- * @param angle The circle angel.
+ * @param angle The circle angle.
* @param segments The number of segments.
* @param drawLineToCenter Whether or not draw the line from the origin to center.
*/
@@ -174,7 +174,7 @@ namespace DrawPrimitives
/** Draws a solid circle given the center, radius and number of segments.
* @param center The circle center point.
* @param radius The circle rotate of radius.
- * @param angle The circle angel.
+ * @param angle The circle angle.
* @param segments The number of segments.
* @param scaleX The scale value in x.
* @param scaleY The scale value in y.
@@ -185,7 +185,7 @@ namespace DrawPrimitives
/** Draws a solid circle given the center, radius and number of segments.
* @param center The circle center point.
* @param radius The circle rotate of radius.
- * @param angle The circle angel.
+ * @param angle The circle angle.
* @param segments The number of segments.
* @js NA
*/
diff --git a/cocos/2d/CCFastTMXTiledMap.cpp b/cocos/2d/CCFastTMXTiledMap.cpp
index e444276ce1..3a13b0bebc 100644
--- a/cocos/2d/CCFastTMXTiledMap.cpp
+++ b/cocos/2d/CCFastTMXTiledMap.cpp
@@ -101,6 +101,9 @@ TMXTiledMap::~TMXTiledMap()
TMXLayer * TMXTiledMap::parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
{
TMXTilesetInfo *tileset = tilesetForLayer(layerInfo, mapInfo);
+ if (tileset == nullptr)
+ return nullptr;
+
TMXLayer *layer = TMXLayer::create(tileset, layerInfo, mapInfo);
// tell the layerinfo to release the ownership of the tiles map.
@@ -170,6 +173,10 @@ void TMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
if (layerInfo->_visible)
{
TMXLayer *child = parseLayer(layerInfo, mapInfo);
+ if (child == nullptr) {
+ idx++;
+ continue;
+ }
addChild(child, idx, idx);
// update content size with the max size
diff --git a/cocos/2d/CCLabelTextFormatter.cpp b/cocos/2d/CCLabelTextFormatter.cpp
index b135d06cff..a7e94cee3f 100644
--- a/cocos/2d/CCLabelTextFormatter.cpp
+++ b/cocos/2d/CCLabelTextFormatter.cpp
@@ -40,23 +40,21 @@ bool LabelTextFormatter::multilineText(Label *theLabel)
std::vector multiline_string;
multiline_string.reserve( limit );
-
std::vector last_word;
last_word.reserve( 25 );
- bool isStartOfLine = false, isStartOfWord = false;
- float startOfLine = -1, startOfWord = -1;
+ bool lineIsEmpty = true;
+ bool calculateLineStart = false;
+ float startOfLine = 0.f;
- int skip = 0;
-
+ int skip = 0;
int tIndex = 0;
- float scalsX = theLabel->getScaleX();
float lineWidth = theLabel->_maxLineWidth;
bool breakLineWithoutSpace = theLabel->_lineBreakWithoutSpaces;
Label::LetterInfo* info = nullptr;
for (int j = 0; j+skip < limit; j++)
- {
+ {
info = & theLabel->_lettersInfo.at(j+skip);
unsigned int justSkipped = 0;
@@ -72,10 +70,10 @@ bool LabelTextFormatter::multilineText(Label *theLabel)
last_word.push_back('\n');
multiline_string.insert(multiline_string.end(), last_word.begin(), last_word.end());
last_word.clear();
- isStartOfWord = false;
- isStartOfLine = false;
- startOfWord = -1;
- startOfLine = -1;
+
+ calculateLineStart = false;
+ startOfLine = 0.f;
+ lineIsEmpty = true;
}
if(tIndex < limit)
{
@@ -90,69 +88,21 @@ bool LabelTextFormatter::multilineText(Label *theLabel)
if (tIndex >= limit)
break;
- char16_t character = strWhole[tIndex];
-
- if (!isStartOfWord)
+ if (calculateLineStart)
{
- startOfWord = info->position.x * scalsX;
- isStartOfWord = true;
+ startOfLine = info->position.x - info->def.offsetX - theLabel->_horizontalKernings[tIndex];
+ calculateLineStart = false;
+ lineIsEmpty = true;
}
- if (!isStartOfLine)
+ auto character = strWhole[tIndex];
+ if (breakLineWithoutSpace)
{
- startOfLine = startOfWord;
- isStartOfLine = true;
- }
-
- // 1) Whitespace.
- // 2) This character is non-CJK, but the last character is CJK
- bool isspace = StringUtils::isUnicodeSpace(character);
- bool isCJK = false;
- if(!isspace)
- {
- isCJK = StringUtils::isCJKUnicode(character);
- }
-
- if (isspace ||
- (!last_word.empty() && StringUtils::isCJKUnicode(last_word.back()) && !isCJK))
- {
- // if current character is white space, put it into the current word
- if (isspace) last_word.push_back(character);
- multiline_string.insert(multiline_string.end(), last_word.begin(), last_word.end());
- last_word.clear();
- isStartOfWord = false;
- startOfWord = -1;
- // put the CJK character in the last word
- // and put the non-CJK(ASCII) character in the current word
- if (!isspace) last_word.push_back(character);
- continue;
- }
-
- float posRight = (info->position.x + info->contentSize.width) * scalsX;
- // Out of bounds.
- if (posRight - startOfLine > lineWidth)
- {
- if (!breakLineWithoutSpace && !isCJK)
+ float posRight = info->position.x + info->contentSize.width;
+ if (posRight - startOfLine > lineWidth)
{
- last_word.push_back(character);
-
- int found = StringUtils::getIndexOfLastNotChar16(multiline_string, ' ');
- if (found != -1)
- StringUtils::trimUTF16Vector(multiline_string);
- else
- multiline_string.clear();
-
- if (multiline_string.size() > 0)
- multiline_string.push_back('\n');
-
- isStartOfLine = false;
- startOfLine = -1;
- }
- else
- {
- StringUtils::trimUTF16Vector(last_word);
//issue #8492:endless loop if not using system font, and constrained length is less than one character width
- if (isStartOfLine && last_word.size() == 0)
+ if (last_word.empty())
last_word.push_back(character);
else
--j;
@@ -160,22 +110,102 @@ bool LabelTextFormatter::multilineText(Label *theLabel)
last_word.push_back('\n');
multiline_string.insert(multiline_string.end(), last_word.begin(), last_word.end());
last_word.clear();
-
- isStartOfWord = false;
- isStartOfLine = false;
- startOfWord = -1;
- startOfLine = -1;
+
+ startOfLine = 0.f;
+ }
+ else
+ {
+ last_word.push_back(character);
}
}
+ //Break line with space.
else
{
- // Character is normal.
- last_word.push_back(character);
+ std::vector nonCJKword;
+ int wordIndex = tIndex;
+ for (; wordIndex < limit; ++wordIndex)
+ {
+ auto ch = strWhole[wordIndex];
+ if (ch == '\n' || StringUtils::isUnicodeSpace(ch) || StringUtils::isCJKUnicode(ch))
+ {
+ break;
+ }
+
+ nonCJKword.push_back(ch);
+ }
+
+ if (!nonCJKword.empty())
+ {
+ auto wordLenth = nonCJKword.size();
+ auto lastCharacterInfo = &theLabel->_lettersInfo.at(tIndex + wordLenth - 1);
+
+ float posRight = lastCharacterInfo->position.x + lastCharacterInfo->contentSize.width;
+ if (posRight - startOfLine > lineWidth)
+ {
+ if (last_word.empty())
+ {
+ nonCJKword.push_back('\n');
+ multiline_string.insert(multiline_string.end(), nonCJKword.begin(), nonCJKword.end());
+
+ calculateLineStart = true;
+ }
+ else
+ {
+ last_word.push_back('\n');
+ multiline_string.insert(multiline_string.end(), last_word.begin(), last_word.end());
+ last_word.clear();
+
+ startOfLine = info->position.x - info->def.offsetX - theLabel->_horizontalKernings[tIndex];
+ if (posRight - startOfLine > lineWidth)
+ {
+ nonCJKword.push_back('\n');
+ multiline_string.insert(multiline_string.end(), nonCJKword.begin(), nonCJKword.end());
+ calculateLineStart = true;
+ }
+ else
+ {
+ multiline_string.insert(multiline_string.end(), nonCJKword.begin(), nonCJKword.end());
+ lineIsEmpty = false;
+ calculateLineStart = false;
+ }
+ }
+ }
+ else
+ {
+ multiline_string.insert(multiline_string.end(), last_word.begin(), last_word.end());
+ last_word.clear();
+
+ multiline_string.insert(multiline_string.end(), nonCJKword.begin(), nonCJKword.end());
+ lineIsEmpty = false;
+ }
+
+ j += wordLenth - 1;
+ continue;
+ }
+
+ float posRight = info->position.x + info->contentSize.width;
+ if (posRight - startOfLine > lineWidth)
+ {
+ //issue #8492:endless loop if not using system font, and constrained length is less than one character width
+ if (lineIsEmpty && last_word.empty())
+ last_word.push_back(character);
+ else
+ --j;
+
+ last_word.push_back('\n');
+ multiline_string.insert(multiline_string.end(), last_word.begin(), last_word.end());
+ last_word.clear();
+
+ calculateLineStart = true;
+ }
+ else
+ {
+ last_word.push_back(character);
+ }
}
}
multiline_string.insert(multiline_string.end(), last_word.begin(), last_word.end());
-
std::u16string strNew(multiline_string.begin(), multiline_string.end());
theLabel->_currentUTF16String = strNew;
@@ -386,33 +416,16 @@ bool LabelTextFormatter::createStringSprites(Label *theLabel)
continue;
}
- nextFontPositionX += charAdvance + kernings[i];
+ nextFontPositionX += charAdvance + theLabel->_additionalKerning;
- if (longestLine < nextFontPositionX)
+ auto letterRight = letterPosition.x + tempDefinition.width;
+ if (longestLine < letterRight)
{
- longestLine = nextFontPositionX;
+ longestLine = letterRight;
}
-
- // check longest line before adding additional kerning
- nextFontPositionX += theLabel->_additionalKerning;
}
- float lastCharWidth = tempDefinition.width * contentScaleFactor;
- Size tmpSize;
- // If the last character processed has an xAdvance which is less that the width of the characters image, then we need
- // to adjust the width of the string to take this into account, or the character will overlap the end of the bounding
- // box
- if(charAdvance < lastCharWidth)
- {
- tmpSize.width = longestLine - charAdvance + lastCharWidth;
- }
- else
- {
- tmpSize.width = longestLine;
- }
-
- tmpSize.height = totalHeight;
-
+ Size tmpSize(longestLine * contentScaleFactor, totalHeight);
if (theLabel->_labelHeight > 0)
{
tmpSize.height = theLabel->_labelHeight * contentScaleFactor;
diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp
index bb9115162f..423a60286e 100644
--- a/cocos/2d/CCNode.cpp
+++ b/cocos/2d/CCNode.cpp
@@ -1314,9 +1314,12 @@ uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFl
_normalizedPositionDirty = false;
}
}
+
+ //remove this two line given that isVisitableByVisitingCamera should not affect the calculation of transform given that we are visiting scene
+ //without involving view and projection matrix.
- if (!isVisitableByVisitingCamera())
- return parentFlags;
+// if (!isVisitableByVisitingCamera())
+// return parentFlags;
uint32_t flags = parentFlags;
flags |= (_transformUpdated ? FLAGS_TRANSFORM_DIRTY : 0);
diff --git a/cocos/2d/CCSprite.cpp b/cocos/2d/CCSprite.cpp
index be359bd71d..656f4bf605 100644
--- a/cocos/2d/CCSprite.cpp
+++ b/cocos/2d/CCSprite.cpp
@@ -598,8 +598,8 @@ void Sprite::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
if(_insideBounds)
#endif
{
- _quadCommand.init(_globalZOrder, _texture->getName(), getGLProgramState(), _blendFunc, &_quad, 1, transform, flags);
- renderer->addCommand(&_quadCommand);
+ _trianglesCommand.init(_globalZOrder, _texture->getName(), getGLProgramState(), _blendFunc, getRenderedTriangles(), transform, flags);
+ renderer->addCommand(&_trianglesCommand);
#if CC_SPRITE_DEBUG_DRAW
_debugDrawNode->clear();
@@ -614,6 +614,17 @@ void Sprite::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
}
}
+TrianglesCommand::Triangles Sprite::getRenderedTriangles() const
+{
+ static unsigned short indices[6] = {0, 1, 2, 3, 2, 1};
+ TrianglesCommand::Triangles result;
+ result.indices = indices;
+ result.verts = (V3F_C4B_T2F*)&_quad;
+ result.vertCount = 4;
+ result.indexCount = 6;
+ return result;
+}
+
// MARK: visit, draw, transform
void Sprite::addChild(Node *child, int zOrder, int tag)
@@ -993,6 +1004,10 @@ bool Sprite::isFrameDisplayed(SpriteFrame *frame) const
SpriteFrame* Sprite::getSpriteFrame() const
{
+ if(nullptr != this->_spriteFrame)
+ {
+ return this->_spriteFrame;
+ }
return SpriteFrame::createWithTexture(_texture,
CC_RECT_POINTS_TO_PIXELS(_rect),
_rectRotated,
diff --git a/cocos/2d/CCSprite.h b/cocos/2d/CCSprite.h
index 66110f9a4b..2f6a65a36a 100644
--- a/cocos/2d/CCSprite.h
+++ b/cocos/2d/CCSprite.h
@@ -33,7 +33,7 @@ THE SOFTWARE.
#include "2d/CCDrawNode.h"
#include "base/CCProtocols.h"
#include "renderer/CCTextureAtlas.h"
-#include "renderer/CCQuadCommand.h"
+#include "renderer/CCTrianglesCommand.h"
#include "renderer/CCCustomCommand.h"
NS_CC_BEGIN
@@ -538,7 +538,8 @@ protected:
virtual void updateBlendFunc();
virtual void setReorderChildDirtyRecursively();
virtual void setDirtyRecursively(bool value);
-
+
+ TrianglesCommand::Triangles getRenderedTriangles() const;
//
// Data used when the sprite is rendered using a SpriteSheet
//
@@ -557,7 +558,7 @@ protected:
BlendFunc _blendFunc; /// It's required for TextureProtocol inheritance
Texture2D* _texture; /// Texture2D object that is used to render the sprite
SpriteFrame* _spriteFrame;
- QuadCommand _quadCommand; /// quad command
+ TrianglesCommand _trianglesCommand; ///
#if CC_SPRITE_DEBUG_DRAW
DrawNode *_debugDrawNode;
#endif //CC_SPRITE_DEBUG_DRAW
diff --git a/cocos/2d/CCSpriteFrameCache.cpp b/cocos/2d/CCSpriteFrameCache.cpp
index c7a56eecef..1a656a5a9b 100644
--- a/cocos/2d/CCSpriteFrameCache.cpp
+++ b/cocos/2d/CCSpriteFrameCache.cpp
@@ -39,7 +39,7 @@ THE SOFTWARE.
#include "base/CCDirector.h"
#include "renderer/CCTexture2D.h"
#include "renderer/CCTextureCache.h"
-
+#include "base/CCNinePatchImageParser.h"
#include "deprecated/CCString.h"
@@ -104,6 +104,10 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(ValueMap& dictionary, Textu
// check the format
CCASSERT(format >=0 && format <= 3, "format is not supported for SpriteFrameCache addSpriteFramesWithDictionary:textureFilename:");
+ auto textureFileName = Director::getInstance()->getTextureCache()->getTextureFilePath(texture);
+ auto image = new Image();
+ image->initWithImageFile(textureFileName);
+ NinePatchImageParser parser;
for (auto iter = framesDict.begin(); iter != framesDict.end(); ++iter)
{
ValueMap& frameDict = iter->second.asValueMap();
@@ -183,7 +187,7 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(ValueMap& dictionary, Textu
_spriteFramesAliases[oneAlias] = Value(spriteFrameName);
}
-
+
// create frame
spriteFrame = SpriteFrame::createWithTexture(texture,
Rect(textureRect.origin.x, textureRect.origin.y, spriteSize.width, spriteSize.height),
@@ -192,9 +196,16 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(ValueMap& dictionary, Textu
spriteSourceSize);
}
+ bool flag = NinePatchImageParser::isNinePatchImage(spriteFrameName);
+ if(flag)
+ {
+ parser.setSpriteFrameInfo(image, spriteFrame->getRectInPixels(), spriteFrame->isRotated());
+ texture->addSpriteFrameCapInset(spriteFrame, parser.parseCapInset());
+ }
// add sprite frame
_spriteFrames.insert(spriteFrameName, spriteFrame);
}
+ CC_SAFE_DELETE(image);
}
void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist, Texture2D *texture)
@@ -327,13 +338,14 @@ void SpriteFrameCache::removeUnusedSpriteFrames()
if( spriteFrame->getReferenceCount() == 1 )
{
toRemoveFrames.push_back(iter->first);
+ spriteFrame->getTexture()->removeSpriteFrameCapInset(spriteFrame);
CCLOG("cocos2d: SpriteFrameCache: removing unused frame: %s", iter->first.c_str());
removed = true;
}
}
_spriteFrames.erase(toRemoveFrames);
-
+
// FIXME:. Since we don't know the .plist file that originated the frame, we must remove all .plist from the cache
if( removed )
{
diff --git a/cocos/2d/CCTMXTiledMap.cpp b/cocos/2d/CCTMXTiledMap.cpp
index d5a3d842e8..773cf01d24 100644
--- a/cocos/2d/CCTMXTiledMap.cpp
+++ b/cocos/2d/CCTMXTiledMap.cpp
@@ -102,6 +102,9 @@ TMXTiledMap::~TMXTiledMap()
TMXLayer * TMXTiledMap::parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
{
TMXTilesetInfo *tileset = tilesetForLayer(layerInfo, mapInfo);
+ if (tileset == nullptr)
+ return nullptr;
+
TMXLayer *layer = TMXLayer::create(tileset, layerInfo, mapInfo);
// tell the layerinfo to release the ownership of the tiles map.
@@ -171,9 +174,12 @@ void TMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
auto& layers = mapInfo->getLayers();
for(const auto &layerInfo : layers) {
- if (layerInfo->_visible)
- {
+ if (layerInfo->_visible) {
TMXLayer *child = parseLayer(layerInfo, mapInfo);
+ if (child == nullptr) {
+ idx++;
+ continue;
+ }
addChild(child, idx, idx);
// update content size with the max size
diff --git a/cocos/2d/MarchingSquare.cpp b/cocos/2d/MarchingSquare.cpp
index 773e51e7e8..b59b1502d6 100644
--- a/cocos/2d/MarchingSquare.cpp
+++ b/cocos/2d/MarchingSquare.cpp
@@ -257,8 +257,8 @@ void MarchingSquare::marchSquare(int startx, int starty)
{
//TODO: we triangulation cannot work collineer points, so we need to modify same point a little
//TODO: maybe we can detect if we go into a hole and coming back the hole, we should extract those points and remove them
- points.back().x -= 0.00001;
- points.back().y -= 0.00001;
+ points.back().x -= 0.00001f;
+ points.back().y -= 0.00001f;
points.push_back(Vec2((float)curx, (float)height-cury)/ scaleFactor);
}
else{
diff --git a/cocos/2d/cocos2dx.props b/cocos/2d/cocos2dx.props
index a0a234ee9f..f1a0af1cd4 100644
--- a/cocos/2d/cocos2dx.props
+++ b/cocos/2d/cocos2dx.props
@@ -7,7 +7,7 @@
- opengl32.lib;glew32.lib;libzlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;libwebp.lib;libiconv.lib;glfw3.lib;freetype250.lib;winmm.lib;ws2_32.lib;libchipmunk.lib;libbox2d.lib;libSpine.lib;%(AdditionalDependencies)
+ opengl32.lib;glew32.lib;libzlib.lib;libwebp.lib;libiconv.lib;freetype250.lib;winmm.lib;ws2_32.lib;libbox2d.lib;libSpine.lib;%(AdditionalDependencies)
$(OutDir);%(AdditionalLibraryDirectories)
false
diff --git a/cocos/2d/libcocos2d.vcxproj b/cocos/2d/libcocos2d.vcxproj
index fb05f4a5d9..66e821a166 100644
--- a/cocos/2d/libcocos2d.vcxproj
+++ b/cocos/2d/libcocos2d.vcxproj
@@ -432,6 +432,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
+
@@ -995,6 +996,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
+
diff --git a/cocos/2d/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d.vcxproj.filters
index 5f21b80697..0fa1979adb 100644
--- a/cocos/2d/libcocos2d.vcxproj.filters
+++ b/cocos/2d/libcocos2d.vcxproj.filters
@@ -1872,6 +1872,9 @@
renderer
+
+ base
+
@@ -3662,6 +3665,9 @@
renderer
+
+ base
+
diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems
index 723413e8ac..11dd2de823 100644
--- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems
+++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems
@@ -236,6 +236,9 @@
+
+
+
@@ -282,6 +285,7 @@
+
@@ -442,6 +446,14 @@
+
+
+
+
+
+
+
+
@@ -830,11 +842,15 @@
+
NotUsing
+
+
+
NotUsing
@@ -883,6 +899,7 @@
+
@@ -892,7 +909,7 @@
-
+
@@ -1019,6 +1036,14 @@
+
+
+
+
+
+
+
+
@@ -1222,4 +1247,7 @@
+
+
+
\ No newline at end of file
diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters
index d433b0f87d..73c955fe4c 100644
--- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters
+++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters
@@ -1791,6 +1791,43 @@
renderer
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ audioengine
+
+
+ audioengine
+
+
+ audioengine
+
+
+ audioengine
+
+
@@ -2776,9 +2813,6 @@
base
-
- base
-
base
@@ -3405,6 +3439,46 @@
renderer
+
+ audioengine
+
+
+ audioengine
+
+
+ audioengine
+
+
+ audioengine
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ base
+
+
@@ -3662,6 +3736,12 @@
{932c5f6e-07b3-4b34-97ae-2f3d42024149}
+
+ {bd1a6214-d6e0-4341-a1fc-79da99b55e35}
+
+
+ {e6f8ab69-f66f-48be-a40f-e33c08e77516}
+
@@ -3777,4 +3857,9 @@
3d
+
+
+ physics3d
+
+
\ No newline at end of file
diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Windows/libcocos2d_8_1.Windows.vcxproj b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Windows/libcocos2d_8_1.Windows.vcxproj
index 7a5ccc03d0..aa50019dda 100644
--- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Windows/libcocos2d_8_1.Windows.vcxproj
+++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Windows/libcocos2d_8_1.Windows.vcxproj
@@ -30,6 +30,9 @@
{3b26a12d-3a44-47ea-82d2-282660fc844d}
+
+ {ec2b1292-2d8c-4feb-a84b-2550b32c1ae7}
+
{f3550fe0-c795-44f6-8feb-093eb68143ae}
@@ -157,7 +160,7 @@
/Zm384 /bigobj %(AdditionalOptions)
pch.h
$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1\freetype2;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
- _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
+ _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
false
%(DisableSpecificWarnings)
@@ -177,7 +180,7 @@
/Zm384 /bigobj %(AdditionalOptions)
pch.h
$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1\freetype2;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
- _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)
+ _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)
false
%(DisableSpecificWarnings)
@@ -197,7 +200,7 @@
/Zm384 /bigobj %(AdditionalOptions)
pch.h
$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1\freetype2;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
- _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
+ _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
false
%(DisableSpecificWarnings)
@@ -217,7 +220,7 @@
/Zm384 /bigobj %(AdditionalOptions)
pch.h
$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1\freetype2;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
- _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)
+ _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)
false
%(DisableSpecificWarnings)
@@ -237,7 +240,7 @@
/Zm384 /bigobj %(AdditionalOptions)
pch.h
$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1\freetype2;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
- _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
+ _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
false
%(DisableSpecificWarnings)
@@ -257,7 +260,7 @@
/Zm384 /bigobj %(AdditionalOptions)
pch.h
$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1\freetype2;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
- _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)
+ _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)
false
%(DisableSpecificWarnings)
diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.WindowsPhone/libcocos2d_8_1.WindowsPhone.vcxproj b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.WindowsPhone/libcocos2d_8_1.WindowsPhone.vcxproj
index 9194a11930..d6f4970a79 100644
--- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.WindowsPhone/libcocos2d_8_1.WindowsPhone.vcxproj
+++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.WindowsPhone/libcocos2d_8_1.WindowsPhone.vcxproj
@@ -22,6 +22,9 @@
{22f798d8-bfff-4754-996f-a5395343d5ec}
+
+ {e35634bd-b91b-4a6d-b957-96f56dd065f9}
+
{cc1da216-a80d-4be4-b309-acb6af313aff}
@@ -111,7 +114,7 @@
/Zm384 /bigobj %(AdditionalOptions)
pch.h
$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1\freetype2;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
- CC_WINDOWS_PHONE_8_1;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
+ CC_WINDOWS_PHONE_8_1;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
false
%(DisableSpecificWarnings)
@@ -131,7 +134,7 @@
/Zm384 /bigobj %(AdditionalOptions)
pch.h
$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1\freetype2;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
- CC_WINDOWS_PHONE_8_1;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)
+ CC_WINDOWS_PHONE_8_1;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)
false
%(DisableSpecificWarnings)
@@ -151,7 +154,7 @@
/Zm384 /bigobj %(AdditionalOptions)
pch.h
$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1\freetype2;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
- CC_WINDOWS_PHONE_8_1;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
+ CC_WINDOWS_PHONE_8_1;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
false
%(DisableSpecificWarnings)
@@ -171,7 +174,7 @@
/Zm384 /bigobj %(AdditionalOptions)
pch.h
$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1\freetype2;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
- CC_WINDOWS_PHONE_8_1;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)
+ CC_WINDOWS_PHONE_8_1;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)
false
%(DisableSpecificWarnings)
diff --git a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj
new file mode 100644
index 0000000000..a6df06194a
--- /dev/null
+++ b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj
@@ -0,0 +1,1616 @@
+
+
+
+
+ Debug
+ ARM
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ ARM
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+ false
+ false
+ false
+ false
+ false
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+ false
+ false
+ false
+ false
+ false
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+ false
+ false
+ false
+ false
+ false
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+ NotUsing
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {ecee1119-ce2e-4f7e-83a8-1932ea48e893}
+
+
+
+ {07c2895d-720c-487d-b7b4-12c293ea533f}
+ DynamicLibrary
+ libcocos2d
+ libcocos2d
+ en-US
+ 14.0
+ true
+ Windows Store
+ 8.2
+ 10.0.10069.0
+ 10.0.10069.0
+
+
+
+ DynamicLibrary
+ true
+ v140
+
+
+ DynamicLibrary
+ true
+ v140
+
+
+ DynamicLibrary
+ true
+ v140
+
+
+ DynamicLibrary
+ false
+ true
+ v140
+
+
+ DynamicLibrary
+ false
+ true
+ v140
+
+
+ DynamicLibrary
+ false
+ true
+ v140
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+ false
+ libcocos2d_v3.7_Windows_10.0
+
+
+ false
+ false
+ libcocos2d_v3.7_Windows_10.0
+
+
+ false
+ false
+ false
+ libcocos2d_v3.7_Windows_10.0
+
+
+ false
+ false
+ false
+ libcocos2d_v3.7_Windows_10.0
+
+
+ false
+ false
+ libcocos2d_v3.7_Windows_10.0
+
+
+ false
+ false
+ libcocos2d_v3.7_Windows_10.0
+
+
+
+ Use
+ true
+ pch.h
+ _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
+ false
+ 4458;4459;%(DisableSpecificWarnings)
+ $(EngineRoot)external\win10-specific\zlib\include;$(EngineRoot)external\freetype2\include\win10\freetype2;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
+ /Zm384 /bigobj %(AdditionalOptions)
+ ProgramDatabase
+
+
+ Console
+ false
+ false
+
+
+
+
+ Use
+ true
+ pch.h
+ _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions)
+ false
+ 4458;4459;%(DisableSpecificWarnings)
+ $(EngineRoot)external\win10-specific\zlib\include;$(EngineRoot)external\freetype2\include\win10\freetype2;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
+ /Zm384 /bigobj %(AdditionalOptions)
+ false
+
+
+ Console
+ false
+ false
+
+
+
+
+
+ Use
+ true
+ pch.h
+ _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
+ false
+ 4458;4459;%(DisableSpecificWarnings)
+ $(EngineRoot)external\win10-specific\zlib\include;$(EngineRoot)external\freetype2\include\win10\freetype2;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
+ /Zm384 /bigobj %(AdditionalOptions)
+ ProgramDatabase
+
+
+ Console
+ false
+ false
+
+
+
+
+ Use
+ true
+ pch.h
+ _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions)
+ false
+ 4458;4459;%(DisableSpecificWarnings)
+ $(EngineRoot)external\win10-specific\zlib\include;$(EngineRoot)external\freetype2\include\win10\freetype2;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
+ /Zm384 /bigobj %(AdditionalOptions)
+ false
+ ProgramDatabase
+
+
+ Console
+ false
+ false
+
+
+
+
+
+ Use
+ true
+ pch.h
+ _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)
+ false
+ 4458;4459;%(DisableSpecificWarnings)
+ $(EngineRoot)external\win10-specific\zlib\include;$(EngineRoot)external\freetype2\include\win10\freetype2;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
+ /Zm384 /bigobj %(AdditionalOptions)
+ EditAndContinue
+
+
+ Console
+ false
+ false
+
+
+
+
+ Use
+ true
+ pch.h
+ _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions)
+ false
+ 4458;4459;%(DisableSpecificWarnings)
+ $(EngineRoot)external\win10-specific\zlib\include;$(EngineRoot)external\freetype2\include\win10\freetype2;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)
+ /Zm384 /bigobj %(AdditionalOptions)
+ false
+
+
+ Console
+ false
+ false
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters
new file mode 100644
index 0000000000..c79856b76e
--- /dev/null
+++ b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters
@@ -0,0 +1,3862 @@
+
+
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {7a1f75b9-e286-444c-9469-0cf18caf9851}
+
+
+ {0fee395c-63c7-44c6-a4f4-1f36e2c87bb8}
+
+
+ {50c0af16-c916-4fa8-9fa2-b86e38449e26}
+
+
+ {5aeb6e4f-9e25-4b88-b583-fa11189743a0}
+
+
+ {cfeb83ba-f330-49a3-a32f-4360729feb34}
+
+
+ {48ef00ff-acc8-4c9c-a6e4-00d72e737ad2}
+
+
+ {f2236b85-0526-49e2-a18c-ac4951062666}
+
+
+ {33f548c2-d835-4404-9e44-ad1511588c8e}
+
+
+ {26495053-242d-4ec8-bf5a-6ea6f5ac4000}
+
+
+ {94bbb957-b493-45d2-9f5a-753ac1ab78ce}
+
+
+ {a2141e87-a561-433e-905b-63ff5c4e0e6e}
+
+
+ {661c905d-7ec2-4161-8b09-1c22ddefb830}
+
+
+ {6b13d475-62b0-4d73-8cee-52f077aa3fe7}
+
+
+ {33af945f-9ffb-4e87-9467-7774d4cbaaee}
+
+
+ {abb46246-b4f9-4ad0-8db8-11b47ce43a1f}
+
+
+ {e779fbed-6102-4689-81bd-57b2e70b0f26}
+
+
+ {769e8f33-4eef-4d34-a192-6113354d584f}
+
+
+ {2775a689-9303-4568-8bdd-85793c152dc0}
+
+
+ {d58e753e-e7d1-49ea-970a-4e980b04cffa}
+
+
+ {9ec27523-fcde-48f7-8f77-34e2f2c51d3d}
+
+
+ {e7a997f1-97ef-408f-9455-132da617f439}
+
+
+ {b7fa88eb-4dd8-4476-89b3-665a128ecd49}
+
+
+ {84e54bc0-68a3-4466-b64b-147525501276}
+
+
+ {1c30324c-b033-419a-b0bc-fcd04bf5e887}
+
+
+ {5f24927a-be4e-43d4-bfa6-19a11c86ba74}
+
+
+ {b4dfd33e-325a-45e5-b5c4-bc759a765944}
+
+
+ {1adc7897-87b2-4fa2-9de1-a662bbc0cef2}
+
+
+ {8f07e318-d877-4880-834e-0e5a36759148}
+
+
+ {47260f4a-f9ab-4801-8a7f-5610755592f6}
+
+
+ {69e44658-eabe-4434-bc55-09ba8fc18a65}
+
+
+ {0a31f1b5-366b-4b0e-b998-6eee00a5e232}
+
+
+ {c2ef43b9-5a8e-4810-9430-31427c61cd57}
+
+
+ {377b23e6-4800-4305-b6de-7ffd6ab75445}
+
+
+ {3629c3cd-b691-403d-bec6-6915a63304bd}
+
+
+ {46c2c273-aa0e-4bc5-8eea-3aa512372d3a}
+
+
+ {09f711eb-3ba4-447e-85a0-b2b5ebb40328}
+
+
+ {ed4442ff-0420-424c-bbfa-720b8ab658d0}
+
+
+ {e6726a08-977a-4d22-b4b4-4e8c5aa75c80}
+
+
+ {33cb6b93-333c-4f05-bc0b-e17ac95abdf9}
+
+
+ {e74ad41e-c739-4e66-8b54-15914b651f1b}
+
+
+ {e6a2d595-06dc-436f-b5d7-57e8852f800e}
+
+
+ {5b4d4e9c-90de-496a-9897-930e48c96052}
+
+
+ {f711caa7-1c16-43ec-8f2e-92438bfdd92d}
+
+
+ {9b4e1b59-dc28-49aa-9b93-05ae39afeef4}
+
+
+ {566aad08-9d43-48ff-99a0-3f4a8e6cfa23}
+
+
+ {ebca298d-3724-42b8-923f-934f2df267de}
+
+
+ {2e9af99e-c268-459a-9615-9f3c5b58efdc}
+
+
+ {cdcb5464-cce7-4252-9fa9-0113c6f88731}
+
+
+ {6ba31aca-4ffb-4c7f-86b3-68c686e9e83a}
+
+
+ {12508884-4921-4027-9e3f-0afcc4d51b18}
+
+
+ {d28da99a-5849-465a-a1ef-a39f13b8d71b}
+
+
+ {5c9216f7-37c5-45a7-abd5-0f91ab126e78}
+
+
+ {efebb9af-0744-4d20-947b-a118679860ba}
+
+
+ {c67477ac-753e-48da-9f7c-2044d8d3561c}
+
+
+ {b96929a6-1068-4e34-ba12-9b1506c52029}
+
+
+ {2b9df357-22d4-4fd0-b797-a9bfb25a2f49}
+
+
+ {cd711175-67df-4a15-bc83-c13422334b46}
+
+
+ {2520090a-69d8-46d3-a958-de49c068035c}
+
+
+ {21031d69-8a1d-468a-98d7-2c3080705ab3}
+
+
+ {b666aa35-1920-44d0-8311-86e80b7a010a}
+
+
+ {21d16309-93ee-4b38-a10a-de87be25dcc9}
+
+
+ {939431be-589b-461b-a4dd-791ad66e9611}
+
+
+ {00ac48e4-fa60-4020-b924-18562a81d799}
+
+
+ {593b7ac7-693d-4a46-ab32-e0203004e865}
+
+
+ {6651f0d8-3685-457c-9674-91ba9c2bde9b}
+
+
+ {922ba080-bc7b-4493-b12a-2ccf5ccc3d68}
+
+
+ {7bfc1d7e-a562-4ef8-82f0-af7c5f9ec004}
+
+
+ {fff4ac28-7649-4202-85ee-4fc22b4de31b}
+
+
+ {d0b5ce80-dfff-44b8-8ca0-c01ec18c3983}
+
+
+ {8d2b7057-43b4-41e4-a752-0cfc20b1c825}
+
+
+ {1715f2ff-18ed-405a-a0b7-1bb7fc7968de}
+
+
+ {7a8dbff0-49af-4a9e-af07-7ecc643cf7d0}
+
+
+ {287c8ea7-54ab-4514-94ad-bc60fca8e2f6}
+
+
+ {f8e329a2-40aa-428b-b111-3b788023c5e0}
+
+
+ {0a443764-b762-4858-b578-114bfc5d7ab5}
+
+
+ {6fcf3801-c3e1-4097-ba82-3da0a6599555}
+
+
+ {acb13cf1-4b21-4392-826a-0ca62db8afe9}
+
+
+ {92cd288c-1327-4990-8ae2-dab11fa3a69c}
+
+
+ {bc47263f-0690-488e-b240-0b7bf763f401}
+
+
+ {5937896e-882c-429a-ada7-72c799c06920}
+
+
+ {f68e83b4-2fa3-4f47-9864-e7dfd90c16a6}
+
+
+
+
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base\allocator
+
+
+ base\allocator
+
+
+ base\allocator
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosdenshion\winrt
+
+
+ cocosdenshion\winrt
+
+
+ cocosdenshion\winrt
+
+
+ cocostudio\action
+
+
+ cocostudio\action
+
+
+ cocostudio\action
+
+
+ cocostudio\action
+
+
+ cocostudio\action
+
+
+ cocostudio\armature
+
+
+ cocostudio\armature
+
+
+ cocostudio\armature\animation
+
+
+ cocostudio\armature\animation
+
+
+ cocostudio\armature\animation
+
+
+ cocostudio\armature\datas
+
+
+ cocostudio\armature\display
+
+
+ cocostudio\armature\display
+
+
+ cocostudio\armature\display
+
+
+ cocostudio\armature\display
+
+
+ cocostudio\armature\display
+
+
+ cocostudio\armature\physics
+
+
+ cocostudio\armature\utils
+
+
+ cocostudio\armature\utils
+
+
+ cocostudio\armature\utils
+
+
+ cocostudio\armature\utils
+
+
+ cocostudio\armature\utils
+
+
+ cocostudio\armature\utils
+
+
+ cocostudio\components
+
+
+ cocostudio\components
+
+
+ cocostudio\components
+
+
+ cocostudio\components
+
+
+ cocostudio\components
+
+
+ cocostudio\json
+
+
+ cocostudio\json
+
+
+ cocostudio\json
+
+
+ cocostudio\json
+
+
+ cocostudio\json
+
+
+ cocostudio\json
+
+
+ cocostudio\json\flatbuffers
+
+
+ cocostudio\json\flatbuffers
+
+
+ cocostudio\json\flatbuffers
+
+
+ cocostudio\json\flatbuffers
+
+
+ cocostudio\json\flatbuffers
+
+
+ cocostudio\json\flatbuffers
+
+
+ cocostudio\trigger
+
+
+ cocostudio\trigger
+
+
+ cocostudio\trigger
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\reader\WidgetReader
+
+
+ cocostudio\reader\WidgetReader
+
+
+ cocostudio\reader\WidgetReader
+
+
+ cocostudio\reader\WidgetReader\ArmatureNodeReader
+
+
+ cocostudio\reader\WidgetReader\ButtonReader
+
+
+ cocostudio\reader\WidgetReader\CheckBoxReader
+
+
+ cocostudio\reader\WidgetReader\ComAudioReader
+
+
+ cocostudio\reader\WidgetReader\GameMapReader
+
+
+ cocostudio\reader\WidgetReader\ImageViewReader
+
+
+ cocostudio\reader\WidgetReader\LayoutReader
+
+
+ cocostudio\reader\WidgetReader\ListViewReader
+
+
+ cocostudio\reader\WidgetReader\LoadingBarReader
+
+
+ cocostudio\reader\WidgetReader\Node3DReader
+
+
+ cocostudio\reader\WidgetReader\NodeReader
+
+
+ cocostudio\reader\WidgetReader\PageViewReader
+
+
+ cocostudio\reader\WidgetReader\Particle3DReader
+
+
+ cocostudio\reader\WidgetReader\ParticleReader
+
+
+ cocostudio\reader\WidgetReader\ProjectNodeReader
+
+
+ cocostudio\reader\WidgetReader\ScrollViewReader
+
+
+ cocostudio\reader\WidgetReader\SliderReader
+
+
+ cocostudio\reader\WidgetReader\SliderReader
+
+
+ cocostudio\reader\WidgetReader\Sprite3DReader
+
+
+ cocostudio\reader\WidgetReader\SpriteReader
+
+
+ cocostudio\reader\WidgetReader\TextAtlasReader
+
+
+ cocostudio\reader\WidgetReader\TextBMFontReader
+
+
+ cocostudio\reader\WidgetReader\TextFieldReader
+
+
+ cocostudio\reader\WidgetReader\TextReader
+
+
+ cocostudio\reader\WidgetReader\UserCameraReader
+
+
+ deprecated
+
+
+ deprecated
+
+
+ deprecated
+
+
+ deprecated
+
+
+ deprecated
+
+
+ deprecated
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCScrollView
+
+
+ extension\GUI\CCScrollView
+
+
+ extension\GUI\CCScrollView
+
+
+ extension\Particle3D
+
+
+ extension\Particle3D
+
+
+ extension\Particle3D
+
+
+ extension\Particle3D
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\physics_nodes
+
+
+ extension\physics_nodes
+
+
+ extension
+
+
+ external\ConvertUTF
+
+
+ external\ConvertUTF
+
+
+ external\edtaa
+
+
+ external\xxhash
+
+
+ external\unzip
+
+
+ external\unzip
+
+
+ external\unzip
+
+
+ external\tinyxml2
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ network
+
+
+ network
+
+
+ network
+
+
+ physics
+
+
+ physics
+
+
+ physics
+
+
+ physics
+
+
+ physics
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ storage
+
+
+ ui\BaseClasses
+
+
+ ui\BaseClasses
+
+
+ ui\Layouts
+
+
+ ui\Layouts
+
+
+ ui\Layouts
+
+
+ ui\Layouts
+
+
+ ui\Layouts
+
+
+ ui\Layouts
+
+
+ ui\Layouts
+
+
+ ui\System
+
+
+ ui\System
+
+
+ ui\System
+
+
+ ui\UIWidgets\EditBox
+
+
+ ui\UIWidgets\EditBox
+
+
+ ui\UIWidgets\ScrollWidget
+
+
+ ui\UIWidgets\ScrollWidget
+
+
+ ui\UIWidgets\ScrollWidget
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ cocostudio\reader
+
+
+ cocostudio\reader
+
+
+ platform\winrt
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ external\poly2tri\common
+
+
+ external\poly2tri\sweep
+
+
+ external\poly2tri\sweep
+
+
+ external\poly2tri\sweep
+
+
+ external\poly2tri\sweep
+
+
+ network
+
+
+ network
+
+
+ base
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ base
+
+
+ base
+
+
+ audioengine
+
+
+ audioengine
+
+
+ audioengine
+
+
+ audioengine
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+
+
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ 3d
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base
+
+
+ base\allocator
+
+
+ base\allocator
+
+
+ base\allocator
+
+
+ base\allocator
+
+
+ base\allocator
+
+
+ base\allocator
+
+
+ base\allocator
+
+
+ base\allocator
+
+
+ base\allocator
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosbuilder
+
+
+ cocosdenshion\include
+
+
+ cocosdenshion\include
+
+
+ cocosdenshion\include
+
+
+ cocosdenshion\winrt
+
+
+ cocosdenshion\winrt
+
+
+ cocostudio
+
+
+ cocostudio\action
+
+
+ cocostudio\action
+
+
+ cocostudio\action
+
+
+ cocostudio\action
+
+
+ cocostudio\action
+
+
+ cocostudio\armature
+
+
+ cocostudio\armature
+
+
+ cocostudio\armature\animation
+
+
+ cocostudio\armature\animation
+
+
+ cocostudio\armature\animation
+
+
+ cocostudio\armature\datas
+
+
+ cocostudio\armature\display
+
+
+ cocostudio\armature\display
+
+
+ cocostudio\armature\display
+
+
+ cocostudio\armature\display
+
+
+ cocostudio\armature\display
+
+
+ cocostudio\armature\physics
+
+
+ cocostudio\armature\utils
+
+
+ cocostudio\armature\utils
+
+
+ cocostudio\armature\utils
+
+
+ cocostudio\armature\utils
+
+
+ cocostudio\armature\utils
+
+
+ cocostudio\armature\utils
+
+
+ cocostudio\components
+
+
+ cocostudio\components
+
+
+ cocostudio\components
+
+
+ cocostudio\components
+
+
+ cocostudio\components
+
+
+ cocostudio\components
+
+
+ cocostudio\json
+
+
+ cocostudio\json
+
+
+ cocostudio\json
+
+
+ cocostudio\json
+
+
+ cocostudio\json
+
+
+ cocostudio\json
+
+
+ cocostudio\json
+
+
+ cocostudio\json
+
+
+ cocostudio\json\flatbuffers
+
+
+ cocostudio\json\flatbuffers
+
+
+ cocostudio\json\flatbuffers
+
+
+ cocostudio\trigger
+
+
+ cocostudio\trigger
+
+
+ cocostudio\trigger
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\TimelineAction
+
+
+ cocostudio\reader\WidgetReader
+
+
+ cocostudio\reader\WidgetReader
+
+
+ cocostudio\reader\WidgetReader
+
+
+ cocostudio\reader\WidgetReader
+
+
+ cocostudio\reader\WidgetReader\ArmatureNodeReader
+
+
+ cocostudio\reader\WidgetReader\ArmatureNodeReader
+
+
+ cocostudio\reader\WidgetReader\ButtonReader
+
+
+ cocostudio\reader\WidgetReader\CheckBoxReader
+
+
+ cocostudio\reader\WidgetReader\ComAudioReader
+
+
+ cocostudio\reader\WidgetReader\GameMapReader
+
+
+ cocostudio\reader\WidgetReader\ImageViewReader
+
+
+ cocostudio\reader\WidgetReader\LayoutReader
+
+
+ cocostudio\reader\WidgetReader\ListViewReader
+
+
+ cocostudio\reader\WidgetReader\LoadingBarReader
+
+
+ cocostudio\reader\WidgetReader\Node3DReader
+
+
+ cocostudio\reader\WidgetReader\NodeReader
+
+
+ cocostudio\reader\WidgetReader\PageViewReader
+
+
+ cocostudio\reader\WidgetReader\Particle3DReader
+
+
+ cocostudio\reader\WidgetReader\ParticleReader
+
+
+ cocostudio\reader\WidgetReader\ProjectNodeReader
+
+
+ cocostudio\reader\WidgetReader\ScrollViewReader
+
+
+ cocostudio\reader\WidgetReader\SliderReader
+
+
+ cocostudio\reader\WidgetReader\SliderReader
+
+
+ cocostudio\reader\WidgetReader\Sprite3DReader
+
+
+ cocostudio\reader\WidgetReader\SpriteReader
+
+
+ cocostudio\reader\WidgetReader\TextAtlasReader
+
+
+ cocostudio\reader\WidgetReader\TextBMFontReader
+
+
+ cocostudio\reader\WidgetReader\TextFieldReader
+
+
+ cocostudio\reader\WidgetReader\TextReader
+
+
+ cocostudio\reader\WidgetReader\UserCameraReader
+
+
+ deprecated
+
+
+ deprecated
+
+
+ deprecated
+
+
+ deprecated
+
+
+ deprecated
+
+
+ deprecated
+
+
+ deprecated
+
+
+ deprecated
+
+
+ deprecated
+
+
+ deprecated
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCControlExtensions
+
+
+ extension\GUI\CCScrollView
+
+
+ extension\GUI\CCScrollView
+
+
+ extension\GUI\CCScrollView
+
+
+ extension\Particle3D
+
+
+ extension\Particle3D
+
+
+ extension\Particle3D
+
+
+ extension\Particle3D
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\Particle3D\PU
+
+
+ extension\physics_nodes
+
+
+ extension\physics_nodes
+
+
+ extension
+
+
+ extension
+
+
+ extension
+
+
+ extension
+
+
+ external\ConvertUTF
+
+
+ external\edtaa
+
+
+ external\xxhash
+
+
+ external\unzip
+
+
+ external\unzip
+
+
+ external\unzip
+
+
+ external\unzip
+
+
+ external\tinyxml2
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ network
+
+
+ network
+
+
+ network
+
+
+ network
+
+
+ network
+
+
+ network
+
+
+ physics
+
+
+ physics
+
+
+ physics
+
+
+ physics
+
+
+ physics
+
+
+ physics
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ platform\winrt
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ storage
+
+
+ ui\BaseClasses
+
+
+ ui\BaseClasses
+
+
+ ui\Layouts
+
+
+ ui\Layouts
+
+
+ ui\Layouts
+
+
+ ui\Layouts
+
+
+ ui\Layouts
+
+
+ ui\Layouts
+
+
+ ui\Layouts
+
+
+ ui\System
+
+
+ ui\System
+
+
+ ui\System
+
+
+ ui\System
+
+
+ ui\UIWidgets\EditBox
+
+
+ ui\UIWidgets\EditBox
+
+
+ ui\UIWidgets\EditBox
+
+
+ ui\UIWidgets\ScrollWidget
+
+
+ ui\UIWidgets\ScrollWidget
+
+
+ ui\UIWidgets\ScrollWidget
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ ui\UIWidgets
+
+
+ cocostudio\reader
+
+
+ cocostudio\reader
+
+
+ platform\winrt
+
+
+ 2d
+
+
+ 2d
+
+
+ 2d
+
+
+ external\poly2tri
+
+
+ external\poly2tri\common
+
+
+ external\poly2tri\common
+
+
+ external\poly2tri\sweep
+
+
+ external\poly2tri\sweep
+
+
+ external\poly2tri\sweep
+
+
+ external\poly2tri\sweep
+
+
+ network
+
+
+ base
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ base
+
+
+ audioengine
+
+
+ audioengine
+
+
+ audioengine
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+ physics3d
+
+
+
+
+ base
+
+
+ base
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+ renderer
+
+
+
+
+ renderer
+
+
+
\ No newline at end of file
diff --git a/cocos/2d/win10_props/cocos2d_win10.props b/cocos/2d/win10_props/cocos2d_win10.props
new file mode 100644
index 0000000000..b5bfaeca85
--- /dev/null
+++ b/cocos/2d/win10_props/cocos2d_win10.props
@@ -0,0 +1,32 @@
+
+
+
+
+ $(MSBuildThisFileDirectory)..\..\..\
+
+
+
+
+ $(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM)\freetype2;$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;$(EngineRoot)external\poly2tri;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;%(AdditionalIncludeDirectories)
+
+
+ WINRT;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;RAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN;%(PreprocessorDefinitions)
+ true
+ true
+ false
+ OldStyle
+ 4056;4244;4251;4756;4453;28204;4099;
+
+
+ libGLESv2.lib;libEGL.lib;ws2_32.lib;libwebsockets.lib;chipmunk.lib;zlib.lib;freetype.lib;sqlite3.lib;d2d1.lib;d3d11.lib;dxgi.lib;windowscodecs.lib;dwrite.lib;dxguid.lib;xaudio2.lib;mfcore.lib;mfplat.lib;mfreadwrite.lib;mfuuid.lib;%(AdditionalDependencies)
+ $(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\prebuilt\$(Platform);$(EngineRoot)external\websockets\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\chipmunk\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\zlib\prebuilt\$(Platform);$(EngineRoot)external\sqlite3\libraries\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\freetype2\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\poly2tri;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;%(AdditionalLibraryDirectories);
+ /IGNORE:4264 %(AdditionalOptions)
+
+
+
+
+ $(EngineRoot)
+ true
+
+
+
\ No newline at end of file
diff --git a/cocos/2d/win10_props/cocos2d_win10_app.props b/cocos/2d/win10_props/cocos2d_win10_app.props
new file mode 100644
index 0000000000..9d5ace9ee9
--- /dev/null
+++ b/cocos/2d/win10_props/cocos2d_win10_app.props
@@ -0,0 +1,27 @@
+
+
+
+
+ $(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\prebuilt\$(Platform)\
+ $(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\zlib\prebuilt\$(Platform)\
+ $(EngineRoot)external\websockets\prebuilt\$(COCOS2D_PLATFORM)\$(Platform)\
+ $(EngineRoot)external\sqlite3\libraries\$(COCOS2D_PLATFORM)\$(Platform)\
+
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+
\ No newline at end of file
diff --git a/cocos/2d/winrt_props/cocos2d_winrt_platform.props b/cocos/2d/win10_props/cocos2d_win10_platform.props
similarity index 59%
rename from cocos/2d/winrt_props/cocos2d_winrt_platform.props
rename to cocos/2d/win10_props/cocos2d_win10_platform.props
index 761976bf4e..14747a896d 100644
--- a/cocos/2d/winrt_props/cocos2d_winrt_platform.props
+++ b/cocos/2d/win10_props/cocos2d_win10_platform.props
@@ -2,6 +2,11 @@
- winrt_8.1
+ win10
+
+
+ msxml6.lib;%(AdditionalDependencies)
+
+
\ No newline at end of file
diff --git a/cocos/2d/winrt_8.1_props/cocos2d_winrt_8.1.props b/cocos/2d/winrt_8.1_props/cocos2d_winrt_8.1.props
index 672498aa94..3e56e02d37 100644
--- a/cocos/2d/winrt_8.1_props/cocos2d_winrt_8.1.props
+++ b/cocos/2d/winrt_8.1_props/cocos2d_winrt_8.1.props
@@ -10,12 +10,12 @@
$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM)\freetype2;$(EngineRoot)external\curl\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;$(EngineRoot)external\poly2tri;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;%(AdditionalIncludeDirectories)
- WINRT;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)
+ WINRT;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;RAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN;%(PreprocessorDefinitions)
true
true
false
OldStyle
- 4056;4244;4251;4756;4453;28204;
+ 4056;4244;4251;4756;4453;28204;4099;
libGLESv2.lib;libEGL.lib;ws2_32.lib;libwebsockets.lib;libcurl.lib;chipmunk.lib;zlib.lib;freetype.lib;sqlite3.lib;d2d1.lib;d3d11.lib;dxgi.lib;windowscodecs.lib;dwrite.lib;dxguid.lib;xaudio2.lib;mfcore.lib;mfplat.lib;mfreadwrite.lib;mfuuid.lib;%(AdditionalDependencies)
diff --git a/cocos/2d/winrt_props/cocos2d_winrt.props b/cocos/2d/winrt_props/cocos2d_winrt.props
deleted file mode 100644
index a35aa77534..0000000000
--- a/cocos/2d/winrt_props/cocos2d_winrt.props
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
- $(MSBuildThisFileDirectory)..\..\..\
-
-
-
-
- $(EngineRoot)external\winrt-specific\angle\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\curl\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;$(EngineRoot)external\poly2tri;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;%(AdditionalIncludeDirectories);
-
-
- WINRT;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)
- true
- true
- false
- OldStyle
- 4056;4996;4244;4251;
-
-
- libGLESv2.lib;libEGL.lib;ws2_32.lib;libwebsockets.lib;libcurl.lib;libchipmunk.lib;zlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;freetype250.lib;sqlite3.lib;d2d1.lib;d3d11.lib;dxgi.lib;windowscodecs.lib;dwrite.lib;dxguid.lib;xaudio2.lib;mfcore.lib;mfplat.lib;mfreadwrite.lib;mfuuid.lib;%(AdditionalDependencies)
- $(EngineRoot)external\winrt-specific\angle\prebuilt\$(Platform);$(EngineRoot)external\curl\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\websockets\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\chipmunk\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\zlib\prebuilt\$(Platform);$(EngineRoot)external\png\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\tiff\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\jpeg\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\sqlite3\libraries\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\freetype2\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\poly2tri;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;%(AdditionalLibraryDirectories);
- /IGNORE:4264 %(AdditionalOptions)
-
-
-
-
- $(EngineRoot)
- true
-
-
-
\ No newline at end of file
diff --git a/cocos/2d/winrt_props/cocos2d_winrt_app.props b/cocos/2d/winrt_props/cocos2d_winrt_app.props
deleted file mode 100644
index d0685779c1..0000000000
--- a/cocos/2d/winrt_props/cocos2d_winrt_app.props
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- $(EngineRoot)external\winrt-specific\angle\prebuilt\$(Platform)\
-
-
-
- true
-
-
- true
-
-
-
\ No newline at end of file
diff --git a/cocos/3d/CCBillBoard.cpp b/cocos/3d/CCBillBoard.cpp
index 95ec6aacd9..b8bbcb5238 100644
--- a/cocos/3d/CCBillBoard.cpp
+++ b/cocos/3d/CCBillBoard.cpp
@@ -230,10 +230,10 @@ void BillBoard::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
//FIXME: frustum culling here
flags |= Node::FLAGS_RENDER_AS_3D;
- _quadCommand.init(0, _texture->getName(), getGLProgramState(), _blendFunc, &_quad, 1, _modelViewTransform, flags);
- _quadCommand.setTransparent(true);
- _quadCommand.set3D(true);
- renderer->addCommand(&_quadCommand);
+ _trianglesCommand.init(0, _texture->getName(), getGLProgramState(), _blendFunc, getRenderedTriangles(), _modelViewTransform, flags);
+ _trianglesCommand.setTransparent(true);
+ _trianglesCommand.set3D(true);
+ renderer->addCommand(&_trianglesCommand);
}
void BillBoard::setMode( Mode mode )
diff --git a/cocos/3d/CCBundle3D.cpp b/cocos/3d/CCBundle3D.cpp
index 247cf35e29..baccc3db2e 100644
--- a/cocos/3d/CCBundle3D.cpp
+++ b/cocos/3d/CCBundle3D.cpp
@@ -760,18 +760,27 @@ bool Bundle3D::loadMeshDatasJson(MeshDatas& meshdatas)
meshData->subMeshIndices.push_back(indexArray);
meshData->numIndex = (int)meshData->subMeshIndices.size();
- //meshData->subMeshAABB.push_back(calculateAABB(meshData->vertex, meshData->getPerVertexSize(), indexArray));
- const rapidjson::Value& mesh_part_aabb = mesh_part[AABBS];
- if (mesh_part.HasMember(AABBS) && mesh_part_aabb.Size() == 6)
+ if(mesh_data.HasMember(AABBS))
{
- Vec3 min(mesh_part_aabb[(rapidjson::SizeType)0].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)1].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)2].GetDouble());
- Vec3 max(mesh_part_aabb[(rapidjson::SizeType)3].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)4].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)5].GetDouble());
- meshData->subMeshAABB.push_back(AABB(min, max));
+ const rapidjson::Value& mesh_part_aabb = mesh_part[AABBS];
+ if (mesh_part.HasMember(AABBS) && mesh_part_aabb.Size() == 6)
+ {
+ Vec3 min(mesh_part_aabb[(rapidjson::SizeType)0].GetDouble(),
+ mesh_part_aabb[(rapidjson::SizeType)1].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)2].GetDouble());
+ Vec3 max(mesh_part_aabb[(rapidjson::SizeType)3].GetDouble(),
+ mesh_part_aabb[(rapidjson::SizeType)4].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)5].GetDouble());
+ meshData->subMeshAABB.push_back(AABB(min, max));
+ }
+ else
+ {
+ meshData->subMeshAABB.push_back(calculateAABB(meshData->vertex, meshData->getPerVertexSize(), indexArray));
+ }
}
else
{
meshData->subMeshAABB.push_back(calculateAABB(meshData->vertex, meshData->getPerVertexSize(), indexArray));
}
+
}
meshdatas.meshDatas.push_back(meshData);
}
diff --git a/cocos/3d/CCSkybox.cpp b/cocos/3d/CCSkybox.cpp
index dc6e841340..ddcab5f257 100644
--- a/cocos/3d/CCSkybox.cpp
+++ b/cocos/3d/CCSkybox.cpp
@@ -152,18 +152,32 @@ void Skybox::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
void Skybox::onDraw(const Mat4& transform, uint32_t flags)
{
- Mat4 trans(transform);
- const cocos2d::Vec3 pos(Camera::getVisitingCamera()->getPosition3D());
- trans.m[12] = pos.x;
- trans.m[13] = pos.y;
- trans.m[14] = pos.z;
-
+ auto camera = Camera::getVisitingCamera();
+
+ /*
+ At beginning, we have a regular skybox at origin point.
+ To render the skybox, we should keep camera at the center of skybox.
+ So we need a translate matrix, which can transform origin point to camera pos.
+ Camera's node to word transform matrix don't match our requement,
+ because it maybe contain the scale, rotate, reflact... effects, which isn't need.
+ First, we transform origin point to camera position by camera's node to world matrix.
+ Second, we create a translate matrix with the origin point's world position.
+ */
+ Vec3 cameraPosInNode(0, 0, 0);
+ Vec3 cameraPosInWorld;
+ Mat4 cameraModelMat = camera->getNodeToWorldTransform();
+ Mat4 trans = Mat4::IDENTITY;
+ cameraModelMat.transformPoint(cameraPosInNode, &cameraPosInWorld);
+ trans.translate(cameraPosInWorld);
+
auto state = getGLProgramState();
state->apply(trans);
Vec4 color(_displayedColor.r / 255.f, _displayedColor.g / 255.f, _displayedColor.b / 255.f, 1.f);
state->setUniformVec4("u_color", color);
-
+ float scalf = (camera->getFarPlane() + camera->getNearPlane()) / 2;
+ state->setUniformFloat("u_scalef", scalf);
+
GLboolean depthFlag = glIsEnabled(GL_DEPTH_TEST);
GLint depthFunc;
glGetIntegerv(GL_DEPTH_FUNC, &depthFunc);
diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp
index f50a2564c1..091ec7ddb2 100644
--- a/cocos/3d/CCSprite3D.cpp
+++ b/cocos/3d/CCSprite3D.cpp
@@ -701,7 +701,7 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
#if CC_USE_CULLING
// camera clipping
- if(!Camera::getVisitingCamera()->isVisibleInFrustum(&this->getAABB()))
+ if(Camera::getVisitingCamera() && !Camera::getVisitingCamera()->isVisibleInFrustum(&this->getAABB()))
return;
#endif
diff --git a/cocos/3d/CCTerrain.cpp b/cocos/3d/CCTerrain.cpp
index d8c9b13a4f..a309052a98 100644
--- a/cocos/3d/CCTerrain.cpp
+++ b/cocos/3d/CCTerrain.cpp
@@ -33,6 +33,7 @@ USING_NS_CC;
#include "renderer/CCRenderer.h"
#include "renderer/CCGLProgramStateCache.h"
#include "renderer/ccGLStateCache.h"
+#include "renderer/CCRenderState.h"
#include "base/CCDirector.h"
#include "2d/CCCamera.h"
@@ -79,6 +80,12 @@ bool Terrain::initProperties()
auto state = GLProgramState::create(shader);
setGLProgramState(state);
+
+ _stateBlock->setBlend(false);
+ _stateBlock->setDepthWrite(true);
+ _stateBlock->setDepthTest(true);
+ _stateBlock->setCullFace(true);
+
setDrawWire(false);
setIsEnableFrustumCull(true);
setAnchorPoint(Vec2(0,0));
@@ -93,6 +100,13 @@ void Terrain::draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform,
void Terrain::onDraw(const Mat4 &transform, uint32_t flags)
{
+ auto modelMatrix = getNodeToWorldTransform();
+ if(memcmp(&modelMatrix,&_terrainModelMatrix,sizeof(Mat4))!=0)
+ {
+ _terrainModelMatrix = modelMatrix;
+ _quadRoot->preCalculateAABB(_terrainModelMatrix);
+ }
+
auto glProgram = getGLProgram();
glProgram->use();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
@@ -104,34 +118,16 @@ void Terrain::onDraw(const Mat4 &transform, uint32_t flags)
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
}
#endif
- GLboolean blendCheck = glIsEnabled(GL_BLEND);
- if(blendCheck)
- {
- glDisable(GL_BLEND);
- }
+
+ _stateBlock->bind();
+
GL::enableVertexAttribs(1<<_positionLocation | 1 << _texcordLocation | 1<<_normalLocation);
glProgram->setUniformsForBuiltins(transform);
- GLboolean depthMaskCheck;
- glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMaskCheck);
- if(!depthMaskCheck)
- {
- glDepthMask(GL_TRUE);
- }
- GLboolean CullFaceCheck =glIsEnabled(GL_CULL_FACE);
- if(!CullFaceCheck)
- {
- glEnable(GL_CULL_FACE);
- }
- GLboolean depthTestCheck;
- depthTestCheck = glIsEnabled(GL_DEPTH_TEST);
- if(!depthTestCheck)
- {
- glEnable(GL_DEPTH_TEST);
- }
+
if(!_alphaMap)
{
glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D,_detailMapTextures[0]->getName());
+ GL::bindTexture2D(_detailMapTextures[0]->getName());
glUniform1i(_detailMapLocation[0],0);
glUniform1i(_alphaIsHasAlphaMapLocation,0);
}else
@@ -139,7 +135,7 @@ void Terrain::onDraw(const Mat4 &transform, uint32_t flags)
for(int i =0;i<_maxDetailMapValue;i++)
{
glActiveTexture(GL_TEXTURE0+i);
- glBindTexture(GL_TEXTURE_2D,_detailMapTextures[i]->getName());
+ GL::bindTexture2D(_detailMapTextures[i]->getName());
glUniform1i(_detailMapLocation[i],i);
glUniform1f(_detailMapSizeLocation[i],_terrainData._detailMaps[i]._detailMapSize);
@@ -148,7 +144,7 @@ void Terrain::onDraw(const Mat4 &transform, uint32_t flags)
glUniform1i(_alphaIsHasAlphaMapLocation,1);
glActiveTexture(GL_TEXTURE4);
- glBindTexture(GL_TEXTURE_2D,_alphaMap->getName());
+ GL::bindTexture2D(_alphaMap->getName());
glUniform1i(_alphaMapLocation,4);
}
@@ -164,6 +160,8 @@ void Terrain::onDraw(const Mat4 &transform, uint32_t flags)
if(_isCameraViewChanged )
{
auto camPos = camera->getPosition3D();
+ auto camModelMat = camera->getNodeToWorldTransform();
+ camModelMat.transformPoint(&camPos);
//set lod
setChunksLOD(camPos);
}
@@ -180,28 +178,7 @@ void Terrain::onDraw(const Mat4 &transform, uint32_t flags)
_isCameraViewChanged = false;
}
glActiveTexture(GL_TEXTURE0);
- if(depthTestCheck)
- {
- }else
- {
- glDisable(GL_DEPTH_TEST);
- }
- if(depthMaskCheck)
- {
- }else
- {
- glDepthMask(GL_FALSE);
- }
- if(CullFaceCheck)
- {
- }else
- {
- glEnable(GL_CULL_FACE);
- }
- if(blendCheck)
- {
- glEnable(GL_BLEND);
- }
+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
if(_isDrawWire)//reset state.
{
@@ -260,8 +237,12 @@ bool Terrain::initHeightMap(const char * heightMap)
}
Terrain::Terrain()
+: _alphaMap(nullptr)
+, _stateBlock(nullptr)
{
- _alphaMap = nullptr;
+ _stateBlock = RenderState::StateBlock::create();
+ CC_SAFE_RETAIN(_stateBlock);
+
_customCommand.setTransparent(false);
_customCommand.set3D(true);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
@@ -453,6 +434,8 @@ void Terrain::setIsEnableFrustumCull(bool bool_value)
Terrain::~Terrain()
{
+ CC_SAFE_RELEASE(_stateBlock);
+
_alphaMap->release();
_heightMapImage->release();
delete _quadRoot;
@@ -832,7 +815,6 @@ void Terrain::reload()
}
}
- CCLOG("recreate");
initTextures();
_chunkLodIndicesSet.clear();
_chunkLodIndicesSkirtSet.clear();
diff --git a/cocos/3d/CCTerrain.h b/cocos/3d/CCTerrain.h
index c348ecb22b..d06e1005d1 100644
--- a/cocos/3d/CCTerrain.h
+++ b/cocos/3d/CCTerrain.h
@@ -24,15 +24,18 @@ THE SOFTWARE.
#ifndef CC_TERRAIN_H
#define CC_TERRAIN_H
+#include
+
#include "2d/CCNode.h"
#include "2d/CCCamera.h"
#include "renderer/CCTexture2D.h"
#include "renderer/CCCustomCommand.h"
+#include "renderer/CCRenderState.h"
#include "3d/CCAABB.h"
#include "3d/CCRay.h"
-#include
#include "base/CCEventListenerCustom.h"
#include "base/CCEventDispatcher.h"
+
NS_CC_BEGIN
/**
@@ -81,7 +84,7 @@ NS_CC_BEGIN
* We can use ray-terrain intersection to pick a point of the terrain;
* Also we can get an arbitrary point of the terrain's height and normal vector for convenience .
**/
-class CC_DLL Terrain :public Node
+class CC_DLL Terrain : public Node
{
public:
@@ -433,6 +436,7 @@ protected:
ChunkIndices insertIndicesLOD(int neighborLod[4], int selfLod, GLushort * indices, int size);
ChunkIndices insertIndicesLODSkirt(int selfLod, GLushort * indices, int size);
+
protected:
std::vector _chunkLodIndicesSet;
std::vector _chunkLodIndicesSkirtSet;
@@ -469,6 +473,9 @@ protected:
GLint _alphaMapLocation;
GLint _alphaIsHasAlphaMapLocation;
GLint _detailMapSizeLocation[4];
+
+ RenderState::StateBlock* _stateBlock;
+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
EventListenerCustom* _backToForegroundListener;
#endif
diff --git a/cocos/Android.mk b/cocos/Android.mk
index e9c51ed861..951fadcf2b 100644
--- a/cocos/Android.mk
+++ b/cocos/Android.mk
@@ -103,6 +103,7 @@ math/TransformUtils.cpp \
math/Vec2.cpp \
math/Vec3.cpp \
math/Vec4.cpp \
+base/CCNinePatchImageParser.cpp \
base/CCAsyncTaskPool.cpp \
base/CCAutoreleasePool.cpp \
base/CCConfiguration.cpp \
diff --git a/cocos/audio/AudioEngine.cpp b/cocos/audio/AudioEngine.cpp
index 3532870bea..252c8de835 100644
--- a/cocos/audio/AudioEngine.cpp
+++ b/cocos/audio/AudioEngine.cpp
@@ -24,7 +24,7 @@
#include "platform/CCPlatformConfig.h"
-#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
+#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
#include "audio/include/AudioEngine.h"
#include "platform/CCFileUtils.h"
@@ -36,6 +36,8 @@
#include "apple/AudioEngine-inl.h"
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
#include "win32/AudioEngine-win32.h"
+#elif CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
+#include "winrt/AudioEngine-winrt.h"
#endif
#define TIME_DELAY_PRECISION 0.0001
diff --git a/cocos/audio/android/Android.mk b/cocos/audio/android/Android.mk
index bbd7725d9d..95b8d5dc7f 100644
--- a/cocos/audio/android/Android.mk
+++ b/cocos/audio/android/Android.mk
@@ -1,23 +1,6 @@
LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_MODULE := cocosdenshion_static
-
-LOCAL_MODULE_FILENAME := libcocosdenshion
-
-LOCAL_SRC_FILES := cddSimpleAudioEngine.cpp \
- ccdandroidUtils.cpp \
- jni/cddandroidAndroidJavaEngine.cpp
-
-LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include \
- $(LOCAL_PATH)/../.. \
- $(LOCAL_PATH)/../../platform/android
-
-include $(BUILD_STATIC_LIBRARY)
-
-#new audio engine
+#New AudioEngine
include $(CLEAR_VARS)
LOCAL_MODULE := audioengine_static
@@ -36,3 +19,23 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include \
$(LOCAL_PATH)/../../platform/android
include $(BUILD_STATIC_LIBRARY)
+
+#SimpleAudioEngine
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := cocosdenshion_static
+
+LOCAL_MODULE_FILENAME := libcocosdenshion
+
+LOCAL_SRC_FILES := cddSimpleAudioEngine.cpp \
+ ccdandroidUtils.cpp \
+ jni/cddandroidAndroidJavaEngine.cpp
+
+LOCAL_STATIC_LIBRARIES := audioengine_static
+LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include
+
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include \
+ $(LOCAL_PATH)/../.. \
+ $(LOCAL_PATH)/../../platform/android
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/cocos/audio/android/AudioEngine-inl.cpp b/cocos/audio/android/AudioEngine-inl.cpp
index 53efb94ea6..804454bd99 100644
--- a/cocos/audio/android/AudioEngine-inl.cpp
+++ b/cocos/audio/android/AudioEngine-inl.cpp
@@ -43,6 +43,8 @@
using namespace cocos2d;
using namespace cocos2d::experimental;
+#define DELAY_TIME_TO_REMOVE 0.5f
+
void PlayOverEvent(SLPlayItf caller, void* context, SLuint32 playEvent)
{
if (context && playEvent == SL_PLAYEVENT_HEADATEND)
@@ -67,6 +69,7 @@ AudioPlayer::AudioPlayer()
, _playOver(false)
, _loop(false)
, _assetFd(0)
+ , _delayTimeToRemove(-1.f)
{
}
@@ -276,18 +279,32 @@ int AudioEngineImpl::play2d(const std::string &filePath ,bool loop ,float volume
void AudioEngineImpl::update(float dt)
{
- auto itend = _audioPlayers.end();
- for (auto iter = _audioPlayers.begin(); iter != itend; ++iter)
- {
- if(iter->second._playOver)
- {
- if (iter->second._finishCallback)
- iter->second._finishCallback(iter->second._audioID, *AudioEngine::_audioIDInfoMap[iter->second._audioID].filePath);
+ AudioPlayer* player = nullptr;
- AudioEngine::remove(iter->second._audioID);
- _audioPlayers.erase(iter);
- break;
+ auto itend = _audioPlayers.end();
+ for (auto iter = _audioPlayers.begin(); iter != itend; )
+ {
+ player = &(iter->second);
+ if (player->_playOver)
+ {
+ if (player->_finishCallback)
+ player->_finishCallback(player->_audioID, *AudioEngine::_audioIDInfoMap[player->_audioID].filePath);
+
+ AudioEngine::remove(player->_audioID);
+ iter = _audioPlayers.erase(iter);
+ continue;
}
+ else if (player->_delayTimeToRemove > 0.f)
+ {
+ player->_delayTimeToRemove -= dt;
+ if (player->_delayTimeToRemove < 0.f)
+ {
+ iter = _audioPlayers.erase(iter);
+ continue;
+ }
+ }
+
+ ++iter;
}
if(_audioPlayers.empty()){
@@ -348,7 +365,13 @@ void AudioEngineImpl::stop(int audioID)
log("%s error:%u",__func__, result);
}
- _audioPlayers.erase(audioID);
+ /*If destroy openSL object immediately,it may cause dead lock.
+ *It's a system issue.For more information:
+ * https://github.com/cocos2d/cocos2d-x/issues/11697
+ * https://groups.google.com/forum/#!msg/android-ndk/zANdS2n2cQI/AT6q1F3nNGIJ
+ */
+ player._delayTimeToRemove = DELAY_TIME_TO_REMOVE;
+ //_audioPlayers.erase(audioID);
}
void AudioEngineImpl::stopAll()
@@ -356,9 +379,13 @@ void AudioEngineImpl::stopAll()
auto itEnd = _audioPlayers.end();
for (auto it = _audioPlayers.begin(); it != itEnd; ++it)
{
- auto result = (*it->second._fdPlayerPlay)->SetPlayState(it->second._fdPlayerPlay, SL_PLAYSTATE_STOPPED);
+ (*it->second._fdPlayerPlay)->SetPlayState(it->second._fdPlayerPlay, SL_PLAYSTATE_STOPPED);
+ if (it->second._delayTimeToRemove < 0.f)
+ {
+ //If destroy openSL object immediately,it may cause dead lock.
+ it->second._delayTimeToRemove = DELAY_TIME_TO_REMOVE;
+ }
}
- _audioPlayers.clear();
}
float AudioEngineImpl::getDuration(int audioID)
diff --git a/cocos/audio/android/AudioEngine-inl.h b/cocos/audio/android/AudioEngine-inl.h
index 8f42a6c00d..28218953c1 100644
--- a/cocos/audio/android/AudioEngine-inl.h
+++ b/cocos/audio/android/AudioEngine-inl.h
@@ -60,6 +60,7 @@ private:
float _duration;
int _audioID;
int _assetFd;
+ float _delayTimeToRemove;
std::function _finishCallback;
diff --git a/cocos/audio/android/jni/cddandroidAndroidJavaEngine.cpp b/cocos/audio/android/jni/cddandroidAndroidJavaEngine.cpp
index 5d4a767a40..074495f96f 100644
--- a/cocos/audio/android/jni/cddandroidAndroidJavaEngine.cpp
+++ b/cocos/audio/android/jni/cddandroidAndroidJavaEngine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
-Copyright (c) 2013-2014 Chukong Technologies Inc.
+Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
@@ -24,10 +24,13 @@ THE SOFTWARE.
****************************************************************************/
#include "cddandroidAndroidJavaEngine.h"
-#include "platform/android/jni/JniHelper.h"
-#include "ccdandroidUtils.h"
+#include
#include
#include
+#include
+#include "platform/android/jni/JniHelper.h"
+#include "ccdandroidUtils.h"
+#include "audio/include/AudioEngine.h"
// logging
#define LOG_TAG "cocosdenshion::android::AndroidJavaEngine"
@@ -36,282 +39,463 @@ THE SOFTWARE.
// Java class
#define CLASS_NAME "org/cocos2dx/lib/Cocos2dxHelper"
-namespace CocosDenshion {
- namespace android {
+using namespace cocos2d::experimental;
+using namespace CocosDenshion::android;
- bool AndroidJavaEngine::getJNIStaticMethodInfo(cocos2d::JniMethodInfo &methodinfo,
- const char *methodName,
- const char *paramCode) {
- return cocos2d::JniHelper::getStaticMethodInfo(methodinfo,
- CLASS_NAME,
- methodName,
- paramCode);
- }
+static inline bool getJNIStaticMethodInfo(cocos2d::JniMethodInfo &methodinfo,
+ const char *methodName,
+ const char *paramCode) {
+ return cocos2d::JniHelper::getStaticMethodInfo(methodinfo,
+ CLASS_NAME,
+ methodName,
+ paramCode);
+}
- AndroidJavaEngine::~AndroidJavaEngine() {
- cocos2d::JniMethodInfo methodInfo;
-
- if (!getJNIStaticMethodInfo(methodInfo, "end", "()V")) {
- return ;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- void AndroidJavaEngine::preloadBackgroundMusic(const char* pszFilePath) {
- std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(pszFilePath);
-
- // void playBackgroundMusic(String,boolean)
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "preloadBackgroundMusic", "(Ljava/lang/String;)V")) {
- return;
- }
-
- jstring stringArg = methodInfo.env->NewStringUTF(fullPath.c_str());
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg);
- methodInfo.env->DeleteLocalRef(stringArg);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- void AndroidJavaEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop) {
- std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(pszFilePath);
-
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "playBackgroundMusic", "(Ljava/lang/String;Z)V")) {
- return;
- }
-
- jstring stringArg = methodInfo.env->NewStringUTF(fullPath.c_str());
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg, bLoop);
- methodInfo.env->DeleteLocalRef(stringArg);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- void AndroidJavaEngine::stopBackgroundMusic(bool bReleaseData) {
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "stopBackgroundMusic", "()V")) {
- return;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- void AndroidJavaEngine::pauseBackgroundMusic() {
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "pauseBackgroundMusic", "()V")) {
- return;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- void AndroidJavaEngine::resumeBackgroundMusic() {
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "resumeBackgroundMusic", "()V")) {
- return;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- void AndroidJavaEngine::rewindBackgroundMusic() {
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "rewindBackgroundMusic", "()V")) {
- return;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
-
- bool AndroidJavaEngine::willPlayBackgroundMusic() {
- return true;
- }
-
- bool AndroidJavaEngine::isBackgroundMusicPlaying() {
- cocos2d::JniMethodInfo methodInfo;
- jboolean ret = false;
-
- if (! getJNIStaticMethodInfo(methodInfo, "isBackgroundMusicPlaying", "()Z")) {
- return ret;
- }
-
- ret = methodInfo.env->CallStaticBooleanMethod(methodInfo.classID, methodInfo.methodID);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
-
- return ret;
- }
-
- float AndroidJavaEngine::getBackgroundMusicVolume() {
- cocos2d::JniMethodInfo methodInfo;
- jfloat ret = -1.0;
-
- if (! getJNIStaticMethodInfo(methodInfo, "getBackgroundMusicVolume", "()F")) {
- return ret;
- }
-
- ret = methodInfo.env->CallStaticFloatMethod(methodInfo.classID, methodInfo.methodID);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
-
- return ret;
- }
-
- void AndroidJavaEngine::setBackgroundMusicVolume(float volume) {
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "setBackgroundMusicVolume", "(F)V")) {
- return ;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, volume);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- float AndroidJavaEngine::getEffectsVolume() {
- cocos2d::JniMethodInfo methodInfo;
- jfloat ret = -1.0;
-
- if (! getJNIStaticMethodInfo(methodInfo, "getEffectsVolume", "()F")) {
- return ret;
- }
-
- ret = methodInfo.env->CallStaticFloatMethod(methodInfo.classID, methodInfo.methodID);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
-
- return ret;
- }
-
- void AndroidJavaEngine::setEffectsVolume(float volume) {
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "setEffectsVolume", "(F)V")) {
- return ;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, volume);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- unsigned int AndroidJavaEngine::playEffect(const char* pszFilePath, bool bLoop,
- float pitch, float pan, float gain) {
- cocos2d::JniMethodInfo methodInfo;
- int ret = 0;
- std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(pszFilePath);
-
- if (! getJNIStaticMethodInfo(methodInfo, "playEffect", "(Ljava/lang/String;ZFFF)I")) {
- return ret;
- }
-
- jstring stringArg = methodInfo.env->NewStringUTF(fullPath.c_str());
- ret = methodInfo.env->CallStaticIntMethod(methodInfo.classID,
- methodInfo.methodID,
- stringArg,
- bLoop,
- pitch, pan, gain);
- methodInfo.env->DeleteLocalRef(stringArg);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
-
- return (unsigned int)ret;
- }
-
- void AndroidJavaEngine::pauseEffect(unsigned int nSoundId) {
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "pauseEffect", "(I)V")) {
- return ;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)nSoundId);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- void AndroidJavaEngine::pauseAllEffects() {
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "pauseAllEffects", "()V")) {
- return ;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- void AndroidJavaEngine::resumeEffect(unsigned int nSoundId) {
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "resumeEffect", "(I)V")) {
- return ;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)nSoundId);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- void AndroidJavaEngine::resumeAllEffects() {
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "resumeAllEffects", "()V")) {
- return ;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- void AndroidJavaEngine::stopEffect(unsigned int nSoundId) {
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "stopEffect", "(I)V")) {
- return ;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)nSoundId);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- void AndroidJavaEngine::stopAllEffects() {
- cocos2d::JniMethodInfo methodInfo;
-
- if (! getJNIStaticMethodInfo(methodInfo, "stopAllEffects", "()V")) {
- return ;
- }
-
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
- static void loadEffect(const char* pszFilePath, char* loadEffectName) {
- cocos2d::JniMethodInfo methodInfo;
- std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(pszFilePath);
-
- if (! cocos2d::JniHelper::getStaticMethodInfo(methodInfo, CLASS_NAME, loadEffectName, "(Ljava/lang/String;)V")) {
- return ;
- }
-
- jstring stringArg = methodInfo.env->NewStringUTF(fullPath.c_str());
- methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg);
- methodInfo.env->DeleteLocalRef(stringArg);
- methodInfo.env->DeleteLocalRef(methodInfo.classID);
- }
-
-
- void AndroidJavaEngine::preloadEffect(const char* pszFilePath) {
- loadEffect(pszFilePath, "preloadEffect");
- }
-
- void AndroidJavaEngine::unloadEffect(const char* pszFilePath) {
- loadEffect(pszFilePath, "unloadEffect");
+AndroidJavaEngine::AndroidJavaEngine()
+ : _implementBaseOnAudioEngine(false)
+ , _effectVolume(1.f)
+{
+ char sdk_ver_str[PROP_VALUE_MAX] = "0";
+ auto len = __system_property_get("ro.build.version.sdk", sdk_ver_str);
+ if (len > 0)
+ {
+ auto sdk_ver = atoi(sdk_ver_str);
+ __android_log_print(ANDROID_LOG_DEBUG, "cocos2d", "android build version:%d", sdk_ver);
+ if (sdk_ver == 21)
+ {
+ _implementBaseOnAudioEngine = true;
}
}
-}
\ No newline at end of file
+ else
+ {
+ __android_log_print(ANDROID_LOG_DEBUG, "cocos2d", "%s", "Fail to get android build version.");
+ }
+}
+
+AndroidJavaEngine::~AndroidJavaEngine() {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "end", "()V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+void AndroidJavaEngine::preloadBackgroundMusic(const char* filePath) {
+ std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(filePath);
+
+ // void playBackgroundMusic(String,boolean)
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "preloadBackgroundMusic", "(Ljava/lang/String;)V")) {
+ return;
+ }
+
+ jstring stringArg = methodInfo.env->NewStringUTF(fullPath.c_str());
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg);
+ methodInfo.env->DeleteLocalRef(stringArg);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+void AndroidJavaEngine::playBackgroundMusic(const char* filePath, bool loop) {
+ std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(filePath);
+
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "playBackgroundMusic", "(Ljava/lang/String;Z)V")) {
+ return;
+ }
+
+ jstring stringArg = methodInfo.env->NewStringUTF(fullPath.c_str());
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg, loop);
+ methodInfo.env->DeleteLocalRef(stringArg);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+void AndroidJavaEngine::stopBackgroundMusic(bool releaseData) {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "stopBackgroundMusic", "()V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+void AndroidJavaEngine::pauseBackgroundMusic() {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "pauseBackgroundMusic", "()V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+void AndroidJavaEngine::resumeBackgroundMusic() {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "resumeBackgroundMusic", "()V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+void AndroidJavaEngine::rewindBackgroundMusic() {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "rewindBackgroundMusic", "()V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+bool AndroidJavaEngine::willPlayBackgroundMusic() {
+ return true;
+}
+
+bool AndroidJavaEngine::isBackgroundMusicPlaying() {
+ cocos2d::JniMethodInfo methodInfo;
+ jboolean ret = false;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "isBackgroundMusicPlaying", "()Z")) {
+ return ret;
+ }
+
+ ret = methodInfo.env->CallStaticBooleanMethod(methodInfo.classID, methodInfo.methodID);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+
+ return ret;
+}
+
+float AndroidJavaEngine::getBackgroundMusicVolume() {
+ cocos2d::JniMethodInfo methodInfo;
+ jfloat ret = -1.0;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "getBackgroundMusicVolume", "()F")) {
+ return ret;
+ }
+
+ ret = methodInfo.env->CallStaticFloatMethod(methodInfo.classID, methodInfo.methodID);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+
+ return ret;
+}
+
+void AndroidJavaEngine::setBackgroundMusicVolume(float volume) {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "setBackgroundMusicVolume", "(F)V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, volume);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+
+static float _jni_getEffectsVolume() {
+ cocos2d::JniMethodInfo methodInfo;
+ jfloat ret = -1.0;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "getEffectsVolume", "()F")) {
+ return ret;
+ }
+
+ ret = methodInfo.env->CallStaticFloatMethod(methodInfo.classID, methodInfo.methodID);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+
+ return ret;
+}
+
+static void _jni_setEffectsVolume(float volume) {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "setEffectsVolume", "(F)V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, volume);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+static unsigned int _jni_playEffect(const char* filePath, bool loop, float pitch, float pan, float gain)
+{
+ cocos2d::JniMethodInfo methodInfo;
+ int ret = 0;
+ std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(filePath);
+
+ if (!getJNIStaticMethodInfo(methodInfo, "playEffect", "(Ljava/lang/String;ZFFF)I")) {
+ return ret;
+ }
+
+ jstring stringArg = methodInfo.env->NewStringUTF(fullPath.c_str());
+ ret = methodInfo.env->CallStaticIntMethod(methodInfo.classID,
+ methodInfo.methodID,
+ stringArg,
+ loop,
+ pitch, pan, gain);
+ methodInfo.env->DeleteLocalRef(stringArg);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+
+ return (unsigned int)ret;
+}
+
+static void _jni_pauseEffect(unsigned int soundId) {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "pauseEffect", "(I)V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)soundId);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+static void _jni_pauseAllEffects() {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "pauseAllEffects", "()V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+static void _jni_resumeEffect(unsigned int soundId) {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "resumeEffect", "(I)V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)soundId);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+static void _jni_resumeAllEffects() {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "resumeAllEffects", "()V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+static void _jni_stopEffect(unsigned int soundId) {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "stopEffect", "(I)V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)soundId);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+static void _jni_stopAllEffects() {
+ cocos2d::JniMethodInfo methodInfo;
+
+ if (!getJNIStaticMethodInfo(methodInfo, "stopAllEffects", "()V")) {
+ return;
+ }
+
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+static void loadEffect(const char* filePath, char* loadEffectName) {
+ cocos2d::JniMethodInfo methodInfo;
+ std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(filePath);
+
+ if (!cocos2d::JniHelper::getStaticMethodInfo(methodInfo, CLASS_NAME, loadEffectName, "(Ljava/lang/String;)V")) {
+ return;
+ }
+
+ jstring stringArg = methodInfo.env->NewStringUTF(fullPath.c_str());
+ methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg);
+ methodInfo.env->DeleteLocalRef(stringArg);
+ methodInfo.env->DeleteLocalRef(methodInfo.classID);
+}
+
+static void _jni_preloadEffect(const char* filePath) {
+ loadEffect(filePath, "preloadEffect");
+}
+
+static void _jni_unloadEffect(const char* filePath) {
+ loadEffect(filePath, "unloadEffect");
+}
+
+
+float AndroidJavaEngine::getEffectsVolume()
+{
+ if (_implementBaseOnAudioEngine)
+ {
+ return _effectVolume;
+ }
+ else
+ {
+ return _jni_getEffectsVolume();
+ }
+}
+
+void AndroidJavaEngine::setEffectsVolume(float volume)
+{
+ if (_implementBaseOnAudioEngine)
+ {
+ if (volume > 1.f)
+ {
+ volume = 1.f;
+ }
+ else if (volume < 0.f)
+ {
+ volume = 0.f;
+ }
+
+ if (_effectVolume != volume)
+ {
+ _effectVolume = volume;
+ for (auto& it : _soundIDs)
+ {
+ AudioEngine::setVolume(it.first, volume);
+ }
+ }
+ }
+ else
+ {
+ _jni_setEffectsVolume(volume);
+ }
+}
+
+unsigned int AndroidJavaEngine::playEffect(const char* filePath, bool loop,
+ float pitch, float pan, float gain)
+{
+ if (_implementBaseOnAudioEngine)
+ {
+ auto soundID = AudioEngine::play2d(filePath, loop, _effectVolume);
+ if (soundID != AudioEngine::INVALID_AUDIO_ID)
+ {
+ _soundIDs[soundID] = soundID;
+
+ AudioEngine::setFinishCallback(soundID, [this](int id, const std::string& filePath){
+ _soundIDs.erase(id);
+ });
+ }
+
+ return soundID;
+ }
+ else
+ {
+ return _jni_playEffect(filePath, loop, pitch, pan, gain);
+ }
+}
+
+void AndroidJavaEngine::pauseEffect(unsigned int soundID)
+{
+ if (_implementBaseOnAudioEngine)
+ {
+ AudioEngine::pause(soundID);
+ }
+ else
+ {
+ _jni_pauseEffect(soundID);
+ }
+}
+
+void AndroidJavaEngine::resumeEffect(unsigned int soundID)
+{
+ if (_implementBaseOnAudioEngine)
+ {
+ AudioEngine::resume(soundID);
+ }
+ else
+ {
+ _jni_resumeEffect(soundID);
+ }
+}
+
+void AndroidJavaEngine::stopEffect(unsigned int soundID)
+{
+ if (_implementBaseOnAudioEngine)
+ {
+ AudioEngine::stop(soundID);
+ _soundIDs.erase(soundID);
+ }
+ else
+ {
+ _jni_stopEffect(soundID);
+ }
+}
+
+void AndroidJavaEngine::pauseAllEffects()
+{
+ if (_implementBaseOnAudioEngine)
+ {
+ for (auto& it : _soundIDs)
+ {
+ AudioEngine::pause(it.first);
+ }
+ }
+ else
+ {
+ _jni_pauseAllEffects();
+ }
+}
+
+void AndroidJavaEngine::resumeAllEffects()
+{
+ if (_implementBaseOnAudioEngine)
+ {
+ for (auto& it : _soundIDs)
+ {
+ AudioEngine::resume(it.first);
+ }
+ }
+ else
+ {
+ _jni_resumeAllEffects();
+ }
+}
+
+void AndroidJavaEngine::stopAllEffects()
+{
+ if (_implementBaseOnAudioEngine)
+ {
+ for (auto& it : _soundIDs)
+ {
+ AudioEngine::stop(it.first);
+ }
+ _soundIDs.clear();
+ }
+ else
+ {
+ _jni_stopAllEffects();
+ }
+}
+
+void AndroidJavaEngine::preloadEffect(const char* filePath)
+{
+ if (!_implementBaseOnAudioEngine)
+ {
+ _jni_preloadEffect(filePath);
+ }
+}
+
+void AndroidJavaEngine::unloadEffect(const char* filePath)
+{
+ if (!_implementBaseOnAudioEngine)
+ {
+ _jni_unloadEffect(filePath);
+ }
+}
diff --git a/cocos/audio/android/jni/cddandroidAndroidJavaEngine.h b/cocos/audio/android/jni/cddandroidAndroidJavaEngine.h
index a6bb400ea4..c5d6dbcd9a 100644
--- a/cocos/audio/android/jni/cddandroidAndroidJavaEngine.h
+++ b/cocos/audio/android/jni/cddandroidAndroidJavaEngine.h
@@ -1,6 +1,6 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
-Copyright (c) 2013-2014 Chukong Technologies Inc.
+Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
@@ -27,39 +27,42 @@ THE SOFTWARE.
#include "SimpleAudioEngine.h"
#include "platform/android/jni/JniHelper.h"
+#include
namespace CocosDenshion {
namespace android {
class AndroidJavaEngine : public SimpleAudioEngine {
+ public:
+ AndroidJavaEngine();
~AndroidJavaEngine();
- void preloadBackgroundMusic(const char* pszFilePath);
- void playBackgroundMusic(const char* pszFilePath, bool bLoop);
- void stopBackgroundMusic(bool bReleaseData);
- void pauseBackgroundMusic();
- void resumeBackgroundMusic();
- void rewindBackgroundMusic();
- bool willPlayBackgroundMusic();
- bool isBackgroundMusicPlaying();
- float getBackgroundMusicVolume();
- void setBackgroundMusicVolume(float volume);
- float getEffectsVolume();
- void setEffectsVolume(float volume);
- unsigned int playEffect(const char* pszFilePath, bool bLoop = false,
+ virtual void preloadBackgroundMusic(const char* filePath);
+ virtual void playBackgroundMusic(const char* filePath, bool loop);
+ virtual void stopBackgroundMusic(bool releaseData);
+ virtual void pauseBackgroundMusic();
+ virtual void resumeBackgroundMusic();
+ virtual void rewindBackgroundMusic();
+ virtual bool willPlayBackgroundMusic();
+ virtual bool isBackgroundMusicPlaying();
+ virtual float getBackgroundMusicVolume();
+ virtual void setBackgroundMusicVolume(float volume);
+ virtual float getEffectsVolume();
+ virtual void setEffectsVolume(float volume);
+ virtual unsigned int playEffect(const char* filePath, bool loop = false,
float pitch = 1.0f, float pan = 0.0f, float gain = 1.0f);
- void pauseEffect(unsigned int nSoundId);
- void pauseAllEffects();
- void resumeEffect(unsigned int nSoundId);
- void resumeAllEffects();
- void stopEffect(unsigned int nSoundId);
- void stopAllEffects();
- void preloadEffect(const char* pszFilePath);
- void unloadEffect(const char* pszFilePath);
+ virtual void pauseEffect(unsigned int soundId);
+ virtual void pauseAllEffects();
+ virtual void resumeEffect(unsigned int soundId);
+ virtual void resumeAllEffects();
+ virtual void stopEffect(unsigned int soundId);
+ virtual void stopAllEffects();
+ virtual void preloadEffect(const char* filePath);
+ virtual void unloadEffect(const char* filePath);
private :
- static bool getJNIStaticMethodInfo(cocos2d::JniMethodInfo &methodinfo,
- const char *methodName,
- const char *paramCode);
+ bool _implementBaseOnAudioEngine;
+ float _effectVolume;
+ std::unordered_map _soundIDs;
};
}
}
diff --git a/cocos/audio/apple/AudioEngine-inl.mm b/cocos/audio/apple/AudioEngine-inl.mm
index 0f9bc4df00..01b4c9260b 100644
--- a/cocos/audio/apple/AudioEngine-inl.mm
+++ b/cocos/audio/apple/AudioEngine-inl.mm
@@ -158,10 +158,11 @@ void AudioEngineInterruptionListenerCallback(void* user_data, UInt32 interruptio
-(id) init
{
- if (self == [super init])
+ if (self = [super init])
{
if ([[[UIDevice currentDevice] systemVersion] intValue] > 5) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) name:AVAudioSessionInterruptionNotification object:[AVAudioSession sharedInstance]];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) name:UIApplicationDidBecomeActiveNotification object:[AVAudioSession sharedInstance]];
}
else {
AudioSessionInitialize(NULL, NULL, AudioEngineInterruptionListenerCallback, self);
@@ -172,6 +173,8 @@ void AudioEngineInterruptionListenerCallback(void* user_data, UInt32 interruptio
-(void)handleInterruption:(NSNotification*)notification
{
+ static bool resumeOnBecomingActive = false;
+
if ([notification.name isEqualToString:AVAudioSessionInterruptionNotification]) {
NSInteger reason = [[[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey] integerValue];
if (reason == AVAudioSessionInterruptionTypeBegan) {
@@ -179,17 +182,35 @@ void AudioEngineInterruptionListenerCallback(void* user_data, UInt32 interruptio
}
if (reason == AVAudioSessionInterruptionTypeEnded) {
- OSStatus result = AudioSessionSetActive(true);
- if (result) NSLog(@"Error setting audio session active! %d\n", result);
-
- alcMakeContextCurrent(s_ALContext);
+ if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
+ NSError *error = nil;
+ [[AVAudioSession sharedInstance] setActive:YES error:&error];
+ alcMakeContextCurrent(s_ALContext);
+ } else {
+ resumeOnBecomingActive = true;
+ }
}
}
+
+ if ([notification.name isEqualToString:UIApplicationDidBecomeActiveNotification] && resumeOnBecomingActive) {
+ resumeOnBecomingActive = false;
+ NSError *error = nil;
+ BOOL success = [[AVAudioSession sharedInstance]
+ setCategory: AVAudioSessionCategoryAmbient
+ error: &error];
+ if (!success) {
+ printf("Fail to set audio session.\n");
+ return;
+ }
+ [[AVAudioSession sharedInstance] setActive:YES error:&error];
+ alcMakeContextCurrent(s_ALContext);
+ }
}
-(void) dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:AVAudioSessionInterruptionNotification object:nil];
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
[super dealloc];
}
@@ -239,12 +260,11 @@ bool AudioEngineImpl::init()
s_ALDevice = alcOpenDevice(nullptr);
if (s_ALDevice) {
- auto alError = alGetError();
s_ALContext = alcCreateContext(s_ALDevice, nullptr);
alcMakeContextCurrent(s_ALContext);
alGenSources(MAX_AUDIOINSTANCES, _alSources);
- alError = alGetError();
+ auto alError = alGetError();
if(alError != AL_NO_ERROR)
{
printf("%s:generating sources fail! error = %x\n", __PRETTY_FUNCTION__, alError);
diff --git a/cocos/audio/include/AudioEngine.h b/cocos/audio/include/AudioEngine.h
index 7cad808f6f..f96fbe75e8 100644
--- a/cocos/audio/include/AudioEngine.h
+++ b/cocos/audio/include/AudioEngine.h
@@ -23,7 +23,7 @@
****************************************************************************/
#include "platform/CCPlatformConfig.h"
-#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
+#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
#ifndef __AUDIO_ENGINE_H_
#define __AUDIO_ENGINE_H_
diff --git a/cocos/audio/win32/AudioCache.h b/cocos/audio/win32/AudioCache.h
index 9d27d7abd8..97896b2d15 100644
--- a/cocos/audio/win32/AudioCache.h
+++ b/cocos/audio/win32/AudioCache.h
@@ -38,7 +38,7 @@
#endif
#include "CCPlatformMacros.h"
-#define QUEUEBUFFER_NUM 3
+#define QUEUEBUFFER_NUM 5
#define QUEUEBUFFER_TIME_STEP 0.1f
NS_CC_BEGIN
diff --git a/cocos/audio/win32/AudioEngine-win32.cpp b/cocos/audio/win32/AudioEngine-win32.cpp
index f131f7ed2c..573daa2867 100644
--- a/cocos/audio/win32/AudioEngine-win32.cpp
+++ b/cocos/audio/win32/AudioEngine-win32.cpp
@@ -62,6 +62,7 @@ namespace cocos2d {
for (int index = 0; index < _numThread; ++index) {
_tasks.push_back(nullptr);
_threads.push_back( std::thread( std::bind(&AudioEngineThreadPool::threadFunc,this,index) ) );
+ _threads[index].detach();
}
}
@@ -78,7 +79,7 @@ namespace cocos2d {
if (targetIndex == -1) {
_tasks.push_back(task);
_threads.push_back( std::thread( std::bind(&AudioEngineThreadPool::threadFunc,this,_numThread) ) );
-
+ _threads[_numThread].detach();
_numThread++;
}
_taskMutex.unlock();
@@ -212,16 +213,14 @@ int AudioEngineImpl::play2d(const std::string &filePath ,bool loop ,float volume
auto it = _audioCaches.find(filePath);
if (it == _audioCaches.end()) {
audioCache = &_audioCaches[filePath];
-
- auto ext = filePath.substr(filePath.rfind('.'));
- transform(ext.begin(), ext.end(), ext.begin(), tolower);
-
+ auto ext = strchr(filePath.c_str(), '.');
bool eraseCache = true;
- if (ext.compare(".ogg") == 0){
+
+ if (_stricmp(ext, ".ogg") == 0){
audioCache->_fileFormat = AudioCache::FileFormat::OGG;
eraseCache = false;
}
- else if (ext.compare(".mp3") == 0){
+ else if (_stricmp(ext, ".mp3") == 0){
audioCache->_fileFormat = AudioCache::FileFormat::MP3;
if (MPG123_LAZYINIT){
@@ -239,7 +238,7 @@ int AudioEngineImpl::play2d(const std::string &filePath ,bool loop ,float volume
}
}
else{
- log("unsupported media type:%s\n",ext.c_str());
+ log("unsupported media type:%s\n", ext);
}
if (eraseCache){
@@ -380,7 +379,14 @@ bool AudioEngineImpl::stop(int audioID)
alSourcei(player._alSource, AL_BUFFER, NULL);
_alSourceUsed[player._alSource] = false;
- _audioPlayers.erase(audioID);
+ if (player._streamingSource)
+ {
+ player.notifyExitThread();
+ }
+ else
+ {
+ _audioPlayers.erase(audioID);
+ }
return ret;
}
@@ -394,7 +400,19 @@ void AudioEngineImpl::stopAll()
_alSourceUsed[_alSources[index]] = false;
}
- _audioPlayers.clear();
+ for (auto it = _audioPlayers.begin(); it != _audioPlayers.end();)
+ {
+ auto& player = it->second;
+ if (player._streamingSource)
+ {
+ player.notifyExitThread();
+ ++it;
+ }
+ else
+ {
+ it = _audioPlayers.erase(it);
+ }
+ }
}
float AudioEngineImpl::getDuration(int audioID)
@@ -498,7 +516,11 @@ void AudioEngineImpl::update(float dt)
auto& player = it->second;
alGetSourcei(player._alSource, AL_SOURCE_STATE, &sourceState);
- if (player._ready && sourceState == AL_STOPPED) {
+ if (player._readForRemove)
+ {
+ it = _audioPlayers.erase(it);
+ }
+ else if (player._ready && sourceState == AL_STOPPED) {
_alSourceUsed[player._alSource] = false;
if (player._finishCallbak) {
auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID];
@@ -507,7 +529,15 @@ void AudioEngineImpl::update(float dt)
AudioEngine::remove(audioID);
- it = _audioPlayers.erase(it);
+ if (player._streamingSource)
+ {
+ player.notifyExitThread();
+ ++it;
+ }
+ else
+ {
+ it = _audioPlayers.erase(it);
+ }
}
else{
++it;
diff --git a/cocos/audio/win32/AudioPlayer.cpp b/cocos/audio/win32/AudioPlayer.cpp
index e7225e5f04..a2a96363e7 100644
--- a/cocos/audio/win32/AudioPlayer.cpp
+++ b/cocos/audio/win32/AudioPlayer.cpp
@@ -42,6 +42,7 @@ AudioPlayer::AudioPlayer()
, _finishCallbak(nullptr)
, _ready(false)
, _audioCache(nullptr)
+ , _readForRemove(false)
{
}
@@ -59,13 +60,17 @@ AudioPlayer::AudioPlayer(const AudioPlayer& player)
AudioPlayer::~AudioPlayer()
{
- _exitThread = true;
if (_audioCache && _audioCache->_queBufferFrames > 0) {
+ alDeleteBuffers(QUEUEBUFFER_NUM, _bufferIds);
+ }
+}
+
+void AudioPlayer::notifyExitThread()
+{
+ if (_audioCache && _audioCache->_queBufferFrames > 0) {
+ std::unique_lock lk(_sleepMutex);
+ _exitThread = true;
_sleepCondition.notify_all();
- if (_rotateBufferThread.joinable()) {
- _rotateBufferThread.join();
- }
- alDeleteBuffers(3, _bufferIds);
}
}
@@ -94,11 +99,9 @@ bool AudioPlayer::play2d(AudioCache* cache)
alSourcei(_alSource, AL_LOOPING, AL_FALSE);
auto alError = alGetError();
- alGenBuffers(3, _bufferIds);
+ alGenBuffers(QUEUEBUFFER_NUM, _bufferIds);
alError = alGetError();
if (alError == AL_NO_ERROR) {
- _rotateBufferThread = std::thread(&AudioPlayer::rotateBufferThread,this, _audioCache->_queBufferFrames * QUEUEBUFFER_NUM + 1);
-
for (int index = 0; index < QUEUEBUFFER_NUM; ++index) {
alBufferData(_bufferIds[index], _audioCache->_alBufferFormat, _audioCache->_queBuffers[index], _audioCache->_queBufferSize[index], _audioCache->_sampleRate);
}
@@ -110,13 +113,22 @@ bool AudioPlayer::play2d(AudioCache* cache)
}
}
- alSourcePlay(_alSource);
- _ready = true;
- auto alError = alGetError();
+ if (_streamingSource)
+ {
+ _rotateBufferThread = std::thread(&AudioPlayer::rotateBufferThread, this, _audioCache->_queBufferFrames * QUEUEBUFFER_NUM + 1);
+ _rotateBufferThread.detach();
+ }
+ else
+ {
+ alSourcePlay(_alSource);
- if (alError != AL_NO_ERROR) {
- log("%s:alSourcePlay error code:%x\n", __FUNCTION__,alError);
- return false;
+ auto alError = alGetError();
+ if (alError != AL_NO_ERROR) {
+ log("%s:alSourcePlay error code:%x\n", __FUNCTION__, alError);
+ return false;
+ }
+
+ _ready = true;
}
return true;
@@ -177,9 +189,13 @@ void AudioPlayer::rotateBufferThread(int offsetFrame)
break;
}
+ alSourcePlay(_alSource);
+
while (!_exitThread) {
alGetSourcei(_alSource, AL_SOURCE_STATE, &sourceState);
if (sourceState == AL_PLAYING) {
+ _ready = true;
+
alGetSourcei(_alSource, AL_BUFFERS_PROCESSED, &bufferProcessed);
while (bufferProcessed > 0) {
bufferProcessed--;
@@ -250,11 +266,13 @@ void AudioPlayer::rotateBufferThread(int offsetFrame)
}
}
- if (_exitThread){
+ std::unique_lock lk(_sleepMutex);
+ if (_exitThread)
+ {
break;
}
- std::unique_lock lk(_sleepMutex);
- _sleepCondition.wait_for(lk,std::chrono::milliseconds(75));
+
+ _sleepCondition.wait_for(lk,std::chrono::milliseconds(35));
}
ExitBufferThread:
switch (audioFileFormat)
@@ -272,6 +290,7 @@ ExitBufferThread:
break;
}
free(tmpBuffer);
+ _readForRemove = true;
}
bool AudioPlayer::setLoop(bool loop)
diff --git a/cocos/audio/win32/AudioPlayer.h b/cocos/audio/win32/AudioPlayer.h
index 7c20ff3701..21ad5222a2 100644
--- a/cocos/audio/win32/AudioPlayer.h
+++ b/cocos/audio/win32/AudioPlayer.h
@@ -37,6 +37,7 @@
#include
#endif
#include "CCPlatformMacros.h"
+#include "AudioCache.h"
NS_CC_BEGIN
namespace experimental{
@@ -55,7 +56,8 @@ public:
bool setTime(float time);
float getTime() { return _currTime;}
bool setLoop(bool loop);
-
+ void notifyExitThread();
+
protected:
void rotateBufferThread(int offsetFrame);
bool play2d(AudioCache* cache);
@@ -73,11 +75,12 @@ protected:
float _currTime;
bool _timeDirty;
bool _streamingSource;
- ALuint _bufferIds[3];
+ ALuint _bufferIds[QUEUEBUFFER_NUM];
std::thread _rotateBufferThread;
std::mutex _sleepMutex;
std::condition_variable _sleepCondition;
- bool _exitThread;
+ bool _exitThread;
+ bool _readForRemove;
friend class AudioEngineImpl;
};
diff --git a/cocos/audio/winrt/Audio.cpp b/cocos/audio/winrt/Audio.cpp
index feaf711a18..13ed507632 100644
--- a/cocos/audio/winrt/Audio.cpp
+++ b/cocos/audio/winrt/Audio.cpp
@@ -17,8 +17,8 @@
*/
#include "Audio.h"
-#include "MediaStreamer.h"
-//#include "CCCommon.h"
+#include "CCCommon.h"
+#include "AudioSourceReader.h"
inline void ThrowIfFailed(HRESULT hr)
{
@@ -522,13 +522,34 @@ void Audio::PreloadSoundEffect(const char* pszFilePath, bool isMusic)
int sound = Hash(pszFilePath);
- MediaStreamer mediaStreamer;
- mediaStreamer.Initialize(CCUtf8ToUnicode(pszFilePath).c_str());
- m_soundEffects[sound].m_soundID = sound;
-
- uint32 bufferLength = mediaStreamer.GetMaxStreamLengthInBytes();
- m_soundEffects[sound].m_soundEffectBufferData = new byte[bufferLength];
- mediaStreamer.ReadAll(m_soundEffects[sound].m_soundEffectBufferData, bufferLength, &m_soundEffects[sound].m_soundEffectBufferLength);
+ std::unique_ptr reader = std::make_unique();
+
+ if (!reader) {
+ return;
+ }
+
+ static_cast(reader.get())->doLargeFileSupport(false);
+
+ if (!reader->initialize(pszFilePath)) {
+ return;
+ }
+
+ m_soundEffects[sound].m_soundID = sound;
+ uint32 bufferLength = reader->getTotalAudioBytes();
+ WAVEFORMATEX wfx = reader->getWaveFormatInfo();
+
+ cocos2d::experimental::AudioDataChunk chunk;
+ if (!reader->consumeChunk(chunk)) {
+ return;
+ }
+
+ m_soundEffects[sound].m_soundEffectBufferData = new (std::nothrow) BYTE[chunk._dataSize];
+ if (nullptr == m_soundEffects[sound].m_soundEffectBufferData) {
+ return;
+ }
+
+ m_soundEffects[sound].m_soundEffectBufferLength = chunk._dataSize;
+ CopyMemory(m_soundEffects[sound].m_soundEffectBufferData, chunk._data->data(), chunk._dataSize);
if (isMusic)
{
@@ -541,7 +562,7 @@ void Audio::PreloadSoundEffect(const char* pszFilePath, bool isMusic)
ThrowIfFailed(
m_musicEngine->CreateSourceVoice(&m_soundEffects[sound].m_soundEffectSourceVoice,
- &(mediaStreamer.GetOutputWaveFormatEx()), 0, 1.0f, &m_voiceContext, &sends)
+ &wfx, 0, 1.0f, &m_voiceContext, &sends)
);
//fix bug: set a initial volume
m_soundEffects[sound].m_soundEffectSourceVoice->SetVolume(m_backgroundMusicVolume);
@@ -556,13 +577,13 @@ void Audio::PreloadSoundEffect(const char* pszFilePath, bool isMusic)
ThrowIfFailed(
m_soundEffectEngine->CreateSourceVoice(&m_soundEffects[sound].m_soundEffectSourceVoice,
- &(mediaStreamer.GetOutputWaveFormatEx()), 0, 1.0f, &m_voiceContext, &sends, nullptr)
+ &wfx, 0, 1.0f, &m_voiceContext, &sends, nullptr)
);
//fix bug: set a initial volume
m_soundEffects[sound].m_soundEffectSourceVoice->SetVolume(m_soundEffctVolume);
}
- m_soundEffects[sound].m_soundEffectSampleRate = mediaStreamer.GetOutputWaveFormatEx().nSamplesPerSec;
+ m_soundEffects[sound].m_soundEffectSampleRate = wfx.nSamplesPerSec;
// Queue in-memory buffer for playback
ZeroMemory(&m_soundEffects[sound].m_audioBuffer, sizeof(m_soundEffects[sound].m_audioBuffer));
diff --git a/cocos/audio/winrt/AudioCachePlayer.cpp b/cocos/audio/winrt/AudioCachePlayer.cpp
new file mode 100644
index 0000000000..19dab3147c
--- /dev/null
+++ b/cocos/audio/winrt/AudioCachePlayer.cpp
@@ -0,0 +1,563 @@
+/*
+* cocos2d-x http://www.cocos2d-x.org
+*
+* Copyright (c) 2010-2011 - cocos2d-x community
+*
+* Portions Copyright (c) Microsoft Open Technologies, Inc.
+* All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and limitations under the License.
+*/
+
+#include "platform/CCPlatformConfig.h"
+
+#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
+
+#include "AudioCachePlayer.h"
+
+using namespace cocos2d;
+using namespace cocos2d::experimental;
+
+inline void ThrowIfFailed(HRESULT hr)
+{
+ if (FAILED(hr)) {
+ // Set a breakpoint on this line to catch XAudio2 API errors.
+ throw Platform::Exception::CreateException(hr);
+ }
+}
+
+
+// AudioCache
+AudioCache::AudioCache()
+ : _isReady(false)
+ , _fileFullPath("")
+ , _srcReader(nullptr)
+ , _fileFormat(FileFormat::UNKNOWN)
+{
+ _callbacks.clear();
+ memset(&_audInfo, 0, sizeof(AudioInfo));
+}
+
+AudioCache::~AudioCache()
+{
+ _callbacks.clear();
+
+ if (nullptr != _srcReader) {
+ delete _srcReader;
+ _srcReader = nullptr;
+ }
+}
+
+void AudioCache::readDataTask()
+{
+ std::wstring path(_fileFullPath.begin(), _fileFullPath.end());
+
+ if (nullptr != _srcReader) {
+ delete _srcReader;
+ _srcReader = nullptr;
+ }
+
+ switch (_fileFormat)
+ {
+ case FileFormat::WAV:
+ _srcReader = new (std::nothrow) WAVReader();
+ if (_srcReader && _srcReader->initialize(_fileFullPath)) {
+ _audInfo._totalAudioBytes = _srcReader->getTotalAudioBytes();
+ _audInfo._wfx = _srcReader->getWaveFormatInfo();
+ _isReady = true;
+ invokeCallbacks();
+ }
+ break;
+
+ case FileFormat::OGG:
+ break;
+
+ case FileFormat::MP3:
+ _srcReader = new (std::nothrow) MP3Reader();
+ if (_srcReader && _srcReader->initialize(_fileFullPath)) {
+ _audInfo._totalAudioBytes = _srcReader->getTotalAudioBytes();
+ _audInfo._wfx = _srcReader->getWaveFormatInfo();
+ _isReady = true;
+ invokeCallbacks();
+ }
+ break;
+
+ case FileFormat::UNKNOWN:
+ default:
+ break;
+ }
+}
+
+void AudioCache::addCallback(const std::function &callback)
+{
+ _cbMutex.lock();
+ if (_isReady) {
+ callback();
+ }
+ else {
+ _callbacks.push_back(callback);
+ }
+ _cbMutex.unlock();
+}
+
+void AudioCache::invokeCallbacks()
+{
+ _cbMutex.lock();
+ auto cnt = _callbacks.size();
+ for (size_t ind = 0; ind < cnt; ind++)
+ {
+ _callbacks[ind]();
+ }
+ _callbacks.clear();
+ _cbMutex.unlock();
+}
+
+bool AudioCache::getChunk(AudioDataChunk& chunk)
+{
+ bool ret = false;
+
+ if (nullptr != _srcReader) {
+ ret = _srcReader->consumeChunk(chunk);
+ }
+
+ return ret;
+}
+
+void AudioCache::doBuffering()
+{
+ if (isStreamingSource()){
+ _srcReader->produceChunk();
+ }
+}
+
+bool AudioCache::isStreamingSource()
+{
+ if (nullptr != _srcReader) {
+ return _srcReader->isStreamingSource();
+ }
+
+ return false;
+}
+
+void AudioCache::seek(const float ratio)
+{
+ if (nullptr != _srcReader){
+ _srcReader->seekTo(ratio);
+ }
+}
+
+
+// AudioPlayer
+AudioPlayer::AudioPlayer()
+ : _loop(false)
+ , _ready(false)
+ , _current(0.0)
+ , _volume(0.0)
+ , _duration(0.0)
+ , _cache(nullptr)
+ , _totalSamples(0)
+ , _samplesOffset(0)
+ , _criticalError(false)
+ , _isStreaming(false)
+ , _finishCallback(nullptr)
+ , _xaMasterVoice(nullptr)
+ , _xaSourceVoice(nullptr)
+ , _state(AudioPlayerState::INITIALZING)
+{
+ init();
+}
+
+AudioPlayer::~AudioPlayer()
+{
+ free();
+}
+
+void AudioPlayer::stop()
+{
+ _stop();
+}
+
+void AudioPlayer::pause()
+{
+ _stop(true);
+}
+
+bool AudioPlayer::update()
+{
+ if (_criticalError){
+ free();
+ init();
+ }
+
+ if (_cache != nullptr) {
+ _cache->doBuffering();
+ }
+
+ //log("bufferQueued: %d, _current: %f", _cachedBufferQ.size(), _current);
+ return _criticalError;
+}
+
+void AudioPlayer::resume()
+{
+ _play(true);
+}
+
+bool AudioPlayer::isInError()
+{
+ return _criticalError;
+}
+
+float AudioPlayer::getDuration()
+{
+ if (nullptr == _cache) {
+ return _duration;
+ }
+
+ auto fmt = _cache->_audInfo._wfx;
+
+ if (!fmt.nChannels) {
+ return _duration;
+ }
+
+ if ((int)_duration <= 0)
+ {
+ switch (fmt.wFormatTag)
+ {
+ case WAVE_FORMAT_PCM:
+ case WAVE_FORMAT_ADPCM:
+ _duration = (float(_cache->_audInfo._totalAudioBytes / ((fmt.wBitsPerSample / 8) * fmt.nChannels)) / fmt.nSamplesPerSec) * 1000;
+ _totalSamples = fmt.nSamplesPerSec * _duration / 1000;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return _duration;
+}
+
+float AudioPlayer::getCurrentTime()
+{
+ _stMutex.lock();
+ auto samplesPlayed = getSourceVoiceState().SamplesPlayed;
+ //log("_samplesOffset: %lu, samplesPlayed: %lu, _current: %f", (UINT32)_samplesOffset, (UINT32)samplesPlayed, _current);
+ _current += ((samplesPlayed - _samplesOffset) / (float)_totalSamples) * _duration;
+ _current = _current > _duration ? 0.0 : _current;
+ _samplesOffset = samplesPlayed;
+ _stMutex.unlock();
+ return _current;
+}
+
+bool AudioPlayer::setTime(float time)
+{
+ bool ret = true;
+ _stop();
+
+ if (!_isStreaming) {
+ auto fmt = _cache->_audInfo._wfx;
+ int seek = (time / _duration) * _totalSamples;
+ seek -= (seek % (fmt.nChannels * fmt.nBlockAlign));
+
+ _xaBuffer.LoopCount = 0;
+ _xaBuffer.PlayBegin = seek;
+ _xaBuffer.PlayLength = _totalSamples - seek;
+
+ if (_xaBuffer.PlayBegin >= _totalSamples) {
+ _xaBuffer.PlayBegin = _totalSamples - (fmt.nChannels * fmt.nBlockAlign);
+ _xaBuffer.PlayLength = (fmt.nChannels * fmt.nBlockAlign);
+ }
+ }
+
+ _stMutex.lock();
+ _samplesOffset = getSourceVoiceState().SamplesPlayed;
+ _current = time;
+ _stMutex.unlock();
+ _play();
+ return ret;
+}
+
+void AudioPlayer::setVolume(float volume)
+{
+ if (_xaMasterVoice != nullptr){
+ if (FAILED(_xaMasterVoice->SetVolume(volume))) {
+ error();
+ }
+ }
+}
+
+bool AudioPlayer::play2d(AudioCache* cache)
+{
+ bool ret = false;
+
+ if (cache != nullptr)
+ {
+ _cache = cache;
+ if (nullptr == _xaSourceVoice && _ready) {
+
+ XAUDIO2_SEND_DESCRIPTOR descriptors[1];
+ descriptors[0].pOutputVoice = _xaMasterVoice;
+ descriptors[0].Flags = 0;
+ XAUDIO2_VOICE_SENDS sends = { 0 };
+ sends.SendCount = 1;
+ sends.pSends = descriptors;
+ ThrowIfFailed(_xaEngine->CreateSourceVoice(&_xaSourceVoice, &cache->_audInfo._wfx, 0, 1.0, this, &sends));
+ }
+
+ _isStreaming = _cache->isStreamingSource();
+ _duration = getDuration();
+ ret = _play();
+ }
+
+ return ret;
+}
+
+void AudioPlayer::init()
+{
+ memset(&_xaBuffer, 0, sizeof(_xaBuffer));
+ ThrowIfFailed(XAudio2Create(_xaEngine.ReleaseAndGetAddressOf()));
+
+#if defined(_DEBUG)
+ XAUDIO2_DEBUG_CONFIGURATION debugConfig = { 0 };
+ debugConfig.BreakMask = XAUDIO2_LOG_ERRORS;
+ debugConfig.TraceMask = XAUDIO2_LOG_ERRORS;
+ _xaEngine->SetDebugConfiguration(&debugConfig);
+#endif
+
+ _xaEngine->RegisterForCallbacks(this);
+ ThrowIfFailed(_xaEngine->CreateMasteringVoice(&_xaMasterVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, nullptr, nullptr, AudioCategory_GameMedia));
+ _ready = true;
+ _state = AudioPlayerState::READY;
+}
+
+void AudioPlayer::free()
+{
+ _stop();
+ memset(&_xaBuffer, 0, sizeof(_xaBuffer));
+
+ if (_xaEngine) {
+ _xaEngine->StopEngine();
+ }
+
+ if (_xaSourceVoice != nullptr) {
+ _xaSourceVoice->DestroyVoice();
+ _xaSourceVoice = nullptr;
+ }
+
+ if (_xaMasterVoice != nullptr) {
+ _xaMasterVoice->DestroyVoice();
+ _xaMasterVoice = nullptr;
+ }
+
+ while (!_cachedBufferQ.empty()) {
+ popBuffer();
+ }
+}
+
+bool AudioPlayer::_play(bool resume)
+{
+ do {
+ if (!resume) {
+ _cache->seek(_current / _duration);
+ submitBuffers();
+ }
+
+ if (_state == AudioPlayerState::PAUSED && !resume || nullptr == _xaSourceVoice) break;
+
+ if (FAILED(_xaSourceVoice->Start())) {
+ error();
+ }
+ else {
+ _state = AudioPlayerState::PLAYING;
+ }
+ } while (false);
+
+ return !_criticalError;
+}
+
+void AudioPlayer::_stop(bool pause)
+{
+ if (_xaSourceVoice != nullptr) {
+
+ if (FAILED(_xaSourceVoice->Stop())) {
+ error();
+ }
+ else {
+ if (!pause) {
+ _xaSourceVoice->FlushSourceBuffers();
+ if (_state != AudioPlayerState::PAUSED) _state = AudioPlayerState::STOPPED;
+ }
+ else {
+ _state = AudioPlayerState::PAUSED;
+ }
+ }
+ }
+}
+
+void AudioPlayer::error()
+{
+ _criticalError = true;
+ _ready = false;
+ _state = AudioPlayerState::ERRORED;
+}
+
+void AudioPlayer::popBuffer()
+{
+ _bqMutex.lock();
+ if (!_cachedBufferQ.empty()) {
+ _cachedBufferQ.pop();
+ }
+ _bqMutex.unlock();
+}
+
+bool AudioPlayer::submitBuffers()
+{
+ bool ret = false;
+
+ _bqMutex.lock();
+ do {
+ if (nullptr == _xaSourceVoice) break;
+ if (!_cachedBufferQ.size() || (_isStreaming && _cachedBufferQ.size() < QUEUEBUFFER_NUM)) {
+ AudioDataChunk chunk;
+ if (_cache->getChunk(chunk) && chunk._dataSize) {
+ _xaBuffer.AudioBytes = chunk._dataSize;
+ _xaBuffer.pAudioData = chunk._data->data();
+ _xaBuffer.Flags = chunk._endOfStream ? XAUDIO2_END_OF_STREAM : 0;
+ _cachedBufferQ.push(chunk);
+ ret = SUCCEEDED(_xaSourceVoice->SubmitSourceBuffer(&_xaBuffer));
+ if (!_isStreaming) break;
+ }
+ else {
+ break;
+ }
+ }
+ else if (!_isStreaming) {
+ ret = SUCCEEDED(_xaSourceVoice->SubmitSourceBuffer(&_xaBuffer));
+ break;
+ }
+ else {
+ break;
+ }
+ } while (ret);
+ _bqMutex.unlock();
+
+ return ret;
+}
+
+void AudioPlayer::updateState()
+{
+ if (!_isStreaming) {
+ _stMutex.lock();
+ _samplesOffset = getSourceVoiceState().SamplesPlayed;
+ _stMutex.unlock();
+ }
+ else {
+ if (_cachedBufferQ.size() > getSourceVoiceState(true).BuffersQueued) {
+ popBuffer();
+ }
+ }
+}
+
+void AudioPlayer::onBufferRunOut()
+{
+ _stMutex.lock();
+ _samplesOffset = 0;
+ _current = 0.0;
+ _xaBuffer.PlayBegin = _xaBuffer.PlayLength = 0;
+ _stMutex.unlock();
+
+ if (!_loop) {
+ _stop();
+ //invokeFinishCallback();
+ }
+ else {
+ _play();
+ }
+}
+
+void AudioPlayer::invokeFinishCallback()
+{
+ if (_finishCallback) {
+ _finishCallback(0, "");
+ }
+}
+
+XAUDIO2_VOICE_STATE AudioPlayer::getSourceVoiceState(bool fast)
+{
+ XAUDIO2_VOICE_STATE state;
+ memset(&state, 0, sizeof(XAUDIO2_VOICE_STATE));
+
+ if (_xaSourceVoice != nullptr) {
+ _xaSourceVoice->GetState(&state, fast ? XAUDIO2_VOICE_NOSAMPLESPLAYED : 0);
+ }
+
+ return state;
+}
+
+// IXAudio2EngineCallback
+void AudioPlayer::OnProcessingPassStart()
+{
+}
+
+void AudioPlayer::OnProcessingPassEnd()
+{
+}
+
+void AudioPlayer::OnCriticalError(HRESULT err)
+{
+ UNREFERENCED_PARAMETER(err);
+ error();
+}
+
+// IXAudio2VoiceCallback
+void AudioPlayer::OnVoiceProcessingPassStart(UINT32 uBytesRequired)
+{
+ if (uBytesRequired && _isStreaming){
+ submitBuffers();
+ }
+}
+
+void AudioPlayer::OnVoiceProcessingPassEnd()
+{
+}
+
+void AudioPlayer::OnStreamEnd()
+{
+ onBufferRunOut();
+}
+
+void AudioPlayer::OnBufferStart(void* pBufferContext)
+{
+ UNREFERENCED_PARAMETER(pBufferContext);
+}
+
+void AudioPlayer::OnBufferEnd(void* pBufferContext)
+{
+ UNREFERENCED_PARAMETER(pBufferContext);
+ updateState();
+}
+
+void AudioPlayer::OnLoopEnd(void* pBufferContext)
+{
+ UNREFERENCED_PARAMETER(pBufferContext);
+
+ if (!_loop) {
+ _stop();
+ }
+}
+
+void AudioPlayer::OnVoiceError(void* pBufferContext, HRESULT err)
+{
+ UNREFERENCED_PARAMETER(pBufferContext);
+ UNREFERENCED_PARAMETER(err);
+ error();
+}
+
+#endif
diff --git a/cocos/audio/winrt/AudioCachePlayer.h b/cocos/audio/winrt/AudioCachePlayer.h
new file mode 100644
index 0000000000..f6911f47c6
--- /dev/null
+++ b/cocos/audio/winrt/AudioCachePlayer.h
@@ -0,0 +1,161 @@
+/*
+* cocos2d-x http://www.cocos2d-x.org
+*
+* Copyright (c) 2010-2011 - cocos2d-x community
+*
+* Portions Copyright (c) Microsoft Open Technologies, Inc.
+* All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and limitations under the License.
+*/
+
+#include "platform/CCPlatformConfig.h"
+
+#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
+
+#ifndef __AUDIO_CACHE_PLAYER_H_
+#define __AUDIO_CACHE_PLAYER_H_
+
+#include "AudioSourceReader.h"
+
+NS_CC_BEGIN
+namespace experimental{
+
+typedef struct AudioInfo
+{
+ size_t _totalAudioBytes;
+ WAVEFORMATEX _wfx;
+} AudioInfo;
+
+enum class AudioPlayerState
+{
+ ERRORED = -1,
+ INITIALZING,
+ READY,
+ PLAYING,
+ PAUSED,
+ STOPPED
+};
+
+ class AudioCache
+{
+public:
+ AudioCache();
+ ~AudioCache();
+
+ void readDataTask();
+ void addCallback(const std::function &callback);
+ bool getChunk(AudioDataChunk& chunk);
+ void doBuffering();
+ bool isStreamingSource();
+ void seek(const float ratio);
+
+protected:
+ void invokeCallbacks();
+
+private:
+ AudioCache(const AudioCache&);
+ AudioCache& operator=(const AudioCache&);
+
+private:
+ bool _isReady;
+ AudioInfo _audInfo;
+ std::mutex _cbMutex;
+ FileFormat _fileFormat;
+ std::string _fileFullPath;
+ AudioSourceReader *_srcReader;
+ std::vector> _callbacks;
+
+
+ friend class AudioPlayer;
+ friend class AudioEngineImpl;
+ };
+
+
+ class AudioPlayer : public IXAudio2EngineCallback, IXAudio2VoiceCallback
+ {
+ public:
+ AudioPlayer();
+ virtual ~AudioPlayer();
+
+ void stop();
+ void pause();
+ bool update();
+ void resume();
+ bool isInError();
+ float getDuration();
+ float getCurrentTime();
+ bool setTime(float time);
+ void setVolume(float volume);
+ bool play2d(AudioCache* cache);
+ AudioPlayerState getState() { return _state; }
+
+ protected:
+ AudioPlayer(AudioPlayer&);
+ AudioPlayer& operator=(AudioPlayer&);
+
+ void init();
+ void free();
+ void error();
+ void popBuffer();
+ void updateState();
+ bool submitBuffers();
+ void onBufferRunOut();
+ void invokeFinishCallback();
+ void _stop(bool pause = false);
+ bool _play(bool resume = false);
+ XAUDIO2_VOICE_STATE getSourceVoiceState(bool fast = false);
+
+ // IXAudio2EngineCallback
+ STDMETHOD_(void, OnProcessingPassStart) () override;
+ STDMETHOD_(void, OnProcessingPassEnd) () override;
+ STDMETHOD_(void, OnCriticalError) (HRESULT error) override;
+
+ // IXAudio2VoiceCallback
+ STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32 uBytesRequired) override;
+ STDMETHOD_(void, OnVoiceProcessingPassEnd) () override;
+ STDMETHOD_(void, OnStreamEnd) () override;
+ STDMETHOD_(void, OnBufferStart) (void* pBufferContext) override;
+ STDMETHOD_(void, OnBufferEnd) (void* pBufferContext) override;
+ STDMETHOD_(void, OnLoopEnd) (void* pBufferContext) override;
+ STDMETHOD_(void, OnVoiceError) (void *pBufferContext, HRESULT error) override;
+
+ private:
+ bool _loop;
+ bool _ready;
+ float _volume;
+ float _current;
+ float _duration;
+ bool _criticalError;
+ bool _isStreaming;
+ UINT64 _totalSamples;
+ UINT64 _samplesOffset;
+
+ XAUDIO2_BUFFER _xaBuffer;
+ IXAudio2SourceVoice *_xaSourceVoice;
+ IXAudio2MasteringVoice *_xaMasterVoice;
+ Microsoft::WRL::ComPtr _xaEngine;
+
+ AudioCache *_cache;
+ std::mutex _stMutex;
+ std::mutex _bqMutex;
+ AudioPlayerState _state;
+ std::queue _cachedBufferQ;
+ std::function _finishCallback;
+
+
+ friend class AudioEngineImpl;
+ };
+
+}
+NS_CC_END
+#endif // __AUDIO_CACHE_PLAYER_H_
+#endif
+
diff --git a/cocos/audio/winrt/AudioEngine-winrt.cpp b/cocos/audio/winrt/AudioEngine-winrt.cpp
new file mode 100644
index 0000000000..bb6f1d5ece
--- /dev/null
+++ b/cocos/audio/winrt/AudioEngine-winrt.cpp
@@ -0,0 +1,430 @@
+/*
+* cocos2d-x http://www.cocos2d-x.org
+*
+* Copyright (c) 2010-2011 - cocos2d-x community
+*
+* Portions Copyright (c) Microsoft Open Technologies, Inc.
+* All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and limitations under the License.
+*/
+
+#include "platform/CCPlatformConfig.h"
+
+#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
+
+#include "AudioEngine-winrt.h"
+#include
+
+
+using namespace cocos2d;
+using namespace cocos2d::experimental;
+
+
+namespace cocos2d {
+ namespace experimental {
+ class AudioEngineThreadPool
+ {
+ public:
+ AudioEngineThreadPool()
+ : _running(true)
+ , _numThread(6)
+ {
+ _threads.reserve(_numThread);
+ _tasks.reserve(_numThread);
+
+ for (int index = 0; index < _numThread; ++index) {
+ _tasks.push_back(nullptr);
+ _threads.push_back(std::thread(std::bind(&AudioEngineThreadPool::threadFunc, this, index)));
+ }
+ }
+
+ void addTask(const std::function &task){
+ _taskMutex.lock();
+ int targetIndex = -1;
+ for (int index = 0; index < _numThread; ++index) {
+ if (_tasks[index] == nullptr) {
+ targetIndex = index;
+ _tasks[index] = task;
+ break;
+ }
+ }
+ if (targetIndex == -1) {
+ _tasks.push_back(task);
+ _threads.push_back(std::thread(std::bind(&AudioEngineThreadPool::threadFunc, this, _numThread)));
+
+ _numThread++;
+ }
+ _taskMutex.unlock();
+ _sleepCondition.notify_all();
+ }
+
+ void destroy()
+ {
+ _running = false;
+ _sleepCondition.notify_all();
+
+ for (int index = 0; index < _numThread; ++index) {
+ _threads[index].join();
+ }
+ }
+ private:
+ bool _running;
+ std::vector _threads;
+ std::vector< std::function > _tasks;
+
+ void threadFunc(int index)
+ {
+ while (_running) {
+ std::function task = nullptr;
+ _taskMutex.lock();
+ task = _tasks[index];
+ _taskMutex.unlock();
+
+ if (nullptr == task)
+ {
+ std::unique_lock lk(_sleepMutex);
+ _sleepCondition.wait(lk);
+ continue;
+ }
+
+ task();
+
+ _taskMutex.lock();
+ _tasks[index] = nullptr;
+ _taskMutex.unlock();
+ }
+ }
+
+ int _numThread;
+
+ std::mutex _taskMutex;
+ std::mutex _sleepMutex;
+ std::condition_variable _sleepCondition;
+ };
+ }
+}
+
+AudioEngineImpl::AudioEngineImpl()
+ : _lazyInitLoop(true)
+ , _currentAudioID(0)
+ , _threadPool(nullptr)
+{
+
+}
+
+AudioEngineImpl::~AudioEngineImpl()
+{
+ _audioCaches.clear();
+
+ if (_threadPool) {
+ _threadPool->destroy();
+ delete _threadPool;
+ }
+}
+
+bool AudioEngineImpl::init()
+{
+ bool ret = false;
+
+ if (nullptr == _threadPool) {
+ _threadPool = new (std::nothrow) AudioEngineThreadPool();
+ }
+
+ ret = true;
+ return ret;
+}
+
+int AudioEngineImpl::play2d(const std::string &filePath, bool loop, float volume)
+{
+ AudioCache* audioCache = nullptr;
+ auto it = _audioCaches.find(filePath);
+ if (it == _audioCaches.end()) {
+ audioCache = &_audioCaches[filePath];
+
+ auto ext = filePath.substr(filePath.rfind('.'));
+ transform(ext.begin(), ext.end(), ext.begin(), tolower);
+
+ bool eraseCache = true;
+
+ if (ext.compare(".wav") == 0){
+ audioCache->_fileFormat = FileFormat::WAV;
+ eraseCache = false;
+ }
+ else if (ext.compare(".ogg") == 0){
+ audioCache->_fileFormat = FileFormat::OGG;
+ //eraseCache = false; //TODO add support for OGG
+ }
+ else if (ext.compare(".mp3") == 0){
+ audioCache->_fileFormat = FileFormat::MP3;
+ eraseCache = false;
+ }
+ else{
+ log("unsupported media type:%s\n", ext.c_str());
+ eraseCache = false;
+ }
+
+ if (eraseCache){
+ _audioCaches.erase(filePath);
+ return AudioEngine::INVALID_AUDIO_ID;
+ }
+
+ std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
+ audioCache->_fileFullPath = fullPath;
+ _threadPool->addTask(std::bind(&AudioCache::readDataTask, audioCache));
+ }
+ else {
+ audioCache = &it->second;
+ }
+
+ auto player = &_audioPlayers[_currentAudioID];
+ player->_loop = loop;
+ player->_volume = volume;
+ audioCache->addCallback(std::bind(&AudioEngineImpl::_play2d, this, audioCache, _currentAudioID));
+
+ if (_lazyInitLoop) {
+ _lazyInitLoop = false;
+
+ auto scheduler = cocos2d::Director::getInstance()->getScheduler();
+ scheduler->schedule(schedule_selector(AudioEngineImpl::update), this, 0.05f, false);
+ }
+
+ return _currentAudioID++;
+}
+
+void AudioEngineImpl::_play2d(AudioCache *cache, int audioID)
+{
+ if (cache->_isReady){
+ auto playerIt = _audioPlayers.find(audioID);
+ if (playerIt != _audioPlayers.end()) {
+ if (playerIt->second.play2d(cache)) {
+ AudioEngine::_audioIDInfoMap[audioID].state = AudioEngine::AudioState::PLAYING;
+ }
+ else{
+ _threadMutex.lock();
+ _toRemoveAudioIDs.push_back(audioID);
+ _threadMutex.unlock();
+ }
+ }
+ }
+ else {
+ _threadMutex.lock();
+ _toRemoveCaches.push_back(cache);
+ _toRemoveAudioIDs.push_back(audioID);
+ _threadMutex.unlock();
+ }
+}
+
+void AudioEngineImpl::setVolume(int audioID, float volume)
+{
+ auto& player = _audioPlayers[audioID];
+
+ if (player._ready){
+ player.setVolume(volume);
+ }
+
+ if (player.isInError()) {
+ log("%s: audio id = %d, error.\n", __FUNCTION__, audioID);
+ }
+}
+
+void AudioEngineImpl::setLoop(int audioID, bool loop)
+{
+ auto& player = _audioPlayers[audioID];
+
+ if (player._ready) {
+ player._loop = loop;
+ }
+
+ if (player.isInError()) {
+ log("%s: audio id = %d, error.\n", __FUNCTION__, audioID);
+ }
+}
+
+bool AudioEngineImpl::pause(int audioID)
+{
+ bool ret = false;
+ auto& player = _audioPlayers[audioID];
+
+ if (player._ready) {
+ player.pause();
+ AudioEngine::_audioIDInfoMap[audioID].state = AudioEngine::AudioState::PAUSED;
+ }
+
+ ret = !player.isInError();
+
+ if (!ret) {
+ log("%s: audio id = %d, error.\n", __FUNCTION__, audioID);
+ }
+
+ return ret;
+}
+
+bool AudioEngineImpl::resume(int audioID)
+{
+ bool ret = false;
+ auto& player = _audioPlayers[audioID];
+
+ if (player._ready) {
+ player.resume();
+ AudioEngine::_audioIDInfoMap[audioID].state = AudioEngine::AudioState::PLAYING;
+ }
+
+ ret = !player.isInError();
+
+ if (!ret) {
+ log("%s: audio id = %d, error.\n", __FUNCTION__, audioID);
+ }
+
+ return ret;
+}
+
+bool AudioEngineImpl::stop(int audioID)
+{
+ bool ret = false;
+ auto& player = _audioPlayers[audioID];
+
+ if (player._ready) {
+ player.stop();
+ ret = !player.isInError();
+ }
+
+ if (!ret) {
+ log("%s: audio id = %d, error.\n", __FUNCTION__, audioID);
+ }
+
+ _audioPlayers.erase(audioID);
+ return ret;
+}
+
+void AudioEngineImpl::stopAll()
+{
+ for (auto &player : _audioPlayers) {
+ player.second.stop();
+ }
+
+ _audioPlayers.clear();
+}
+
+float AudioEngineImpl::getDuration(int audioID)
+{
+ auto& player = _audioPlayers[audioID];
+
+ if (player._ready) {
+ return player.getDuration();
+ }
+ else {
+ return AudioEngine::TIME_UNKNOWN;
+ }
+}
+
+float AudioEngineImpl::getCurrentTime(int audioID)
+{
+ float ret = 0.0f;
+ auto& player = _audioPlayers[audioID];
+
+ if (player._ready) {
+ ret = player.getCurrentTime();
+ }
+
+ return ret;
+}
+
+bool AudioEngineImpl::setCurrentTime(int audioID, float time)
+{
+ bool ret = false;
+ auto& player = _audioPlayers[audioID];
+
+ if (player._ready) {
+ ret = player.setTime(time);
+ }
+
+ if (!ret) {
+ log("%s: audio id = %d, error.\n", __FUNCTION__, audioID);
+ }
+
+ return ret;
+}
+
+void AudioEngineImpl::setFinishCallback(int audioID, const std::function &callback)
+{
+ _audioPlayers[audioID]._finishCallback = callback;
+}
+
+void AudioEngineImpl::update(float dt)
+{
+ int audioID;
+
+ if (_threadMutex.try_lock()) {
+ size_t removeAudioCount = _toRemoveAudioIDs.size();
+ for (size_t index = 0; index < removeAudioCount; ++index) {
+ audioID = _toRemoveAudioIDs[index];
+ auto playerIt = _audioPlayers.find(audioID);
+ if (playerIt != _audioPlayers.end()) {
+ if (playerIt->second._finishCallback) {
+ auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID];
+ playerIt->second._finishCallback(audioID, *audioInfo.filePath);
+ }
+ _audioPlayers.erase(audioID);
+ AudioEngine::remove(audioID);
+ }
+ }
+
+ size_t removeCacheCount = _toRemoveCaches.size();
+ for (size_t index = 0; index < removeCacheCount; ++index) {
+ auto itEnd = _audioCaches.end();
+ for (auto it = _audioCaches.begin(); it != itEnd; ++it) {
+ if (&it->second == _toRemoveCaches[index]) {
+ _audioCaches.erase(it);
+ break;
+ }
+ }
+ }
+ _threadMutex.unlock();
+ }
+
+ for (auto it = _audioPlayers.begin(); it != _audioPlayers.end();) {
+ audioID = it->first;
+ auto& player = it->second;
+
+ if (player._ready && player._state == AudioPlayerState::STOPPED) {
+ if (player._finishCallback) {
+ auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID];
+ player._finishCallback(audioID, *audioInfo.filePath);
+ }
+
+ AudioEngine::remove(audioID);
+ it = _audioPlayers.erase(it);
+ }
+ else{
+ player.update();
+ ++it;
+ }
+ }
+
+ if (_audioPlayers.empty()){
+ _lazyInitLoop = true;
+
+ auto scheduler = cocos2d::Director::getInstance()->getScheduler();
+ scheduler->unschedule(schedule_selector(AudioEngineImpl::update), this);
+ }
+}
+
+void AudioEngineImpl::uncache(const std::string &filePath)
+{
+ _audioCaches.erase(filePath);
+}
+
+void AudioEngineImpl::uncacheAll()
+{
+ _audioCaches.clear();
+}
+
+#endif
diff --git a/cocos/audio/winrt/AudioEngine-winrt.h b/cocos/audio/winrt/AudioEngine-winrt.h
new file mode 100644
index 0000000000..906ab7ff31
--- /dev/null
+++ b/cocos/audio/winrt/AudioEngine-winrt.h
@@ -0,0 +1,82 @@
+/*
+* cocos2d-x http://www.cocos2d-x.org
+*
+* Copyright (c) 2010-2011 - cocos2d-x community
+*
+* Portions Copyright (c) Microsoft Open Technologies, Inc.
+* All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and limitations under the License.
+*/
+
+#include "platform/CCPlatformConfig.h"
+
+#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
+
+#ifndef __AUDIO_ENGINE_WINRT_H_
+#define __AUDIO_ENGINE_WINRT_H_
+
+#define NEAR near
+
+#include
+
+#include "base/CCRef.h"
+#include "AudioEngine.h"
+#include "AudioCachePlayer.h"
+
+NS_CC_BEGIN
+ namespace experimental{
+#define MAX_AUDIOINSTANCES 32
+
+
+ class AudioEngineThreadPool;
+
+ class CC_DLL AudioEngineImpl : public cocos2d::Ref
+ {
+ public:
+ AudioEngineImpl();
+ ~AudioEngineImpl();
+
+ bool init();
+ int play2d(const std::string &fileFullPath, bool loop, float volume);
+ void setVolume(int audioID, float volume);
+ void setLoop(int audioID, bool loop);
+ bool pause(int audioID);
+ bool resume(int audioID);
+ bool stop(int audioID);
+ void stopAll();
+ float getDuration(int audioID);
+ float getCurrentTime(int audioID);
+ bool setCurrentTime(int audioID, float time);
+ void setFinishCallback(int audioID, const std::function &callback);
+ void uncache(const std::string& filePath);
+ void uncacheAll();
+ void update(float dt);
+
+ private:
+ void _play2d(AudioCache *cache, int audioID);
+
+ private:
+ std::unordered_map _audioPlayers;
+ std::unordered_map _audioCaches;
+ std::vector _toRemoveCaches;
+
+ std::mutex _threadMutex;
+ std::vector _toRemoveAudioIDs;
+ bool _lazyInitLoop;
+ int _currentAudioID;
+ AudioEngineThreadPool* _threadPool;
+ };
+}
+
+NS_CC_END
+#endif // __AUDIO_ENGINE_WINRT_H_
+#endif
+
diff --git a/cocos/audio/winrt/AudioSourceReader.cpp b/cocos/audio/winrt/AudioSourceReader.cpp
new file mode 100644
index 0000000000..dcca1804f1
--- /dev/null
+++ b/cocos/audio/winrt/AudioSourceReader.cpp
@@ -0,0 +1,523 @@
+/*
+* cocos2d-x http://www.cocos2d-x.org
+*
+* Copyright (c) 2010-2011 - cocos2d-x community
+*
+* Portions Copyright (c) Microsoft Open Technologies, Inc.
+* All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and limitations under the License.
+*/
+
+#include "platform/CCPlatformConfig.h"
+
+#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
+
+#include "CCWinRTUtils.h"
+#include "AudioSourceReader.h"
+
+using namespace cocos2d;
+using namespace cocos2d::experimental;
+using namespace Microsoft::WRL;
+
+
+// AudioFileReader
+AudioSourceReader::AudioSourceReader() :
+_isStreaming(false)
+, _filePath("")
+, _audioSize(0)
+, _bytesRead(0)
+, _isDirty(false)
+{
+ memset(&_wfx, 0, sizeof(_wfx));
+}
+
+AudioSourceReader::~AudioSourceReader()
+{
+ flushChunks();
+}
+
+void AudioSourceReader::flushChunks()
+{
+ _rwMutex.lock();
+ while (!_chnkQ.empty()) {
+ _chnkQ.pop();
+ }
+ _rwMutex.unlock();
+}
+
+
+// WAVFileReader
+WAVReader::WAVReader() :
+_streamer(nullptr)
+{
+}
+
+WAVReader::~WAVReader()
+{
+}
+
+bool WAVReader::initialize(const std::string& filePath)
+{
+ bool ret = false;
+ _isStreaming = false;
+ _filePath = filePath;
+
+ do {
+ auto fileSize = FileUtils::getInstance()->getFileSize(_filePath);
+
+ if (fileSize <= 0)
+ break;
+
+ flushChunks();
+
+ _rwMutex.lock();
+ _streamer = ref new MediaStreamer;
+ _streamer->Initialize(std::wstring(_filePath.begin(), _filePath.end()).c_str(), true);
+ _rwMutex.unlock();
+ _wfx = _streamer->GetOutputWaveFormatEx();
+ UINT32 dataSize = _streamer->GetMaxStreamLengthInBytes();
+
+ if (dataSize <= 0)
+ break;
+
+ _audioSize = dataSize;
+ if (_audioSize <= PCMDATA_CACHEMAXSIZE) {
+ produceChunk();
+ }
+ else {
+ _isStreaming = true;
+ for (int i = 0; i < QUEUEBUFFER_NUM; i++) {
+ produceChunk();
+ }
+ }
+
+ ret = true;
+ } while (false);
+
+ return ret;
+}
+
+bool WAVReader::consumeChunk(AudioDataChunk& chunk)
+{
+ bool ret = false;
+ _isDirty = true;
+
+ _rwMutex.lock();
+ if (_chnkQ.size() > 0) {
+ chunk = _chnkQ.front();
+ if (_isStreaming) {
+ _chnkQ.pop();
+ }
+ ret = true;
+ }
+ _rwMutex.unlock();
+
+ return ret;
+}
+
+void WAVReader::produceChunk()
+{
+ _rwMutex.lock();
+ int chunkSize = _audioSize;
+
+ do {
+ if (!_isStreaming && _chnkQ.size() || _chnkQ.size() >= QUEUEBUFFER_NUM) {
+ break;
+ }
+
+ if (_isStreaming) {
+ chunkSize = std::min(CHUNK_SIZE_MAX, _audioSize - _bytesRead);
+ }
+
+ if (!chunkSize && !_chnkQ.size()) {
+ auto alignment = _wfx.nChannels * _wfx.nBlockAlign;
+ _bytesRead -= alignment;
+ chunkSize = alignment;
+ }
+
+ if (!chunkSize) {
+ break;
+ }
+
+ UINT retSize = 0;
+ AudioDataChunk chunk = { 0 };
+ chunk._data = std::make_shared(chunkSize);
+ _streamer->ReadChunk(chunk._data->data(), _bytesRead, chunkSize, &retSize);
+ _bytesRead += retSize;
+ chunk._dataSize = retSize;
+ chunk._seqNo = ((float)_bytesRead / _audioSize) * ((float)_audioSize / CHUNK_SIZE_MAX);
+ chunk._endOfStream = (_bytesRead >= _audioSize);
+ _chnkQ.push(chunk);
+ } while (false);
+ _rwMutex.unlock();
+}
+
+void WAVReader::seekTo(const float ratio)
+{
+ if (_isStreaming) {
+ auto newPos = ratio * _audioSize;
+
+ if (!newPos && !_isDirty && _chnkQ.size()) // already in 0.0 position
+ return;
+
+ _bytesRead = newPos;
+ flushChunks();
+
+ switch (_wfx.wFormatTag)
+ {
+ case WAVE_FORMAT_PCM:
+ case WAVE_FORMAT_ADPCM: {
+ auto alignment = _wfx.nChannels * _wfx.nBlockAlign;
+ _bytesRead = _bytesRead >= _audioSize ? (_audioSize - alignment) : _bytesRead - (_bytesRead % alignment);
+ } break;
+
+ default:
+ break;
+ }
+
+ for (int i = 0; i < QUEUEBUFFER_NUM; i++) {
+ produceChunk();
+ }
+ }
+}
+
+
+// MP3Reader
+MP3Reader::MP3Reader() :
+_mappedWavFile("")
+, _largeFileSupport(true)
+{
+}
+
+MP3Reader::~MP3Reader()
+{
+}
+
+bool MP3Reader::initialize(const std::string& filePath)
+{
+ bool ret = false;
+ _filePath = filePath;
+ HRESULT hr = S_OK;
+ MFStartup(MF_VERSION);
+
+ do {
+ ComPtr pReader;
+ ComPtr ppDecomprsdAudioType;
+
+ if (FAILED(hr = MFCreateSourceReaderFromURL(std::wstring(_filePath.begin(), _filePath.end()).c_str(), NULL, &pReader))) {
+ break;
+ }
+
+ hr = configureSourceReader(pReader.Get(), &ppDecomprsdAudioType);
+
+ if (FAILED(hr)) {
+ break;
+ }
+
+ UINT32 cbFormat = 0;
+ WAVEFORMATEX *pWav = nullptr;
+ if (FAILED(hr = MFCreateWaveFormatExFromMFMediaType(ppDecomprsdAudioType.Get(), &pWav, &cbFormat))) {
+ break;
+ }
+
+ CopyMemory(&_wfx, pWav, sizeof(WAVEFORMATEX));
+ CoTaskMemFree(pWav);
+
+ if (FAILED(hr = readAudioData(pReader.Get()))) {
+ break;
+ }
+
+ ret = SUCCEEDED(hr);
+ } while (false);
+
+ MFShutdown();
+ return ret;
+}
+
+bool MP3Reader::consumeChunk(AudioDataChunk& chunk)
+{
+ bool ret = false;
+ _isDirty = true;
+
+ _rwMutex.lock();
+ if (_chnkQ.size() > 0) {
+ chunk = _chnkQ.front();
+ if (_isStreaming) {
+ _chnkQ.pop();
+ }
+ ret = true;
+ }
+ _rwMutex.unlock();
+
+ return ret;
+}
+
+void MP3Reader::produceChunk()
+{
+ _rwMutex.lock();
+ int chunkSize = _audioSize;
+
+ do {
+ if (!_isStreaming && _chnkQ.size() || _chnkQ.size() >= QUEUEBUFFER_NUM) {
+ break;
+ }
+
+ if (_isStreaming) {
+ chunkSize = std::min(CHUNK_SIZE_MAX, _audioSize - _bytesRead);
+ }
+
+ if (!chunkSize && !_chnkQ.size()) {
+ auto alignment = _wfx.nChannels * _wfx.nBlockAlign;
+ _bytesRead -= alignment;
+ chunkSize = alignment;
+ }
+
+ if (!chunkSize) {
+ break;
+ }
+
+ UINT retSize = 0;
+ AudioDataChunk chunk = { 0 };
+ chunk._data = std::make_shared(chunkSize);
+ readFromMappedWavFile(chunk._data->data(), _bytesRead, chunkSize, &retSize);
+ _bytesRead += retSize;
+ chunk._dataSize = retSize;
+ chunk._seqNo = ((float)_bytesRead / _audioSize) * ((float)_audioSize / CHUNK_SIZE_MAX);
+ chunk._endOfStream = (_bytesRead >= _audioSize);
+ _chnkQ.push(chunk);
+ } while (false);
+ _rwMutex.unlock();
+}
+
+void MP3Reader::seekTo(const float ratio)
+{
+ if (_isStreaming) {
+ auto newPos = ratio * _audioSize;
+
+ if (!newPos && !_isDirty && _chnkQ.size()) // already in 0.0 position
+ return;
+
+ _bytesRead = newPos;
+ flushChunks();
+ auto alignment = _wfx.nChannels * _wfx.nBlockAlign;
+ _bytesRead = _bytesRead >= _audioSize ? (_audioSize - alignment) : _bytesRead - (_bytesRead % alignment);
+
+ for (int i = 0; i < QUEUEBUFFER_NUM; i++) {
+ produceChunk();
+ }
+ }
+}
+
+HRESULT MP3Reader::configureSourceReader(IMFSourceReader* pReader, IMFMediaType** ppDecomprsdAudioType)
+{
+ HRESULT hr = S_OK;
+
+ do {
+ ComPtr pTmpMediaType;
+ ComPtr pRetMediaType;
+ pReader->SetStreamSelection(MF_SOURCE_READER_ALL_STREAMS, FALSE);
+ pReader->SetStreamSelection(MF_SOURCE_READER_FIRST_AUDIO_STREAM, TRUE);
+
+ if (FAILED(hr = MFCreateMediaType(&pTmpMediaType))) {
+ break;
+ }
+
+ if (FAILED(hr = pTmpMediaType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio))) {
+ break;
+ }
+
+ if (FAILED(hr = pTmpMediaType->SetGUID(MF_MT_SUBTYPE, MFAudioFormat_PCM))) {
+ break;
+ }
+
+ if (FAILED(hr = pReader->SetCurrentMediaType(MF_SOURCE_READER_FIRST_AUDIO_STREAM, NULL, pTmpMediaType.Get()))) {
+ break;
+ }
+
+ if (FAILED(hr = pReader->GetCurrentMediaType(MF_SOURCE_READER_FIRST_AUDIO_STREAM, &pRetMediaType))) {
+ break;
+ }
+
+ if (FAILED(hr = pReader->SetStreamSelection(MF_SOURCE_READER_FIRST_AUDIO_STREAM, TRUE))) {
+ break;
+ }
+
+ *ppDecomprsdAudioType = pRetMediaType.Get();
+ (*ppDecomprsdAudioType)->AddRef();
+ } while (false);
+
+ return hr;
+}
+
+HRESULT MP3Reader::readAudioData(IMFSourceReader* pReader)
+{
+ HRESULT hr = S_OK;
+
+ do {
+ PCMBuffer buffer;
+
+ if (createMappedCacheFile(_filePath, _mappedWavFile, ".dat")) {
+ _isStreaming = _largeFileSupport;
+ _audioSize = FileUtils::getInstance()->getFileSize(_mappedWavFile);
+ if (!_largeFileSupport) {
+ buffer.resize(_audioSize);
+ readFromMappedWavFile(buffer.data(), 0, _audioSize, nullptr);
+ chunkify(buffer);
+ }
+ break;
+ }
+
+ buffer.reserve(PCMDATA_CACHEMAXSIZE);
+
+ while (SUCCEEDED(hr))
+ {
+ DWORD flags = 0;
+ DWORD cbSize = 0;
+ BYTE* pAudioData = nullptr;
+ ComPtr pSample;
+ ComPtr pBuffer;
+
+ if (FAILED(hr = pReader->ReadSample(MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, NULL, &flags, NULL, &pSample))) {
+ break;
+ }
+
+ if (flags & MF_SOURCE_READERF_ENDOFSTREAM) {
+ break;
+ }
+
+ if (FAILED(hr = pSample->ConvertToContiguousBuffer(&pBuffer))) {
+ break;
+ }
+
+ if (FAILED(hr = pBuffer->Lock(&pAudioData, NULL, &cbSize))) {
+ break;
+ }
+
+ if (_largeFileSupport && _audioSize + cbSize > PCMDATA_CACHEMAXSIZE) {
+
+ if (!_isStreaming) {
+ _isStreaming = true;
+ chunkify(buffer);
+ appendToMappedWavFile(buffer);
+ buffer.clear();
+ }
+
+ buffer.resize(cbSize);
+ CopyMemory(buffer.data(), pAudioData, cbSize);
+ appendToMappedWavFile(buffer);
+ buffer.clear();
+ }
+ else {
+ buffer.resize(_audioSize + cbSize);
+ CopyMemory(&buffer[_audioSize], pAudioData, cbSize);
+ }
+
+ _audioSize += cbSize;
+ hr = pBuffer->Unlock();
+ pAudioData = NULL;
+ }
+
+ if (FAILED(hr)) {
+ break;
+ }
+
+ if (!_isStreaming) {
+ chunkify(buffer);
+ _audioSize > PCMDATA_CACHEMAXSIZE ?
+ appendToMappedWavFile(buffer) :
+ destroyMappedCacheFile(_filePath);
+ }
+ } while (false);
+
+ return hr;
+}
+
+void MP3Reader::chunkify(PCMBuffer& buffer)
+{
+ _rwMutex.lock();
+ size_t offset = 0;
+
+ if (buffer.size() && _chnkQ.size() < QUEUEBUFFER_NUM)
+ {
+ AudioDataChunk chunk = { 0 };
+ int chunkSize = buffer.size();
+ chunk._data = std::make_shared(buffer);
+ _bytesRead += chunkSize;
+ chunk._dataSize = chunkSize;
+ chunk._endOfStream = (!_isStreaming && _bytesRead >= _audioSize);
+ chunk._seqNo = ((float)_bytesRead / _audioSize) * ((float)_audioSize / CHUNK_SIZE_MAX);
+ _chnkQ.push(chunk);
+ offset += chunkSize;
+ }
+ _rwMutex.unlock();
+}
+
+bool MP3Reader::appendToMappedWavFile(PCMBuffer& buffer)
+{
+ bool ret = false;
+
+ _rwMutex.lock();
+ do {
+ auto file = openFile(_mappedWavFile, true);
+
+ if (file.Get() == INVALID_HANDLE_VALUE) {
+ break;
+ }
+
+ LARGE_INTEGER li = { 0 };
+ if (!SetFilePointerEx(file.Get(), li, nullptr, FILE_END)) {
+ break;
+ }
+
+ ret = (TRUE == WriteFile(file.Get(), buffer.data(), buffer.size(), nullptr, nullptr));
+ } while (false);
+ _rwMutex.unlock();
+
+ return ret;
+}
+
+void MP3Reader::readFromMappedWavFile(BYTE *data, size_t offset, int size, UINT *pRetSize)
+{
+ do {
+ auto file = openFile(_mappedWavFile);
+
+ if (file.Get() == INVALID_HANDLE_VALUE) {
+ break;
+ }
+
+ if (offset) {
+ LARGE_INTEGER li = { 0 };
+ li.QuadPart = offset;
+ if (!SetFilePointerEx(file.Get(), li, nullptr, FILE_BEGIN)) {
+ break;
+ }
+ }
+
+ ReadFile(file.Get(), data, size, (LPDWORD)pRetSize, nullptr);
+ } while (false);
+}
+
+Wrappers::FileHandle MP3Reader::openFile(const std::string& path, bool append)
+{
+ CREATEFILE2_EXTENDED_PARAMETERS extParams = { 0 };
+ extParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
+ extParams.dwFileFlags = FILE_FLAG_RANDOM_ACCESS;
+ extParams.dwSecurityQosFlags = SECURITY_ANONYMOUS;
+ extParams.dwSize = sizeof(extParams);
+ extParams.hTemplateFile = nullptr;
+ extParams.lpSecurityAttributes = nullptr;
+
+ DWORD access = append ? GENERIC_WRITE : GENERIC_READ;
+ DWORD creation = append ? OPEN_ALWAYS : OPEN_EXISTING;
+ return Microsoft::WRL::Wrappers::FileHandle(CreateFile2(std::wstring(path.begin(), path.end()).c_str(), access, FILE_SHARE_READ, creation, &extParams));
+}
+
+#endif
diff --git a/cocos/audio/winrt/AudioSourceReader.h b/cocos/audio/winrt/AudioSourceReader.h
new file mode 100644
index 0000000000..e6d5f37a05
--- /dev/null
+++ b/cocos/audio/winrt/AudioSourceReader.h
@@ -0,0 +1,139 @@
+/*
+* cocos2d-x http://www.cocos2d-x.org
+*
+* Copyright (c) 2010-2011 - cocos2d-x community
+*
+* Portions Copyright (c) Microsoft Open Technologies, Inc.
+* All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and limitations under the License.
+*/
+
+#include "platform/CCPlatformConfig.h"
+
+#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
+
+#ifndef __AUDIO_SOURCE_READER_H_
+#define __AUDIO_SOURCE_READER_H_
+
+#define NEAR near
+#include
+#include
+#include
+#include
+#include
+#include "MediaStreamer.h"
+
+NS_CC_BEGIN
+namespace experimental{
+
+const UINT PCMDATA_CACHEMAXSIZE = 2621440;
+const UINT QUEUEBUFFER_NUM = 4;
+const UINT CHUNK_SIZE_MAX = PCMDATA_CACHEMAXSIZE / QUEUEBUFFER_NUM;
+
+typedef std::vector PCMBuffer;
+
+enum class FileFormat
+{
+ UNKNOWN,
+ WAV,
+ MP3,
+ OGG
+};
+
+typedef struct AudioDataChunk
+{
+ std::shared_ptr _data;
+ size_t _dataSize;
+ bool _endOfStream;
+ int _seqNo;
+} AudioDataChunk;
+
+
+class AudioSourceReader
+{
+public:
+ AudioSourceReader();
+ virtual ~AudioSourceReader();
+
+ bool isStreamingSource() { return _isStreaming; }
+ std::string getFilePath() { return _filePath; }
+ virtual size_t getTotalAudioBytes() { return _audioSize; }
+
+ virtual bool initialize(const std::string& filePath) = 0;
+ virtual FileFormat getFileFormat() = 0;
+ virtual bool consumeChunk(AudioDataChunk& chunk) = 0;
+ virtual void produceChunk() = 0;
+ virtual void seekTo(const float ratio) = 0;
+ virtual const WAVEFORMATEX& getWaveFormatInfo() { return _wfx; }
+
+protected:
+ void flushChunks();
+
+protected:
+ bool _isDirty;
+ size_t _bytesRead;
+ bool _isStreaming;
+ std::string _filePath;
+ size_t _audioSize;
+ WAVEFORMATEX _wfx;
+ std::mutex _rwMutex;
+ std::queue _chnkQ;
+};
+
+class WAVReader : public AudioSourceReader
+ {
+ public:
+ WAVReader();
+ virtual ~WAVReader();
+
+ virtual bool initialize(const std::string& filePath) override;
+ virtual FileFormat getFileFormat() override { return FileFormat::WAV; }
+ virtual bool consumeChunk(AudioDataChunk& chunk) override;
+ virtual void produceChunk() override;
+ virtual void seekTo(const float ratio) override;
+
+ private:
+ MediaStreamer^ _streamer;
+ };
+
+class MP3Reader : public AudioSourceReader
+ {
+ public:
+ MP3Reader();
+ virtual ~MP3Reader();
+
+ virtual bool initialize(const std::string& filePath) override;
+ virtual FileFormat getFileFormat() override { return FileFormat::WAV; }
+ virtual bool consumeChunk(AudioDataChunk& chunk) override;
+ virtual void produceChunk() override;
+ virtual void seekTo(const float ratio) override;
+
+ // for backward compatibility with simple audio engine
+ void doLargeFileSupport(bool action) { _largeFileSupport = action; }
+
+ protected:
+ HRESULT configureSourceReader(IMFSourceReader* pReader, IMFMediaType** ppDecomprsdAudioType);
+ HRESULT readAudioData(IMFSourceReader* pReader);
+ void chunkify(PCMBuffer& buffer);
+ bool appendToMappedWavFile(PCMBuffer& buffer);
+ void readFromMappedWavFile(BYTE *data, size_t offset, int size, UINT *pRetSize);
+ Microsoft::WRL::Wrappers::FileHandle openFile(const std::string& path, bool append = false);
+
+ private:
+ bool _largeFileSupport;
+ std::string _mappedWavFile;
+ };
+
+}
+NS_CC_END
+#endif // __AUDIO_SOURCE_READER_H_
+#endif
+
diff --git a/cocos/audio/winrt/MediaStreamer.cpp b/cocos/audio/winrt/MediaStreamer.cpp
index fc6287cd04..b50091634c 100644
--- a/cocos/audio/winrt/MediaStreamer.cpp
+++ b/cocos/audio/winrt/MediaStreamer.cpp
@@ -39,6 +39,8 @@ using namespace Concurrency;
((uint32)(byte)(ch2) << 16) | ((uint32)(byte)(ch3) << 24 ))
#endif /* defined(MAKEFOURCC) */
+const int FMT_CHUNK_MAX = 256;
+
inline void ThrowIfFailed(HRESULT hr)
{
if (FAILED(hr))
@@ -50,6 +52,8 @@ inline void ThrowIfFailed(HRESULT hr)
MediaStreamer::MediaStreamer() :
m_offset(0)
+ , m_dataLen(0)
+ , m_filename(nullptr)
{
ZeroMemory(&m_waveFormat, sizeof(m_waveFormat));
m_location = Package::Current->InstalledLocation;
@@ -59,39 +63,33 @@ MediaStreamer::MediaStreamer() :
MediaStreamer::~MediaStreamer()
{
}
-Platform::Array^ MediaStreamer::ReadData(
- _In_ Platform::String^ filename
- )
+
+Platform::Array^ MediaStreamer::ReadData(_In_ Platform::String^ filename)
+{
+ return ReadData(filename, 0, 0);
+}
+
+Platform::Array^ MediaStreamer::ReadData(_In_ Platform::String^ filename, uint32 from, uint32 length)
{
CREATEFILE2_EXTENDED_PARAMETERS extendedParams = {0};
extendedParams.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
extendedParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
- extendedParams.dwFileFlags = FILE_FLAG_SEQUENTIAL_SCAN;
+ extendedParams.dwFileFlags = from ? FILE_FLAG_RANDOM_ACCESS : FILE_FLAG_SEQUENTIAL_SCAN;
extendedParams.dwSecurityQosFlags = SECURITY_ANONYMOUS;
extendedParams.lpSecurityAttributes = nullptr;
extendedParams.hTemplateFile = nullptr;
Wrappers::FileHandle file(
- CreateFile2(
- filename->Data(),
- GENERIC_READ,
- FILE_SHARE_READ,
- OPEN_EXISTING,
- &extendedParams
- )
+ CreateFile2(filename->Data(), GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, &extendedParams)
);
+
if (file.Get()==INVALID_HANDLE_VALUE)
{
throw ref new Platform::FailureException();
}
- FILE_STANDARD_INFO fileInfo = {0};
- if (!GetFileInformationByHandleEx(
- file.Get(),
- FileStandardInfo,
- &fileInfo,
- sizeof(fileInfo)
- ))
+ FILE_STANDARD_INFO fileInfo = { 0 };
+ if (!GetFileInformationByHandleEx(file.Get(), FileStandardInfo, &fileInfo, sizeof(fileInfo)))
{
throw ref new Platform::FailureException();
}
@@ -101,15 +99,21 @@ Platform::Array^ MediaStreamer::ReadData(
throw ref new Platform::OutOfMemoryException();
}
- Platform::Array^ fileData = ref new Platform::Array(fileInfo.EndOfFile.LowPart);
+ from += m_offset;
+ length = (length == 0 || from + length > fileInfo.EndOfFile.LowPart) ? fileInfo.EndOfFile.LowPart - from : length;
+ Platform::Array^ fileData = ref new Platform::Array(length);
- if (!ReadFile(
- file.Get(),
- fileData->Data,
- fileData->Length,
- nullptr,
- nullptr
- ) )
+ if (from)
+ {
+ LARGE_INTEGER pos = { 0 };
+ pos.QuadPart = from;
+ if (!SetFilePointerEx(file.Get(), pos, nullptr, FILE_BEGIN))
+ {
+ throw ref new Platform::FailureException();
+ }
+ }
+
+ if (!ReadFile(file.Get(), fileData->Data, fileData->Length, nullptr, nullptr))
{
throw ref new Platform::FailureException();
}
@@ -117,9 +121,9 @@ Platform::Array^ MediaStreamer::ReadData(
return fileData;
}
-void MediaStreamer::Initialize(__in const WCHAR* url)
+void MediaStreamer::Initialize(__in const WCHAR* url, bool lazy)
{
-
+ m_filename = ref new Platform::String(url);
WCHAR filePath[MAX_PATH] = {0};
if ((wcslen(url) > 1 && url[1] == ':'))
{
@@ -139,8 +143,7 @@ void MediaStreamer::Initialize(__in const WCHAR* url)
wcscat_s(filePath, url);
}
-
- Platform::Array^ data = ReadData(ref new Platform::String(filePath));
+ Platform::Array^ data = lazy ? ReadData(ref new Platform::String(filePath), 0, FMT_CHUNK_MAX) : ReadData(ref new Platform::String(filePath));
UINT32 length = data->Length;
const byte * dataPtr = data->Data;
UINT32 offset = 0;
@@ -197,22 +200,45 @@ void MediaStreamer::Initialize(__in const WCHAR* url)
// Locate the 'data' chunk and copy its contents to a buffer.
ThrowIfFailed(ReadChunk(MAKEFOURCC('d', 'a', 't', 'a'), chunkSize, chunkPos));
- m_data.resize(chunkSize);
- CopyMemory(m_data.data(), &dataPtr[chunkPos], chunkSize);
+ m_dataLen = chunkSize;
+ m_offset = chunkPos;
- m_offset = 0;
+ if (!lazy)
+ {
+ m_data.resize(chunkSize);
+ CopyMemory(m_data.data(), &dataPtr[chunkPos], chunkSize);
+ m_offset = 0;
+ }
}
void MediaStreamer::ReadAll(uint8* buffer, uint32 maxBufferSize, uint32* bufferLength)
{
- UINT32 toCopy = m_data.size() - m_offset;
- if (toCopy > maxBufferSize) toCopy = maxBufferSize;
+ if (!m_data.size())
+ {
+ ReadChunk(buffer, 0, m_dataLen, bufferLength);
+ }
+ else
+ {
+ UINT32 toCopy = m_data.size() - m_offset;
+ if (toCopy > maxBufferSize) toCopy = maxBufferSize;
- CopyMemory(buffer, m_data.data(), toCopy);
- *bufferLength = toCopy;
+ CopyMemory(buffer, m_data.data(), toCopy);
+ *bufferLength = toCopy;
- m_offset += toCopy;
- if (m_offset > m_data.size()) m_offset = m_data.size();
+ m_offset += toCopy;
+ if (m_offset > m_data.size()) m_offset = m_data.size();
+ }
+}
+
+void MediaStreamer::ReadChunk(uint8* buffer, uint32 from, uint32 length, uint32* bytesRead)
+{
+ Platform::Array^ data = ReadData(m_filename, from, length);
+ *bytesRead = data->Length;
+
+ if (*bytesRead > 0)
+ {
+ CopyMemory(buffer, (byte*)data->Data, data->Length);
+ }
}
void MediaStreamer::Restart()
diff --git a/cocos/audio/winrt/MediaStreamer.h b/cocos/audio/winrt/MediaStreamer.h
index e72ac5974a..d2c46f613f 100644
--- a/cocos/audio/winrt/MediaStreamer.h
+++ b/cocos/audio/winrt/MediaStreamer.h
@@ -29,9 +29,12 @@ private:
uint32 m_maxStreamLengthInBytes;
std::vector m_data;
UINT32 m_offset;
- Platform::Array^ ReadData(
- _In_ Platform::String^ filename
- );
+ UINT32 m_dataLen;
+ Platform::String^ m_filename;
+
+ Platform::Array^ ReadData(_In_ Platform::String^ filename);
+ Platform::Array^ ReadData(_In_ Platform::String^ filename, uint32 from, uint32 length);
+
internal:
Windows::Storage::StorageFolder^ m_location;
Platform::String^ m_locationPath;
@@ -49,10 +52,11 @@ internal:
UINT32 GetMaxStreamLengthInBytes()
{
- return m_data.size();
+ return m_dataLen;
}
- void Initialize(_In_ const WCHAR* url);
- void ReadAll(uint8* buffer, uint32 maxBufferSize, uint32* bufferLength);
+ void Initialize(_In_ const WCHAR* url, bool lazy = false);
+ void ReadAll(uint8* buffer, uint32 maxBufferSize, uint32* bufferLength);
+ void ReadChunk(uint8* buffer, uint32 from, uint32 length, uint32* bytesRead);
void Restart();
};
diff --git a/cocos/audio/winrt/SimpleAudioEngine.cpp b/cocos/audio/winrt/SimpleAudioEngine.cpp
index 6a9b17354b..df69cf263c 100644
--- a/cocos/audio/winrt/SimpleAudioEngine.cpp
+++ b/cocos/audio/winrt/SimpleAudioEngine.cpp
@@ -18,10 +18,12 @@
#include "SimpleAudioEngine.h"
#include "Audio.h"
+#include "cocos2d.h"
#include