diff --git a/AUTHORS b/AUTHORS
index e59e2a6ce3..0f9ee1b0bf 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -820,6 +820,7 @@ Developers:
aeonmine
Fixed ActionObject memory leak in ActionManagerEx::initWithDictionary
+ Fixed memory leak in cocos studiov2.0 reader
LoungeKatt
Corrected a mistake of building android project in README.md
@@ -921,6 +922,7 @@ Developers:
Fix the bug that UIButton doesn't support TTF font
Fix a bug of TextReader
Fix a bug that UITextField doesn't support TTF font
+ Setted contentSize in CSLoader
gin0606
Add a new line at the end of a file
@@ -1048,6 +1050,9 @@ Developers:
liamcindy
update ui button size changed logic
+
+ vovkasm
+ Fix warnings for Xcode6.1
Retired Core Developers:
WenSheng Yang
diff --git a/CHANGELOG b/CHANGELOG
index db133ad049..8ab6765be2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,12 +1,21 @@
cocos2d-x-3.3 ??
[NEW] Vec2: added greater than operator
+ [FIX] Audio: `SimpleAudioEngine::sharedEngine()->playBackgroundMusic()` crashed freezen on Lollipop(Android5.0)
+ [FIX] Button: when the dimension of button title is larger than the button, button will scale to fit the dimension of the button title
+ [FIX] Button: when the dimension of button title is larger than the button, button will scale to fit the dimension of the button title
+ [FIX] Camera: does not work correctly when the up is not (0, 1, 0)
[FIX] Cocos console: compile failure on windows if using VS express version
- [FIX] GrawNode: drawPoint() may cause crash
+ [FIX] DrawNode: drawPoint() may cause crash
[FIX] GLProgramCache: doesn't release old program with the same key before adding a new one
[FIX] GLProgramState: enabled GLProgramState restoring on render recreated on WP8
[FIX] Label: label shifting when outline feature enabled
[FIX] Label: when applying additionalKerning to a Label that displays a string with only 1 character, the character is shifted
+ [FIX] Label: display incompletely with multiline text with outline feature enabled
+ [FIX] New audio: can not loop on Android 2.3.x
+ [FIX] Scale9Sprite: will be flipped if both flipX and flipY are false
+ [FIX] Scale9Sprite: if scale and flip property are set at the same time, the result would be wrong
+ [FIX] Scene: setScale() doesn't work as expected
[FIX] Sprite3D: did not create attached sprite from cache
[FIX] WP/WinRT: Windows 8.1 universal app support; `UIEditBox` support
@@ -33,7 +42,7 @@ cocos2d-x-3.3-rc0 Oct.21 2014
[FIX] C++: remove armv7s in VALID_ARCHS for Xcode projects
[FIX] Cocos Studio reader: UI animation playing crash if GUI JSON file is loaded again
[FIX] Cocos Studio reader: improvement ImageViewReader don't necessary loadTexture when imageFilePath is empty
- [FIX] EditBox: view rendereed in wrong position if click EditBox on iOS 8
+ [FIX] EditBox: view rendered in wrong position if click EditBox on iOS 8
[FIX] FileUtils: can not remove files/directory on iOS devices
[FIX] GLProgram: crashed on some Android devices that do not support more than 8 attributes
[FIX] Label: getStringNumLines() may returns wrong result if label is dirty
@@ -103,7 +112,7 @@ cocos2d-x-3.3alpha0 Aug.28 2014
[NEW] Sprite3D: added getBoundingBox() and getAABB()
[NEW] SpriteFrameCache: load from plist file content data
[NEW] utils: added gettime()
- [NEW] UI: Added Added UIScale9Sprite
+ [NEW] UI: Added UIScale9Sprite
[NEW] UI: ui::Button: support customize how much zoom scale is when pressing a button
[NEW] UI: ui::PageView: added `customScrollThreshold`, could determine the swipe distance to trigger a PageView scroll event
[NEW] UI: ui::TextField: support utf8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f949dbb9b..e6120f3a1a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,8 +29,8 @@ project (Cocos2d-X)
# The version number
set(COCOS2D_X_VERSION 3.3.0-beta0)
-include(cmake/BuildHelpers.CMakeLists.txt)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
+include(CocosBuildHelpers)
message(${BUILDING_STRING})
@@ -123,7 +123,6 @@ else()
endif()
include_directories(
- ${PLATFORM_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cocos
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/deprecated
diff --git a/README.cmake b/README.cmake
index 3df615997e..edbe073c19 100644
--- a/README.cmake
+++ b/README.cmake
@@ -23,7 +23,7 @@ mac build Instructions
cd cocos2d-x
mkdir macbuild && cd macbuild
-cmake -G "Unix Makefile" -DBUILD_CPP_TESTS=OFF -DBUILD_LUA_LIBS=OFF ..
+cmake -G "Unix Makefiles" -DBUILD_CPP_TESTS=OFF -DBUILD_LUA_LIBS=OFF ..
Android Build Instructions
@@ -35,6 +35,6 @@ mingw64 with msys2 build Instructions
cd cocos2d-x
mkdir mingwbuild && cd mingwbuild
-cmake -G "MSYS Makefile" -DBUILD_CPP_TESTS=OFF -DBUILD_LUA_LIBS=OFF ..
+cmake -G "MSYS Makefiles" -DBUILD_CPP_TESTS=OFF -DBUILD_LUA_LIBS=OFF ..
-todo: structure this document in markdown with better examples and more details
\ No newline at end of file
+todo: structure this document in markdown with better examples and more details
diff --git a/README.md b/README.md
index a6f59e372f..61cb4de288 100644
--- a/README.md
+++ b/README.md
@@ -119,7 +119,7 @@ Main features
Build Requirements
------------------
-* Mac OS X 10.7+, Xcode 4.6+
+* Mac OS X 10.7+, Xcode 5.1+
* or Ubuntu 12.10+, CMake 2.6+
* or Windows 7+, VS 2012+
* Python 2.7.5
diff --git a/build/android-build.py b/build/android-build.py
index 3465d37d8c..0376e02b65 100755
--- a/build/android-build.py
+++ b/build/android-build.py
@@ -15,15 +15,8 @@ def get_num_of_cpu():
''' The build process can be accelerated by running multiple concurrent job processes using the -j-option.
'''
try:
- platform = sys.platform
- if platform == 'win32':
- if 'NUMBER_OF_PROCESSORS' in os.environ:
- return int(os.environ['NUMBER_OF_PROCESSORS'])
- else:
- return 1
- else:
- from numpy.distutils import cpuinfo
- return cpuinfo.cpu._getNCPUs()
+ import multiprocessing
+ return multiprocessing.cpu_count()
except Exception:
print "Can't know cpuinfo, use default 1 cpu"
return 1
diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj
index 51b3dddc11..452e52b591 100644
--- a/build/cocos2d_libs.xcodeproj/project.pbxproj
+++ b/build/cocos2d_libs.xcodeproj/project.pbxproj
@@ -7231,7 +7231,6 @@
CC_KEYBOARD_SUPPORT,
_USRDLL,
);
- GCC_TREAT_WARNINGS_AS_ERRORS = NO;
HEADER_SEARCH_PATHS = "";
LD_DYLIB_INSTALL_NAME = "";
LIBRARY_SEARCH_PATHS = (
@@ -7266,7 +7265,6 @@
CC_TARGET_OS_MAC,
_USRDLL,
);
- GCC_TREAT_WARNINGS_AS_ERRORS = NO;
HEADER_SEARCH_PATHS = "";
LD_DYLIB_INSTALL_NAME = "";
LIBRARY_SEARCH_PATHS = (
@@ -7296,7 +7294,6 @@
"$(inherited)",
CC_TARGET_OS_IPHONE,
);
- GCC_TREAT_WARNINGS_AS_ERRORS = NO;
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
@@ -7329,7 +7326,6 @@
"$(inherited)",
CC_TARGET_OS_IPHONE,
);
- GCC_TREAT_WARNINGS_AS_ERRORS = NO;
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj
index fbccd74fa9..d06e3d4818 100644
--- a/build/cocos2d_tests.xcodeproj/project.pbxproj
+++ b/build/cocos2d_tests.xcodeproj/project.pbxproj
@@ -5706,6 +5706,7 @@
"CC_ENABLE_CHIPMUNK_INTEGRATION=1",
);
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
+ GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@@ -5733,6 +5734,7 @@
"CC_ENABLE_CHIPMUNK_INTEGRATION=1",
);
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
+ GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
diff --git a/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.sln b/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.sln
index 481fbd3963..22c9464a6e 100644
--- a/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.sln
+++ b/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.sln
@@ -23,8 +23,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Shared", "..\..\..
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Windows", "..\..\..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Windows\libSpine.Windows.vcxproj", "{F3550FE0-C795-44F6-8FEB-093EB68143AE}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Windows", "..\..\..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Windows\libcocos2d_8_1.Windows.vcxproj", "{9335005F-678E-4E8E-9B84-50037216AEC8}"
+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
..\..\..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{4a3c6ba8-c227-498b-aa21-40bda27b461f}*SharedItemsImports = 9
..\..\..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{adafd00d-a0d6-46ef-9f0b-ea2880bfe1de}*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
@@ -82,6 +85,18 @@ Global
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|Win32.Build.0 = Release|Win32
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.ActiveCfg = Release|x64
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.Build.0 = Release|x64
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.ActiveCfg = Debug|ARM
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.Build.0 = Debug|ARM
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.Build.0 = Debug|Win32
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.ActiveCfg = Debug|x64
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.Build.0 = Debug|x64
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.ActiveCfg = Release|ARM
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.Build.0 = Release|ARM
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.ActiveCfg = Release|Win32
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.Build.0 = Release|Win32
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.ActiveCfg = Release|x64
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -94,5 +109,6 @@ Global
{3B26A12D-3A44-47EA-82D2-282660FC844D} = {7CA66464-6A5E-493B-82EF-DBD84F91766F}
{ADAFD00D-A0D6-46EF-9F0B-EA2880BFE1DE} = {8F8A69D6-BD64-4BAD-AE20-2D07E7BD57BA}
{F3550FE0-C795-44F6-8FEB-093EB68143AE} = {8F8A69D6-BD64-4BAD-AE20-2D07E7BD57BA}
+ {9335005F-678E-4E8E-9B84-50037216AEC8} = {29321038-F308-421E-B8CA-140BB23D3C6D}
EndGlobalSection
EndGlobal
diff --git a/cmake/BuildHelpers.CMakeLists.txt b/cmake/BuildHelpers.CMakeLists.txt
index 1ad543c6d5..f8dd21cff5 100644
--- a/cmake/BuildHelpers.CMakeLists.txt
+++ b/cmake/BuildHelpers.CMakeLists.txt
@@ -1,71 +1,2 @@
-macro(pre_build TARGET_NAME)
- add_custom_target( ${TARGET_NAME}_PRE_BUILD ALL )
-
- add_custom_command(
- TARGET ${TARGET_NAME}_PRE_BUILD
- ${ARGN}
- PRE_BUILD
- COMMENT "${TARGET_NAME}_PRE_BUILD ..."
- )
-
- add_custom_target(${TARGET_NAME}_CORE_PRE_BUILD)
- add_dependencies(${TARGET_NAME}_PRE_BUILD ${TARGET_NAME}_CORE_PRE_BUILD)
- add_dependencies(${TARGET_NAME} ${TARGET_NAME}_PRE_BUILD)
-endmacro()
-
-#cmake has some strange defaults, this should help us a lot
-#Please use them everywhere
-
-#WINDOWS = Windows Desktop
-#WINRT = Windows RT
-#WP8 = Windows Phone 8
-#ANDROID = ANDROID
-#IOS = IOS
-#MACOSX = MAC OSX
-
-if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
- if(WINRT)
- set(SYSTEM_STRING "Windows RT")
- elseif(WP8)
- set(SYSTEM_STRING "Windows Phone 8")
- else()
- set(WINDOWS TRUE)
- set(SYSTEM_STRING "Windows Desktop")
- endif()
-elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
- if(ANDROID)
- set(SYSTEM_STRING "Android")
- else()
- set(LINUX TRUE)
- set(SYSTEM_STRING "Linux")
- endif()
-elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- if(IOS)
- set(SYSTEM_STRING "IOS")
- else()
- set(MACOSX TRUE)
- set(APPLE TRUE)
- set(SYSTEM_STRING "Mac OSX")
- endif()
-endif()
-
-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set(COMPILER_STRING ${CMAKE_CXX_COMPILER_ID})
- set(CLANG TRUE)
-elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
- if(MINGW)
- set(COMPILER_STRING "Mingw GCC")
- else()
- set(COMPILER_STRING "GCC")
- endif()
-elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
- set(COMPILER_STRING "${CMAKE_CXX_COMPILER_ID} C++")
-elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
- set(COMPILER_STRING "Visual Studio C++")
-endif()
-
-if(CMAKE_CROSSCOMPILING)
- set(BUILDING_STRING "It appears you are cross compiling for ${SYSTEM_STRING} with ${COMPILER_STRING}")
-else()
- set(BUILDING_STRING "It appears you are builing natively for ${SYSTEM_STRING} with ${COMPILER_STRING}")
-endif()
+# For compatibility only, please use include(CocosBuildHelpers) in future projects
+include(CocosBuildHelpers)
diff --git a/cmake/Modules/CocosBuildHelpers.cmake b/cmake/Modules/CocosBuildHelpers.cmake
new file mode 100644
index 0000000000..c90ed82c08
--- /dev/null
+++ b/cmake/Modules/CocosBuildHelpers.cmake
@@ -0,0 +1,95 @@
+include(CMakeParseArguments)
+
+macro(pre_build TARGET_NAME)
+ add_custom_target( ${TARGET_NAME}_PRE_BUILD ALL )
+
+ add_custom_command(
+ TARGET ${TARGET_NAME}_PRE_BUILD
+ ${ARGN}
+ PRE_BUILD
+ COMMENT "${TARGET_NAME}_PRE_BUILD ..."
+ )
+
+ add_custom_target(${TARGET_NAME}_CORE_PRE_BUILD)
+ add_dependencies(${TARGET_NAME}_PRE_BUILD ${TARGET_NAME}_CORE_PRE_BUILD)
+ add_dependencies(${TARGET_NAME} ${TARGET_NAME}_PRE_BUILD)
+endmacro()
+
+function(cocos_mark_resources)
+ set(oneValueArgs BASEDIR RESOURCEBASE)
+ set(multiValueArgs FILES)
+ cmake_parse_arguments(opt "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if(NOT opt_RESOURCEBASE)
+ set(opt_RESOURCEBASE Resources)
+ endif()
+
+ get_filename_component(BASEDIR_ABS ${opt_BASEDIR} ABSOLUTE)
+ foreach(RES_FILE ${opt_FILES} ${opt_UNPARSED_ARGUMENTS})
+ get_filename_component(RES_FILE_ABS ${RES_FILE} ABSOLUTE)
+ file(RELATIVE_PATH RES ${BASEDIR_ABS} ${RES_FILE_ABS})
+ get_filename_component(RES_LOC ${RES} PATH)
+ set_source_files_properties(${RES_FILE} PROPERTIES
+ MACOSX_PACKAGE_LOCATION "${opt_RESOURCEBASE}/${RES_LOC}"
+ HEADER_FILE_ONLY 1
+ )
+ endforeach()
+endfunction()
+
+#cmake has some strange defaults, this should help us a lot
+#Please use them everywhere
+
+#WINDOWS = Windows Desktop
+#WINRT = Windows RT
+#WP8 = Windows Phone 8
+#ANDROID = Android
+#IOS = iOS
+#MACOSX = MacOS X
+#LINUX = Linux
+
+if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+ if(WINRT)
+ set(SYSTEM_STRING "Windows RT")
+ elseif(WP8)
+ set(SYSTEM_STRING "Windows Phone 8")
+ else()
+ set(WINDOWS TRUE)
+ set(SYSTEM_STRING "Windows Desktop")
+ endif()
+elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ if(ANDROID)
+ set(SYSTEM_STRING "Android")
+ else()
+ set(LINUX TRUE)
+ set(SYSTEM_STRING "Linux")
+ endif()
+elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ if(IOS)
+ set(SYSTEM_STRING "IOS")
+ else()
+ set(MACOSX TRUE)
+ set(APPLE TRUE)
+ set(SYSTEM_STRING "Mac OSX")
+ endif()
+endif()
+
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set(COMPILER_STRING ${CMAKE_CXX_COMPILER_ID})
+ set(CLANG TRUE)
+elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+ if(MINGW)
+ set(COMPILER_STRING "Mingw GCC")
+ else()
+ set(COMPILER_STRING "GCC")
+ endif()
+elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
+ set(COMPILER_STRING "${CMAKE_CXX_COMPILER_ID} C++")
+elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
+ set(COMPILER_STRING "Visual Studio C++")
+endif()
+
+if(CMAKE_CROSSCOMPILING)
+ set(BUILDING_STRING "It appears you are cross compiling for ${SYSTEM_STRING} with ${COMPILER_STRING}")
+else()
+ set(BUILDING_STRING "It appears you are builing natively for ${SYSTEM_STRING} with ${COMPILER_STRING}")
+endif()
diff --git a/cocos/2d/CCCamera.cpp b/cocos/2d/CCCamera.cpp
index 27dd0284db..9bdbc33edc 100644
--- a/cocos/2d/CCCamera.cpp
+++ b/cocos/2d/CCCamera.cpp
@@ -66,9 +66,9 @@ Camera* Camera::createOrthographic(float zoomX, float zoomY, float nearPlane, fl
}
Camera::Camera()
-: _cameraFlag(1)
-, _scene(nullptr)
+: _scene(nullptr)
, _viewProjectionDirty(true)
+, _cameraFlag(1)
{
}
@@ -130,12 +130,15 @@ void Camera::lookAt(const Vec3& lookAtPos, const Vec3& up)
rotation.m[9] = zaxis.y;
rotation.m[10] = zaxis.z;
rotation.m[11] = 0;
+
Quaternion quaternion;
Quaternion::createFromRotationMatrix(rotation,&quaternion);
- float fRoll = atan2(2 * (quaternion.w * quaternion.z + quaternion.x * quaternion.y) , 1 - 2 * (quaternion.z * quaternion.z + quaternion.x * quaternion.x));
- float fPitch = asin(clampf(2 * (quaternion.w * quaternion.x - quaternion.y * quaternion.z) , -1.0f , 1.0f));
- float fYaw = atan2(2 * (quaternion.w * quaternion.y + quaternion.z * quaternion.x) , 1 - 2 * (quaternion.x * quaternion.x + quaternion.y * quaternion.y));
- setRotation3D(Vec3(CC_RADIANS_TO_DEGREES(fPitch),CC_RADIANS_TO_DEGREES(fYaw),CC_RADIANS_TO_DEGREES(fRoll)));
+
+ float rotx = atan2f(2 * (quaternion.w * quaternion.x + quaternion.y * quaternion.z), 1 - 2 * (quaternion.x * quaternion.x + quaternion.y * quaternion.y));
+ float roty = asin(clampf(2 * (quaternion.w * quaternion.y - quaternion.z * quaternion.x) , -1.0f , 1.0f));
+ float rotz = -atan2(2 * (quaternion.w * quaternion.z + quaternion.x * quaternion.y) , 1 - 2 * (quaternion.y * quaternion.y + quaternion.z * quaternion.z));
+
+ setRotation3D(Vec3(CC_RADIANS_TO_DEGREES(rotx),CC_RADIANS_TO_DEGREES(roty),CC_RADIANS_TO_DEGREES(rotz)));
}
const Mat4& Camera::getViewProjectionMatrix() const
diff --git a/cocos/2d/CCCamera.h b/cocos/2d/CCCamera.h
index aa95b15064..c1178cd96b 100644
--- a/cocos/2d/CCCamera.h
+++ b/cocos/2d/CCCamera.h
@@ -28,9 +28,16 @@ THE SOFTWARE.
NS_CC_BEGIN
-//class Ray;
class Scene;
+/**
+ * Note:
+ * Scene creates a default camera. And the default camera mask of Node is 1, therefore it can be seen by the default camera.
+ * During rendering the scene, it draws the objects seen by each camera in the added order except default camera. The default camera is the last one being drawn with.
+ * If 3D objects exist, you'd better create a seperate camera for them. And set the 3d camera flag to CameraFlag::USER1 or anything else except DEFAULT. The DEFAULT camera is for UI, because it is rendered at last.
+ * You can change the camera added order to get different result when depth test is not enabled.
+ * For each camera, transparent 3d sprite is rendered after opaque 3d sprite and other 2d objects.
+ */
enum class CameraFlag
{
DEFAULT = 1,
diff --git a/cocos/2d/CCDrawNode.cpp b/cocos/2d/CCDrawNode.cpp
index 3edbe0bbac..9c9b5599e9 100644
--- a/cocos/2d/CCDrawNode.cpp
+++ b/cocos/2d/CCDrawNode.cpp
@@ -106,23 +106,23 @@ static inline Tex2F __t(const Vec2 &v)
DrawNode::DrawNode()
: _vao(0)
, _vbo(0)
+, _vaoGLPoint(0)
+, _vboGLPoint(0)
+, _vaoGLLine(0)
+, _vboGLLine(0)
, _bufferCapacity(0)
, _bufferCount(0)
, _buffer(nullptr)
-, _dirty(false)
-, _vaoGLPoint(0)
-, _vboGLPoint(0)
, _bufferCapacityGLPoint(0)
, _bufferCountGLPoint(0)
, _bufferGLPoint(nullptr)
, _pointColor(1,1,1,1)
, _pointSize(1)
-, _dirtyGLPoint(false)
-, _vaoGLLine(0)
-, _vboGLLine(0)
, _bufferCapacityGLLine(0)
, _bufferCountGLLine(0)
, _bufferGLLine(nullptr)
+, _dirty(false)
+, _dirtyGLPoint(false)
, _dirtyGLLine(false)
{
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
@@ -348,6 +348,7 @@ void DrawNode::onDraw(const Mat4 &transform, uint32_t flags)
}
glDrawArrays(GL_TRIANGLES, 0, _bufferCount);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _bufferCount);
CHECK_GL_ERROR_DEBUG();
@@ -382,6 +383,7 @@ void DrawNode::onDrawGLLine(const Mat4 &transform, uint32_t flags)
}
glLineWidth(2);
glDrawArrays(GL_LINES, 0, _bufferCountGLLine);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_bufferCountGLLine);
CHECK_GL_ERROR_DEBUG();
@@ -418,6 +420,7 @@ void DrawNode::onDrawGLPoint(const Mat4 &transform, uint32_t flags)
}
glDrawArrays(GL_POINTS, 0, _bufferCountGLPoint);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_bufferCountGLPoint);
CHECK_GL_ERROR_DEBUG();
diff --git a/cocos/2d/CCFastTMXLayer.cpp b/cocos/2d/CCFastTMXLayer.cpp
index fc4d7dc29b..ad84ecac3f 100644
--- a/cocos/2d/CCFastTMXLayer.cpp
+++ b/cocos/2d/CCFastTMXLayer.cpp
@@ -113,11 +113,11 @@ TMXLayer::TMXLayer()
, _tiles(nullptr)
, _tileSet(nullptr)
, _layerOrientation(FAST_TMX_ORIENTATION_ORTHO)
-,_texture(nullptr)
+, _texture(nullptr)
, _vertexZvalue(0)
, _useAutomaticVertexZ(false)
-, _dirty(true)
, _quadsDirty(true)
+, _dirty(true)
, _vertexBuffer(nullptr)
, _vData(nullptr)
, _indexBuffer(nullptr)
diff --git a/cocos/2d/CCFontFreeType.cpp b/cocos/2d/CCFontFreeType.cpp
index 1ee2c1aebc..446c24f0d3 100644
--- a/cocos/2d/CCFontFreeType.cpp
+++ b/cocos/2d/CCFontFreeType.cpp
@@ -94,9 +94,9 @@ FT_Library FontFreeType::getFTLibrary()
FontFreeType::FontFreeType(bool distanceFieldEnabled /* = false */,int outline /* = 0 */)
: _fontRef(nullptr)
-,_distanceFieldEnabled(distanceFieldEnabled)
-,_outlineSize(0.0f)
-,_stroker(nullptr)
+, _stroker(nullptr)
+, _distanceFieldEnabled(distanceFieldEnabled)
+, _outlineSize(0.0f)
{
if (outline > 0)
{
diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp
index 79ec70dfca..39f5316cf2 100644
--- a/cocos/2d/CCLabel.cpp
+++ b/cocos/2d/CCLabel.cpp
@@ -235,30 +235,30 @@ bool Label::setCharMap(const std::string& charMapFile, int itemWidth, int itemHe
Label::Label(FontAtlas *atlas /* = nullptr */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */,
TextVAlignment vAlignment /* = TextVAlignment::TOP */,bool useDistanceField /* = false */,bool useA8Shader /* = false */)
-: _reusedLetter(nullptr)
-, _commonLineHeight(0.0f)
+: _isOpacityModifyRGB(false)
+, _contentDirty(false)
+, _fontAtlas(atlas)
+, _textSprite(nullptr)
+, _compatibleMode(false)
+, _reusedLetter(nullptr)
, _additionalKerning(0.0f)
+, _commonLineHeight(0.0f)
, _lineBreakWithoutSpaces(false)
+, _horizontalKernings(nullptr)
, _maxLineWidth(0)
+, _labelDimensions(Size::ZERO)
, _labelWidth(0)
, _labelHeight(0)
-, _labelDimensions(Size::ZERO)
, _hAlignment(hAlignment)
, _vAlignment(vAlignment)
-, _horizontalKernings(nullptr)
-, _fontAtlas(atlas)
-, _isOpacityModifyRGB(false)
+, _currNumLines(-1)
+, _fontScale(1.0f)
, _useDistanceField(useDistanceField)
, _useA8Shader(useA8Shader)
-, _fontScale(1.0f)
-, _uniformEffectColor(0)
-, _currNumLines(-1)
-, _textSprite(nullptr)
-, _contentDirty(false)
-, _shadowDirty(false)
-, _compatibleMode(false)
-, _insideBounds(true)
, _effectColorF(Color4F::BLACK)
+, _uniformEffectColor(0)
+, _shadowDirty(false)
+, _insideBounds(true)
{
setAnchorPoint(Vec2::ANCHOR_MIDDLE);
reset();
@@ -395,7 +395,13 @@ void Label::setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false *
_commonLineHeight = _fontAtlas->getCommonLineHeight();
_contentDirty = true;
}
+#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
_useDistanceField = distanceFieldEnabled;
+#else
+ // some older Windows Phones cannot run the ccShader_Label_df.frag program
+ // so we must disable distance field
+ _useDistanceField = false;
+#endif
_useA8Shader = useA8Shader;
if (_currentLabelType != LabelType::TTF)
diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h
index 2b3efbb34a..02844fa5f4 100644
--- a/cocos/2d/CCLabel.h
+++ b/cocos/2d/CCLabel.h
@@ -273,7 +273,7 @@ public:
CC_DEPRECATED_ATTRIBUTE virtual void setFontDefinition(const FontDefinition& textDefinition);
CC_DEPRECATED_ATTRIBUTE const FontDefinition& getFontDefinition() const { return _fontDefinition; }
- CC_DEPRECATED_ATTRIBUTE int getCommonLineHeight() const { return getLineHeight();}
+ CC_DEPRECATED_ATTRIBUTE int getCommonLineHeight() const { return (int)getLineHeight();}
CC_CONSTRUCTOR_ACCESS:
/**
diff --git a/cocos/2d/CCLabelTextFormatter.cpp b/cocos/2d/CCLabelTextFormatter.cpp
index dfad03f4f2..f884e74f67 100644
--- a/cocos/2d/CCLabelTextFormatter.cpp
+++ b/cocos/2d/CCLabelTextFormatter.cpp
@@ -269,18 +269,16 @@ bool LabelTextFormatter::alignText(Label *theLabel)
bool LabelTextFormatter::createStringSprites(Label *theLabel)
{
- // check for string
- unsigned int stringLen = theLabel->getStringLength();
theLabel->_limitShowCount = 0;
-
- // no string
- if (stringLen == 0)
+ // check for string
+ int stringLen = theLabel->getStringLength();
+ if (stringLen <= 0)
return false;
- int longestLine = 0;
- unsigned int totalHeight = theLabel->_commonLineHeight * theLabel->_currNumLines;
- int nextFontPositionX = 0;
- int nextFontPositionY = totalHeight;
+ auto totalHeight = theLabel->_commonLineHeight * theLabel->_currNumLines;
+ auto longestLine = 0.0f;
+ auto nextFontPositionX = 0.0f;
+ auto nextFontPositionY = totalHeight;
auto contentScaleFactor = CC_CONTENT_SCALE_FACTOR();
if (theLabel->_labelHeight > 0)
@@ -307,7 +305,6 @@ bool LabelTextFormatter::createStringSprites(Label *theLabel)
}
}
- Rect charRect;
int charXOffset = 0;
int charYOffset = 0;
int charAdvance = 0;
@@ -322,13 +319,13 @@ bool LabelTextFormatter::createStringSprites(Label *theLabel)
float clipBottom = 0;
int lineIndex = 0;
bool lineStart = true;
- bool clip = false;
+ bool clipBlank = false;
if (theLabel->_currentLabelType == Label::LabelType::TTF && theLabel->_clipEnabled)
{
- clip = true;
+ clipBlank = true;
}
- for (unsigned int i = 0; i < stringLen; i++)
+ for (int i = 0; i < stringLen; i++)
{
char16_t c = strWhole[i];
if (fontAtlas->getLetterDefinitionForChar(c, tempDefinition))
@@ -357,7 +354,7 @@ bool LabelTextFormatter::createStringSprites(Label *theLabel)
lineStart = true;
continue;
}
- else if (clip && tempDefinition.height > 0.0f)
+ else if (clipBlank && tempDefinition.height > 0.0f)
{
if (lineStart)
{
@@ -382,7 +379,7 @@ bool LabelTextFormatter::createStringSprites(Label *theLabel)
letterPosition.x = (nextFontPositionX + charXOffset + kernings[i]) / contentScaleFactor;
letterPosition.y = (nextFontPositionY - charYOffset) / contentScaleFactor;
- if( theLabel->recordLetterInfo(letterPosition,tempDefinition,i) == false)
+ if( theLabel->recordLetterInfo(letterPosition, tempDefinition, i) == false)
{
log("WARNING: can't find letter definition in font file for letter: %c", c);
continue;
@@ -420,7 +417,7 @@ bool LabelTextFormatter::createStringSprites(Label *theLabel)
tmpSize.height = theLabel->_labelHeight * contentScaleFactor;
}
- if (clip)
+ if (clipBlank)
{
int clipTotal = (clipTop + clipBottom) / contentScaleFactor;
tmpSize.height -= clipTotal * contentScaleFactor;
diff --git a/cocos/2d/CCLight.cpp b/cocos/2d/CCLight.cpp
index 30c98b37a4..45777ff5bc 100644
--- a/cocos/2d/CCLight.cpp
+++ b/cocos/2d/CCLight.cpp
@@ -44,8 +44,8 @@ void BaseLight::setRotationFromDirection( const Vec3 &direction )
BaseLight::BaseLight()
: _intensity(1.0f)
-, _enabled(true)
, _lightFlag(LightFlag::LIGHT0)
+, _enabled(true)
{
}
diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp
index 2a0d78965e..27597bb248 100644
--- a/cocos/2d/CCNode.cpp
+++ b/cocos/2d/CCNode.cpp
@@ -82,16 +82,18 @@ Node::Node(void)
, _scaleX(1.0f)
, _scaleY(1.0f)
, _scaleZ(1.0f)
-, _positionZ(0.0f)
, _position(Vec2::ZERO)
+, _positionZ(0.0f)
+, _usingNormalizedPosition(false)
+, _normalizedPositionDirty(false)
, _skewX(0.0f)
, _skewY(0.0f)
, _anchorPointInPoints(Vec2::ZERO)
, _anchorPoint(Vec2::ZERO)
, _contentSize(Size::ZERO)
-, _useAdditionalTransform(false)
, _transformDirty(true)
, _inverseDirty(true)
+, _useAdditionalTransform(false)
, _transformUpdated(true)
// children (lazy allocs)
// lazy alloc
@@ -100,6 +102,8 @@ Node::Node(void)
, _parent(nullptr)
// "whole screen" objects. like Scenes and Layers, should set _ignoreAnchorPointForPosition to true
, _tag(Node::INVALID_TAG)
+, _name("")
+, _hashOfName(0)
// userData is always inited as nil
, _userData(nullptr)
, _userObject(nullptr)
@@ -125,10 +129,6 @@ Node::Node(void)
, _realColor(Color3B::WHITE)
, _cascadeColorEnabled(false)
, _cascadeOpacityEnabled(false)
-, _usingNormalizedPosition(false)
-, _normalizedPositionDirty(false)
-, _name("")
-, _hashOfName(0)
, _cameraMask(1)
{
// set default scheduler and actionManager
diff --git a/cocos/2d/CCRenderTexture.cpp b/cocos/2d/CCRenderTexture.cpp
index 201cf0cfc1..4c2157843f 100644
--- a/cocos/2d/CCRenderTexture.cpp
+++ b/cocos/2d/CCRenderTexture.cpp
@@ -40,7 +40,11 @@ NS_CC_BEGIN
// implementation RenderTexture
RenderTexture::RenderTexture()
-: _FBO(0)
+: _keepMatrix(false)
+, _rtTextureRect(Rect::ZERO)
+, _fullRect(Rect::ZERO)
+, _fullviewPort(Rect::ZERO)
+, _FBO(0)
, _depthRenderBufffer(0)
, _oldFBO(0)
, _texture(0)
@@ -53,10 +57,6 @@ RenderTexture::RenderTexture()
, _clearStencil(0)
, _autoDraw(false)
, _sprite(nullptr)
-, _keepMatrix(false)
-, _rtTextureRect(Rect::ZERO)
-, _fullRect(Rect::ZERO)
-, _fullviewPort(Rect::ZERO)
, _saveFileCallback(nullptr)
{
#if CC_ENABLE_CACHE_TEXTURE_DATA
@@ -553,7 +553,7 @@ void RenderTexture::onBegin()
director->setProjection(director->getProjection());
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
- Mat4 modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
+ auto modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
modifiedProjection = GLViewImpl::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION,modifiedProjection);
#endif
@@ -572,7 +572,7 @@ void RenderTexture::onBegin()
else
{
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
- Mat4 modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
+ auto modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
modifiedProjection = GLViewImpl::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, modifiedProjection);
#endif
diff --git a/cocos/2d/CCScene.cpp b/cocos/2d/CCScene.cpp
index f2b0094bac..297ca6119d 100644
--- a/cocos/2d/CCScene.cpp
+++ b/cocos/2d/CCScene.cpp
@@ -129,6 +129,7 @@ void Scene::render(Renderer* renderer)
{
auto director = Director::getInstance();
Camera* defaultCamera = nullptr;
+ const auto& transform = getNodeToParentTransform();
for (const auto& camera : _cameras)
{
Camera::_visitingCamera = camera;
@@ -142,7 +143,7 @@ void Scene::render(Renderer* renderer)
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, Camera::_visitingCamera->getViewProjectionMatrix());
//visit the scene
- visit(renderer, Mat4::IDENTITY, 0);
+ visit(renderer, transform, 0);
renderer->render();
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
@@ -155,7 +156,7 @@ void Scene::render(Renderer* renderer)
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, Camera::_visitingCamera->getViewProjectionMatrix());
//visit the scene
- visit(renderer, Mat4::IDENTITY, 0);
+ visit(renderer, transform, 0);
renderer->render();
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
diff --git a/cocos/2d/CCScene.h b/cocos/2d/CCScene.h
index 1200350400..4fb66846f4 100644
--- a/cocos/2d/CCScene.h
+++ b/cocos/2d/CCScene.h
@@ -55,6 +55,8 @@ For the moment Scene has no other logic than that, but in future releases it mig
additional logic.
It is a good practice to use a Scene as the parent of all your nodes.
+
+Scene will create a default camera for you.
*/
class CC_DLL Scene : public Node
{
diff --git a/cocos/2d/CCSprite.cpp b/cocos/2d/CCSprite.cpp
index 3deb8978ed..564acd98ef 100644
--- a/cocos/2d/CCSprite.cpp
+++ b/cocos/2d/CCSprite.cpp
@@ -259,10 +259,10 @@ bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect, bool rotated)
}
Sprite::Sprite(void)
-: _shouldBeHidden(false)
+: _batchNode(nullptr)
+, _shouldBeHidden(false)
, _texture(nullptr)
, _insideBounds(true)
-, _batchNode(nullptr)
{
#if CC_SPRITE_DEBUG_DRAW
_debugDrawNode = DrawNode::create();
diff --git a/cocos/2d/CCTextFieldTTF.cpp b/cocos/2d/CCTextFieldTTF.cpp
index 591d62fb20..1e971665f9 100644
--- a/cocos/2d/CCTextFieldTTF.cpp
+++ b/cocos/2d/CCTextFieldTTF.cpp
@@ -55,8 +55,8 @@ TextFieldTTF::TextFieldTTF()
, _charCount(0)
, _inputText("")
, _placeHolder("") // prevent Label initWithString assertion
-, _secureTextEntry(false)
, _colorText(Color4B::WHITE)
+, _secureTextEntry(false)
{
_colorSpaceHolder.r = _colorSpaceHolder.g = _colorSpaceHolder.b = 127;
_colorSpaceHolder.a = 255;
diff --git a/cocos/2d/libcocos2d_wp8.vcxproj.filters b/cocos/2d/libcocos2d_wp8.vcxproj.filters
index b71852073f..b342af5218 100644
--- a/cocos/2d/libcocos2d_wp8.vcxproj.filters
+++ b/cocos/2d/libcocos2d_wp8.vcxproj.filters
@@ -53,12 +53,6 @@
{a2fd6c36-9078-45e7-bc11-c235357f565e}
-
- {c52c9563-bc10-4b77-8bcc-0e061628fae7}
-
-
- {1be811ab-a9b0-44f7-9a37-b7ef7f1ef24a}
-
{794d19d1-2992-497a-a770-081932fa9242}
@@ -236,6 +230,12 @@
{b7fdf4e2-b3be-4b7a-b586-ddab39fb05b7}
+
+ {c52c9563-bc10-4b77-8bcc-0e061628fae7}
+
+
+ {1be811ab-a9b0-44f7-9a37-b7ef7f1ef24a}
+
@@ -782,67 +782,67 @@
platform\winrt
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
@@ -1932,70 +1932,70 @@
platform\winrt
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
- platform\renderer
+ renderer
cocosbuilder\Header Files
@@ -2586,70 +2586,70 @@
math
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
- platform\renderer\shaders
+ renderer\shaders
\ 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 cd169e5074..9a2f6f4ea3 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
@@ -15,7 +15,7 @@
true
false
OldStyle
- 4056;4996;4244;4251;
+ 4056;4996;4244;4251;4756;
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)
diff --git a/cocos/3d/CCAnimate3D.cpp b/cocos/3d/CCAnimate3D.cpp
index b89805c4dd..0fc5d5b8a4 100644
--- a/cocos/3d/CCAnimate3D.cpp
+++ b/cocos/3d/CCAnimate3D.cpp
@@ -247,13 +247,13 @@ void Animate3D::setWeight(float weight)
}
Animate3D::Animate3D()
-: _absSpeed(1.f)
+: _state(Animate3D::Animate3DState::Running)
+, _animation(nullptr)
+, _absSpeed(1.f)
, _weight(1.f)
, _start(0.f)
, _last(1.f)
-, _animation(nullptr)
, _playReverse(false)
-, _state(Animate3D::Animate3DState::Running)
, _accTransTime(0.0f)
, _lastTime(0.0f)
{
diff --git a/cocos/3d/CCAnimationCurve.inl b/cocos/3d/CCAnimationCurve.inl
index ac2207bf9b..41380f8c89 100644
--- a/cocos/3d/CCAnimationCurve.inl
+++ b/cocos/3d/CCAnimationCurve.inl
@@ -103,8 +103,8 @@ float AnimationCurve::getEndTime() const
template
AnimationCurve::AnimationCurve()
-: _keytime(nullptr)
-, _value(nullptr)
+: _value(nullptr)
+, _keytime(nullptr)
, _count(0)
, _componentSizeByte(0)
, _evaluateFun(nullptr)
diff --git a/cocos/3d/CCAttachNode.h b/cocos/3d/CCAttachNode.h
index f312b6cc7c..8f43a4a2b5 100644
--- a/cocos/3d/CCAttachNode.h
+++ b/cocos/3d/CCAttachNode.h
@@ -58,7 +58,7 @@ CC_CONSTRUCTOR_ACCESS:
protected:
- Bone3D* _attachBone;
+ Bone3D* _attachBone;
};
diff --git a/cocos/3d/CCBundle3D.cpp b/cocos/3d/CCBundle3D.cpp
index a80eb35819..bca305c28b 100644
--- a/cocos/3d/CCBundle3D.cpp
+++ b/cocos/3d/CCBundle3D.cpp
@@ -306,20 +306,6 @@ bool Bundle3D::loadObj(MeshDatas& meshdatas, MaterialDatas& materialdatas, NodeD
return false;
}
-bool Bundle3D::loadMeshData(const std::string& id, MeshData* meshdata)
-{
- meshdata->resetData();
-
- if (_isBinary)
- {
- return loadMeshDataBinary(meshdata);
- }
- else
- {
- return loadMeshDataJson(meshdata);
- }
-}
-
bool Bundle3D::loadSkinData(const std::string& id, SkinData* skindata)
{
skindata->resetData();
@@ -334,20 +320,6 @@ bool Bundle3D::loadSkinData(const std::string& id, SkinData* skindata)
}
}
-bool Bundle3D::loadMaterialData(const std::string& id, MaterialData* materialdata)
-{
- materialdata->resetData();
-
- if (_isBinary)
- {
- return loadMaterialDataBinary(materialdata);
- }
- else
- {
- return loadMaterialDataJson(materialdata);
- }
-}
-
bool Bundle3D::loadAnimationData(const std::string& id, Animation3DData* animationdata)
{
animationdata->resetData();
@@ -368,14 +340,10 @@ bool Bundle3D::loadMeshDatas(MeshDatas& meshdatas)
meshdatas.resetData();
if (_isBinary)
{
- if (_version == "0.1")
+ if (_version == "0.1" || _version == "0.2")
{
return loadMeshDatasBinary_0_1(meshdatas);
}
- else if(_version == "0.2")
- {
- return loadMeshDatasBinary_0_2(meshdatas);
- }
else
{
return loadMeshDatasBinary(meshdatas);
@@ -383,14 +351,10 @@ bool Bundle3D::loadMeshDatas(MeshDatas& meshdatas)
}
else
{
- if (_version == "1.2")
+ if (_version == "1.2" || _version == "0.2")
{
return loadMeshDataJson_0_1(meshdatas);
}
- else if(_version == "0.2")
- {
- return loadMeshDataJson_0_2(meshdatas);
- }
else
{
return loadMeshDatasJson(meshdatas);
@@ -937,7 +901,7 @@ bool Bundle3D::loadMaterialsBinary_0_2(MaterialDatas& materialdatas)
if (texturePath.empty())
{
CCLOG("warning: Failed to read Materialdata: texturePath is empty '%s'.", _path.c_str());
- return false;
+ return true;
}
NTextureData textureData;
@@ -1005,6 +969,73 @@ bool Bundle3D::loadJson(const std::string& path)
return true;
}
+
+bool Bundle3D::loadBinary(const std::string& path)
+{
+ clear();
+
+ // get file data
+ CC_SAFE_DELETE(_binaryBuffer);
+ _binaryBuffer = new (std::nothrow) Data();
+ *_binaryBuffer = FileUtils::getInstance()->getDataFromFile(path);
+ if (_binaryBuffer->isNull())
+ {
+ clear();
+ CCLOG("warning: Failed to read file: %s", path.c_str());
+ return false;
+ }
+
+ // Initialise bundle reader
+ _binaryReader.init( (char*)_binaryBuffer->getBytes(), _binaryBuffer->getSize() );
+
+ // Read identifier info
+ char identifier[] = { 'C', '3', 'B', '\0'};
+ char sig[4];
+ if (_binaryReader.read(sig, 1, 4) != 4 || memcmp(sig, identifier, 4) != 0)
+ {
+ clear();
+ CCLOG("warning: Invalid identifier: %s", path.c_str());
+ return false;
+ }
+
+ // Read version
+ unsigned char ver[2];
+ if (_binaryReader.read(ver, 1, 2)!= 2){
+ CCLOG("warning: Failed to read version:");
+ return false;
+ }
+
+ char version[20] = {0};
+ sprintf(version, "%d.%d", ver[0], ver[1]);
+ _version = version;
+
+ // Read ref table size
+ if (_binaryReader.read(&_referenceCount, 4, 1) != 1)
+ {
+ clear();
+ CCLOG("warning: Failed to read ref table size '%s'.", path.c_str());
+ return false;
+ }
+
+ // Read all refs
+ CC_SAFE_DELETE_ARRAY(_references);
+ _references = new (std::nothrow) Reference[_referenceCount];
+ for (ssize_t i = 0; i < _referenceCount; ++i)
+ {
+ if ((_references[i].id = _binaryReader.readString()).empty() ||
+ _binaryReader.read(&_references[i].type, 4, 1) != 1 ||
+ _binaryReader.read(&_references[i].offset, 4, 1) != 1)
+ {
+ clear();
+ CCLOG("warning: Failed to read ref number %d for bundle '%s'.", (int)i, path.c_str());
+ CC_SAFE_DELETE_ARRAY(_references);
+ return false;
+ }
+ }
+
+ return true;
+}
+
bool Bundle3D::loadMeshDataJson_0_1(MeshDatas& meshdatas)
{
const rapidjson::Value& mesh_data_array = _jsonReader[MESH];
@@ -1145,6 +1176,108 @@ bool Bundle3D::loadSkinDataJson(SkinData* skindata)
return true;
}
+
+bool Bundle3D::loadSkinDataBinary(SkinData* skindata)
+{
+ if (!seekToFirstType(BUNDLE_TYPE_MESHSKIN))
+ return false;
+
+ std::string boneName = _binaryReader.readString();
+
+ // transform
+ float bindShape[16];
+ if (!_binaryReader.readMatrix(bindShape))
+ {
+ CCLOG("warning: Failed to read SkinData: bindShape matrix '%s'.", _path.c_str());
+ return false;
+ }
+
+ // bone count
+ unsigned int boneNum;
+ if (!_binaryReader.read(&boneNum))
+ {
+ CCLOG("warning: Failed to read SkinData: boneNum '%s'.", _path.c_str());
+ return false;
+ }
+
+ // bone names and bind pos
+ float bindpos[16];
+ for (unsigned int i = 0; i < boneNum; i++)
+ {
+ std::string skinBoneName = _binaryReader.readString();
+ skindata->skinBoneNames.push_back(skinBoneName);
+ if (!_binaryReader.readMatrix(bindpos))
+ {
+ CCLOG("warning: Failed to load SkinData: bindpos '%s'.", _path.c_str());
+ return false;
+ }
+ skindata->inverseBindPoseMatrices.push_back(bindpos);
+ }
+
+ skindata->skinBoneOriginMatrices.resize(boneNum);
+
+ boneName = _binaryReader.readString();
+
+ // bind shape
+ _binaryReader.readMatrix(bindShape);
+ int rootIndex = skindata->getSkinBoneNameIndex(boneName);
+ if(rootIndex < 0)
+ {
+ skindata->addNodeBoneNames(boneName);
+ rootIndex = skindata->getBoneNameIndex(boneName);
+ skindata->nodeBoneOriginMatrices.push_back(bindShape);
+ }
+ else
+ {
+ skindata->skinBoneOriginMatrices[rootIndex] = bindShape;
+ }
+
+ // set root bone index
+ skindata->rootBoneIndex = rootIndex;
+
+ // read parent and child relationship map
+ float transform[16];
+ unsigned int linkNum;
+ _binaryReader.read(&linkNum);
+ for (unsigned int i = 0; i < linkNum; ++i)
+ {
+ std::string id = _binaryReader.readString();
+ int index = skindata->getSkinBoneNameIndex(id);
+
+
+ std::string parentid = _binaryReader.readString();
+
+ if (!_binaryReader.readMatrix(transform))
+ {
+ CCLOG("warning: Failed to load SkinData: transform '%s'.", _path.c_str());
+ return false;
+ }
+
+ if(index < 0)
+ {
+ skindata->addNodeBoneNames(id);
+ index = skindata->getBoneNameIndex(id);
+ skindata->nodeBoneOriginMatrices.push_back(transform);
+ }
+ else
+ {
+ skindata->skinBoneOriginMatrices[index] = transform;
+ }
+
+ int parentIndex = skindata->getSkinBoneNameIndex(parentid);
+ if(parentIndex < 0)
+ {
+ skindata->addNodeBoneNames(parentid);
+ parentIndex = skindata->getBoneNameIndex(parentid);
+ }
+
+ skindata->boneChild[parentIndex].push_back(index);
+
+ }
+
+ return true;
+}
+
bool Bundle3D::loadMaterialDataJson_0_1(MaterialDatas& materialdatas)
{
if (!_jsonReader.HasMember(MATERIAL))
@@ -1269,361 +1402,6 @@ bool Bundle3D::loadAnimationDataJson(const std::string& id, Animation3DData* ani
return true;
}
-bool Bundle3D::loadBinary(const std::string& path)
-{
- clear();
-
- // get file data
- CC_SAFE_DELETE(_binaryBuffer);
- _binaryBuffer = new (std::nothrow) Data();
- *_binaryBuffer = FileUtils::getInstance()->getDataFromFile(path);
- if (_binaryBuffer->isNull())
- {
- clear();
- CCLOG("warning: Failed to read file: %s", path.c_str());
- return false;
- }
-
- // Initialise bundle reader
- _binaryReader.init( (char*)_binaryBuffer->getBytes(), _binaryBuffer->getSize() );
-
- // Read identifier info
- char identifier[] = { 'C', '3', 'B', '\0'};
- char sig[4];
- if (_binaryReader.read(sig, 1, 4) != 4 || memcmp(sig, identifier, 4) != 0)
- {
- clear();
- CCLOG("warning: Invalid identifier: %s", path.c_str());
- return false;
- }
-
- // Read version
- unsigned char ver[2];
- if (_binaryReader.read(ver, 1, 2)!= 2){
- CCLOG("warning: Failed to read version:");
- return false;
- }
-
- char version[20] = {0};
- sprintf(version, "%d.%d", ver[0], ver[1]);
- _version = version;
-
- // Read ref table size
- if (_binaryReader.read(&_referenceCount, 4, 1) != 1)
- {
- clear();
- CCLOG("warning: Failed to read ref table size '%s'.", path.c_str());
- return false;
- }
-
- // Read all refs
- CC_SAFE_DELETE_ARRAY(_references);
- _references = new (std::nothrow) Reference[_referenceCount];
- for (ssize_t i = 0; i < _referenceCount; ++i)
- {
- if ((_references[i].id = _binaryReader.readString()).empty() ||
- _binaryReader.read(&_references[i].type, 4, 1) != 1 ||
- _binaryReader.read(&_references[i].offset, 4, 1) != 1)
- {
- clear();
- CCLOG("warning: Failed to read ref number %d for bundle '%s'.", (int)i, path.c_str());
- CC_SAFE_DELETE_ARRAY(_references);
- return false;
- }
- }
-
- return true;
-}
-
-bool Bundle3D::loadMeshDataBinary(MeshData* meshdata)
-{
- if (_version == "0.1")
- {
- return loadMeshDataBinary_0_1(meshdata);
- }
- else if(_version == "0.2")
- {
- return loadMeshDataBinary_0_2(meshdata);
- }
- else
- {
- CCLOG("warning: Unsupported version of loadMeshDataBinary() : %s", _version.c_str());
- return false;
- }
-}
-
-bool Bundle3D::loadMeshDataBinary_0_1(MeshData* meshdata)
-{
- if (!seekToFirstType(BUNDLE_TYPE_MESH))
- return false;
-
- // read mesh data
- if (_binaryReader.read(&meshdata->attribCount, 4, 1) != 1 || meshdata->attribCount < 1)
- {
- CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
- return false;
- }
-
- meshdata->attribs.resize(meshdata->attribCount);
- for (ssize_t i = 0; i < meshdata->attribCount; i++)
- {
- unsigned int vUsage, vSize;
- if (_binaryReader.read(&vUsage, 4, 1) != 1 || _binaryReader.read(&vSize, 4, 1) != 1)
- {
- CCLOG("warning: Failed to read meshdata: usage or size '%s'.", _path.c_str());
- return false;
- }
-
- meshdata->attribs[i].size = vSize;
- meshdata->attribs[i].attribSizeBytes = meshdata->attribs[i].size * 4;
- meshdata->attribs[i].type = GL_FLOAT;
- meshdata->attribs[i].vertexAttrib = vUsage;
- }
-
- // Read vertex data
- if (_binaryReader.read(&meshdata->vertexSizeInFloat, 4, 1) != 1 || meshdata->vertexSizeInFloat == 0)
- {
- CCLOG("warning: Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str());
- return false;
- }
-
- meshdata->vertex.resize(meshdata->vertexSizeInFloat);
- if (_binaryReader.read(&meshdata->vertex[0], 4, meshdata->vertexSizeInFloat) != meshdata->vertexSizeInFloat)
- {
- CCLOG("warning: Failed to read meshdata: vertex element '%s'.", _path.c_str());
- return false;
- }
-
- // Read index data
- unsigned int meshPartCount = 1;
- //_binaryReader.read(&meshPartCount, 4, 1);
-
- for (unsigned int i = 0; i < meshPartCount; ++i)
- {
- unsigned int nIndexCount;
- if (_binaryReader.read(&nIndexCount, 4, 1) != 1)
- {
- CCLOG("warning: Failed to read meshdata: nIndexCount '%s'.", _path.c_str());
- return false;
- }
-
- std::vector indices;
- indices.resize(nIndexCount);
- if (_binaryReader.read(&indices[0], 2, nIndexCount) != nIndexCount)
- {
- CCLOG("warning: Failed to read meshdata: indices '%s'.", _path.c_str());
- return false;
- }
-
- meshdata->subMeshIndices.push_back(indices);
- }
-
- return true;
-}
-
-bool Bundle3D::loadMeshDataBinary_0_2(MeshData* meshdata)
-{
- if (!seekToFirstType(BUNDLE_TYPE_MESH))
- return false;
-
- meshdata->resetData();
-
- // read mesh data
- if (_binaryReader.read(&meshdata->attribCount, 4, 1) != 1 || meshdata->attribCount < 1)
- {
- CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
- return false;
- }
-
- meshdata->attribs.resize(meshdata->attribCount);
- for (ssize_t i = 0; i < meshdata->attribCount; i++)
- {
- unsigned int vUsage, vSize;
- if (_binaryReader.read(&vUsage, 4, 1) != 1 || _binaryReader.read(&vSize, 4, 1) != 1)
- {
- CCLOG("warning: Failed to read meshdata: usage or size '%s'.", _path.c_str());
- return false;
- }
-
- meshdata->attribs[i].size = vSize;
- meshdata->attribs[i].attribSizeBytes = meshdata->attribs[i].size * 4;
- meshdata->attribs[i].type = GL_FLOAT;
- meshdata->attribs[i].vertexAttrib = vUsage;
- }
-
- // Read vertex data
- if (_binaryReader.read(&meshdata->vertexSizeInFloat, 4, 1) != 1 || meshdata->vertexSizeInFloat == 0)
- {
- CCLOG("warning: Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str());
- return false;
- }
-
- meshdata->vertex.resize(meshdata->vertexSizeInFloat);
- if (_binaryReader.read(&meshdata->vertex[0], 4, meshdata->vertexSizeInFloat) != meshdata->vertexSizeInFloat)
- {
- CCLOG("warning: Failed to read meshdata: vertex element '%s'.", _path.c_str());
- return false;
- }
-
- // read submesh
- unsigned int submeshCount;
- if (_binaryReader.read(&submeshCount, 4, 1) != 1)
- {
- CCLOG("warning: Failed to read meshdata: submeshCount '%s'.", _path.c_str());
- return false;
- }
-
- for (unsigned int i = 0; i < submeshCount; ++i)
- {
- unsigned int nIndexCount;
- if (_binaryReader.read(&nIndexCount, 4, 1) != 1)
- {
- CCLOG("warning: Failed to read meshdata: nIndexCount '%s'.", _path.c_str());
- return false;
- }
-
- std::vector indices;
- indices.resize(nIndexCount);
- if (_binaryReader.read(&indices[0], 2, nIndexCount) != nIndexCount)
- {
- CCLOG("warning: Failed to read meshdata: indices '%s'.", _path.c_str());
- return false;
- }
-
- meshdata->subMeshIndices.push_back(indices);
- }
-
- return true;
-}
-
-bool Bundle3D::loadSkinDataBinary(SkinData* skindata)
-{
- if (!seekToFirstType(BUNDLE_TYPE_MESHSKIN))
- return false;
-
- std::string boneName = _binaryReader.readString();
-
- // transform
- float bindShape[16];
- if (!_binaryReader.readMatrix(bindShape))
- {
- CCLOG("warning: Failed to read SkinData: bindShape matrix '%s'.", _path.c_str());
- return false;
- }
-
- // bone count
- unsigned int boneNum;
- if (!_binaryReader.read(&boneNum))
- {
- CCLOG("warning: Failed to read SkinData: boneNum '%s'.", _path.c_str());
- return false;
- }
-
- // bone names and bind pos
- float bindpos[16];
- for (unsigned int i = 0; i < boneNum; i++)
- {
- std::string skinBoneName = _binaryReader.readString();
- skindata->skinBoneNames.push_back(skinBoneName);
- if (!_binaryReader.readMatrix(bindpos))
- {
- CCLOG("warning: Failed to load SkinData: bindpos '%s'.", _path.c_str());
- return false;
- }
- skindata->inverseBindPoseMatrices.push_back(bindpos);
- }
-
- skindata->skinBoneOriginMatrices.resize(boneNum);
-
- boneName = _binaryReader.readString();
-
- // bind shape
- _binaryReader.readMatrix(bindShape);
- int rootIndex = skindata->getSkinBoneNameIndex(boneName);
- if(rootIndex < 0)
- {
- skindata->addNodeBoneNames(boneName);
- rootIndex = skindata->getBoneNameIndex(boneName);
- skindata->nodeBoneOriginMatrices.push_back(bindShape);
- }
- else
- {
- skindata->skinBoneOriginMatrices[rootIndex] = bindShape;
- }
-
- // set root bone index
- skindata->rootBoneIndex = rootIndex;
-
- // read parent and child relationship map
- float transform[16];
- unsigned int linkNum;
- _binaryReader.read(&linkNum);
- for (unsigned int i = 0; i < linkNum; ++i)
- {
- std::string id = _binaryReader.readString();
- int index = skindata->getSkinBoneNameIndex(id);
-
-
- std::string parentid = _binaryReader.readString();
-
- if (!_binaryReader.readMatrix(transform))
- {
- CCLOG("warning: Failed to load SkinData: transform '%s'.", _path.c_str());
- return false;
- }
-
- if(index < 0)
- {
- skindata->addNodeBoneNames(id);
- index = skindata->getBoneNameIndex(id);
- skindata->nodeBoneOriginMatrices.push_back(transform);
- }
- else
- {
- skindata->skinBoneOriginMatrices[index] = transform;
- }
-
- int parentIndex = skindata->getSkinBoneNameIndex(parentid);
- if(parentIndex < 0)
- {
- skindata->addNodeBoneNames(parentid);
- parentIndex = skindata->getBoneNameIndex(parentid);
- }
-
- skindata->boneChild[parentIndex].push_back(index);
-
- }
-
- return true;
-}
-
-bool Bundle3D::loadMaterialDataBinary(MaterialData* materialdata)
-{
- if (!seekToFirstType(BUNDLE_TYPE_MATERIAL))
- return false;
-
- unsigned int materialnum = 1;
- if (_version == "0.2")
- {
- _binaryReader.read(&materialnum, 4, 1);
- }
-
- for (int i = 0; i < materialnum; i++)
- {
- std::string texturePath = _binaryReader.readString();
- if (texturePath.empty())
- {
- CCLOG("warning: Failed to read Materialdata: texturePath is empty '%s'.", _path.c_str());
- return false;
- }
-
- std::string path = _modelPath + texturePath;
- materialdata->texturePaths[i] = path;
- }
-
- return true;
-}
-
bool Bundle3D::loadAnimationDataBinary(const std::string& id, Animation3DData* animationdata)
{
if (!seekToFirstType(BUNDLE_TYPE_ANIMATIONS))
@@ -2181,14 +1959,14 @@ Reference* Bundle3D::seekToFirstType(unsigned int type)
}
Bundle3D::Bundle3D()
- :_isBinary(false),
- _modelPath(""),
+ : _modelPath(""),
_path(""),
_version(""),
_jsonBuffer(nullptr),
_binaryBuffer(nullptr),
_referenceCount(0),
- _references(nullptr)
+ _references(nullptr),
+ _isBinary(false)
{
}
diff --git a/cocos/3d/CCBundle3D.h b/cocos/3d/CCBundle3D.h
index 6f1c1a8bee..b8591bdf0b 100644
--- a/cocos/3d/CCBundle3D.h
+++ b/cocos/3d/CCBundle3D.h
@@ -58,24 +58,12 @@ public:
*/
virtual bool load(const std::string& path);
- /**
- * load mesh data from bundle
- * @param id The ID of the mesh, load the first Mesh in the bundle if it is empty
- */
- virtual bool loadMeshData(const std::string& id, MeshData* meshdata);
-
/**
* load skin data from bundle
* @param id The ID of the skin, load the first Skin in the bundle if it is empty
*/
virtual bool loadSkinData(const std::string& id, SkinData* skindata);
- /**
- * load material data from bundle
- * @param id The ID of the material, load the first Material in the bundle if it is empty
- */
- virtual bool loadMaterialData(const std::string& id, MaterialData* materialdata);
-
/**
* load material data from bundle
* @param id The ID of the animation, load the first animation in the bundle if it is empty
@@ -95,6 +83,7 @@ public:
protected:
bool loadJson(const std::string& path);
+ bool loadBinary(const std::string& path);
bool loadMeshDatasJson(MeshDatas& meshdatas);
bool loadMeshDataJson_0_1(MeshDatas& meshdatas);
bool loadMeshDataJson_0_2(MeshDatas& meshdatas);
@@ -111,44 +100,13 @@ protected:
bool loadMeshDataJson_0_1(MeshData* meshdata){return true;}
bool loadMeshDataJson_0_2(MeshData* meshdata){return true;}
bool loadSkinDataJson(SkinData* skindata);
+ bool loadSkinDataBinary(SkinData* skindata);
bool loadMaterialDataJson(MaterialData* materialdata){return true;}
bool loadMaterialDataJson_0_1(MaterialData* materialdata){return true;}
bool loadMaterialDataJson_0_2(MaterialData* materialdata){return true;}
bool loadAnimationDataJson(const std::string& id,Animation3DData* animationdata);
- /**
- * load data in binary
- * @param path The c3b file path
- */
- bool loadBinary(const std::string& path);
-
- /**
- * load mesh data in binary
- * @param meshdata The mesh data pointer
- */
- bool loadMeshDataBinary(MeshData* meshdata);
- bool loadMeshDataBinary_0_1(MeshData* meshdata);
- bool loadMeshDataBinary_0_2(MeshData* meshdata);
-
- /**
- * load skin data in binary
- * @param skindata The skin data pointer
- */
- bool loadSkinDataBinary(SkinData* skindata);
-
- /**
- * load material data in binary
- * @param materialdata The material pointer
- */
- bool loadMaterialDataBinary(MaterialData* materialdata);
-
- /**
- * load animation data in binary
- * @param animationdata The animation data pointer
- */
bool loadAnimationDataBinary(const std::string& id,Animation3DData* animationdata);
- bool checkIsBone(const std::string& name);
-
/**
* load nodes of json
*/
@@ -196,12 +154,9 @@ CC_CONSTRUCTOR_ACCESS:
virtual ~Bundle3D();
protected:
-
static Bundle3D* _instance;
-
std::string _modelPath;
- std::string _path;
-
+ std::string _path;
std::string _version;// the c3b or c3t version
// for json reading
diff --git a/cocos/3d/CCBundle3DData.h b/cocos/3d/CCBundle3DData.h
index 63c5916c89..2e477e49eb 100644
--- a/cocos/3d/CCBundle3DData.h
+++ b/cocos/3d/CCBundle3DData.h
@@ -364,10 +364,10 @@ public:
}
Animation3DData(const Animation3DData& other)
- : _totalTime(other._totalTime)
- , _translationKeys(other._translationKeys)
+ : _translationKeys(other._translationKeys)
, _rotationKeys(other._rotationKeys)
, _scaleKeys(other._scaleKeys)
+ , _totalTime(other._totalTime)
{
}
diff --git a/cocos/3d/CCBundleReader.cpp b/cocos/3d/CCBundleReader.cpp
index 5bc99e8499..33ba3acfb2 100644
--- a/cocos/3d/CCBundleReader.cpp
+++ b/cocos/3d/CCBundleReader.cpp
@@ -49,13 +49,16 @@ void BundleReader::init(char* buffer, ssize_t length)
ssize_t BundleReader::read(void* ptr, ssize_t size, ssize_t count)
{
if (!_buffer || eof())
+ {
+ CCLOG("warning: bundle reader out of range");
return 0;
+ }
ssize_t validCount;
ssize_t validLength = _length - _position;
ssize_t needLength = size*count;
char* ptr1 = (char*)ptr;
- if(validLength <= needLength)
+ if(validLength < needLength)
{
validCount = validLength/size;
ssize_t readLength = size*validCount;
diff --git a/cocos/3d/CCMesh.cpp b/cocos/3d/CCMesh.cpp
index 2ab7417034..f21c507166 100644
--- a/cocos/3d/CCMesh.cpp
+++ b/cocos/3d/CCMesh.cpp
@@ -36,14 +36,14 @@ using namespace std;
NS_CC_BEGIN
Mesh::Mesh()
-: _visible(true)
-, _texture(nullptr)
+: _texture(nullptr)
, _skin(nullptr)
+, _visible(true)
+, _isTransparent(false)
, _meshIndexData(nullptr)
-, _visibleChanged(nullptr)
, _glProgramState(nullptr)
, _blend(BlendFunc::ALPHA_NON_PREMULTIPLIED)
-, _isTransparent(false)
+, _visibleChanged(nullptr)
{
}
diff --git a/cocos/3d/CCMeshSkin.cpp b/cocos/3d/CCMeshSkin.cpp
index 901ca212d7..d192796df4 100644
--- a/cocos/3d/CCMeshSkin.cpp
+++ b/cocos/3d/CCMeshSkin.cpp
@@ -33,8 +33,8 @@ static int PALETTE_ROWS = 3;
MeshSkin::MeshSkin()
: _rootBone(nullptr)
-, _matrixPalette(nullptr)
, _skeleton(nullptr)
+, _matrixPalette(nullptr)
{
}
diff --git a/cocos/3d/CCMeshVertexIndexData.cpp b/cocos/3d/CCMeshVertexIndexData.cpp
index 513805ccb2..00822071ca 100644
--- a/cocos/3d/CCMeshVertexIndexData.cpp
+++ b/cocos/3d/CCMeshVertexIndexData.cpp
@@ -94,15 +94,12 @@ MeshVertexData* MeshVertexData::create(const MeshData& meshdata)
vertexdata->_vertexData->setStream(vertexdata->_vertexBuffer, VertexStreamAttribute(offset, it.vertexAttrib, it.type, it.size));
offset += it.attribSizeBytes;
}
- vertexdata->_vertexData->setStream(vertexdata->_vertexBuffer, VertexStreamAttribute(0, GLProgram::VERTEX_ATTRIB_POSITION, GL_FLOAT, 3));
- vertexdata->_vertexData->setStream(vertexdata->_vertexBuffer, VertexStreamAttribute(offsetof(V3F_C4B_T2F, colors), GLProgram::VERTEX_ATTRIB_COLOR, GL_UNSIGNED_BYTE, 4, true));
- vertexdata->_vertexData->setStream(vertexdata->_vertexBuffer, VertexStreamAttribute(offsetof(V3F_C4B_T2F, texCoords), GLProgram::VERTEX_ATTRIB_TEX_COORD, GL_FLOAT, 2));
vertexdata->_attribs = meshdata.attribs;
if(vertexdata->_vertexBuffer)
{
- vertexdata->_vertexBuffer->updateVertices((void*)&meshdata.vertex[0], (int)meshdata.vertex.size() * 4, 0);
+ vertexdata->_vertexBuffer->updateVertices((void*)&meshdata.vertex[0], (int)meshdata.vertex.size() * 4 / vertexdata->_vertexBuffer->getSizePerVertex(), 0);
}
AABB aabb;
diff --git a/cocos/3d/CCOBB.cpp b/cocos/3d/CCOBB.cpp
index a9e3235c31..582898657b 100755
--- a/cocos/3d/CCOBB.cpp
+++ b/cocos/3d/CCOBB.cpp
@@ -414,7 +414,7 @@ bool OBB::intersects(const OBB& box) const
for (int j = 0; j < 3; j++)
{
Vec3 axis;
- Vec3::cross(getFaceDirection(i), box.getFaceDirection(j), &axis);
+ Vec3::cross(getEdgeDirection(i), box.getEdgeDirection(j), &axis);
getInterval(*this, axis, min1, max1);
getInterval(box, axis, min2, max2);
if (max1 < min2 || max2 < min1) return false;
diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp
index a498d9b03e..66a0f0d216 100644
--- a/cocos/3d/CCSprite3D.cpp
+++ b/cocos/3d/CCSprite3D.cpp
@@ -684,7 +684,7 @@ Mesh* Sprite3D::getMeshByIndex(int index) const
return _meshes.at(index);
}
-/**get SubMeshState by Name */
+/**get Mesh by Name */
Mesh* Sprite3D::getMeshByName(const std::string& name) const
{
for (const auto& it : _meshes) {
@@ -694,6 +694,16 @@ Mesh* Sprite3D::getMeshByName(const std::string& name) const
return nullptr;
}
+std::vector Sprite3D::getMeshArrayByName(const std::string& name) const
+{
+ std::vector meshes;
+ for (const auto& it : _meshes) {
+ if (it->getName() == name)
+ meshes.push_back(it);
+ }
+ return meshes;
+}
+
MeshSkin* Sprite3D::getSkin() const
{
for (const auto& it : _meshes) {
diff --git a/cocos/3d/CCSprite3D.h b/cocos/3d/CCSprite3D.h
index 3b08d9bf9e..daeb83c688 100644
--- a/cocos/3d/CCSprite3D.h
+++ b/cocos/3d/CCSprite3D.h
@@ -60,11 +60,14 @@ public:
void setTexture(const std::string& texFile);
void setTexture(Texture2D* texture);
- /**get SubMeshState by index*/
+ /**get Mesh by index*/
Mesh* getMeshByIndex(int index) const;
- /**get SubMeshState by Name */
+ /**get Mesh by Name, it returns the first one if there are more than one mesh with the same name */
Mesh* getMeshByName(const std::string& name) const;
+
+ /** get mesh array by name, returns all meshes with the given name */
+ std::vector getMeshArrayByName(const std::string& name) const;
/**get mesh*/
Mesh* getMesh() const { return _meshes.at(0); }
diff --git a/cocos/CMakeLists.txt b/cocos/CMakeLists.txt
index fe54a7e700..24ffe5fe76 100644
--- a/cocos/CMakeLists.txt
+++ b/cocos/CMakeLists.txt
@@ -48,18 +48,23 @@ include(network/CMakeLists.txt)
include(audio/CMakeLists.txt)
include(storage/CMakeLists.txt)
+if(BUILD_EDITOR_COCOSBUILDER)
include(editor-support/cocosbuilder/CMakeLists.txt)
+set(COCOS_EDITOR_SUPPORT_SRC ${COCOS_EDITOR_SUPPORT_SRC} ${COCOS_CCB_SRC})
+endif(BUILD_EDITOR_COCOSBUILDER)
+
+if(BUILD_EDITOR_COCOSTUDIO)
include(editor-support/cocostudio/CMakeLists.txt)
+set(COCOS_EDITOR_SUPPORT_SRC ${COCOS_EDITOR_SUPPORT_SRC} ${COCOS_CS_SRC})
+endif(BUILD_EDITOR_COCOSTUDIO)
+
+if(BUILD_EDITOR_SPINE)
include(editor-support/spine/CMakeLists.txt)
+set(COCOS_EDITOR_SUPPORT_SRC ${COCOS_EDITOR_SUPPORT_SRC} ${COCOS_SPINE_SRC})
+endif(BUILD_EDITOR_SPINE)
include(../extensions/CMakeLists.txt)
-set(COCOS_EDITOR_SUPPORT_SRC
- ${COCOS_CCB_SRC}
- ${COCOS_CS_SRC}
- ${COCOS_SPINE_SRC}
-)
-
set(COCOS_SRC cocos2d.cpp
${COCOS_2D_SRC}
${COCOS_3D_SRC}
@@ -98,6 +103,7 @@ endif()
if(MINGW)
find_package(Freetype REQUIRED)
find_package(WebP REQUIRED)
+ find_package(Protobuf REQUIRED)
#find_package(MiniZip REQUIRED)
#${MINIZIP_INCLUDE_DIR}
@@ -112,8 +118,9 @@ if(MINGW)
message( STATUS "WEBP dirs: ${WEBP_INCLUDE_DIRS}")
message( STATUS "FREETYPE dirs: ${FREETYPE_INCLUDE_DIRS}")
message( STATUS "Chipmunk dirs: ${CHIPMUNK_INCLUDE_DIRS}")
+ message( STATUS "Protobuf dirs: ${PROTOBUF_INCLUDE_DIRS}")
- include_directories(${FREETYPE_INCLUDE_DIRS} ${WEBP_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${CHIPMUNK_INCLUDE_DIRS})
+ include_directories(${FREETYPE_INCLUDE_DIRS} ${WEBP_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${CHIPMUNK_INCLUDE_DIRS} ${PROTOBUF_INCLUDE_DIRS})
else()
@@ -146,7 +153,7 @@ elseif(WINDOWS)
set(PLATFORM_SPECIFIC_LIBS libjpeg libpng libwebp libtiff libcurl_imp libwebsockets freetype250 glfw3 glew32 opengl32 libiconv libzlib)
elseif(LINUX)
set(PLATFORM_SPECIFIC_LIBS jpeg webp tiff freetype curl websockets ssl crypto
- fontconfig png pthread glfw GLEW GL X11 rt z protobuf ${FMOD_LIB})
+ fontconfig png pthread glfw GLEW GL X11 rt z ${FMOD_LIB})
elseif(MACOSX OR APPLE)
INCLUDE_DIRECTORIES ( /System/Library/Frameworks )
@@ -178,7 +185,7 @@ else()
message( FATAL_ERROR "Unsupported platform, CMake will exit" )
endif()
-target_link_libraries(cocos2d chipmunk box2d tinyxml2 unzip xxhash ${PLATFORM_SPECIFIC_LIBS})
+target_link_libraries(cocos2d chipmunk box2d protobuf tinyxml2 unzip xxhash ${PLATFORM_SPECIFIC_LIBS})
set_target_properties(cocos2d
PROPERTIES
diff --git a/cocos/audio/CMakeLists.txt b/cocos/audio/CMakeLists.txt
index 289ea93231..c2e12f8769 100644
--- a/cocos/audio/CMakeLists.txt
+++ b/cocos/audio/CMakeLists.txt
@@ -1,46 +1,51 @@
-if(WINDOWS AND NOT BUILD_STATIC)
- ADD_DEFINITIONS (-D_EXPORT_DLL_)
-endif()
+set(COCOS_AUDIO_SRC
+ audio/AudioEngine.cpp
+ )
if(WINDOWS)
- set(COCOS_AUDIO_SRC
- audio/win32/SimpleAudioEngine.cpp
- audio/win32/MciPlayer.cpp
- audio/win32/MciPlayer.h
- )
+ set(COCOS_AUDIO_PLATFORM_SRC
+ audio/win32/SimpleAudioEngine.cpp
+ audio/win32/MciPlayer.cpp
+ audio/win32/MciPlayer.h
+ )
elseif(LINUX)
- set(COCOS_AUDIO_SRC
- audio/linux/SimpleAudioEngineFMOD.cpp
- audio/linux/FmodAudioPlayer.cpp
- audio/linux/FmodAudioPlayer.h
- audio/linux/AudioPlayer.h
- )
+ set(COCOS_AUDIO_PLATFORM_SRC
+ audio/linux/SimpleAudioEngineFMOD.cpp
+ audio/linux/FmodAudioPlayer.cpp
+ audio/linux/FmodAudioPlayer.h
+ audio/linux/AudioPlayer.h
+ )
- include_directories( ../external/linux-specific/fmod/include/${ARCH_DIR} )
+ include_directories( ../external/linux-specific/fmod/include/${ARCH_DIR} )
elseif(MACOSX)
# split it in _C and non C
# because C files needs to be compiled with C compiler and not C++
# compiler
- set(COCOS_AUDIO_SRC_C
+ set(COCOS_AUDIO_PLATFORM_SRC_C
audio/mac/CDAudioManager.m
audio/mac/CDOpenALSupport.m
audio/mac/CocosDenshion.m
audio/mac/SimpleAudioEngine_objc.m
- )
- set(COCOS_AUDIO_SRC
- ${COCOS_AUDIO_SRC_C}
+ )
+ set(COCOS_AUDIO_PLATFORM_SRC
+ ${COCOS_AUDIO_PLATFORM_SRC_C}
+ audio/apple/AudioCache.mm
+ audio/apple/AudioEngine-inl.mm
+ audio/apple/AudioPlayer.mm
audio/mac/SimpleAudioEngine.mm
audio/mac/CDXMacOSXSupport.mm
- )
- SET_SOURCE_FILES_PROPERTIES(
- ${COCOS_AUDIO_SRC_C}
+ )
+ set_source_files_properties(
+ ${COCOS_AUDIO_PLATFORM_SRC_C}
PROPERTIES LANGUAGE C
)
endif()
+list(APPEND COCOS_AUDIO_SRC ${COCOS_AUDIO_PLATFORM_SRC})
+
if(LINUX)
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(FMOD_LIB "fmodex64")
diff --git a/cocos/audio/android/AudioEngine-inl.cpp b/cocos/audio/android/AudioEngine-inl.cpp
index 05be61036f..7860aedc18 100644
--- a/cocos/audio/android/AudioEngine-inl.cpp
+++ b/cocos/audio/android/AudioEngine-inl.cpp
@@ -46,7 +46,15 @@ void PlayOverEvent(SLPlayItf caller, void* context, SLuint32 playEvent)
if (context && playEvent == SL_PLAYEVENT_HEADATEND)
{
AudioPlayer* player = (AudioPlayer*)context;
- player->_playOver = true;
+ //fix issue#8965:AudioEngine can't looping audio on Android 2.3.x
+ if (player->_loop)
+ {
+ (*(player->_fdPlayerPlay))->SetPlayState(player->_fdPlayerPlay, SL_PLAYSTATE_PLAYING);
+ }
+ else
+ {
+ player->_playOver = true;
+ }
}
}
@@ -55,6 +63,7 @@ AudioPlayer::AudioPlayer()
, _finishCallback(nullptr)
, _duration(0.0f)
, _playOver(false)
+ , _loop(false)
{
}
@@ -143,6 +152,7 @@ bool AudioPlayer::init(SLEngineItf engineEngine, SLObjectItf outputMixObject,con
result = (*_fdPlayerObject)->GetInterface(_fdPlayerObject, SL_IID_VOLUME, &_fdPlayerVolume);
if(SL_RESULT_SUCCESS != result){ ERRORLOG("get the volume interface fail"); break; }
+ _loop = loop;
if (loop){
(*_fdPlayerSeek)->SetLoop(_fdPlayerSeek, SL_BOOLEAN_TRUE, 0, SL_TIME_UNKNOWN);
}
@@ -286,13 +296,14 @@ void AudioEngineImpl::setVolume(int audioID,float volume)
}
auto result = (*player._fdPlayerVolume)->SetVolumeLevel(player._fdPlayerVolume, dbVolume);
if(SL_RESULT_SUCCESS != result){
- log("%s error:%lu",__func__, result);
+ log("%s error:%u",__func__, result);
}
}
void AudioEngineImpl::setLoop(int audioID, bool loop)
{
auto& player = _audioPlayers[audioID];
+ player._loop = loop;
SLboolean loopEnabled = SL_BOOLEAN_TRUE;
if (!loop){
loopEnabled = SL_BOOLEAN_FALSE;
@@ -305,7 +316,7 @@ void AudioEngineImpl::pause(int audioID)
auto& player = _audioPlayers[audioID];
auto result = (*player._fdPlayerPlay)->SetPlayState(player._fdPlayerPlay, SL_PLAYSTATE_PAUSED);
if(SL_RESULT_SUCCESS != result){
- log("%s error:%lu",__func__, result);
+ log("%s error:%u",__func__, result);
}
}
@@ -314,7 +325,7 @@ void AudioEngineImpl::resume(int audioID)
auto& player = _audioPlayers[audioID];
auto result = (*player._fdPlayerPlay)->SetPlayState(player._fdPlayerPlay, SL_PLAYSTATE_PLAYING);
if(SL_RESULT_SUCCESS != result){
- log("%s error:%lu",__func__, result);
+ log("%s error:%u",__func__, result);
}
}
@@ -323,7 +334,7 @@ void AudioEngineImpl::stop(int audioID)
auto& player = _audioPlayers[audioID];
auto result = (*player._fdPlayerPlay)->SetPlayState(player._fdPlayerPlay, SL_PLAYSTATE_STOPPED);
if(SL_RESULT_SUCCESS != result){
- log("%s error:%lu",__func__, result);
+ log("%s error:%u",__func__, result);
}
_audioPlayers.erase(audioID);
diff --git a/cocos/audio/android/AudioEngine-inl.h b/cocos/audio/android/AudioEngine-inl.h
index 209f52b206..c28e0edb53 100644
--- a/cocos/audio/android/AudioEngine-inl.h
+++ b/cocos/audio/android/AudioEngine-inl.h
@@ -50,16 +50,15 @@ public:
bool init(SLEngineItf engineEngine, SLObjectItf outputMixObject,const std::string& fileFullPath, float volume, bool loop);
bool _playOver;
-private:
-
- SLObjectItf _fdPlayerObject;
+ bool _loop;
SLPlayItf _fdPlayerPlay;
+private:
+ SLObjectItf _fdPlayerObject;
SLSeekItf _fdPlayerSeek;
SLVolumeItf _fdPlayerVolume;
float _duration;
int _audioID;
-
std::function _finishCallback;
diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp
index 227dfe2796..be72136274 100644
--- a/cocos/base/CCDirector.cpp
+++ b/cocos/base/CCDirector.cpp
@@ -540,15 +540,15 @@ void Director::multiplyMatrix(MATRIX_STACK_TYPE type, const Mat4& mat)
void Director::pushMatrix(MATRIX_STACK_TYPE type)
{
- if(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW == type)
+ if(type == MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW)
{
_modelViewMatrixStack.push(_modelViewMatrixStack.top());
}
- else if(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION == type)
+ else if(type == MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION)
{
_projectionMatrixStack.push(_projectionMatrixStack.top());
}
- else if(MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE == type)
+ else if(type == MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE)
{
_textureMatrixStack.push(_textureMatrixStack.top());
}
@@ -558,36 +558,23 @@ void Director::pushMatrix(MATRIX_STACK_TYPE type)
}
}
-Mat4 Director::getMatrix(MATRIX_STACK_TYPE type)
+const Mat4& Director::getMatrix(MATRIX_STACK_TYPE type)
{
- Mat4 result;
- if(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW == type)
+ if(type == MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW)
{
- result = _modelViewMatrixStack.top();
+ return _modelViewMatrixStack.top();
}
- else if(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION == type)
+ else if(type == MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION)
{
- result = _projectionMatrixStack.top();
+ return _projectionMatrixStack.top();
}
- else if(MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE == type)
+ else if(type == MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE)
{
- result = _textureMatrixStack.top();
+ return _textureMatrixStack.top();
}
- else
- {
- CCASSERT(false, "unknow matrix stack type, will return modelview matrix instead");
- result = _modelViewMatrixStack.top();
- }
-// float diffResult(0);
-// for (int index = 0; index <16; ++index)
-// {
-// diffResult += abs(result2.mat[index] - result.mat[index]);
-// }
-// if(diffResult > 1e-30)
-// {
-// CCASSERT(false, "Error in director matrix stack");
-// }
- return result;
+
+ CCASSERT(false, "unknow matrix stack type, will return modelview matrix instead");
+ return _modelViewMatrixStack.top();
}
void Director::setProjection(Projection projection)
@@ -717,17 +704,15 @@ static void GLToClipTransform(Mat4 *transformOut)
Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
-
- Mat4 projection;
- projection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
+
+ auto projection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
//if needed, we need to undo the rotation for Landscape orientation in order to get the correct positions
projection = Director::getInstance()->getOpenGLView()->getReverseOrientationMatrix() * projection;
#endif
- Mat4 modelview;
- modelview = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
+ auto modelview = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
*transformOut = projection * modelview;
}
diff --git a/cocos/base/CCDirector.h b/cocos/base/CCDirector.h
index d84464a994..c9baba964a 100644
--- a/cocos/base/CCDirector.h
+++ b/cocos/base/CCDirector.h
@@ -90,27 +90,12 @@ enum class MATRIX_STACK_TYPE
class CC_DLL Director : public Ref
{
-private:
- std::stack _modelViewMatrixStack;
- std::stack _projectionMatrixStack;
- std::stack _textureMatrixStack;
-protected:
- void initMatrixStack();
-public:
- void pushMatrix(MATRIX_STACK_TYPE type);
- void popMatrix(MATRIX_STACK_TYPE type);
- void loadIdentityMatrix(MATRIX_STACK_TYPE type);
- void loadMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
- void multiplyMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
- Mat4 getMatrix(MATRIX_STACK_TYPE type);
- void resetMatrixStack();
public:
static const char *EVENT_PROJECTION_CHANGED;
static const char* EVENT_AFTER_UPDATE;
static const char* EVENT_AFTER_VISIT;
static const char* EVENT_AFTER_DRAW;
-
/** @typedef ccDirectorProjection
Possible OpenGL projections used by director
*/
@@ -399,6 +384,14 @@ public:
*/
float getFrameRate() const { return _frameRate; }
+ void pushMatrix(MATRIX_STACK_TYPE type);
+ void popMatrix(MATRIX_STACK_TYPE type);
+ void loadIdentityMatrix(MATRIX_STACK_TYPE type);
+ void loadMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
+ void multiplyMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
+ const Mat4& getMatrix(MATRIX_STACK_TYPE type);
+ void resetMatrixStack();
+
protected:
void purgeDirector();
bool _purgeDirectorInNextLoop; // this flag will be set to true in end()
@@ -417,6 +410,12 @@ protected:
void initTextureCache();
void destroyTextureCache();
+ void initMatrixStack();
+
+ std::stack _modelViewMatrixStack;
+ std::stack _projectionMatrixStack;
+ std::stack _textureMatrixStack;
+
/** Scheduler associated with this director
@since v2.0
*/
diff --git a/cocos/base/CCEventController.cpp b/cocos/base/CCEventController.cpp
index 3176f7d82c..1c0eebb1e1 100644
--- a/cocos/base/CCEventController.cpp
+++ b/cocos/base/CCEventController.cpp
@@ -30,8 +30,8 @@ NS_CC_BEGIN
EventController::EventController(ControllerEventType type, Controller* controller, int keyCode)
: Event(Type::GAME_CONTROLLER)
, _controllerEventType(type)
-, _keyCode(keyCode)
, _controller(controller)
+, _keyCode(keyCode)
, _isConnected(true)
{
@@ -41,8 +41,8 @@ EventController::EventController(ControllerEventType type, Controller* controlle
: Event(Type::GAME_CONTROLLER)
, _controllerEventType(type)
, _controller(controller)
-, _isConnected(isConnected)
, _keyCode(0)
+, _isConnected(isConnected)
{
}
diff --git a/cocos/base/CCEventFocus.cpp b/cocos/base/CCEventFocus.cpp
index 442f72372c..92ff539dcb 100644
--- a/cocos/base/CCEventFocus.cpp
+++ b/cocos/base/CCEventFocus.cpp
@@ -30,8 +30,8 @@ NS_CC_BEGIN
EventFocus::EventFocus(ui::Widget *widgetLoseFocus, ui::Widget* widgetGetFocus)
:Event(Type::FOCUS),
-_widgetLoseFocus(widgetLoseFocus),
-_widgetGetFocus(widgetGetFocus)
+_widgetGetFocus(widgetGetFocus),
+_widgetLoseFocus(widgetLoseFocus)
{
}
diff --git a/cocos/base/CCEventListenerTouch.h b/cocos/base/CCEventListenerTouch.h
index 353c938e9d..603160b1e9 100644
--- a/cocos/base/CCEventListenerTouch.h
+++ b/cocos/base/CCEventListenerTouch.h
@@ -52,10 +52,14 @@ public:
//
public:
- std::function onTouchBegan;
- std::function onTouchMoved;
- std::function onTouchEnded;
- std::function onTouchCancelled;
+
+ typedef std::function ccTouchBeganCallback;
+ typedef std::function ccTouchCallback;
+
+ ccTouchBeganCallback onTouchBegan;
+ ccTouchCallback onTouchMoved;
+ ccTouchCallback onTouchEnded;
+ ccTouchCallback onTouchCancelled;
CC_CONSTRUCTOR_ACCESS:
EventListenerTouchOneByOne();
@@ -82,10 +86,13 @@ public:
virtual bool checkAvailable() override;
//
public:
- std::function&, Event*)> onTouchesBegan;
- std::function&, Event*)> onTouchesMoved;
- std::function&, Event*)> onTouchesEnded;
- std::function&, Event*)> onTouchesCancelled;
+
+ typedef std::function&, Event*)> ccTouchesCallback;
+
+ ccTouchesCallback onTouchesBegan;
+ ccTouchesCallback onTouchesMoved;
+ ccTouchesCallback onTouchesEnded;
+ ccTouchesCallback onTouchesCancelled;
CC_CONSTRUCTOR_ACCESS:
EventListenerTouchAllAtOnce();
diff --git a/cocos/base/CCRef.cpp b/cocos/base/CCRef.cpp
index 59478a4eec..91e30935e9 100644
--- a/cocos/base/CCRef.cpp
+++ b/cocos/base/CCRef.cpp
@@ -189,7 +189,7 @@ static void untrackRef(Ref* ref)
__refAllocationList.erase(iter);
}
-#endif // #if CC_USE_MEM_LEAK_DETECTION
+#endif // #if CC_REF_LEAK_DETECTION
NS_CC_END
diff --git a/cocos/base/CCRef.h b/cocos/base/CCRef.h
index cfb1971177..f0f2820ed9 100644
--- a/cocos/base/CCRef.h
+++ b/cocos/base/CCRef.h
@@ -146,8 +146,8 @@ public:
void* _scriptObject;
#endif
- // Memory leak diagnostic data (only included when CC_USE_MEM_LEAK_DETECTION is defined and its value isn't zero)
-#if CC_USE_MEM_LEAK_DETECTION
+ // Memory leak diagnostic data (only included when CC_REF_LEAK_DETECTION is defined and its value isn't zero)
+#if CC_REF_LEAK_DETECTION
public:
static void printLeaks();
#endif
diff --git a/cocos/base/CCScriptSupport.h b/cocos/base/CCScriptSupport.h
index 1079dd0903..da896a9f07 100644
--- a/cocos/base/CCScriptSupport.h
+++ b/cocos/base/CCScriptSupport.h
@@ -27,8 +27,6 @@
#define __SCRIPT_SUPPORT_H__
#include "base/ccConfig.h"
-#if CC_ENABLE_SCRIPT_BINDING
-
#include "platform/CCCommon.h"
#include "base/CCTouch.h"
#include "base/CCEventTouch.h"
@@ -37,6 +35,8 @@
#include
#include
+#if CC_ENABLE_SCRIPT_BINDING
+
typedef struct lua_State lua_State;
NS_CC_BEGIN
diff --git a/cocos/base/CCValue.cpp b/cocos/base/CCValue.cpp
index ce840193a2..fe0ad27296 100644
--- a/cocos/base/CCValue.cpp
+++ b/cocos/base/CCValue.cpp
@@ -29,9 +29,9 @@
NS_CC_BEGIN
-const ValueVector ValueVectorNull;
-const ValueMap ValueMapNull;
-const ValueMapIntKey ValueMapIntKeyNull;
+CC_DLL const ValueVector ValueVectorNull;
+CC_DLL const ValueMap ValueMapNull;
+CC_DLL const ValueMapIntKey ValueMapIntKeyNull;
const Value Value::Null;
diff --git a/cocos/base/CCValue.h b/cocos/base/CCValue.h
index 98531422f5..c007a15f3c 100644
--- a/cocos/base/CCValue.h
+++ b/cocos/base/CCValue.h
@@ -39,9 +39,9 @@ typedef std::vector ValueVector;
typedef std::unordered_map ValueMap;
typedef std::unordered_map ValueMapIntKey;
-extern const ValueVector ValueVectorNull;
-extern const ValueMap ValueMapNull;
-extern const ValueMapIntKey ValueMapIntKeyNull;
+CC_DLL extern const ValueVector ValueVectorNull;
+CC_DLL extern const ValueMap ValueMapNull;
+CC_DLL extern const ValueMapIntKey ValueMapIntKeyNull;
class CC_DLL Value
{
diff --git a/cocos/editor-support/cocosbuilder/CCBKeyframe.cpp b/cocos/editor-support/cocosbuilder/CCBKeyframe.cpp
index ef0ffcdeea..bd4040bbde 100644
--- a/cocos/editor-support/cocosbuilder/CCBKeyframe.cpp
+++ b/cocos/editor-support/cocosbuilder/CCBKeyframe.cpp
@@ -5,10 +5,10 @@ using namespace cocos2d;
namespace cocosbuilder {
CCBKeyframe::CCBKeyframe()
-: _time(0.0f)
+: _object(nullptr)
+, _time(0.0f)
, _easingType(EasingType::INSTANT)
, _easingOpt(0.0f)
-, _object(nullptr)
{}
CCBKeyframe::~CCBKeyframe()
diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp
index feb015a36a..e4dcd1da2b 100644
--- a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp
+++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp
@@ -78,6 +78,7 @@ ActionTimeline::ActionTimeline()
, _startFrame(0)
, _endFrame(0)
, _frameEventListener(nullptr)
+ , _lastFrameListener(nullptr)
{
}
@@ -186,6 +187,9 @@ void ActionTimeline::step(float delta)
if(_time > _endFrame * _frameInternal)
{
+ if(_lastFrameListener != nullptr)
+ _lastFrameListener();
+
_playing = _loop;
if(!_playing)
_time = _endFrame * _frameInternal;
@@ -272,6 +276,15 @@ void ActionTimeline::clearFrameEventCallFunc()
_frameEventListener = nullptr;
}
+void ActionTimeline::setLastFrameCallFunc(std::function listener)
+{
+ _lastFrameListener = listener;
+}
+
+void ActionTimeline::clearLastFrameCallFunc()
+{
+ _lastFrameListener = nullptr;
+}
void ActionTimeline::emitFrameEvent(Frame* frame)
{
@@ -283,6 +296,9 @@ void ActionTimeline::emitFrameEvent(Frame* frame)
void ActionTimeline::gotoFrame(int frameIndex)
{
+ if(_target == nullptr)
+ return;
+
ssize_t size = _timelineList.size();
for(ssize_t i = 0; i < size; i++)
{
diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h
index 321b1136fa..76a3299d78 100644
--- a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h
+++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h
@@ -129,6 +129,10 @@ public:
void setFrameEventCallFunc(std::function listener);
void clearFrameEventCallFunc();
+ /** Last frame callback will call when arriving last frame */
+ void setLastFrameCallFunc(std::function listener);
+ void clearLastFrameCallFunc();
+
/** Inherit from Action. */
/** Returns a clone of ActionTimeline */
@@ -163,6 +167,7 @@ protected:
bool _loop;
std::function _frameEventListener;
+ std::function _lastFrameListener;
};
NS_TIMELINE_END
diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp
index a9a2f0c593..cb38bab2fd 100644
--- a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp
+++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp
@@ -733,11 +733,15 @@ ActionTimeline* ActionTimelineCache::loadAnimationActionWithFileFromXML(const st
// xml read
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(fileName).c_str();
ssize_t size;
- std::string content =(char*)FileUtils::getInstance()->getFileData(fullpath, "r", &size);
+
+ //fix memory leak for v3.3
+ unsigned char* pByte = FileUtils::getInstance()->getFileData(fullpath, "r", &size);
// xml parse
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();
- document->Parse(content.c_str());
+ document->Parse((const char*)pByte);
+
+ free(pByte);
const tinyxml2::XMLElement* rootElement = document->RootElement();// Root
CCLOG("rootElement name = %s", rootElement->Name());
diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp
index f1dc53a7af..a959680716 100644
--- a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp
+++ b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp
@@ -79,7 +79,7 @@ VisibleFrame::VisibleFrame()
{
}
-void VisibleFrame::onEnter(Frame *nextFrame)
+void VisibleFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
_node->setVisible(_visible);
}
@@ -122,7 +122,7 @@ void TextureFrame::setNode(Node* node)
_sprite = dynamic_cast(node);
}
-void TextureFrame::onEnter(Frame *nextFrame)
+void TextureFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
if(_sprite)
{
@@ -166,10 +166,10 @@ RotationFrame::RotationFrame()
{
}
-void RotationFrame::onEnter(Frame *nextFrame)
+void RotationFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
_node->setRotation(_rotation);
-
+
if(_tween)
{
_betwennRotation = static_cast(nextFrame)->_rotation - _rotation;
@@ -216,11 +216,11 @@ SkewFrame::SkewFrame()
{
}
-void SkewFrame::onEnter(Frame *nextFrame)
+void SkewFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
_node->setSkewX(_skewX);
_node->setSkewY(_skewY);
-
+
if(_tween)
{
_betweenSkewX = static_cast(nextFrame)->_skewX - _skewX;
@@ -271,11 +271,11 @@ RotationSkewFrame::RotationSkewFrame()
{
}
-void RotationSkewFrame::onEnter(Frame *nextFrame)
+void RotationSkewFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
_node->setRotationSkewX(_skewX);
_node->setRotationSkewY(_skewY);
-
+
if (_tween)
{
_betweenSkewX = static_cast(nextFrame)->_skewX - _skewX;
@@ -325,7 +325,7 @@ PositionFrame::PositionFrame()
{
}
-void PositionFrame::onEnter(Frame *nextFrame)
+void PositionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
_node->setPosition(_position);
@@ -378,11 +378,11 @@ ScaleFrame::ScaleFrame()
{
}
-void ScaleFrame::onEnter(Frame *nextFrame)
+void ScaleFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
_node->setScaleX(_scaleX);
_node->setScaleY(_scaleY);
-
+
if(_tween)
{
_betweenScaleX = static_cast(nextFrame)->_scaleX - _scaleX;
@@ -432,7 +432,7 @@ AnchorPointFrame::AnchorPointFrame()
{
}
-void AnchorPointFrame::onEnter(Frame *nextFrame)
+void AnchorPointFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
_node->setAnchorPoint(_anchorPoint);
}
@@ -469,7 +469,7 @@ InnerActionFrame::InnerActionFrame()
{
}
-void InnerActionFrame::onEnter(Frame *nextFrame)
+void InnerActionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
}
@@ -505,11 +505,11 @@ ColorFrame::ColorFrame()
{
}
-void ColorFrame::onEnter(Frame *nextFrame)
+void ColorFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
_node->setOpacity(_alpha);
_node->setColor(_color);
-
+
if(_tween)
{
_betweenAlpha = static_cast(nextFrame)->_alpha - _alpha;
@@ -573,9 +573,10 @@ EventFrame::EventFrame()
{
}
-void EventFrame::onEnter(Frame *nextFrame)
+void EventFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
- emitEvent();
+ if(currentFrameIndex>=_frameIndex)
+ emitEvent();
}
@@ -608,7 +609,7 @@ ZOrderFrame::ZOrderFrame()
{
}
-void ZOrderFrame::onEnter(Frame *nextFrame)
+void ZOrderFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
if(_node)
_node->setLocalZOrder(_zorder);
diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h
index 10b72d36a4..2be52adfb4 100644
--- a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h
+++ b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h
@@ -56,7 +56,7 @@ public:
virtual bool isEnterWhenPassed() { return _enterWhenPassed; }
- virtual void onEnter(Frame *nextFrame) = 0;
+ virtual void onEnter(Frame* nextFrame, int currentFrameIndex) = 0;
virtual void apply(float percent) {}
virtual Frame* clone() = 0;
@@ -84,7 +84,7 @@ public:
VisibleFrame();
- virtual void onEnter(Frame *nextFrame) override;
+ virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
virtual Frame* clone() override;
inline void setVisible(bool visible) { _visible = visible;}
@@ -104,7 +104,7 @@ public:
virtual void setNode(cocos2d::Node* node);
- virtual void onEnter(Frame *nextFrame) override;
+ virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
virtual Frame* clone() override;
inline void setTextureName(std::string textureName) { _textureName = textureName;}
@@ -122,7 +122,7 @@ public:
RotationFrame();
- virtual void onEnter(Frame *nextFrame) override;
+ virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
virtual void apply(float percent) override;
virtual Frame* clone() override;
@@ -141,7 +141,7 @@ public:
SkewFrame();
- virtual void onEnter(Frame *nextFrame) override;
+ virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
virtual void apply(float percent) override;
virtual Frame* clone() override;
@@ -166,7 +166,7 @@ public:
RotationSkewFrame();
- virtual void onEnter(Frame *nextFrame) override;
+ virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
virtual void apply(float percent) override;
virtual Frame* clone() override;
};
@@ -179,7 +179,7 @@ public:
PositionFrame();
- virtual void onEnter(Frame *nextFrame) override;
+ virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
virtual void apply(float percent) override;
virtual Frame* clone() override;
@@ -205,7 +205,7 @@ public:
ScaleFrame();
- virtual void onEnter(Frame *nextFrame) override;
+ virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
virtual void apply(float percent) override;
virtual Frame* clone() override;
@@ -232,7 +232,7 @@ public:
AnchorPointFrame();
- virtual void onEnter(Frame *nextFrame) override;
+ virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
virtual Frame* clone() override;
inline void setAnchorPoint(const cocos2d::Point& point) { _anchorPoint = point; }
@@ -257,7 +257,7 @@ public:
static InnerActionFrame* create();
InnerActionFrame();
- virtual void onEnter(Frame *nextFrame) override;
+ virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
virtual Frame* clone() override;
inline void setInnerActionType(InnerActionType type) { _innerActionType = type; }
@@ -278,7 +278,7 @@ public:
static ColorFrame* create();
ColorFrame();
- virtual void onEnter(Frame *nextFrame) override;
+ virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
virtual void apply(float percent) override;
virtual Frame* clone() override;
@@ -307,7 +307,7 @@ public:
EventFrame();
- virtual void onEnter(Frame *nextFrame) override;
+ virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
virtual Frame* clone() override;
inline void setEvent(std::string event) { _event = event;}
@@ -324,7 +324,7 @@ public:
ZOrderFrame();
- virtual void onEnter(Frame *nextFrame) override;
+ virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
virtual Frame* clone() override;
inline void setZOrder(int zorder) { _zorder = zorder;}
diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp
index 1ae02c9485..65d8f2be7d 100644
--- a/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp
+++ b/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp
@@ -202,7 +202,7 @@ void Timeline::binarySearchKeyFrame(int frameIndex)
if(needEnterFrame || _currentKeyFrame != from)
{
_currentKeyFrame = from;
- _currentKeyFrame->onEnter(to);
+ _currentKeyFrame->onEnter(to, frameIndex);
}
}
@@ -252,7 +252,7 @@ void Timeline::updateCurrentKeyFrame(int frameIndex)
if(frameIndex > from->getFrameIndex() && frameIndex < to->getFrameIndex())
break;
if(from->isEnterWhenPassed())
- from->onEnter(to);
+ from->onEnter(to, from->getFrameIndex());
}
while (true);
@@ -264,7 +264,7 @@ void Timeline::updateCurrentKeyFrame(int frameIndex)
} while (0);
_currentKeyFrame = from;
- _currentKeyFrame->onEnter(to);
+ _currentKeyFrame->onEnter(to, frameIndex);
}
}
diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp
index c70bd2e3bf..206847d592 100644
--- a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp
+++ b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp
@@ -449,7 +449,8 @@ void CSLoader::initNode(Node* node, const rapidjson::Value& json)
Node* CSLoader::loadSimpleNode(const rapidjson::Value& json)
{
Node* node = Node::create();
- node->retain();
+ // fix memory leak for v3.3
+ //node->retain();
initNode(node, json);
return node;
@@ -468,8 +469,8 @@ Node* CSLoader::loadSubGraph(const rapidjson::Value& json)
{
node = Node::create();
}
-
- node->retain();
+ // fix memory leak for v3.3
+ //node->retain();
initNode(node, json);
@@ -507,7 +508,8 @@ Node* CSLoader::loadSprite(const rapidjson::Value& json)
sprite = Sprite::create();
}
- sprite->retain();
+ // fix memory leak for v3.3
+ //sprite->retain();
initNode(sprite, json);
@@ -529,7 +531,8 @@ Node* CSLoader::loadParticle(const rapidjson::Value& json)
ParticleSystemQuad* particle = ParticleSystemQuad::create(filePath);
particle->setTotalParticles(num);
- particle->retain();
+ // fix memory leak for v3.3
+ //particle->retain();
initNode(particle, json);
@@ -578,7 +581,8 @@ Node* CSLoader::loadWidget(const rapidjson::Value& json)
std::string guiClassName = getGUIClassName(classname);
widget = dynamic_cast(ObjectFactory::getInstance()->createObject(guiClassName));
- widget->retain();
+ // fix memory leak for v3.3
+ //widget->retain();
WidgetReaderProtocol* reader = dynamic_cast(ObjectFactory::getInstance()->createObject(readerName));
@@ -587,7 +591,9 @@ Node* CSLoader::loadWidget(const rapidjson::Value& json)
else if (isCustomWidget(classname))
{
widget = dynamic_cast(ObjectFactory::getInstance()->createObject(classname));
- widget->retain();
+
+ //fix memory leak for v3.3
+ //widget->retain();
//
// 1st., custom widget parse properties of parent widget with parent widget reader
@@ -826,7 +832,8 @@ Node* CSLoader::nodeFromProtocolBuffers(const protocolbuffers::NodeTree &nodetre
readerName.append("Reader");
Widget* widget = dynamic_cast(ObjectFactory::getInstance()->createObject(guiClassName));
- widget->retain();
+ //fix memory leak for v3.3
+ //widget->retain();
WidgetReaderProtocol* reader = dynamic_cast(ObjectFactory::getInstance()->createObject(readerName));
reader->setPropsFromProtocolBuffers(widget, nodetree);
@@ -840,7 +847,9 @@ Node* CSLoader::nodeFromProtocolBuffers(const protocolbuffers::NodeTree &nodetre
else if (isCustomWidget(classname))
{
Widget* widget = dynamic_cast(ObjectFactory::getInstance()->createObject(classname));
- widget->retain();
+
+ //fix memory leak for v3.3
+ //widget->retain();
//
// 1st., custom widget parse properties of parent widget with parent widget reader
@@ -946,6 +955,8 @@ void CSLoader::setPropsForNodeFromProtocolBuffers(cocos2d::Node *node,
int tag = options.tag();
int actionTag = options.actiontag();
bool visible = options.visible();
+ float w = options.width();
+ float h = options.height();
node->setName(name);
@@ -967,6 +978,8 @@ void CSLoader::setPropsForNodeFromProtocolBuffers(cocos2d::Node *node,
node->setLocalZOrder(zorder);
if(visible != true)
node->setVisible(visible);
+ if (w != 0 || h != 0)
+ node->setContentSize(Size(w, h));
node->setTag(tag);
node->setUserObject(ActionTimelineData::create(actionTag));
@@ -1042,8 +1055,8 @@ void CSLoader::setPropsForSpriteFromProtocolBuffers(cocos2d::Node *node,
CCLOG("filePath is empty. Create a sprite with no texture");
}
*/
-
- sprite->retain();
+ //fix memory leak for v3.3
+ //sprite->retain();
setPropsForNodeFromProtocolBuffers(sprite, nodeOptions);
@@ -1241,11 +1254,15 @@ Node* CSLoader::nodeFromXMLFile(const std::string &fileName)
// xml read
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(fileName).c_str();
ssize_t size;
- std::string content =(char*)FileUtils::getInstance()->getFileData(fullpath, "r", &size);
+
+ //fix memory leak for v3.3
+ unsigned char* pByte = FileUtils::getInstance()->getFileData(fullpath, "r", &size);
// xml parse
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();
- document->Parse(content.c_str());
+ document->Parse((const char*)pByte);
+
+ free(pByte);
const tinyxml2::XMLElement* rootElement = document->RootElement();// Root
CCLOG("rootElement name = %s", rootElement->Name());
@@ -1404,7 +1421,9 @@ Node* CSLoader::nodeFromXML(const tinyxml2::XMLElement *objectData, const std::s
readerName.append("Reader");
Widget* widget = dynamic_cast(ObjectFactory::getInstance()->createObject(guiClassName));
- widget->retain();
+
+ //fix memory leak for v3.3
+ //widget->retain();
WidgetReaderProtocol* reader = dynamic_cast(ObjectFactory::getInstance()->createObject(readerName));
reader->setPropsFromXML(widget, objectData);
diff --git a/cocos/editor-support/cocostudio/CCBone.cpp b/cocos/editor-support/cocostudio/CCBone.cpp
index 3c74b6047e..4b217141b5 100644
--- a/cocos/editor-support/cocostudio/CCBone.cpp
+++ b/cocos/editor-support/cocostudio/CCBone.cpp
@@ -188,21 +188,20 @@ void Bone::update(float delta)
if (_boneTransformDirty)
{
+ _worldInfo->copy(_tweenData);
if (_dataVersion >= VERSION_COMBINED)
{
- TransformHelp::nodeConcat(*_tweenData, *_boneData);
- _tweenData->scaleX -= 1;
- _tweenData->scaleY -= 1;
+ TransformHelp::nodeConcat(*_worldInfo, *_boneData);
+ _worldInfo->scaleX -= 1;
+ _worldInfo->scaleY -= 1;
}
- _worldInfo->copy(_tweenData);
-
- _worldInfo->x = _tweenData->x + _position.x;
- _worldInfo->y = _tweenData->y + _position.y;
- _worldInfo->scaleX = _tweenData->scaleX * _scaleX;
- _worldInfo->scaleY = _tweenData->scaleY * _scaleY;
- _worldInfo->skewX = _tweenData->skewX + _skewX + CC_DEGREES_TO_RADIANS(_rotationZ_X);
- _worldInfo->skewY = _tweenData->skewY + _skewY - CC_DEGREES_TO_RADIANS(_rotationZ_Y);
+ _worldInfo->x = _worldInfo->x + _position.x;
+ _worldInfo->y = _worldInfo->y + _position.y;
+ _worldInfo->scaleX = _worldInfo->scaleX * _scaleX;
+ _worldInfo->scaleY = _worldInfo->scaleY * _scaleY;
+ _worldInfo->skewX = _worldInfo->skewX + _skewX + CC_DEGREES_TO_RADIANS(_rotationZ_X);
+ _worldInfo->skewY = _worldInfo->skewY + _skewY - CC_DEGREES_TO_RADIANS(_rotationZ_Y);
if(_parentBone)
{
diff --git a/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp b/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp
index cc8cc328c4..36b1e6326b 100644
--- a/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp
+++ b/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp
@@ -330,7 +330,7 @@ void DataReaderHelper::addDataFromFile(const std::string& filePath)
DataReaderHelper::addDataFromBinaryCache(contentStr.c_str(),&dataInfo);
}
- CC_SAFE_DELETE_ARRAY(pBytes);
+ free(pBytes);
}
void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const std::string& plistPath, const std::string& filePath, Ref *target, SEL_SCHEDULE selector)
@@ -429,7 +429,9 @@ void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const
Data bytecpy;
bytecpy.copy(pBytes, size);
data->fileContent = std::string((const char*)bytecpy.getBytes(), size);
- CC_SAFE_DELETE_ARRAY(pBytes);
+
+ // fix memory leak for v3.3
+ free(pBytes);
if (str == ".xml")
{
diff --git a/cocos/editor-support/cocostudio/CCSSceneReader.cpp b/cocos/editor-support/cocostudio/CCSSceneReader.cpp
index 52a9e50e5e..0e29de8d2f 100644
--- a/cocos/editor-support/cocostudio/CCSSceneReader.cpp
+++ b/cocos/editor-support/cocostudio/CCSSceneReader.cpp
@@ -42,7 +42,7 @@ SceneReader::SceneReader()
ObjectFactory::getInstance()->registerType(CREATE_CLASS_COMPONENT_INFO(ComAttribute));
ObjectFactory::getInstance()->registerType(CREATE_CLASS_COMPONENT_INFO(ComRender));
ObjectFactory::getInstance()->registerType(CREATE_CLASS_COMPONENT_INFO(ComAudio));
- ObjectFactory::getInstance()->registerType(CREATE_CLASS_COMPONENT_INFO(ComController));
+ ObjectFactory::getInstance()->registerType(CREATE_CLASS_COMPONENT_INFO(ComController));
}
SceneReader::~SceneReader()
@@ -57,13 +57,13 @@ const char* SceneReader::sceneReaderVersion()
cocos2d::Node* SceneReader::createNodeWithSceneFile(const std::string &fileName, AttachComponentType attachComponent /*= AttachComponentType::EMPTY_NODE*/)
{
std::string reDir = fileName;
- std::string file_extension = "";
- size_t pos = reDir.find_last_of('.');
- if (pos != std::string::npos)
- {
- file_extension = reDir.substr(pos, reDir.length());
- std::transform(file_extension.begin(),file_extension.end(), file_extension.begin(), (int(*)(int))toupper);
- }
+ std::string file_extension = "";
+ size_t pos = reDir.find_last_of('.');
+ if (pos != std::string::npos)
+ {
+ file_extension = reDir.substr(pos, reDir.length());
+ std::transform(file_extension.begin(),file_extension.end(), file_extension.begin(), (int(*)(int))toupper);
+ }
if (file_extension == ".JSON")
{
_node = nullptr;
@@ -78,7 +78,7 @@ cocos2d::Node* SceneReader::createNodeWithSceneFile(const std::string &fileName,
}
else if(file_extension == ".CSB")
{
- do {
+ do {
std::string binaryFilePath = CCFileUtils::getInstance()->fullPathForFilename(fileName);
auto fileData = FileUtils::getInstance()->getDataFromFile(binaryFilePath);
auto fileDataBytes = fileData.getBytes();
@@ -86,90 +86,90 @@ cocos2d::Node* SceneReader::createNodeWithSceneFile(const std::string &fileName,
CocoLoader tCocoLoader;
if (tCocoLoader.ReadCocoBinBuff((char*)fileDataBytes))
{
- stExpCocoNode *tpRootCocoNode = tCocoLoader.GetRootCocoNode();
- rapidjson::Type tType = tpRootCocoNode->GetType(&tCocoLoader);
- if (rapidjson::kObjectType == tType)
- {
- stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray(&tCocoLoader);
- CC_BREAK_IF(tpRootCocoNode->GetChildNum() == 0);
- _node = Node::create();
- int nCount = 0;
- std::vector _vecComs;
- ComRender *pRender = nullptr;
- std::string key = tpChildArray[15].GetName(&tCocoLoader);
- if (key == "components")
- {
- nCount = tpChildArray[15].GetChildNum();
- }
- stExpCocoNode *pComponents = tpChildArray[15].GetChildArray(&tCocoLoader);
- SerData *data = new (std::nothrow) SerData();
- for (int i = 0; i < nCount; i++)
- {
- stExpCocoNode *subDict = pComponents[i].GetChildArray(&tCocoLoader);
- if (subDict == nullptr)
- {
- continue;
- }
- std::string key1 = subDict[1].GetName(&tCocoLoader);
- const char *comName = subDict[1].GetValue(&tCocoLoader);
- Component *pCom = nullptr;
- if (key1 == "classname" && comName != nullptr)
- {
- pCom = createComponent(comName);
- }
- CCLOG("classname = %s", comName);
- if (pCom != nullptr)
- {
- data->_rData = nullptr;
- data->_cocoNode = subDict;
+ stExpCocoNode *tpRootCocoNode = tCocoLoader.GetRootCocoNode();
+ rapidjson::Type tType = tpRootCocoNode->GetType(&tCocoLoader);
+ if (rapidjson::kObjectType == tType)
+ {
+ stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray(&tCocoLoader);
+ CC_BREAK_IF(tpRootCocoNode->GetChildNum() == 0);
+ _node = Node::create();
+ int nCount = 0;
+ std::vector _vecComs;
+ ComRender *pRender = nullptr;
+ std::string key = tpChildArray[15].GetName(&tCocoLoader);
+ if (key == "components")
+ {
+ nCount = tpChildArray[15].GetChildNum();
+ }
+ stExpCocoNode *pComponents = tpChildArray[15].GetChildArray(&tCocoLoader);
+ SerData *data = new (std::nothrow) SerData();
+ for (int i = 0; i < nCount; i++)
+ {
+ stExpCocoNode *subDict = pComponents[i].GetChildArray(&tCocoLoader);
+ if (subDict == nullptr)
+ {
+ continue;
+ }
+ std::string key1 = subDict[1].GetName(&tCocoLoader);
+ const char *comName = subDict[1].GetValue(&tCocoLoader);
+ Component *pCom = nullptr;
+ if (key1 == "classname" && comName != nullptr)
+ {
+ pCom = createComponent(comName);
+ }
+ CCLOG("classname = %s", comName);
+ if (pCom != nullptr)
+ {
+ data->_rData = nullptr;
+ data->_cocoNode = subDict;
data->_cocoLoader = &tCocoLoader;
- if (pCom->serialize(data))
- {
- ComRender *pTRender = dynamic_cast(pCom);
- if (pTRender != nullptr)
- {
- pRender = pTRender;
- }
- else
- {
- _vecComs.push_back(pCom);
- }
- }
- else
- {
- CC_SAFE_RELEASE_NULL(pCom);
- }
- }
+ if (pCom->serialize(data))
+ {
+ ComRender *pTRender = dynamic_cast(pCom);
+ if (pTRender != nullptr)
+ {
+ pRender = pTRender;
+ }
+ else
+ {
+ _vecComs.push_back(pCom);
+ }
+ }
+ else
+ {
+ CC_SAFE_RELEASE_NULL(pCom);
+ }
+ }
if(_fnSelector != nullptr)
{
_fnSelector(pCom, (void*)(data));
}
- }
+ }
- setPropertyFromJsonDict(&tCocoLoader, tpRootCocoNode, _node);
- for (std::vector::iterator iter = _vecComs.begin(); iter != _vecComs.end(); ++iter)
- {
- _node->addComponent(*iter);
- }
+ setPropertyFromJsonDict(&tCocoLoader, tpRootCocoNode, _node);
+ for (std::vector::iterator iter = _vecComs.begin(); iter != _vecComs.end(); ++iter)
+ {
+ _node->addComponent(*iter);
+ }
- stExpCocoNode *pGameObjects = tpChildArray[11].GetChildArray(&tCocoLoader);
- int length = tpChildArray[11].GetChildNum();
- for (int i = 0; i < length; ++i)
- {
- createObject(&tCocoLoader, &pGameObjects[i], _node, attachComponent);
- }
- TriggerMng::getInstance()->parse(&tCocoLoader, tpChildArray);
- }
-
- }
- }while (0);
- return _node;
+ stExpCocoNode *pGameObjects = tpChildArray[11].GetChildArray(&tCocoLoader);
+ int length = tpChildArray[11].GetChildNum();
+ for (int i = 0; i < length; ++i)
+ {
+ createObject(&tCocoLoader, &pGameObjects[i], _node, attachComponent);
+ }
+ TriggerMng::getInstance()->parse(&tCocoLoader, tpChildArray);
+ }
+
+ }
+ }while (0);
+ return _node;
}
else
- {
- log("read file [%s] error!\n", fileName.c_str());
- }
- return nullptr;
+ {
+ log("read file [%s] error!\n", fileName.c_str());
+ }
+ return nullptr;
}
bool SceneReader::readJson(const std::string &fileName, rapidjson::Document &doc)
@@ -282,7 +282,7 @@ Node* SceneReader::createObject(const rapidjson::Value &dict, cocos2d::Node* par
if (com != nullptr)
{
data->_rData = &subDict;
- data->_cocoNode = nullptr;
+ data->_cocoNode = nullptr;
data->_cocoLoader = nullptr;
if (com->serialize(data))
{
@@ -531,7 +531,7 @@ void SceneReader::setPropertyFromJsonDict(CocoLoader *cocoLoader, stExpCocoNode
}
else if (key == "visible")
{
- bVisible = (bool)atoi(value.c_str());
+ bVisible = atoi(value.c_str()) != 0;
node->setVisible(bVisible);
}
else if (key == "objecttag")
diff --git a/cocos/editor-support/cocostudio/CCSkin.cpp b/cocos/editor-support/cocostudio/CCSkin.cpp
index c1a9ddda72..f83cdc0296 100644
--- a/cocos/editor-support/cocostudio/CCSkin.cpp
+++ b/cocos/editor-support/cocostudio/CCSkin.cpp
@@ -222,7 +222,7 @@ Mat4 Skin::getNodeToWorldTransformAR() const
void Skin::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
- Mat4 mv = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
+ auto mv = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
//TODO: implement z order
_quadCommand.init(_globalZOrder, _texture->getName(), getGLProgramState(), _blendFunc, &_quad, 1, mv);
diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp
index 2e2fa468d0..0c08af624a 100644
--- a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp
+++ b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp
@@ -163,15 +163,7 @@ namespace cocostudio
label->setFontSize(fontSize);
std::string fontName = options.has_fontname() ? options.fontname() : "微软雅黑";
-
- std::string fontFilePath = protocolBuffersPath.append(fontName);
- if (FileUtils::getInstance()->isFileExist(fontFilePath))
- {
- label->setFontName(fontFilePath);
- }
- else{
- label->setFontName(fontName);
- }
+ label->setFontName(fontName);
bool aw = options.has_areawidth();
bool ah = options.has_areaheight();
diff --git a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp
index 00b8dce09f..757df9e31a 100644
--- a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp
+++ b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp
@@ -69,12 +69,12 @@ namespace cocostudio
WidgetReader::WidgetReader()
:_sizePercentX(0.0f),
_sizePercentY(0.0f),
- _isAdaptScreen(false),
- _width(0.0f),
- _height(0.0f),
_positionPercentX(0.0f),
_positionPercentY(0.0f),
- _opacity(255)
+ _width(0.0f),
+ _height(0.0f),
+ _opacity(255),
+ _isAdaptScreen(false)
{
valueToInt = [=](const std::string& str) -> int{
return atoi(str.c_str());
diff --git a/cocos/network/WebSocket.cpp b/cocos/network/WebSocket.cpp
index 934b1e0c6a..ec35a1309e 100644
--- a/cocos/network/WebSocket.cpp
+++ b/cocos/network/WebSocket.cpp
@@ -222,15 +222,15 @@ enum WS_MSG {
WebSocket::WebSocket()
: _readyState(State::CONNECTING)
, _port(80)
+, _pendingFrameDataLen(0)
+, _currentDataLen(0)
+, _currentData(nullptr)
, _wsHelper(nullptr)
, _wsInstance(nullptr)
, _wsContext(nullptr)
, _delegate(nullptr)
, _SSLConnection(0)
, _wsProtocols(nullptr)
-, _pendingFrameDataLen(0)
-, _currentDataLen(0)
-, _currentData(nullptr)
{
}
diff --git a/cocos/platform/CCFileUtils.cpp b/cocos/platform/CCFileUtils.cpp
index e137e32df8..f6038d5774 100644
--- a/cocos/platform/CCFileUtils.cpp
+++ b/cocos/platform/CCFileUtils.cpp
@@ -543,7 +543,7 @@ static Data getData(const std::string& filename, bool forString)
Data ret;
unsigned char* buffer = nullptr;
- ssize_t size = 0;
+ size_t size = 0;
size_t readsize;
const char* mode = nullptr;
if (forString)
@@ -1062,7 +1062,7 @@ bool FileUtils::createDirectory(const std::string& path)
if (!(GetFileAttributesEx(wpath.c_str(), GetFileExInfoStandard, &wfad)))
{
subpath = "";
- for(int i = 0 ; i < dirs.size() ; ++i)
+ for(unsigned int i = 0 ; i < dirs.size() ; ++i)
{
subpath += dirs[i];
if (i > 0 && !isDirectoryExist(subpath))
@@ -1146,7 +1146,7 @@ bool FileUtils::removeDirectory(const std::string& path)
bool ret=true;
if (search!=INVALID_HANDLE_VALUE)
{
- bool find=true;
+ BOOL find=true;
while (find)
{
//. ..
@@ -1168,8 +1168,10 @@ bool FileUtils::removeDirectory(const std::string& path)
}
FindClose(search);
}
- if (ret)
- return RemoveDirectory(wpath.c_str());
+ if (ret && RemoveDirectory(wpath.c_str()))
+ {
+ return true;
+ }
return false;
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
std::string command = "cmd /c rd /s /q ";
diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxMusic.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxMusic.java
index c0c5dfe0e9..eacfa65fbf 100644
--- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxMusic.java
+++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxMusic.java
@@ -112,16 +112,17 @@ public class Cocos2dxMusic {
if (this.mBackgroundMediaPlayer == null) {
Log.e(Cocos2dxMusic.TAG, "playBackgroundMusic: background media player is null");
} else {
- // if the music is playing or paused, stop it
- this.mBackgroundMediaPlayer.stop();
-
- this.mBackgroundMediaPlayer.setLooping(isLoop);
-
try {
- this.mBackgroundMediaPlayer.prepare();
- this.mBackgroundMediaPlayer.seekTo(0);
- this.mBackgroundMediaPlayer.start();
-
+ // if the music is playing or paused, stop it
+ if (mPaused) {
+ mBackgroundMediaPlayer.seekTo(0);
+ this.mBackgroundMediaPlayer.start();
+ } else if (mBackgroundMediaPlayer.isPlaying()) {
+ mBackgroundMediaPlayer.seekTo(0);
+ } else {
+ this.mBackgroundMediaPlayer.start();
+ }
+ this.mBackgroundMediaPlayer.setLooping(isLoop);
this.mPaused = false;
} catch (final Exception e) {
Log.e(Cocos2dxMusic.TAG, "playBackgroundMusic: error state");
diff --git a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp
index c413cc8a12..b442f9df7d 100644
--- a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp
+++ b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp
@@ -17,9 +17,11 @@ extern "C" {
}
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnPause() {
- Application::getInstance()->applicationDidEnterBackground();
- cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);
- cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent);
+ if (Director::getInstance()->getOpenGLView()) {
+ Application::getInstance()->applicationDidEnterBackground();
+ cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);
+ cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent);
+ }
}
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume() {
diff --git a/cocos/platform/android/jni/TouchesJni.cpp b/cocos/platform/android/jni/TouchesJni.cpp
index aaeaf89fc2..b3a74ebdd1 100644
--- a/cocos/platform/android/jni/TouchesJni.cpp
+++ b/cocos/platform/android/jni/TouchesJni.cpp
@@ -33,11 +33,13 @@ using namespace cocos2d;
extern "C" {
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesBegin(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y) {
- cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesBegin(1, &id, &x, &y);
+ intptr_t idlong = id;
+ cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesBegin(1, &idlong, &x, &y);
}
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y) {
- cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesEnd(1, &id, &x, &y);
+ intptr_t idlong = id;
+ cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesEnd(1, &idlong, &x, &y);
}
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) {
@@ -50,7 +52,11 @@ extern "C" {
env->GetFloatArrayRegion(xs, 0, size, x);
env->GetFloatArrayRegion(ys, 0, size, y);
- cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesMove(size, id, x, y);
+ intptr_t idlong[size];
+ for(int i = 0; i < size; i++)
+ idlong[i] = id[i];
+
+ cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesMove(size, idlong, x, y);
}
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesCancel(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) {
@@ -63,7 +69,11 @@ extern "C" {
env->GetFloatArrayRegion(xs, 0, size, x);
env->GetFloatArrayRegion(ys, 0, size, y);
- cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesCancel(size, id, x, y);
+ intptr_t idlong[size];
+ for(int i = 0; i < size; i++)
+ idlong[i] = id[i];
+
+ cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesCancel(size, idlong, x, y);
}
#define KEYCODE_BACK 0x04
diff --git a/cocos/platform/linux/CCFileUtils-linux.cpp b/cocos/platform/linux/CCFileUtils-linux.cpp
index a1c047b5bd..70136decd9 100644
--- a/cocos/platform/linux/CCFileUtils-linux.cpp
+++ b/cocos/platform/linux/CCFileUtils-linux.cpp
@@ -36,6 +36,10 @@ THE SOFTWARE.
#include
#include
+#ifndef CC_RESOURCE_FOLDER_LINUX
+#define CC_RESOURCE_FOLDER_LINUX ("/Resources/")
+#endif
+
using namespace std;
NS_CC_BEGIN
@@ -71,7 +75,7 @@ bool FileUtilsLinux::init()
fullpath[length] = '\0';
std::string appPath = fullpath;
_defaultResRootPath = appPath.substr(0, appPath.find_last_of("/"));
- _defaultResRootPath += "/Resources/";
+ _defaultResRootPath += CC_RESOURCE_FOLDER_LINUX;
// Set writable path to $XDG_CONFIG_HOME or ~/.config// if $XDG_CONFIG_HOME not exists.
const char* xdg_config_path = getenv("XDG_CONFIG_HOME");
diff --git a/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp b/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp
index e0c02e3ee8..e25f12576e 100644
--- a/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp
+++ b/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp
@@ -35,39 +35,46 @@ using namespace Windows::Graphics::Display;
USING_NS_CC;
-Cocos2dRenderer::Cocos2dRenderer(const int width, const int height, CoreDispatcher^ dispatcher, Panel^ panel)
- : mApp(nullptr)
- , mWidth(width)
- , mHeight(height)
+Cocos2dRenderer::Cocos2dRenderer(int width, int height, float dpi, CoreDispatcher^ dispatcher, Panel^ panel)
+ : m_app(nullptr)
+ , m_width(width)
+ , m_height(height)
+ , m_dpi(dpi)
, m_dispatcher(dispatcher)
, m_panel(panel)
{
- mApp = new AppDelegate();
+ m_app = new AppDelegate();
auto director = cocos2d::Director::getInstance();
GLViewImpl* glview = GLViewImpl::create("Test Cpp");
glview->setDispatcher(dispatcher);
glview->setPanel(panel);
- glview->Create(static_cast(width), static_cast(height), DisplayOrientations::Landscape);
+ glview->Create(static_cast(width), static_cast(height), dpi, DisplayOrientations::Landscape);
director->setOpenGLView(glview);
CCApplication::getInstance()->run();
}
Cocos2dRenderer::~Cocos2dRenderer()
{
- delete mApp;
+ delete m_app;
}
// Draws a basic triangle
-void Cocos2dRenderer::Draw(GLsizei width, GLsizei height)
+void Cocos2dRenderer::Draw(GLsizei width, GLsizei height, float dpi)
{
- if (width != mWidth || height != mHeight)
+ if (width != m_width || height != m_height)
{
- mWidth = width;
- mHeight = height;
+ m_width = width;
+ m_height = height;
GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(static_cast(width), static_cast(height));
}
+ if (dpi != m_dpi)
+ {
+ m_dpi = dpi;
+ GLViewImpl::sharedOpenGLView()->SetDPI(m_dpi);
+ }
+
GLViewImpl::sharedOpenGLView()->ProcessEvents();
GLViewImpl::sharedOpenGLView()->Render();
}
diff --git a/cocos/platform/win8.1-universal/Cocos2dRenderer.h b/cocos/platform/win8.1-universal/Cocos2dRenderer.h
index 387445f6d5..b8d63d60b1 100644
--- a/cocos/platform/win8.1-universal/Cocos2dRenderer.h
+++ b/cocos/platform/win8.1-universal/Cocos2dRenderer.h
@@ -29,18 +29,20 @@ namespace cocos2d
class Cocos2dRenderer
{
public:
- Cocos2dRenderer(const int width, const int height, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel);
+ Cocos2dRenderer( int width, int height, float dpi, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel);
~Cocos2dRenderer();
- void Draw(GLsizei width, GLsizei height);
+ void Draw(GLsizei width, GLsizei height, float dpi);
void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
void QueueKeyBoardEvent(Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e);
private:
- int mWidth;
- int mHeight;
+ int m_width;
+ int m_height;
+ float m_dpi;
+
// The AppDelegate for the Cocos2D app
- AppDelegate* mApp;
+ AppDelegate* m_app;
Platform::Agile m_dispatcher;
Platform::Agile m_panel;
};
diff --git a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp
index c8ee9afb42..71f3c692e9 100644
--- a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp
+++ b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp
@@ -47,7 +47,8 @@ OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) :
mRenderSurface(EGL_NO_SURFACE),
mCustomRenderSurfaceSize(0,0),
mUseCustomRenderSurfaceSize(false),
- m_coreInput(nullptr)
+ m_coreInput(nullptr),
+ m_dpi(0.0f)
{
InitializeComponent();
@@ -225,6 +226,9 @@ void OpenGLESPage::StartRenderLoop()
return;
}
+ DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView();
+ m_dpi = currentDisplayInformation->LogicalDpi;
+
auto dispatcher = Windows::UI::Xaml::Window::Current->CoreWindow->Dispatcher;
// Create a task for rendering that will be run on a background thread.
@@ -238,16 +242,18 @@ void OpenGLESPage::StartRenderLoop()
GLsizei panelHeight = 0;
GetSwapChainPanelSize(&panelWidth, &panelHeight);
+
+
if (m_renderer.get() == nullptr)
{
- m_renderer = std::make_shared(panelWidth, panelHeight, dispatcher, swapChainPanel);
+ m_renderer = std::make_shared(panelWidth, panelHeight, m_dpi, dispatcher, swapChainPanel);
}
while (action->Status == Windows::Foundation::AsyncStatus::Started)
{
GetSwapChainPanelSize(&panelWidth, &panelHeight);
- m_renderer.get()->Draw(panelWidth, panelHeight);
+ m_renderer.get()->Draw(panelWidth, panelHeight, m_dpi);
// The call to eglSwapBuffers might not be successful (i.e. due to Device Lost)
// If the call fails, then we must reinitialize EGL and the GL resources.
diff --git a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h
index d8ddccc63e..9b65e475b3 100644
--- a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h
+++ b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h
@@ -67,5 +67,7 @@ namespace cocos2d
void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e);
void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e);
void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e);
+
+ float m_dpi;
};
}
diff --git a/cocos/platform/winrt/CCDevice.cpp b/cocos/platform/winrt/CCDevice.cpp
index 46b631ea4d..e3f7edbde5 100644
--- a/cocos/platform/winrt/CCDevice.cpp
+++ b/cocos/platform/winrt/CCDevice.cpp
@@ -42,8 +42,14 @@ CCFreeTypeFont sFT;
int Device::getDPI()
{
+#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
static const float dipsPerInch = 96.0f;
return floor(DisplayProperties::LogicalDpi / dipsPerInch + 0.5f); // Round to nearest integer.
+#elif defined WP8_SHADER_COMPILER
+ return 0;
+#else
+ return cocos2d::GLViewImpl::sharedOpenGLView()->GetDPI();
+#endif
}
static Accelerometer^ sAccelerometer = nullptr;
diff --git a/cocos/platform/winrt/CCGLViewImpl-winrt.cpp b/cocos/platform/winrt/CCGLViewImpl-winrt.cpp
index 4526c07091..d9ee1f4fe5 100644
--- a/cocos/platform/winrt/CCGLViewImpl-winrt.cpp
+++ b/cocos/platform/winrt/CCGLViewImpl-winrt.cpp
@@ -33,6 +33,7 @@ THE SOFTWARE.
#include "deprecated/CCNotificationCenter.h"
using namespace Platform;
+using namespace Concurrency;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::Graphics::Display;
@@ -107,9 +108,10 @@ bool GLViewImpl::initWithFullScreen(const std::string& viewName)
}
-bool GLViewImpl::Create(float width, float height, DisplayOrientations orientation)
+bool GLViewImpl::Create(float width, float height, float dpi, DisplayOrientations orientation)
{
m_orientation = orientation;
+ m_dpi = dpi;
UpdateForWindowSizeChange(width, height);
return true;
}
@@ -454,33 +456,27 @@ void GLViewImpl::setScissorInPoints(float x , float y , float w , float h)
void GLViewImpl::QueueBackKeyPress()
{
- std::lock_guard guard(mMutex);
std::shared_ptr e(new BackButtonEvent());
mInputEvents.push(e);
}
void GLViewImpl::QueuePointerEvent(PointerEventType type, PointerEventArgs^ args)
{
- std::lock_guard guard(mMutex);
std::shared_ptr e(new PointerEvent(type, args));
mInputEvents.push(e);
}
void GLViewImpl::QueueEvent(std::shared_ptr& event)
{
- std::lock_guard guard(mMutex);
mInputEvents.push(event);
}
void GLViewImpl::ProcessEvents()
{
- std::lock_guard guard(mMutex);
-
- while (!mInputEvents.empty())
+ std::shared_ptr e;
+ while (mInputEvents.try_pop(e))
{
- InputEvent* e = mInputEvents.front().get();
e->execute();
- mInputEvents.pop();
}
}
diff --git a/cocos/platform/winrt/CCGLViewImpl-winrt.h b/cocos/platform/winrt/CCGLViewImpl-winrt.h
index 33eac1cfbe..942a67552d 100644
--- a/cocos/platform/winrt/CCGLViewImpl-winrt.h
+++ b/cocos/platform/winrt/CCGLViewImpl-winrt.h
@@ -33,10 +33,10 @@ THE SOFTWARE.
#include
+#include
#include
+#include
#include
-#include
-#include
#include
NS_CC_BEGIN
@@ -61,7 +61,7 @@ public:
virtual void setIMEKeyboardState(bool bOpen);
virtual void setIMEKeyboardState(bool bOpen, std::string str);
- virtual bool Create(float width, float height ,Windows::Graphics::Display::DisplayOrientations orientation);
+ virtual bool Create(float width, float height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation);
void setDispatcher(Windows::UI::Core::CoreDispatcher^ dispatcher);
Windows::UI::Core::CoreDispatcher^ getDispatcher() {return m_dispatcher.Get();}
@@ -97,8 +97,11 @@ public:
void centerWindow();
void UpdateOrientation(Windows::Graphics::Display::DisplayOrientations orientation);
- void UpdateForWindowSizeChange(float width, float height);
-
+ void UpdateForWindowSizeChange(float width, float height);
+
+ void SetDPI(float dpi) { m_dpi = dpi; }
+ float GetDPI() { return m_dpi; }
+
// static function
/**
@brief get the shared main open gl window
@@ -141,6 +144,7 @@ private:
float m_width;
float m_height;
+ float m_dpi;
Windows::Graphics::Display::DisplayOrientations m_orientation;
Windows::Foundation::Rect m_keyboardRect;
@@ -156,8 +160,7 @@ private:
Cocos2dMessageBoxDelegate^ m_messageBoxDelegate;
Cocos2dEditBoxDelegate^ m_editBoxDelegate;
- std::queue> mInputEvents;
- std::mutex mMutex;
+ Concurrency::concurrent_queue> mInputEvents;
Platform::Agile m_dispatcher;
Platform::Agile m_panel;
diff --git a/cocos/platform/winrt/CCPrecompiledShaders.cpp b/cocos/platform/winrt/CCPrecompiledShaders.cpp
index da7c40080b..472c8f248a 100644
--- a/cocos/platform/winrt/CCPrecompiledShaders.cpp
+++ b/cocos/platform/winrt/CCPrecompiledShaders.cpp
@@ -192,7 +192,7 @@ bool CCPrecompiledShaders::addProgram(GLuint program, const std::string& id)
return true;
}
-#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) && defined(WP8_SHADER_COMPILER)
void CCPrecompiledShaders::savePrecompiledPrograms(Windows::Storage::StorageFolder^ folder)
{
diff --git a/cocos/platform/winrt/CCPrecompiledShaders.h b/cocos/platform/winrt/CCPrecompiledShaders.h
index d1dba0896a..6d8dc289d8 100644
--- a/cocos/platform/winrt/CCPrecompiledShaders.h
+++ b/cocos/platform/winrt/CCPrecompiledShaders.h
@@ -48,14 +48,6 @@ typedef struct _CompiledProgram
int length;
} CompiledProgram;
-#if 0
-
-const unsigned char gKey[] = "hello";
-const unsigned char gProgram[] = "world";
-PrecompiledShader gFoo = {gKey, gProgram, 100};
-
-PrecompiledShader shaders[] = {gFoo, gFoo};
-#endif
class CC_DLL CCPrecompiledShaders
{
@@ -63,7 +55,6 @@ public:
CCPrecompiledShaders();
virtual ~CCPrecompiledShaders();
-
/**
@brief Get current precompiled shaders instance.
@return Current precompiled shaders instance pointer.
@@ -77,7 +68,7 @@ public:
bool loadProgram(GLuint program, const GLchar* vShaderByteArray, const GLchar* fShaderByteArray);
-#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) && defined(WP8_SHADER_COMPILER)
void savePrecompiledShaders();
#endif
diff --git a/cocos/platform/wp8/CCGLViewImpl-wp8.cpp b/cocos/platform/wp8/CCGLViewImpl-wp8.cpp
index 3f77cc1f73..6c6835aecc 100644
--- a/cocos/platform/wp8/CCGLViewImpl-wp8.cpp
+++ b/cocos/platform/wp8/CCGLViewImpl-wp8.cpp
@@ -531,33 +531,27 @@ void GLViewImpl::setScissorInPoints(float x , float y , float w , float h)
void GLViewImpl::QueueBackKeyPress()
{
- std::lock_guard guard(mMutex);
std::shared_ptr e(new BackButtonEvent());
mInputEvents.push(e);
}
void GLViewImpl::QueuePointerEvent(PointerEventType type, PointerEventArgs^ args)
{
- std::lock_guard guard(mMutex);
std::shared_ptr e(new PointerEvent(type, args));
mInputEvents.push(e);
}
void GLViewImpl::QueueEvent(std::shared_ptr& event)
{
- std::lock_guard guard(mMutex);
mInputEvents.push(event);
}
void GLViewImpl::ProcessEvents()
{
- std::lock_guard guard(mMutex);
-
- while (!mInputEvents.empty())
+ std::shared_ptr e;
+ while (mInputEvents.try_pop(e))
{
- InputEvent* e = mInputEvents.front().get();
e->execute();
- mInputEvents.pop();
}
}
diff --git a/cocos/platform/wp8/CCGLViewImpl-wp8.h b/cocos/platform/wp8/CCGLViewImpl-wp8.h
index e48c9ce21d..d734f1cfeb 100644
--- a/cocos/platform/wp8/CCGLViewImpl-wp8.h
+++ b/cocos/platform/wp8/CCGLViewImpl-wp8.h
@@ -36,8 +36,7 @@ THE SOFTWARE.
#include
#include
-#include
-#include
+#include
#include
#include
@@ -182,9 +181,7 @@ private:
Cocos2dMessageBoxDelegate^ m_messageBoxDelegate;
Cocos2dEditBoxDelegate^ m_editBoxDelegate;
- std::queue> mInputEvents;
- std::mutex mMutex;
-
+ Concurrency::concurrent_queue> mInputEvents;
};
NS_CC_END
diff --git a/cocos/platform/wp8/shaders/precompiledshaders.h b/cocos/platform/wp8/shaders/precompiledshaders.h
index d93c40f9cf..0bd699de9d 100644
--- a/cocos/platform/wp8/shaders/precompiledshaders.h
+++ b/cocos/platform/wp8/shaders/precompiledshaders.h
@@ -86,7 +86,7 @@ const unsigned char s_133478C5A874C1E6F59B418CE6C7C39F1AE0F873[] = {
120, 116, 117, 114, 101, 48, 0, 0,
0, 0, 1, 0, 0, 0, 248, 3,
0, 0, 4, 5, 0, 0, 0, 0,
- 0, 0, 182, 139, 0, 0, 0, 0,
+ 0, 0, 235, 143, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 68, 88, 66, 67, 11, 95,
74, 206, 145, 124, 32, 219, 67, 19,
@@ -456,7 +456,7 @@ const unsigned char s_13E33F532157A58EC77EDE3B3112560A89D272B2[] = {
116, 114, 105, 120, 0, 0, 0, 0,
0, 0, 0, 0, 204, 2, 0, 0,
164, 4, 0, 0, 0, 0, 0, 0,
-182, 139, 0, 0, 0, 0, 0, 0,
+235, 143, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
68, 88, 66, 67, 127, 145, 81, 72,
216, 190, 16, 61, 245, 231, 235, 249,
@@ -800,7 +800,7 @@ const unsigned char s_1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE[] = {
116, 67, 111, 108, 111, 114, 0, 0,
0, 0, 3, 0, 0, 0, 208, 7,
0, 0, 4, 5, 0, 0, 0, 0,
- 0, 0, 182, 139, 0, 0, 0, 0,
+ 0, 0, 235, 143, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 68, 88, 66, 67, 65, 106,
69, 173, 111, 248, 97, 165, 186, 90,
@@ -1462,7 +1462,7 @@ const unsigned char s_2CF9793879165058483EFB4AD6FA9746ECD7DD2A[] = {
99, 111, 108, 111, 114, 0, 0, 0,
0, 16, 0, 0, 0, 236, 16, 0,
0, 124, 10, 0, 0, 0, 0, 0,
- 0, 182, 139, 0, 0, 0, 0, 0,
+ 0, 235, 143, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 68, 88, 66, 67, 39, 224, 169,
185, 116, 156, 41, 157, 187, 9, 222,
@@ -2430,7 +2430,7 @@ const unsigned char s_53938AB67AD93ABA0DDB87F3C9889304284E011E[] = {
120, 116, 117, 114, 101, 48, 0, 0,
0, 0, 1, 0, 0, 0, 24, 4,
0, 0, 4, 5, 0, 0, 0, 0,
- 0, 0, 182, 139, 0, 0, 0, 0,
+ 0, 0, 235, 143, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 68, 88, 66, 67, 200, 5,
103, 205, 248, 30, 69, 65, 32, 117,
@@ -2804,7 +2804,7 @@ const unsigned char s_67837675F2BB48C0E926316F505FC1538228E0FA[] = {
86, 80, 77, 97, 116, 114, 105, 120,
0, 0, 0, 0, 0, 0, 0, 0,
16, 4, 0, 0, 48, 5, 0, 0,
- 0, 0, 0, 0, 182, 139, 0, 0,
+ 0, 0, 0, 0, 235, 143, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 68, 88, 66, 67,
79, 226, 72, 124, 94, 252, 37, 157,
@@ -3968,7 +3968,7 @@ const unsigned char s_77D0755E06AA7AF59FAA6B003CA2363EDEB25C4C[] = {
99, 111, 108, 111, 114, 0, 0, 0,
0, 17, 0, 0, 0, 236, 16, 0,
0, 232, 19, 0, 0, 0, 0, 0,
- 0, 182, 139, 0, 0, 0, 0, 0,
+ 0, 235, 143, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 68, 88, 66, 67, 39, 224, 169,
185, 116, 156, 41, 157, 187, 9, 222,
@@ -5245,7 +5245,7 @@ const unsigned char s_78250E25D1929D4A842050738140787BE42541C6[] = {
108, 112, 104, 97, 95, 118, 97, 108,
117, 101, 0, 0, 0, 0, 2, 0,
0, 0, 36, 5, 0, 0, 4, 5,
- 0, 0, 0, 0, 0, 0, 182, 139,
+ 0, 0, 0, 0, 0, 0, 235, 143,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 68, 88,
66, 67, 100, 113, 175, 29, 164, 71,
@@ -5660,7 +5660,7 @@ const unsigned char s_7B67DD242152D35ACC079265FAD9D03DC98182DE[] = {
67, 95, 84, 101, 120, 116, 117, 114,
101, 48, 0, 0, 0, 0, 1, 0,
0, 0, 248, 3, 0, 0, 0, 5,
- 0, 0, 0, 0, 0, 0, 182, 139,
+ 0, 0, 0, 0, 0, 0, 235, 143,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 68, 88,
66, 67, 11, 95, 74, 206, 145, 124,
@@ -6044,7 +6044,7 @@ const unsigned char s_7CE5EE84ACB6110F7FA29152ECE3344CB6D6620D[] = {
99, 111, 108, 111, 114, 0, 0, 0,
0, 2, 0, 0, 0, 96, 4, 0,
0, 192, 4, 0, 0, 0, 0, 0,
- 0, 182, 139, 0, 0, 0, 0, 0,
+ 0, 235, 143, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 68, 88, 66, 67, 157, 116, 105,
89, 118, 135, 249, 239, 42, 226, 184,
@@ -6425,7 +6425,7 @@ const unsigned char s_7E1EEF397305D0BC2DCDBA4F2DAFBCBA1534E45C[] = {
117, 95, 99, 111, 108, 111, 114, 0,
0, 0, 0, 1, 0, 0, 0, 52,
3, 0, 0, 40, 4, 0, 0, 0,
- 0, 0, 0, 182, 139, 0, 0, 0,
+ 0, 0, 0, 235, 143, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 68, 88, 66, 67, 153,
8, 62, 201, 202, 170, 111, 182, 149,
@@ -6759,7 +6759,7 @@ const unsigned char s_847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5[] = {
111, 108, 111, 114, 0, 0, 0, 0,
2, 0, 0, 0, 240, 4, 0, 0,
4, 5, 0, 0, 0, 0, 0, 0,
-182, 139, 0, 0, 0, 0, 0, 0,
+235, 143, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
68, 88, 66, 67, 134, 66, 128, 226,
107, 172, 247, 161, 241, 207, 89, 240,
@@ -7176,7 +7176,7 @@ const unsigned char s_92BE325B516F887D2C928EDE20ADF428DB01C038[] = {
95, 118, 97, 108, 117, 101, 0, 0,
0, 0, 2, 0, 0, 0, 36, 5,
0, 0, 0, 5, 0, 0, 0, 0,
- 0, 0, 182, 139, 0, 0, 0, 0,
+ 0, 0, 235, 143, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 68, 88, 66, 67, 100, 113,
175, 29, 164, 71, 177, 78, 120, 99,
@@ -7744,7 +7744,7 @@ const unsigned char s_93D31E1668075AE4941C53441D7A9D0DE8F76331[] = {
117, 95, 99, 111, 108, 111, 114, 0,
0, 0, 0, 15, 0, 0, 0, 200,
15, 0, 0, 216, 9, 0, 0, 0,
- 0, 0, 0, 182, 139, 0, 0, 0,
+ 0, 0, 0, 235, 143, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 68, 88, 66, 67, 136,
158, 207, 210, 174, 144, 71, 116, 248,
@@ -9277,7 +9277,7 @@ const unsigned char s_A130FCE93CA2E5D68468367D88D1D7BE357912E5[] = {
99, 111, 108, 111, 114, 0, 0, 0,
0, 3, 0, 0, 0, 96, 4, 0,
0, 192, 13, 0, 0, 0, 0, 0,
- 0, 182, 139, 0, 0, 0, 0, 0,
+ 0, 235, 143, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 68, 88, 66, 67, 157, 116, 105,
89, 118, 135, 249, 239, 42, 226, 184,
@@ -9954,7 +9954,7 @@ const unsigned char s_A2377A827972A5466DA8637681045D32DA8A817D[] = {
99, 111, 108, 111, 114, 0, 0, 0,
0, 2, 0, 0, 0, 96, 4, 0,
0, 144, 4, 0, 0, 0, 0, 0,
- 0, 182, 139, 0, 0, 0, 0, 0,
+ 0, 235, 143, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 68, 88, 66, 67, 157, 116, 105,
89, 118, 135, 249, 239, 42, 226, 184,
@@ -10339,7 +10339,7 @@ const unsigned char s_B5E27B4F3CF7236633255B28CBA530D6EE5CED86[] = {
111, 108, 111, 114, 0, 0, 0, 0,
2, 0, 0, 0, 240, 5, 0, 0,
4, 5, 0, 0, 0, 0, 0, 0,
-182, 139, 0, 0, 0, 0, 0, 0,
+235, 143, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
68, 88, 66, 67, 223, 173, 203, 80,
172, 13, 170, 215, 168, 128, 228, 5,
@@ -10771,7 +10771,7 @@ const unsigned char s_E2C7CE1244DE9C76688EFA9463B2A130B6A08893[] = {
77, 97, 116, 114, 105, 120, 0, 0,
0, 0, 0, 0, 0, 0, 204, 2,
0, 0, 144, 4, 0, 0, 0, 0,
- 0, 0, 182, 139, 0, 0, 0, 0,
+ 0, 0, 235, 143, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 68, 88, 66, 67, 127, 145,
81, 72, 216, 190, 16, 61, 245, 231,
@@ -11101,8 +11101,8 @@ const unsigned char s_E2D56227712263272BD5218FEA117CD06180F81B[] = {
117, 95, 112, 111, 105, 110, 116, 83,
105, 122, 101, 0, 0, 0, 0, 2,
0, 0, 0, 204, 2, 0, 0, 208,
- 4, 0, 0, 0, 0, 0, 0, 182,
-139, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0, 0, 235,
+143, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 68,
88, 66, 67, 127, 145, 81, 72, 216,
190, 16, 61, 245, 231, 235, 249, 125,
@@ -11452,7 +11452,7 @@ const unsigned char s_F46558C274182079784898CF4968CF431593D5E2[] = {
116, 67, 111, 108, 111, 114, 0, 0,
0, 0, 3, 0, 0, 0, 108, 6,
0, 0, 4, 5, 0, 0, 0, 0,
- 0, 0, 182, 139, 0, 0, 0, 0,
+ 0, 0, 235, 143, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 68, 88, 66, 67, 47, 220,
115, 183, 137, 174, 141, 96, 204, 60,
@@ -11908,7 +11908,7 @@ const unsigned char s_F6BA4519AF2653A53D57FB5D5508F0D8617105D6[] = {
101, 120, 116, 117, 114, 101, 48, 0,
0, 0, 0, 1, 0, 0, 0, 156,
3, 0, 0, 144, 4, 0, 0, 0,
- 0, 0, 0, 182, 139, 0, 0, 0,
+ 0, 0, 0, 235, 143, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 68, 88, 66, 67, 203,
117, 183, 110, 154, 52, 220, 70, 125,
diff --git a/cocos/renderer/CCGLProgram.cpp b/cocos/renderer/CCGLProgram.cpp
index 6aa05848ca..f1c59731f4 100644
--- a/cocos/renderer/CCGLProgram.cpp
+++ b/cocos/renderer/CCGLProgram.cpp
@@ -844,15 +844,14 @@ void GLProgram::setUniformsForBuiltins()
Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
- Mat4 matrixMV;
- matrixMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
+ auto matrixMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
setUniformsForBuiltins(matrixMV);
}
void GLProgram::setUniformsForBuiltins(const Mat4 &matrixMV)
{
- Mat4 matrixP = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
+ auto matrixP = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
if(_flags.usesP)
setUniformLocationWithMatrix4fv(_builtInUniforms[UNIFORM_P_MATRIX], matrixP.m, 1);
diff --git a/cocos/renderer/CCGLProgramCache.cpp b/cocos/renderer/CCGLProgramCache.cpp
index defb6080bb..1626bc30d9 100644
--- a/cocos/renderer/CCGLProgramCache.cpp
+++ b/cocos/renderer/CCGLProgramCache.cpp
@@ -181,6 +181,7 @@ void GLProgramCache::loadDefaultGLPrograms()
loadDefaultGLProgram(p, kShaderType_PositionLengthTexureColor);
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR, p) );
+#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
p = new (std::nothrow) GLProgram();
loadDefaultGLProgram(p, kShaderType_LabelDistanceFieldNormal);
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL, p) );
@@ -188,6 +189,7 @@ void GLProgramCache::loadDefaultGLPrograms()
p = new (std::nothrow) GLProgram();
loadDefaultGLProgram(p, kShaderType_LabelDistanceFieldGlow);
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW, p) );
+#endif
p = new (std::nothrow) GLProgram();
loadDefaultGLProgram(p, kShaderType_LabelNormal);
@@ -293,6 +295,7 @@ void GLProgramCache::reloadDefaultGLPrograms()
p->reset();
loadDefaultGLProgram(p, kShaderType_PositionLengthTexureColor);
+#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
p = getGLProgram(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL);
p->reset();
loadDefaultGLProgram(p, kShaderType_LabelDistanceFieldNormal);
@@ -300,6 +303,7 @@ void GLProgramCache::reloadDefaultGLPrograms()
p = getGLProgram(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW);
p->reset();
loadDefaultGLProgram(p, kShaderType_LabelDistanceFieldGlow);
+#endif
p = getGLProgram(GLProgram::SHADER_NAME_LABEL_NORMAL);
p->reset();
@@ -372,12 +376,14 @@ void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type)
case kShaderType_PositionLengthTexureColor:
p->initWithByteArrays(ccPositionColorLengthTexture_vert, ccPositionColorLengthTexture_frag);
break;
+#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
case kShaderType_LabelDistanceFieldNormal:
p->initWithByteArrays(ccLabel_vert, ccLabelDistanceFieldNormal_frag);
break;
case kShaderType_LabelDistanceFieldGlow:
p->initWithByteArrays(ccLabel_vert, ccLabelDistanceFieldGlow_frag);
break;
+#endif
case kShaderType_LabelNormal:
p->initWithByteArrays(ccLabel_vert, ccLabelNormal_frag);
break;
@@ -433,7 +439,7 @@ GLProgram* GLProgramCache::getGLProgram(const std::string &key)
void GLProgramCache::addGLProgram(GLProgram* program, const std::string &key)
{
// release old one
- auto prev = getProgram(key);
+ auto prev = getGLProgram(key);
if( prev == program )
return;
@@ -441,17 +447,21 @@ void GLProgramCache::addGLProgram(GLProgram* program, const std::string &key)
CC_SAFE_RELEASE_NULL(prev);
if (program)
- program->retain();
+ program->retain();
_programs[key] = program;
}
std::string GLProgramCache::getShaderMacrosForLight() const
{
GLchar def[256];
- sprintf(def, "\n#define MAX_DIRECTIONAL_LIGHT_NUM %d \n"
+ auto conf = Configuration::getInstance();
+
+ snprintf(def, sizeof(def)-1, "\n#define MAX_DIRECTIONAL_LIGHT_NUM %d \n"
"\n#define MAX_POINT_LIGHT_NUM %d \n"
- "\n#define MAX_SPOT_LIGHT_NUM %d \n"
- , Configuration::getInstance()->getMaxSupportDirLightInShader(), Configuration::getInstance()->getMaxSupportPointLightInShader(), Configuration::getInstance()->getMaxSupportSpotLightInShader());
+ "\n#define MAX_SPOT_LIGHT_NUM %d \n",
+ conf->getMaxSupportDirLightInShader(),
+ conf->getMaxSupportPointLightInShader(),
+ conf->getMaxSupportSpotLightInShader());
return std::string(def);
}
diff --git a/cocos/renderer/CCGLProgramState.cpp b/cocos/renderer/CCGLProgramState.cpp
index 7025992f61..2006e72a9d 100644
--- a/cocos/renderer/CCGLProgramState.cpp
+++ b/cocos/renderer/CCGLProgramState.cpp
@@ -48,16 +48,16 @@ NS_CC_BEGIN
//
UniformValue::UniformValue()
-: _useCallback(false)
-, _uniform(nullptr)
+: _uniform(nullptr)
, _glprogram(nullptr)
+, _useCallback(false)
{
}
UniformValue::UniformValue(Uniform *uniform, GLProgram* glprogram)
-: _useCallback(false)
-, _uniform(uniform)
+: _uniform(uniform)
, _glprogram(glprogram)
+, _useCallback(false)
{
}
@@ -182,15 +182,15 @@ void UniformValue::setMat4(const Mat4& value)
//
VertexAttribValue::VertexAttribValue()
-: _useCallback(false)
-, _vertexAttrib(nullptr)
+: _vertexAttrib(nullptr)
+, _useCallback(false)
, _enabled(false)
{
}
VertexAttribValue::VertexAttribValue(VertexAttrib *vertexAttrib)
-: _useCallback(false)
-, _vertexAttrib(vertexAttrib)
+: _vertexAttrib(vertexAttrib)
+, _useCallback(false)
, _enabled(false)
{
}
@@ -274,10 +274,10 @@ GLProgramState* GLProgramState::getOrCreateWithGLProgram(GLProgram *glprogram)
}
GLProgramState::GLProgramState()
-: _vertexAttribsFlags(0)
-, _glprogram(nullptr)
+: _uniformAttributeValueDirty(true)
, _textureUnitIndex(1)
-, _uniformAttributeValueDirty(true)
+, _vertexAttribsFlags(0)
+, _glprogram(nullptr)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
/** listen the event that renderer was recreated on Android/WP8 */
diff --git a/cocos/renderer/CCMeshCommand.cpp b/cocos/renderer/CCMeshCommand.cpp
index 74f8b6b9bd..96d43291cc 100644
--- a/cocos/renderer/CCMeshCommand.cpp
+++ b/cocos/renderer/CCMeshCommand.cpp
@@ -78,17 +78,17 @@ static const char *s_ambientLightUniformColorName = "u_AmbientLightSour
MeshCommand::MeshCommand()
: _textureID(0)
-, _blendType(BlendFunc::DISABLE)
, _glProgramState(nullptr)
-, _cullFaceEnabled(false)
-, _cullFace(GL_BACK)
-, _depthTestEnabled(false)
-, _depthWriteEnabled(false)
+, _blendType(BlendFunc::DISABLE)
, _displayColor(1.0f, 1.0f, 1.0f, 1.0f)
, _matrixPalette(nullptr)
, _matrixPaletteSize(0)
, _materialID(0)
, _vao(0)
+, _cullFaceEnabled(false)
+, _cullFace(GL_BACK)
+, _depthTestEnabled(false)
+, _depthWriteEnabled(false)
, _lightMask(-1)
{
_type = RenderCommand::Type::MESH_COMMAND;
diff --git a/cocos/renderer/CCVertexIndexBuffer.cpp b/cocos/renderer/CCVertexIndexBuffer.cpp
index ff8285078e..c387398f38 100644
--- a/cocos/renderer/CCVertexIndexBuffer.cpp
+++ b/cocos/renderer/CCVertexIndexBuffer.cpp
@@ -56,10 +56,10 @@ VertexBuffer* VertexBuffer::create(int sizePerVertex, int vertexNumber)
}
VertexBuffer::VertexBuffer()
-: _vbo(0)
-, _vertexNumber(0)
+: _recreateVBOEventListener(nullptr)
+, _vbo(0)
, _sizePerVertex(0)
-, _recreateVBOEventListener(nullptr)
+, _vertexNumber(0)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
diff --git a/cocos/renderer/CCVertexIndexData.h b/cocos/renderer/CCVertexIndexData.h
index 300e1d9feb..78499c5cd3 100644
--- a/cocos/renderer/CCVertexIndexData.h
+++ b/cocos/renderer/CCVertexIndexData.h
@@ -35,17 +35,17 @@ class VertexBuffer;
struct CC_DLL VertexStreamAttribute
{
VertexStreamAttribute()
- : _offset(0),_semantic(0),_type(0),_size(0), _normalize(false)
+ : _normalize(false),_offset(0),_semantic(0),_type(0),_size(0)
{
}
VertexStreamAttribute(int offset, int semantic, int type, int size)
- : _offset(offset),_semantic(semantic),_type(type),_size(size), _normalize(false)
+ : _normalize(false),_offset(offset),_semantic(semantic),_type(type),_size(size)
{
}
VertexStreamAttribute(int offset, int semantic, int type, int size, bool normalize)
- : _offset(offset),_semantic(semantic),_type(type),_size(size), _normalize(normalize)
+ : _normalize(normalize),_offset(offset),_semantic(semantic),_type(type),_size(size)
{
}
diff --git a/cocos/scripting/lua-bindings/auto/api/ActionTimeline.lua b/cocos/scripting/lua-bindings/auto/api/ActionTimeline.lua
index b04785700d..f73bfd0208 100644
--- a/cocos/scripting/lua-bindings/auto/api/ActionTimeline.lua
+++ b/cocos/scripting/lua-bindings/auto/api/ActionTimeline.lua
@@ -5,10 +5,16 @@
-- @parent_module ccs
--------------------------------
---
--- @function [parent=#ActionTimeline] getTimelines
+-- Set ActionTimeline's frame event callback function
+-- @function [parent=#ActionTimeline] setFrameEventCallFunc
-- @param self
--- @return array_table#array_table ret (return value: array_table)
+-- @param #function listener
+
+--------------------------------
+-- add Timeline to ActionTimeline
+-- @function [parent=#ActionTimeline] addTimeline
+-- @param self
+-- @param #ccs.Timeline timeline
--------------------------------
-- Get current frame.
@@ -28,66 +34,46 @@
-- @param self
--------------------------------
--- Set ActionTimeline's frame event callback function
--- @function [parent=#ActionTimeline] setFrameEventCallFunc
+--
+-- @function [parent=#ActionTimeline] init
+-- @param self
+-- @return bool#bool ret (return value: bool)
+
+--------------------------------
+--
+-- @function [parent=#ActionTimeline] removeTimeline
+-- @param self
+-- @param #ccs.Timeline timeline
+
+--------------------------------
+-- Last frame callback will call when arriving last frame
+-- @function [parent=#ActionTimeline] setLastFrameCallFunc
-- @param self
-- @param #function listener
+--------------------------------
+--
+-- @function [parent=#ActionTimeline] getTimelines
+-- @param self
+-- @return array_table#array_table ret (return value: array_table)
+
--------------------------------
-- Resume the animation.
-- @function [parent=#ActionTimeline] resume
-- @param self
---------------------------------
---
--- @function [parent=#ActionTimeline] getDuration
--- @param self
--- @return int#int ret (return value: int)
-
---------------------------------
--- add Timeline to ActionTimeline
--- @function [parent=#ActionTimeline] addTimeline
--- @param self
--- @param #ccs.Timeline timeline
-
---------------------------------
--- End frame of this action.
--- When action play to this frame, if action is not loop, then it will stop,
--- or it will play from start frame again.
--- @function [parent=#ActionTimeline] getEndFrame
--- @param self
--- @return int#int ret (return value: int)
-
---------------------------------
--- Set current frame index, this will cause action plays to this frame.
--- @function [parent=#ActionTimeline] setCurrentFrame
--- @param self
--- @param #int frameIndex
-
---------------------------------
--- Set the animation speed, this will speed up or slow down the speed.
--- @function [parent=#ActionTimeline] setTimeSpeed
--- @param self
--- @param #float speed
-
---------------------------------
---
--- @function [parent=#ActionTimeline] init
--- @param self
--- @return bool#bool ret (return value: bool)
-
---------------------------------
--- duration of the whole action
--- @function [parent=#ActionTimeline] setDuration
--- @param self
--- @param #int duration
-
--------------------------------
-- Get current animation speed.
-- @function [parent=#ActionTimeline] getTimeSpeed
-- @param self
-- @return float#float ret (return value: float)
+--------------------------------
+--
+-- @function [parent=#ActionTimeline] getDuration
+-- @param self
+-- @return int#int ret (return value: int)
+
--------------------------------
-- Goto the specified frame index, and pause at this index.
-- param startIndex The animation will pause at this index.
@@ -115,15 +101,40 @@
--------------------------------
--
--- @function [parent=#ActionTimeline] removeTimeline
+-- @function [parent=#ActionTimeline] clearFrameEventCallFunc
-- @param self
--- @param #ccs.Timeline timeline
+
+--------------------------------
+-- End frame of this action.
+-- When action play to this frame, if action is not loop, then it will stop,
+-- or it will play from start frame again.
+-- @function [parent=#ActionTimeline] getEndFrame
+-- @param self
+-- @return int#int ret (return value: int)
+
+--------------------------------
+-- Set the animation speed, this will speed up or slow down the speed.
+-- @function [parent=#ActionTimeline] setTimeSpeed
+-- @param self
+-- @param #float speed
--------------------------------
--
--- @function [parent=#ActionTimeline] clearFrameEventCallFunc
+-- @function [parent=#ActionTimeline] clearLastFrameCallFunc
-- @param self
+--------------------------------
+-- duration of the whole action
+-- @function [parent=#ActionTimeline] setDuration
+-- @param self
+-- @param #int duration
+
+--------------------------------
+-- Set current frame index, this will cause action plays to this frame.
+-- @function [parent=#ActionTimeline] setCurrentFrame
+-- @param self
+-- @param #int frameIndex
+
--------------------------------
--
-- @function [parent=#ActionTimeline] create
diff --git a/cocos/scripting/lua-bindings/auto/api/Director.lua b/cocos/scripting/lua-bindings/auto/api/Director.lua
index e7b3350567..6373be31ec 100644
--- a/cocos/scripting/lua-bindings/auto/api/Director.lua
+++ b/cocos/scripting/lua-bindings/auto/api/Director.lua
@@ -18,19 +18,13 @@
-- @param #cc.EventDispatcher dispatcher
--------------------------------
--- Suspends the execution of the running scene, pushing it on the stack of suspended scenes.
--- The new scene will be executed.
--- Try to avoid big stacks of pushed scenes to reduce memory allocation.
--- ONLY call it if there is a running scene.
--- @function [parent=#Director] pushScene
+-- The size in pixels of the surface. It could be different than the screen size.
+-- High-res devices might have a higher surface size than the screen size.
+-- Only available when compiled using SDK >= 4.0.
+-- since v0.99.4
+-- @function [parent=#Director] setContentScaleFactor
-- @param self
--- @param #cc.Scene scene
-
---------------------------------
---
--- @function [parent=#Director] getDeltaTime
--- @param self
--- @return float#float ret (return value: float)
+-- @param #float scaleFactor
--------------------------------
--
@@ -44,18 +38,11 @@
-- @param self
-- @return size_table#size_table ret (return value: size_table)
---------------------------------
--- Returns the Console
--- since v3.0
--- @function [parent=#Director] getConsole
--- @param self
--- @return Console#Console ret (return value: cc.Console)
-
--------------------------------
--
--- @function [parent=#Director] pushMatrix
+-- @function [parent=#Director] getDeltaTime
-- @param self
--- @param #int type
+-- @return float#float ret (return value: float)
--------------------------------
-- sets the OpenGL default values
@@ -148,6 +135,11 @@
-- @param self
-- @return float#float ret (return value: float)
+--------------------------------
+--
+-- @function [parent=#Director] resetMatrixStack
+-- @param self
+
--------------------------------
-- converts an OpenGL coordinate to a UIKit coordinate
-- Useful to convert node points to window points for calls such as glScissor
@@ -156,6 +148,12 @@
-- @param #vec2_table point
-- @return vec2_table#vec2_table ret (return value: vec2_table)
+--------------------------------
+--
+-- @function [parent=#Director] pushMatrix
+-- @param self
+-- @param #int type
+
--------------------------------
-- sets the default values based on the Configuration info
-- @function [parent=#Director] setDefaultValues
@@ -206,15 +204,6 @@
-- @function [parent=#Director] stopAnimation
-- @param self
---------------------------------
--- The size in pixels of the surface. It could be different than the screen size.
--- High-res devices might have a higher surface size than the screen size.
--- Only available when compiled using SDK >= 4.0.
--- since v0.99.4
--- @function [parent=#Director] setContentScaleFactor
--- @param self
--- @param #float scaleFactor
-
--------------------------------
-- Pops out all scenes from the stack until it reaches `level`.
-- If level is 0, it will end the director.
@@ -292,12 +281,6 @@
-- @function [parent=#Director] drawScene
-- @param self
---------------------------------
--- / FIXME: missing description
--- @function [parent=#Director] getZEye
--- @param self
--- @return float#float ret (return value: float)
-
--------------------------------
--
-- @function [parent=#Director] getMatrix
@@ -313,6 +296,12 @@
-- @function [parent=#Director] popScene
-- @param self
+--------------------------------
+--
+-- @function [parent=#Director] loadIdentityMatrix
+-- @param self
+-- @param #int type
+
--------------------------------
-- Whether or not to display the FPS on the bottom-left corner
-- @function [parent=#Director] isDisplayStats
@@ -325,11 +314,25 @@
-- @param self
-- @param #int projection
+--------------------------------
+-- Returns the Console
+-- since v3.0
+-- @function [parent=#Director] getConsole
+-- @param self
+-- @return Console#Console ret (return value: cc.Console)
+
--------------------------------
--
--- @function [parent=#Director] loadIdentityMatrix
+-- @function [parent=#Director] multiplyMatrix
-- @param self
-- @param #int type
+-- @param #mat4_table mat
+
+--------------------------------
+-- / FIXME: missing description
+-- @function [parent=#Director] getZEye
+-- @param self
+-- @return float#float ret (return value: float)
--------------------------------
--
@@ -337,11 +340,6 @@
-- @param self
-- @param #bool nextDeltaTimeZero
---------------------------------
---
--- @function [parent=#Director] resetMatrixStack
--- @param self
-
--------------------------------
--
-- @function [parent=#Director] popMatrix
@@ -364,10 +362,13 @@
-- @return Scheduler#Scheduler ret (return value: cc.Scheduler)
--------------------------------
--- Set the FPS value.
--- @function [parent=#Director] setAnimationInterval
+-- Suspends the execution of the running scene, pushing it on the stack of suspended scenes.
+-- The new scene will be executed.
+-- Try to avoid big stacks of pushed scenes to reduce memory allocation.
+-- ONLY call it if there is a running scene.
+-- @function [parent=#Director] pushScene
-- @param self
--- @param #double interval
+-- @param #cc.Scene scene
--------------------------------
-- Get the FPS value
@@ -402,11 +403,10 @@
-- @param #cc.Scene scene
--------------------------------
---
--- @function [parent=#Director] multiplyMatrix
+-- Set the FPS value.
+-- @function [parent=#Director] setAnimationInterval
-- @param self
--- @param #int type
--- @param #mat4_table mat
+-- @param #double interval
--------------------------------
-- Gets the ActionManager associated with this director
diff --git a/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua b/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua
index c261634a7d..428fd4194d 100644
--- a/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua
+++ b/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua
@@ -259,6 +259,30 @@
-- @param self
-- @param #vec2_table anchorPoint
+--------------------------------
+--
+-- @function [parent=#Scale9Sprite] setScaleY
+-- @param self
+-- @param #float scaleY
+
+--------------------------------
+--
+-- @function [parent=#Scale9Sprite] setScaleX
+-- @param self
+-- @param #float scaleX
+
+--------------------------------
+--
+-- @function [parent=#Scale9Sprite] getScaleY
+-- @param self
+-- @return float#float ret (return value: float)
+
+--------------------------------
+--
+-- @function [parent=#Scale9Sprite] getScaleX
+-- @param self
+-- @return float#float ret (return value: float)
+
--------------------------------
--
-- @function [parent=#Scale9Sprite] updateDisplayedOpacity
@@ -270,6 +294,14 @@
-- @function [parent=#Scale9Sprite] cleanup
-- @param self
+--------------------------------
+-- @overload self, float, float
+-- @overload self, float
+-- @function [parent=#Scale9Sprite] setScale
+-- @param self
+-- @param #float scalex
+-- @param #float scaley
+
--------------------------------
--
-- @function [parent=#Scale9Sprite] updateDisplayedColor
@@ -282,6 +314,12 @@
-- @param self
-- @param #size_table size
+--------------------------------
+--
+-- @function [parent=#Scale9Sprite] getScale
+-- @param self
+-- @return float#float ret (return value: float)
+
--------------------------------
-- js ctor
-- @function [parent=#Scale9Sprite] Scale9Sprite
diff --git a/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua b/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua
index 9af5be0a63..b1e8971886 100644
--- a/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua
+++ b/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua
@@ -34,6 +34,12 @@
-- @param self
-- @return Mesh#Mesh ret (return value: cc.Mesh)
+--------------------------------
+--
+-- @function [parent=#Sprite3D] setCullFace
+-- @param self
+-- @param #unsigned int cullFace
+
--------------------------------
-- light mask getter & setter, light works only when _lightmask & light's flag is true, default value of _lightmask is 0xffff
-- @function [parent=#Sprite3D] setLightMask
@@ -60,30 +66,24 @@
--------------------------------
--
--- @function [parent=#Sprite3D] setCullFace
+-- @function [parent=#Sprite3D] getSkeleton
-- @param self
--- @param #unsigned int cullFace
+-- @return Skeleton3D#Skeleton3D ret (return value: cc.Skeleton3D)
--------------------------------
--- get SubMeshState by index
+-- get Mesh by index
-- @function [parent=#Sprite3D] getMeshByIndex
-- @param self
-- @param #int index
-- @return Mesh#Mesh ret (return value: cc.Mesh)
--------------------------------
--- get SubMeshState by Name
+-- get Mesh by Name, it returns the first one if there are more than one mesh with the same name
-- @function [parent=#Sprite3D] getMeshByName
-- @param self
-- @param #string name
-- @return Mesh#Mesh ret (return value: cc.Mesh)
---------------------------------
---
--- @function [parent=#Sprite3D] getSkeleton
--- @param self
--- @return Skeleton3D#Skeleton3D ret (return value: cc.Skeleton3D)
-
--------------------------------
-- get AttachNode by bone name, return nullptr if not exist
-- @function [parent=#Sprite3D] getAttachNode
diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp
index 4e5e2095a1..98cc4521d1 100644
--- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp
+++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp
@@ -580,6 +580,52 @@ int lua_cocos2dx_3d_Sprite3D_getMesh(lua_State* tolua_S)
return 0;
}
+int lua_cocos2dx_3d_Sprite3D_setCullFace(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocos2d::Sprite3D* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"cc.Sprite3D",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocos2d::Sprite3D*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_setCullFace'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 1)
+ {
+ unsigned int arg0;
+
+ ok &= luaval_to_uint32(tolua_S, 2,&arg0, "cc.Sprite3D:setCullFace");
+ if(!ok)
+ return 0;
+ cobj->setCullFace(arg0);
+ return 0;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:setCullFace",argc, 1);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_setCullFace'.",&tolua_err);
+#endif
+
+ return 0;
+}
int lua_cocos2dx_3d_Sprite3D_setLightMask(lua_State* tolua_S)
{
int argc = 0;
@@ -760,7 +806,7 @@ int lua_cocos2dx_3d_Sprite3D_removeAttachNode(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_3d_Sprite3D_setCullFace(lua_State* tolua_S)
+int lua_cocos2dx_3d_Sprite3D_getSkeleton(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Sprite3D* cobj = nullptr;
@@ -780,28 +826,26 @@ int lua_cocos2dx_3d_Sprite3D_setCullFace(lua_State* tolua_S)
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_setCullFace'", nullptr);
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_getSkeleton'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
- if (argc == 1)
+ if (argc == 0)
{
- unsigned int arg0;
-
- ok &= luaval_to_uint32(tolua_S, 2,&arg0, "cc.Sprite3D:setCullFace");
if(!ok)
return 0;
- cobj->setCullFace(arg0);
- return 0;
+ cocos2d::Skeleton3D* ret = cobj->getSkeleton();
+ object_to_luaval(tolua_S, "cc.Skeleton3D",(cocos2d::Skeleton3D*)ret);
+ return 1;
}
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:setCullFace",argc, 1);
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:getSkeleton",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_setCullFace'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_getSkeleton'.",&tolua_err);
#endif
return 0;
@@ -900,50 +944,6 @@ int lua_cocos2dx_3d_Sprite3D_getMeshByName(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_3d_Sprite3D_getSkeleton(lua_State* tolua_S)
-{
- int argc = 0;
- cocos2d::Sprite3D* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"cc.Sprite3D",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocos2d::Sprite3D*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_getSkeleton'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 0)
- {
- if(!ok)
- return 0;
- cocos2d::Skeleton3D* ret = cobj->getSkeleton();
- object_to_luaval(tolua_S, "cc.Skeleton3D",(cocos2d::Skeleton3D*)ret);
- return 1;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:getSkeleton",argc, 0);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_getSkeleton'.",&tolua_err);
-#endif
-
- return 0;
-}
int lua_cocos2dx_3d_Sprite3D_getAttachNode(lua_State* tolua_S)
{
int argc = 0;
@@ -1059,14 +1059,14 @@ int lua_register_cocos2dx_3d_Sprite3D(lua_State* tolua_S)
tolua_function(tolua_S,"getLightMask",lua_cocos2dx_3d_Sprite3D_getLightMask);
tolua_function(tolua_S,"removeAllAttachNode",lua_cocos2dx_3d_Sprite3D_removeAllAttachNode);
tolua_function(tolua_S,"getMesh",lua_cocos2dx_3d_Sprite3D_getMesh);
+ tolua_function(tolua_S,"setCullFace",lua_cocos2dx_3d_Sprite3D_setCullFace);
tolua_function(tolua_S,"setLightMask",lua_cocos2dx_3d_Sprite3D_setLightMask);
tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_3d_Sprite3D_getBlendFunc);
tolua_function(tolua_S,"getMeshCount",lua_cocos2dx_3d_Sprite3D_getMeshCount);
tolua_function(tolua_S,"removeAttachNode",lua_cocos2dx_3d_Sprite3D_removeAttachNode);
- tolua_function(tolua_S,"setCullFace",lua_cocos2dx_3d_Sprite3D_setCullFace);
+ tolua_function(tolua_S,"getSkeleton",lua_cocos2dx_3d_Sprite3D_getSkeleton);
tolua_function(tolua_S,"getMeshByIndex",lua_cocos2dx_3d_Sprite3D_getMeshByIndex);
tolua_function(tolua_S,"getMeshByName",lua_cocos2dx_3d_Sprite3D_getMeshByName);
- tolua_function(tolua_S,"getSkeleton",lua_cocos2dx_3d_Sprite3D_getSkeleton);
tolua_function(tolua_S,"getAttachNode",lua_cocos2dx_3d_Sprite3D_getAttachNode);
tolua_function(tolua_S,"create", lua_cocos2dx_3d_Sprite3D_create);
tolua_endmodule(tolua_S);
diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp
index e6baedae6c..d795a814d0 100644
--- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp
+++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp
@@ -10763,7 +10763,7 @@ int lua_cocos2dx_Director_setEventDispatcher(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_Director_pushScene(lua_State* tolua_S)
+int lua_cocos2dx_Director_setContentScaleFactor(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Director* cobj = nullptr;
@@ -10783,7 +10783,7 @@ int lua_cocos2dx_Director_pushScene(lua_State* tolua_S)
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_pushScene'", nullptr);
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_setContentScaleFactor'", nullptr);
return 0;
}
#endif
@@ -10791,64 +10791,20 @@ int lua_cocos2dx_Director_pushScene(lua_State* tolua_S)
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
- cocos2d::Scene* arg0;
+ double arg0;
- ok &= luaval_to_object(tolua_S, 2, "cc.Scene",&arg0);
+ ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Director:setContentScaleFactor");
if(!ok)
return 0;
- cobj->pushScene(arg0);
+ cobj->setContentScaleFactor(arg0);
return 0;
}
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:pushScene",argc, 1);
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:setContentScaleFactor",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_pushScene'.",&tolua_err);
-#endif
-
- return 0;
-}
-int lua_cocos2dx_Director_getDeltaTime(lua_State* tolua_S)
-{
- int argc = 0;
- cocos2d::Director* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getDeltaTime'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 0)
- {
- if(!ok)
- return 0;
- double ret = cobj->getDeltaTime();
- tolua_pushnumber(tolua_S,(lua_Number)ret);
- return 1;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getDeltaTime",argc, 0);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getDeltaTime'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_setContentScaleFactor'.",&tolua_err);
#endif
return 0;
@@ -10941,7 +10897,7 @@ int lua_cocos2dx_Director_getWinSizeInPixels(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_Director_getConsole(lua_State* tolua_S)
+int lua_cocos2dx_Director_getDeltaTime(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Director* cobj = nullptr;
@@ -10961,7 +10917,7 @@ int lua_cocos2dx_Director_getConsole(lua_State* tolua_S)
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getConsole'", nullptr);
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getDeltaTime'", nullptr);
return 0;
}
#endif
@@ -10971,62 +10927,16 @@ int lua_cocos2dx_Director_getConsole(lua_State* tolua_S)
{
if(!ok)
return 0;
- cocos2d::Console* ret = cobj->getConsole();
- object_to_luaval(tolua_S, "cc.Console",(cocos2d::Console*)ret);
+ double ret = cobj->getDeltaTime();
+ tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getConsole",argc, 0);
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getDeltaTime",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getConsole'.",&tolua_err);
-#endif
-
- return 0;
-}
-int lua_cocos2dx_Director_pushMatrix(lua_State* tolua_S)
-{
- int argc = 0;
- cocos2d::Director* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_pushMatrix'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 1)
- {
- cocos2d::MATRIX_STACK_TYPE arg0;
-
- ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:pushMatrix");
- if(!ok)
- return 0;
- cobj->pushMatrix(arg0);
- return 0;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:pushMatrix",argc, 1);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_pushMatrix'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getDeltaTime'.",&tolua_err);
#endif
return 0;
@@ -11655,6 +11565,49 @@ int lua_cocos2dx_Director_getSecondsPerFrame(lua_State* tolua_S)
return 0;
}
+int lua_cocos2dx_Director_resetMatrixStack(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocos2d::Director* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_resetMatrixStack'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 0)
+ {
+ if(!ok)
+ return 0;
+ cobj->resetMatrixStack();
+ return 0;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:resetMatrixStack",argc, 0);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_resetMatrixStack'.",&tolua_err);
+#endif
+
+ return 0;
+}
int lua_cocos2dx_Director_convertToUI(lua_State* tolua_S)
{
int argc = 0;
@@ -11702,6 +11655,52 @@ int lua_cocos2dx_Director_convertToUI(lua_State* tolua_S)
return 0;
}
+int lua_cocos2dx_Director_pushMatrix(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocos2d::Director* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_pushMatrix'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 1)
+ {
+ cocos2d::MATRIX_STACK_TYPE arg0;
+
+ ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:pushMatrix");
+ if(!ok)
+ return 0;
+ cobj->pushMatrix(arg0);
+ return 0;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:pushMatrix",argc, 1);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_pushMatrix'.",&tolua_err);
+#endif
+
+ return 0;
+}
int lua_cocos2dx_Director_setDefaultValues(lua_State* tolua_S)
{
int argc = 0;
@@ -12052,52 +12051,6 @@ int lua_cocos2dx_Director_stopAnimation(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_Director_setContentScaleFactor(lua_State* tolua_S)
-{
- int argc = 0;
- cocos2d::Director* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_setContentScaleFactor'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 1)
- {
- double arg0;
-
- ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Director:setContentScaleFactor");
- if(!ok)
- return 0;
- cobj->setContentScaleFactor(arg0);
- return 0;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:setContentScaleFactor",argc, 1);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_setContentScaleFactor'.",&tolua_err);
-#endif
-
- return 0;
-}
int lua_cocos2dx_Director_popToSceneStackLevel(lua_State* tolua_S)
{
int argc = 0;
@@ -12589,50 +12542,6 @@ int lua_cocos2dx_Director_drawScene(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_Director_getZEye(lua_State* tolua_S)
-{
- int argc = 0;
- cocos2d::Director* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getZEye'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 0)
- {
- if(!ok)
- return 0;
- double ret = cobj->getZEye();
- tolua_pushnumber(tolua_S,(lua_Number)ret);
- return 1;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getZEye",argc, 0);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getZEye'.",&tolua_err);
-#endif
-
- return 0;
-}
int lua_cocos2dx_Director_getMatrix(lua_State* tolua_S)
{
int argc = 0;
@@ -12666,7 +12575,7 @@ int lua_cocos2dx_Director_getMatrix(lua_State* tolua_S)
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:getMatrix");
if(!ok)
return 0;
- cocos2d::Mat4 ret = cobj->getMatrix(arg0);
+ const cocos2d::Mat4& ret = cobj->getMatrix(arg0);
mat4_to_luaval(tolua_S, ret);
return 1;
}
@@ -12723,6 +12632,52 @@ int lua_cocos2dx_Director_popScene(lua_State* tolua_S)
return 0;
}
+int lua_cocos2dx_Director_loadIdentityMatrix(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocos2d::Director* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_loadIdentityMatrix'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 1)
+ {
+ cocos2d::MATRIX_STACK_TYPE arg0;
+
+ ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:loadIdentityMatrix");
+ if(!ok)
+ return 0;
+ cobj->loadIdentityMatrix(arg0);
+ return 0;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:loadIdentityMatrix",argc, 1);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_loadIdentityMatrix'.",&tolua_err);
+#endif
+
+ return 0;
+}
int lua_cocos2dx_Director_isDisplayStats(lua_State* tolua_S)
{
int argc = 0;
@@ -12813,7 +12768,7 @@ int lua_cocos2dx_Director_setProjection(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_Director_loadIdentityMatrix(lua_State* tolua_S)
+int lua_cocos2dx_Director_getConsole(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Director* cobj = nullptr;
@@ -12833,28 +12788,119 @@ int lua_cocos2dx_Director_loadIdentityMatrix(lua_State* tolua_S)
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_loadIdentityMatrix'", nullptr);
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getConsole'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
- if (argc == 1)
+ if (argc == 0)
{
- cocos2d::MATRIX_STACK_TYPE arg0;
-
- ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:loadIdentityMatrix");
if(!ok)
return 0;
- cobj->loadIdentityMatrix(arg0);
- return 0;
+ cocos2d::Console* ret = cobj->getConsole();
+ object_to_luaval(tolua_S, "cc.Console",(cocos2d::Console*)ret);
+ return 1;
}
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:loadIdentityMatrix",argc, 1);
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getConsole",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_loadIdentityMatrix'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getConsole'.",&tolua_err);
+#endif
+
+ return 0;
+}
+int lua_cocos2dx_Director_multiplyMatrix(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocos2d::Director* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_multiplyMatrix'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 2)
+ {
+ cocos2d::MATRIX_STACK_TYPE arg0;
+ cocos2d::Mat4 arg1;
+
+ ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:multiplyMatrix");
+
+ ok &= luaval_to_mat4(tolua_S, 3, &arg1, "cc.Director:multiplyMatrix");
+ if(!ok)
+ return 0;
+ cobj->multiplyMatrix(arg0, arg1);
+ return 0;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:multiplyMatrix",argc, 2);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_multiplyMatrix'.",&tolua_err);
+#endif
+
+ return 0;
+}
+int lua_cocos2dx_Director_getZEye(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocos2d::Director* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getZEye'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 0)
+ {
+ if(!ok)
+ return 0;
+ double ret = cobj->getZEye();
+ tolua_pushnumber(tolua_S,(lua_Number)ret);
+ return 1;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getZEye",argc, 0);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getZEye'.",&tolua_err);
#endif
return 0;
@@ -12905,49 +12951,6 @@ int lua_cocos2dx_Director_setNextDeltaTimeZero(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_Director_resetMatrixStack(lua_State* tolua_S)
-{
- int argc = 0;
- cocos2d::Director* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_resetMatrixStack'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 0)
- {
- if(!ok)
- return 0;
- cobj->resetMatrixStack();
- return 0;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:resetMatrixStack",argc, 0);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_resetMatrixStack'.",&tolua_err);
-#endif
-
- return 0;
-}
int lua_cocos2dx_Director_popMatrix(lua_State* tolua_S)
{
int argc = 0;
@@ -13082,7 +13085,7 @@ int lua_cocos2dx_Director_getScheduler(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_Director_setAnimationInterval(lua_State* tolua_S)
+int lua_cocos2dx_Director_pushScene(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Director* cobj = nullptr;
@@ -13102,7 +13105,7 @@ int lua_cocos2dx_Director_setAnimationInterval(lua_State* tolua_S)
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_setAnimationInterval'", nullptr);
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_pushScene'", nullptr);
return 0;
}
#endif
@@ -13110,20 +13113,20 @@ int lua_cocos2dx_Director_setAnimationInterval(lua_State* tolua_S)
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
- double arg0;
+ cocos2d::Scene* arg0;
- ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Director:setAnimationInterval");
+ ok &= luaval_to_object(tolua_S, 2, "cc.Scene",&arg0);
if(!ok)
return 0;
- cobj->setAnimationInterval(arg0);
+ cobj->pushScene(arg0);
return 0;
}
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:setAnimationInterval",argc, 1);
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:pushScene",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_setAnimationInterval'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_pushScene'.",&tolua_err);
#endif
return 0;
@@ -13352,7 +13355,7 @@ int lua_cocos2dx_Director_replaceScene(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_Director_multiplyMatrix(lua_State* tolua_S)
+int lua_cocos2dx_Director_setAnimationInterval(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Director* cobj = nullptr;
@@ -13372,31 +13375,28 @@ int lua_cocos2dx_Director_multiplyMatrix(lua_State* tolua_S)
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_multiplyMatrix'", nullptr);
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_setAnimationInterval'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
- if (argc == 2)
+ if (argc == 1)
{
- cocos2d::MATRIX_STACK_TYPE arg0;
- cocos2d::Mat4 arg1;
+ double arg0;
- ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:multiplyMatrix");
-
- ok &= luaval_to_mat4(tolua_S, 3, &arg1, "cc.Director:multiplyMatrix");
+ ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Director:setAnimationInterval");
if(!ok)
return 0;
- cobj->multiplyMatrix(arg0, arg1);
+ cobj->setAnimationInterval(arg0);
return 0;
}
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:multiplyMatrix",argc, 2);
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:setAnimationInterval",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_multiplyMatrix'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_setAnimationInterval'.",&tolua_err);
#endif
return 0;
@@ -13490,12 +13490,10 @@ int lua_register_cocos2dx_Director(lua_State* tolua_S)
tolua_beginmodule(tolua_S,"Director");
tolua_function(tolua_S,"pause",lua_cocos2dx_Director_pause);
tolua_function(tolua_S,"setEventDispatcher",lua_cocos2dx_Director_setEventDispatcher);
- tolua_function(tolua_S,"pushScene",lua_cocos2dx_Director_pushScene);
- tolua_function(tolua_S,"getDeltaTime",lua_cocos2dx_Director_getDeltaTime);
+ tolua_function(tolua_S,"setContentScaleFactor",lua_cocos2dx_Director_setContentScaleFactor);
tolua_function(tolua_S,"getContentScaleFactor",lua_cocos2dx_Director_getContentScaleFactor);
tolua_function(tolua_S,"getWinSizeInPixels",lua_cocos2dx_Director_getWinSizeInPixels);
- tolua_function(tolua_S,"getConsole",lua_cocos2dx_Director_getConsole);
- tolua_function(tolua_S,"pushMatrix",lua_cocos2dx_Director_pushMatrix);
+ tolua_function(tolua_S,"getDeltaTime",lua_cocos2dx_Director_getDeltaTime);
tolua_function(tolua_S,"setGLDefaultValues",lua_cocos2dx_Director_setGLDefaultValues);
tolua_function(tolua_S,"setActionManager",lua_cocos2dx_Director_setActionManager);
tolua_function(tolua_S,"setAlphaBlending",lua_cocos2dx_Director_setAlphaBlending);
@@ -13510,7 +13508,9 @@ int lua_register_cocos2dx_Director(lua_State* tolua_S)
tolua_function(tolua_S,"setDepthTest",lua_cocos2dx_Director_setDepthTest);
tolua_function(tolua_S,"getFrameRate",lua_cocos2dx_Director_getFrameRate);
tolua_function(tolua_S,"getSecondsPerFrame",lua_cocos2dx_Director_getSecondsPerFrame);
+ tolua_function(tolua_S,"resetMatrixStack",lua_cocos2dx_Director_resetMatrixStack);
tolua_function(tolua_S,"convertToUI",lua_cocos2dx_Director_convertToUI);
+ tolua_function(tolua_S,"pushMatrix",lua_cocos2dx_Director_pushMatrix);
tolua_function(tolua_S,"setDefaultValues",lua_cocos2dx_Director_setDefaultValues);
tolua_function(tolua_S,"init",lua_cocos2dx_Director_init);
tolua_function(tolua_S,"setScheduler",lua_cocos2dx_Director_setScheduler);
@@ -13519,7 +13519,6 @@ int lua_register_cocos2dx_Director(lua_State* tolua_S)
tolua_function(tolua_S,"getRunningScene",lua_cocos2dx_Director_getRunningScene);
tolua_function(tolua_S,"setViewport",lua_cocos2dx_Director_setViewport);
tolua_function(tolua_S,"stopAnimation",lua_cocos2dx_Director_stopAnimation);
- tolua_function(tolua_S,"setContentScaleFactor",lua_cocos2dx_Director_setContentScaleFactor);
tolua_function(tolua_S,"popToSceneStackLevel",lua_cocos2dx_Director_popToSceneStackLevel);
tolua_function(tolua_S,"resume",lua_cocos2dx_Director_resume);
tolua_function(tolua_S,"isNextDeltaTimeZero",lua_cocos2dx_Director_isNextDeltaTimeZero);
@@ -13531,24 +13530,25 @@ int lua_register_cocos2dx_Director(lua_State* tolua_S)
tolua_function(tolua_S,"runWithScene",lua_cocos2dx_Director_runWithScene);
tolua_function(tolua_S,"setNotificationNode",lua_cocos2dx_Director_setNotificationNode);
tolua_function(tolua_S,"drawScene",lua_cocos2dx_Director_drawScene);
- tolua_function(tolua_S,"getZEye",lua_cocos2dx_Director_getZEye);
tolua_function(tolua_S,"getMatrix",lua_cocos2dx_Director_getMatrix);
tolua_function(tolua_S,"popScene",lua_cocos2dx_Director_popScene);
+ tolua_function(tolua_S,"loadIdentityMatrix",lua_cocos2dx_Director_loadIdentityMatrix);
tolua_function(tolua_S,"isDisplayStats",lua_cocos2dx_Director_isDisplayStats);
tolua_function(tolua_S,"setProjection",lua_cocos2dx_Director_setProjection);
- tolua_function(tolua_S,"loadIdentityMatrix",lua_cocos2dx_Director_loadIdentityMatrix);
+ tolua_function(tolua_S,"getConsole",lua_cocos2dx_Director_getConsole);
+ tolua_function(tolua_S,"multiplyMatrix",lua_cocos2dx_Director_multiplyMatrix);
+ tolua_function(tolua_S,"getZEye",lua_cocos2dx_Director_getZEye);
tolua_function(tolua_S,"setNextDeltaTimeZero",lua_cocos2dx_Director_setNextDeltaTimeZero);
- tolua_function(tolua_S,"resetMatrixStack",lua_cocos2dx_Director_resetMatrixStack);
tolua_function(tolua_S,"popMatrix",lua_cocos2dx_Director_popMatrix);
tolua_function(tolua_S,"getVisibleSize",lua_cocos2dx_Director_getVisibleSize);
tolua_function(tolua_S,"getScheduler",lua_cocos2dx_Director_getScheduler);
- tolua_function(tolua_S,"setAnimationInterval",lua_cocos2dx_Director_setAnimationInterval);
+ tolua_function(tolua_S,"pushScene",lua_cocos2dx_Director_pushScene);
tolua_function(tolua_S,"getAnimationInterval",lua_cocos2dx_Director_getAnimationInterval);
tolua_function(tolua_S,"isPaused",lua_cocos2dx_Director_isPaused);
tolua_function(tolua_S,"setDisplayStats",lua_cocos2dx_Director_setDisplayStats);
tolua_function(tolua_S,"getEventDispatcher",lua_cocos2dx_Director_getEventDispatcher);
tolua_function(tolua_S,"replaceScene",lua_cocos2dx_Director_replaceScene);
- tolua_function(tolua_S,"multiplyMatrix",lua_cocos2dx_Director_multiplyMatrix);
+ tolua_function(tolua_S,"setAnimationInterval",lua_cocos2dx_Director_setAnimationInterval);
tolua_function(tolua_S,"getActionManager",lua_cocos2dx_Director_getActionManager);
tolua_function(tolua_S,"getInstance", lua_cocos2dx_Director_getInstance);
tolua_endmodule(tolua_S);
diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp
index 8af6f8b3dd..0041c715f3 100644
--- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp
+++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp
@@ -18911,7 +18911,7 @@ int lua_register_cocos2dx_studio_ActionTimelineData(lua_State* tolua_S)
return 1;
}
-int lua_cocos2dx_studio_ActionTimeline_getTimelines(lua_State* tolua_S)
+int lua_cocos2dx_studio_ActionTimeline_setFrameEventCallFunc(lua_State* tolua_S)
{
int argc = 0;
cocostudio::timeline::ActionTimeline* cobj = nullptr;
@@ -18931,26 +18931,78 @@ int lua_cocos2dx_studio_ActionTimeline_getTimelines(lua_State* tolua_S)
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_getTimelines'", nullptr);
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_setFrameEventCallFunc'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
- if (argc == 0)
+ if (argc == 1)
{
+ std::function arg0;
+
+ do {
+ // Lambda binding for lua is not supported.
+ assert(false);
+ } while(0)
+ ;
if(!ok)
return 0;
- const cocos2d::Vector& ret = cobj->getTimelines();
- ccvector_to_luaval(tolua_S, ret);
- return 1;
+ cobj->setFrameEventCallFunc(arg0);
+ return 0;
}
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:getTimelines",argc, 0);
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:setFrameEventCallFunc",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_getTimelines'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_setFrameEventCallFunc'.",&tolua_err);
+#endif
+
+ return 0;
+}
+int lua_cocos2dx_studio_ActionTimeline_addTimeline(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocostudio::timeline::ActionTimeline* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_addTimeline'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 1)
+ {
+ cocostudio::timeline::Timeline* arg0;
+
+ ok &= luaval_to_object(tolua_S, 2, "ccs.Timeline",&arg0);
+ if(!ok)
+ return 0;
+ cobj->addTimeline(arg0);
+ return 0;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:addTimeline",argc, 1);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_addTimeline'.",&tolua_err);
#endif
return 0;
@@ -19086,7 +19138,7 @@ int lua_cocos2dx_studio_ActionTimeline_pause(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_studio_ActionTimeline_setFrameEventCallFunc(lua_State* tolua_S)
+int lua_cocos2dx_studio_ActionTimeline_init(lua_State* tolua_S)
{
int argc = 0;
cocostudio::timeline::ActionTimeline* cobj = nullptr;
@@ -19106,7 +19158,51 @@ int lua_cocos2dx_studio_ActionTimeline_setFrameEventCallFunc(lua_State* tolua_S)
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_setFrameEventCallFunc'", nullptr);
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_init'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 0)
+ {
+ if(!ok)
+ return 0;
+ bool ret = cobj->init();
+ tolua_pushboolean(tolua_S,(bool)ret);
+ return 1;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:init",argc, 0);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_init'.",&tolua_err);
+#endif
+
+ return 0;
+}
+int lua_cocos2dx_studio_ActionTimeline_removeTimeline(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocostudio::timeline::ActionTimeline* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_removeTimeline'", nullptr);
return 0;
}
#endif
@@ -19114,7 +19210,53 @@ int lua_cocos2dx_studio_ActionTimeline_setFrameEventCallFunc(lua_State* tolua_S)
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
- std::function arg0;
+ cocostudio::timeline::Timeline* arg0;
+
+ ok &= luaval_to_object(tolua_S, 2, "ccs.Timeline",&arg0);
+ if(!ok)
+ return 0;
+ cobj->removeTimeline(arg0);
+ return 0;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:removeTimeline",argc, 1);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_removeTimeline'.",&tolua_err);
+#endif
+
+ return 0;
+}
+int lua_cocos2dx_studio_ActionTimeline_setLastFrameCallFunc(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocostudio::timeline::ActionTimeline* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_setLastFrameCallFunc'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 1)
+ {
+ std::function arg0;
do {
// Lambda binding for lua is not supported.
@@ -19123,15 +19265,59 @@ int lua_cocos2dx_studio_ActionTimeline_setFrameEventCallFunc(lua_State* tolua_S)
;
if(!ok)
return 0;
- cobj->setFrameEventCallFunc(arg0);
+ cobj->setLastFrameCallFunc(arg0);
return 0;
}
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:setFrameEventCallFunc",argc, 1);
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:setLastFrameCallFunc",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_setFrameEventCallFunc'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_setLastFrameCallFunc'.",&tolua_err);
+#endif
+
+ return 0;
+}
+int lua_cocos2dx_studio_ActionTimeline_getTimelines(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocostudio::timeline::ActionTimeline* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_getTimelines'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 0)
+ {
+ if(!ok)
+ return 0;
+ const cocos2d::Vector& ret = cobj->getTimelines();
+ ccvector_to_luaval(tolua_S, ret);
+ return 1;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:getTimelines",argc, 0);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_getTimelines'.",&tolua_err);
#endif
return 0;
@@ -19179,322 +19365,6 @@ int lua_cocos2dx_studio_ActionTimeline_resume(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_studio_ActionTimeline_getDuration(lua_State* tolua_S)
-{
- int argc = 0;
- cocostudio::timeline::ActionTimeline* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_getDuration'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 0)
- {
- if(!ok)
- return 0;
- int ret = cobj->getDuration();
- tolua_pushnumber(tolua_S,(lua_Number)ret);
- return 1;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:getDuration",argc, 0);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_getDuration'.",&tolua_err);
-#endif
-
- return 0;
-}
-int lua_cocos2dx_studio_ActionTimeline_addTimeline(lua_State* tolua_S)
-{
- int argc = 0;
- cocostudio::timeline::ActionTimeline* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_addTimeline'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 1)
- {
- cocostudio::timeline::Timeline* arg0;
-
- ok &= luaval_to_object(tolua_S, 2, "ccs.Timeline",&arg0);
- if(!ok)
- return 0;
- cobj->addTimeline(arg0);
- return 0;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:addTimeline",argc, 1);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_addTimeline'.",&tolua_err);
-#endif
-
- return 0;
-}
-int lua_cocos2dx_studio_ActionTimeline_getEndFrame(lua_State* tolua_S)
-{
- int argc = 0;
- cocostudio::timeline::ActionTimeline* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_getEndFrame'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 0)
- {
- if(!ok)
- return 0;
- int ret = cobj->getEndFrame();
- tolua_pushnumber(tolua_S,(lua_Number)ret);
- return 1;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:getEndFrame",argc, 0);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_getEndFrame'.",&tolua_err);
-#endif
-
- return 0;
-}
-int lua_cocos2dx_studio_ActionTimeline_setCurrentFrame(lua_State* tolua_S)
-{
- int argc = 0;
- cocostudio::timeline::ActionTimeline* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_setCurrentFrame'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 1)
- {
- int arg0;
-
- ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:setCurrentFrame");
- if(!ok)
- return 0;
- cobj->setCurrentFrame(arg0);
- return 0;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:setCurrentFrame",argc, 1);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_setCurrentFrame'.",&tolua_err);
-#endif
-
- return 0;
-}
-int lua_cocos2dx_studio_ActionTimeline_setTimeSpeed(lua_State* tolua_S)
-{
- int argc = 0;
- cocostudio::timeline::ActionTimeline* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_setTimeSpeed'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 1)
- {
- double arg0;
-
- ok &= luaval_to_number(tolua_S, 2,&arg0, "ccs.ActionTimeline:setTimeSpeed");
- if(!ok)
- return 0;
- cobj->setTimeSpeed(arg0);
- return 0;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:setTimeSpeed",argc, 1);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_setTimeSpeed'.",&tolua_err);
-#endif
-
- return 0;
-}
-int lua_cocos2dx_studio_ActionTimeline_init(lua_State* tolua_S)
-{
- int argc = 0;
- cocostudio::timeline::ActionTimeline* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_init'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 0)
- {
- if(!ok)
- return 0;
- bool ret = cobj->init();
- tolua_pushboolean(tolua_S,(bool)ret);
- return 1;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:init",argc, 0);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_init'.",&tolua_err);
-#endif
-
- return 0;
-}
-int lua_cocos2dx_studio_ActionTimeline_setDuration(lua_State* tolua_S)
-{
- int argc = 0;
- cocostudio::timeline::ActionTimeline* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_setDuration'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 1)
- {
- int arg0;
-
- ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:setDuration");
- if(!ok)
- return 0;
- cobj->setDuration(arg0);
- return 0;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:setDuration",argc, 1);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_setDuration'.",&tolua_err);
-#endif
-
- return 0;
-}
int lua_cocos2dx_studio_ActionTimeline_getTimeSpeed(lua_State* tolua_S)
{
int argc = 0;
@@ -19539,6 +19409,50 @@ int lua_cocos2dx_studio_ActionTimeline_getTimeSpeed(lua_State* tolua_S)
return 0;
}
+int lua_cocos2dx_studio_ActionTimeline_getDuration(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocostudio::timeline::ActionTimeline* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_getDuration'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 0)
+ {
+ if(!ok)
+ return 0;
+ int ret = cobj->getDuration();
+ tolua_pushnumber(tolua_S,(lua_Number)ret);
+ return 1;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:getDuration",argc, 0);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_getDuration'.",&tolua_err);
+#endif
+
+ return 0;
+}
int lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPause(lua_State* tolua_S)
{
int argc = 0;
@@ -19728,52 +19642,6 @@ int lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(lua_State* tolua_S)
return 0;
}
-int lua_cocos2dx_studio_ActionTimeline_removeTimeline(lua_State* tolua_S)
-{
- int argc = 0;
- cocostudio::timeline::ActionTimeline* cobj = nullptr;
- bool ok = true;
-
-#if COCOS2D_DEBUG >= 1
- tolua_Error tolua_err;
-#endif
-
-
-#if COCOS2D_DEBUG >= 1
- if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
-#endif
-
- cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
-
-#if COCOS2D_DEBUG >= 1
- if (!cobj)
- {
- tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_removeTimeline'", nullptr);
- return 0;
- }
-#endif
-
- argc = lua_gettop(tolua_S)-1;
- if (argc == 1)
- {
- cocostudio::timeline::Timeline* arg0;
-
- ok &= luaval_to_object(tolua_S, 2, "ccs.Timeline",&arg0);
- if(!ok)
- return 0;
- cobj->removeTimeline(arg0);
- return 0;
- }
- CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:removeTimeline",argc, 1);
- return 0;
-
-#if COCOS2D_DEBUG >= 1
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_removeTimeline'.",&tolua_err);
-#endif
-
- return 0;
-}
int lua_cocos2dx_studio_ActionTimeline_clearFrameEventCallFunc(lua_State* tolua_S)
{
int argc = 0;
@@ -19817,6 +19685,231 @@ int lua_cocos2dx_studio_ActionTimeline_clearFrameEventCallFunc(lua_State* tolua_
return 0;
}
+int lua_cocos2dx_studio_ActionTimeline_getEndFrame(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocostudio::timeline::ActionTimeline* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_getEndFrame'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 0)
+ {
+ if(!ok)
+ return 0;
+ int ret = cobj->getEndFrame();
+ tolua_pushnumber(tolua_S,(lua_Number)ret);
+ return 1;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:getEndFrame",argc, 0);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_getEndFrame'.",&tolua_err);
+#endif
+
+ return 0;
+}
+int lua_cocos2dx_studio_ActionTimeline_setTimeSpeed(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocostudio::timeline::ActionTimeline* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_setTimeSpeed'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 1)
+ {
+ double arg0;
+
+ ok &= luaval_to_number(tolua_S, 2,&arg0, "ccs.ActionTimeline:setTimeSpeed");
+ if(!ok)
+ return 0;
+ cobj->setTimeSpeed(arg0);
+ return 0;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:setTimeSpeed",argc, 1);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_setTimeSpeed'.",&tolua_err);
+#endif
+
+ return 0;
+}
+int lua_cocos2dx_studio_ActionTimeline_clearLastFrameCallFunc(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocostudio::timeline::ActionTimeline* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_clearLastFrameCallFunc'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 0)
+ {
+ if(!ok)
+ return 0;
+ cobj->clearLastFrameCallFunc();
+ return 0;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:clearLastFrameCallFunc",argc, 0);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_clearLastFrameCallFunc'.",&tolua_err);
+#endif
+
+ return 0;
+}
+int lua_cocos2dx_studio_ActionTimeline_setDuration(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocostudio::timeline::ActionTimeline* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_setDuration'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 1)
+ {
+ int arg0;
+
+ ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:setDuration");
+ if(!ok)
+ return 0;
+ cobj->setDuration(arg0);
+ return 0;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:setDuration",argc, 1);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_setDuration'.",&tolua_err);
+#endif
+
+ return 0;
+}
+int lua_cocos2dx_studio_ActionTimeline_setCurrentFrame(lua_State* tolua_S)
+{
+ int argc = 0;
+ cocostudio::timeline::ActionTimeline* cobj = nullptr;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
+
+#if COCOS2D_DEBUG >= 1
+ if (!cobj)
+ {
+ tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_setCurrentFrame'", nullptr);
+ return 0;
+ }
+#endif
+
+ argc = lua_gettop(tolua_S)-1;
+ if (argc == 1)
+ {
+ int arg0;
+
+ ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.ActionTimeline:setCurrentFrame");
+ if(!ok)
+ return 0;
+ cobj->setCurrentFrame(arg0);
+ return 0;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ActionTimeline:setCurrentFrame",argc, 1);
+ return 0;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_setCurrentFrame'.",&tolua_err);
+#endif
+
+ return 0;
+}
int lua_cocos2dx_studio_ActionTimeline_create(lua_State* tolua_S)
{
int argc = 0;
@@ -19895,25 +19988,27 @@ int lua_register_cocos2dx_studio_ActionTimeline(lua_State* tolua_S)
tolua_beginmodule(tolua_S,"ActionTimeline");
tolua_function(tolua_S,"new",lua_cocos2dx_studio_ActionTimeline_constructor);
- tolua_function(tolua_S,"getTimelines",lua_cocos2dx_studio_ActionTimeline_getTimelines);
+ tolua_function(tolua_S,"setFrameEventCallFunc",lua_cocos2dx_studio_ActionTimeline_setFrameEventCallFunc);
+ tolua_function(tolua_S,"addTimeline",lua_cocos2dx_studio_ActionTimeline_addTimeline);
tolua_function(tolua_S,"getCurrentFrame",lua_cocos2dx_studio_ActionTimeline_getCurrentFrame);
tolua_function(tolua_S,"getStartFrame",lua_cocos2dx_studio_ActionTimeline_getStartFrame);
tolua_function(tolua_S,"pause",lua_cocos2dx_studio_ActionTimeline_pause);
- tolua_function(tolua_S,"setFrameEventCallFunc",lua_cocos2dx_studio_ActionTimeline_setFrameEventCallFunc);
- tolua_function(tolua_S,"resume",lua_cocos2dx_studio_ActionTimeline_resume);
- tolua_function(tolua_S,"getDuration",lua_cocos2dx_studio_ActionTimeline_getDuration);
- tolua_function(tolua_S,"addTimeline",lua_cocos2dx_studio_ActionTimeline_addTimeline);
- tolua_function(tolua_S,"getEndFrame",lua_cocos2dx_studio_ActionTimeline_getEndFrame);
- tolua_function(tolua_S,"setCurrentFrame",lua_cocos2dx_studio_ActionTimeline_setCurrentFrame);
- tolua_function(tolua_S,"setTimeSpeed",lua_cocos2dx_studio_ActionTimeline_setTimeSpeed);
tolua_function(tolua_S,"init",lua_cocos2dx_studio_ActionTimeline_init);
- tolua_function(tolua_S,"setDuration",lua_cocos2dx_studio_ActionTimeline_setDuration);
+ tolua_function(tolua_S,"removeTimeline",lua_cocos2dx_studio_ActionTimeline_removeTimeline);
+ tolua_function(tolua_S,"setLastFrameCallFunc",lua_cocos2dx_studio_ActionTimeline_setLastFrameCallFunc);
+ tolua_function(tolua_S,"getTimelines",lua_cocos2dx_studio_ActionTimeline_getTimelines);
+ tolua_function(tolua_S,"resume",lua_cocos2dx_studio_ActionTimeline_resume);
tolua_function(tolua_S,"getTimeSpeed",lua_cocos2dx_studio_ActionTimeline_getTimeSpeed);
+ tolua_function(tolua_S,"getDuration",lua_cocos2dx_studio_ActionTimeline_getDuration);
tolua_function(tolua_S,"gotoFrameAndPause",lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPause);
tolua_function(tolua_S,"isPlaying",lua_cocos2dx_studio_ActionTimeline_isPlaying);
tolua_function(tolua_S,"gotoFrameAndPlay",lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay);
- tolua_function(tolua_S,"removeTimeline",lua_cocos2dx_studio_ActionTimeline_removeTimeline);
tolua_function(tolua_S,"clearFrameEventCallFunc",lua_cocos2dx_studio_ActionTimeline_clearFrameEventCallFunc);
+ tolua_function(tolua_S,"getEndFrame",lua_cocos2dx_studio_ActionTimeline_getEndFrame);
+ tolua_function(tolua_S,"setTimeSpeed",lua_cocos2dx_studio_ActionTimeline_setTimeSpeed);
+ tolua_function(tolua_S,"clearLastFrameCallFunc",lua_cocos2dx_studio_ActionTimeline_clearLastFrameCallFunc);
+ tolua_function(tolua_S,"setDuration",lua_cocos2dx_studio_ActionTimeline_setDuration);
+ tolua_function(tolua_S,"setCurrentFrame",lua_cocos2dx_studio_ActionTimeline_setCurrentFrame);
tolua_function(tolua_S,"create", lua_cocos2dx_studio_ActionTimeline_create);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocostudio::timeline::ActionTimeline).name();
diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp
index 1f5778d277..a1ad549900 100644
--- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp
+++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp
@@ -484,6 +484,8 @@ int register_all_cocos2dx_studio(lua_State* tolua_S);
+
+
diff --git a/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp b/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp
index 1933041efc..5a918d57eb 100644
--- a/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp
+++ b/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp
@@ -773,7 +773,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L)
(unsigned char*)stack->_xxteaKey,
(xxtea_long)stack->_xxteaKeyLen,
&len);
- delete []zipFileData;
+ free(zipFileData);
zipFileData = nullptr;
zip = ZipFile::createWithBuffer(buffer, len);
} else {
@@ -797,7 +797,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L)
lua_setfield(L, -2, filename.c_str());
++count;
}
- delete []zbuffer;
+ free(zbuffer);
}
filename = zip->getNextFilename();
}
@@ -812,7 +812,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L)
}
if (zipFileData) {
- delete []zipFileData;
+ free(zipFileData);
}
if (buffer) {
diff --git a/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp b/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp
index 732eed5a57..956e9b0cd7 100644
--- a/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp
+++ b/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp
@@ -108,7 +108,7 @@ extern "C"
{
LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
stack->luaLoadBuffer(L, (char*)chunk, (int)chunkSize, chunkName.c_str());
- delete []chunk;
+ free(chunk);
}
else
{
diff --git a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp
index 634baf4e97..2e726a4b83 100644
--- a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp
+++ b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp
@@ -1184,7 +1184,7 @@ bool luaval_to_array(lua_State* L,int lo, __Array** outValue, const char* funcNa
}
}
}
- else if(lua_isstring(L, -1))
+ else if(lua_type(L, -1) == LUA_TSTRING)
{
std::string stringValue = "";
if(luaval_to_std_string(L, -1, &stringValue) )
@@ -1192,7 +1192,7 @@ bool luaval_to_array(lua_State* L,int lo, __Array** outValue, const char* funcNa
arr->addObject(String::create(stringValue));
}
}
- else if(lua_isboolean(L, -1))
+ else if(lua_type(L, -1) == LUA_TBOOLEAN)
{
bool boolVal = false;
if (luaval_to_boolean(L, -1, &boolVal))
@@ -1200,7 +1200,7 @@ bool luaval_to_array(lua_State* L,int lo, __Array** outValue, const char* funcNa
arr->addObject(Bool::create(boolVal));
}
}
- else if(lua_isnumber(L, -1))
+ else if(lua_type(L, -1) == LUA_TNUMBER)
{
arr->addObject(Double::create(tolua_tonumber(L, -1, 0)));
}
@@ -1288,21 +1288,21 @@ bool luaval_to_dictionary(lua_State* L,int lo, __Dictionary** outValue, const ch
}
}
}
- else if(lua_isstring(L, -1))
+ else if(lua_type(L, -1) == LUA_TSTRING)
{
if(luaval_to_std_string(L, -1, &stringValue))
{
dict->setObject(String::create(stringValue), stringKey);
}
}
- else if(lua_isboolean(L, -1))
+ else if(lua_type(L, -1) == LUA_TBOOLEAN)
{
if (luaval_to_boolean(L, -1, &boolVal))
{
dict->setObject(Bool::create(boolVal),stringKey);
}
}
- else if(lua_isnumber(L, -1))
+ else if(lua_type(L, -1) == LUA_TNUMBER)
{
dict->setObject(Double::create(tolua_tonumber(L, -1, 0)),stringKey);
}
@@ -1389,7 +1389,7 @@ bool luavals_variadic_to_array(lua_State* L,int argc, __Array** ret)
for (int i = 0; i < argc; i++)
{
double num = 0.0;
- if (lua_isnumber(L, i + 2))
+ if (lua_type(L, i + 2) == LUA_TNUMBER )
{
ok &= luaval_to_number(L, i + 2, &num);
if (!ok)
@@ -1397,7 +1397,7 @@ bool luavals_variadic_to_array(lua_State* L,int argc, __Array** ret)
array->addObject(Integer::create((int)num));
}
- else if (lua_isstring(L, i + 2))
+ else if (lua_type(L, i + 2) == LUA_TSTRING )
{
std::string str = lua_tostring(L, i + 2);
array->addObject(String::create(str));
@@ -1453,7 +1453,7 @@ bool luavals_variadic_to_ccvaluevector(lua_State* L, int argc, cocos2d::ValueVec
}
}
}
- else if(lua_isstring(L, i + 2))
+ else if(lua_type(L, i + 2) == LUA_TSTRING )
{
std::string stringValue = "";
if(luaval_to_std_string(L, i + 2, &stringValue) )
@@ -1469,7 +1469,7 @@ bool luavals_variadic_to_ccvaluevector(lua_State* L, int argc, cocos2d::ValueVec
ret->push_back(Value(boolVal));
}
}
- else if(lua_isnumber(L, i + 2))
+ else if(lua_type(L, i + 2) == LUA_TNUMBER )
{
ret->push_back(Value(tolua_tonumber(L, i + 2, 0)));
}
@@ -1515,7 +1515,7 @@ bool luaval_to_ccvalue(lua_State* L, int lo, cocos2d::Value* ret, const char* fu
}
}
}
- else if (tolua_isstring(L, lo, 0, &tolua_err))
+ else if ((lua_type(L, lo) == LUA_TSTRING) && tolua_isstring(L, lo, 0, &tolua_err))
{
std::string stringValue = "";
if (luaval_to_std_string(L, lo, &stringValue))
@@ -1523,7 +1523,7 @@ bool luaval_to_ccvalue(lua_State* L, int lo, cocos2d::Value* ret, const char* fu
*ret = Value(stringValue);
}
}
- else if (tolua_isboolean(L, lo, 0, &tolua_err))
+ else if ((lua_type(L, lo) == LUA_TBOOLEAN) && tolua_isboolean(L, lo, 0, &tolua_err))
{
bool boolVal = false;
if (luaval_to_boolean(L, lo, &boolVal))
@@ -1531,7 +1531,7 @@ bool luaval_to_ccvalue(lua_State* L, int lo, cocos2d::Value* ret, const char* fu
*ret = Value(boolVal);
}
}
- else if (tolua_isnumber(L, lo, 0, &tolua_err))
+ else if ((lua_type(L, lo) == LUA_TNUMBER) && tolua_isnumber(L, lo, 0, &tolua_err))
{
*ret = Value(tolua_tonumber(L, lo, 0));
}
@@ -1595,21 +1595,21 @@ bool luaval_to_ccvaluemap(lua_State* L, int lo, cocos2d::ValueMap* ret, const ch
}
}
}
- else if(lua_isstring(L, -1))
+ else if(lua_type(L, -1) == LUA_TSTRING)
{
if(luaval_to_std_string(L, -1, &stringValue))
{
dict[stringKey] = Value(stringValue);
}
}
- else if(lua_isboolean(L, -1))
+ else if(lua_type(L, -1) == LUA_TBOOLEAN)
{
if (luaval_to_boolean(L, -1, &boolVal))
{
dict[stringKey] = Value(boolVal);
}
}
- else if(lua_isnumber(L, -1))
+ else if(lua_type(L, -1) == LUA_TNUMBER)
{
dict[stringKey] = Value(tolua_tonumber(L, -1, 0));
}
@@ -1683,21 +1683,21 @@ bool luaval_to_ccvaluemapintkey(lua_State* L, int lo, cocos2d::ValueMapIntKey* r
}
}
}
- else if(lua_isstring(L, -1))
+ else if(lua_type(L, -1) == LUA_TSTRING)
{
if(luaval_to_std_string(L, -1, &stringValue))
{
dict[intKey] = Value(stringValue);
}
}
- else if(lua_isboolean(L, -1))
+ else if(lua_type(L, -1) == LUA_TBOOLEAN)
{
if (luaval_to_boolean(L, -1, &boolVal))
{
dict[intKey] = Value(boolVal);
}
}
- else if(lua_isnumber(L, -1))
+ else if(lua_type(L, -1) == LUA_TNUMBER)
{
dict[intKey] = Value(tolua_tonumber(L, -1, 0));
}
@@ -1764,7 +1764,7 @@ bool luaval_to_ccvaluevector(lua_State* L, int lo, cocos2d::ValueVector* ret, co
}
}
}
- else if(lua_isstring(L, -1))
+ else if(lua_type(L, -1) == LUA_TSTRING)
{
std::string stringValue = "";
if(luaval_to_std_string(L, -1, &stringValue) )
@@ -1772,7 +1772,7 @@ bool luaval_to_ccvaluevector(lua_State* L, int lo, cocos2d::ValueVector* ret, co
ret->push_back(Value(stringValue));
}
}
- else if(lua_isboolean(L, -1))
+ else if(lua_type(L, -1) == LUA_TBOOLEAN)
{
bool boolVal = false;
if (luaval_to_boolean(L, -1, &boolVal))
@@ -1780,7 +1780,7 @@ bool luaval_to_ccvaluevector(lua_State* L, int lo, cocos2d::ValueVector* ret, co
ret->push_back(Value(boolVal));
}
}
- else if(lua_isnumber(L, -1))
+ else if(lua_type(L, -1) == LUA_TNUMBER)
{
ret->push_back(Value(tolua_tonumber(L, -1, 0)));
}
diff --git a/cocos/scripting/lua-bindings/proj.android/Android.mk b/cocos/scripting/lua-bindings/proj.android/Android.mk
index a07e28abac..0c6f4bfb58 100644
--- a/cocos/scripting/lua-bindings/proj.android/Android.mk
+++ b/cocos/scripting/lua-bindings/proj.android/Android.mk
@@ -1,4 +1,31 @@
LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := cocos2d_lua_android_static
+
+LOCAL_MODULE_FILENAME := libluacocos2dandroid
+
+LOCAL_SRC_FILES := ../manual/platform/android/CCLuaJavaBridge.cpp \
+ ../manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp
+
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../.. \
+ $(LOCAL_PATH)/../manual \
+ $(LOCAL_PATH)/../../../../external/lua/tolua \
+ $(LOCAL_PATH)/../manual/platform/android \
+ $(LOCAL_PATH)/../manual/platform/android/jni
+
+LOCAL_EXPORT_LDLIBS := -lGLESv2 \
+ -llog \
+ -lz \
+ -landroid
+
+LOCAL_STATIC_LIBRARIES := luajit_static
+
+include $(BUILD_STATIC_LIBRARY)
+
+#==============================================================
+
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2d_lua_static
@@ -20,8 +47,6 @@ LOCAL_SRC_FILES := ../manual/CCLuaBridge.cpp \
../manual/cocos2d/lua_cocos2dx_physics_manual.cpp \
../manual/cocos2d/LuaOpengl.cpp \
../manual/cocos2d/LuaScriptHandlerMgr.cpp \
- ../manual/platform/android/CCLuaJavaBridge.cpp \
- ../manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp \
../manual/tolua_fix.cpp \
../../../../external/lua/tolua/tolua_event.c \
../../../../external/lua/tolua/tolua_is.c \
@@ -117,15 +142,11 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../external/lua/tolua \
$(LOCAL_PATH)/../manual/cocosbuilder \
$(LOCAL_PATH)/../manual/spine \
$(LOCAL_PATH)/../manual/ui \
- $(LOCAL_PATH)/../manual/platform/android \
- $(LOCAL_PATH)/../manual/platform/android/jni \
$(LOCAL_PATH)/../../../../external/xxtea \
$(LOCAL_PATH)/../../../.. \
$(LOCAL_PATH)/../../../../external/lua \
$(LOCAL_PATH)/../../../../external/lua/quick
-
-
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../external/lua/tolua \
$(LOCAL_PATH)/../../../../external/lua/luajit/include \
$(LOCAL_PATH)/../auto \
@@ -143,12 +164,11 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../external/lua/tolua \
$(LOCAL_PATH)/../../../../external/lua/quick \
$(LOCAL_PATH)/../../../..
+LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_android_static
-LOCAL_STATIC_LIBRARIES := luajit_static
-LOCAL_STATIC_LIBRARIES += cocos2dx_static
+LOCAL_STATIC_LIBRARIES := cocos2dx_static
include $(BUILD_STATIC_LIBRARY)
-
$(call import-module,lua/luajit/prebuilt/android)
$(call import-module,.)
diff --git a/cocos/ui/CMakeLists.txt b/cocos/ui/CMakeLists.txt
index 630c4ee2dc..696a83295a 100644
--- a/cocos/ui/CMakeLists.txt
+++ b/cocos/ui/CMakeLists.txt
@@ -5,14 +5,16 @@ endif()
if(WINDOWS)
set(COCOS_UI_SPECIFIC_SRC
- ui/UIEditBox/UIEditBoxImpl-win32.cpp)
-else()#elseif(MACOSX)
- #todo: fix mac UI edit box
- #set(COCOS_UI_SPECIFIC_SRC
- # ui/UIEditBox/UIEditBoxImpl-mac.mm)
-#elseif(LINUX)
+ ui/UIEditBox/UIEditBoxImpl-win32.cpp
+ )
+elseif(MACOSX)
set(COCOS_UI_SPECIFIC_SRC
- ui/UIEditBox/UIEditBoxImpl-stub.cpp)
+ ui/UIEditBox/UIEditBoxImpl-mac.mm
+ )
+elseif(LINUX)
+ set(COCOS_UI_SPECIFIC_SRC
+ ui/UIEditBox/UIEditBoxImpl-stub.cpp
+ )
endif()
#todo: android UIWebViewImpl and UIVideoPlayer
diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp
index a5c66f1802..b27d746735 100644
--- a/cocos/ui/UIButton.cpp
+++ b/cocos/ui/UIButton.cpp
@@ -46,6 +46,7 @@ _buttonNormalRenderer(nullptr),
_buttonClickedRenderer(nullptr),
_buttonDisableRenderer(nullptr),
_titleRenderer(nullptr),
+_zoomScale(0.1f),
_normalFileName(""),
_clickedFileName(""),
_disabledFileName(""),
@@ -65,7 +66,6 @@ _normalTextureScaleXInSize(1.0f),
_normalTextureScaleYInSize(1.0f),
_pressedTextureScaleXInSize(1.0f),
_pressedTextureScaleYInSize(1.0f),
-_zoomScale(0.1f),
_normalTextureLoaded(false),
_pressedTextureLoaded(false),
_disabledTextureLoaded(false),
diff --git a/cocos/ui/UIEditBox/UIEditBox.cpp b/cocos/ui/UIEditBox/UIEditBox.cpp
index 85fb8145a2..73a504930d 100644
--- a/cocos/ui/UIEditBox/UIEditBox.cpp
+++ b/cocos/ui/UIEditBox/UIEditBox.cpp
@@ -38,13 +38,13 @@ EditBox::EditBox(void)
, _editBoxInputMode(EditBox::InputMode::SINGLE_LINE)
, _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS)
, _keyboardReturnType(KeyboardReturnType::DEFAULT)
+, _backgroundSprite(nullptr)
, _fontSize(-1)
, _placeholderFontSize(-1)
, _colText(Color3B::WHITE)
, _colPlaceHolder(Color3B::GRAY)
, _maxLength(0)
, _adjustHeight(0.0f)
-, _backgroundSprite(nullptr)
#if CC_ENABLE_SCRIPT_BINDING
, _scriptEditBoxHandler(0)
#endif
diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp
index 1a1e9b66ac..9b75316cbf 100644
--- a/cocos/ui/UILayout.cpp
+++ b/cocos/ui/UILayout.cpp
@@ -51,13 +51,15 @@ static GLint s_layer = -1;
IMPLEMENT_CLASS_GUI_INFO(Layout)
Layout::Layout():
-_clippingEnabled(false),
_backGroundScale9Enabled(false),
_backGroundImage(nullptr),
_backGroundImageFileName(""),
_backGroundImageCapInsets(Rect::ZERO),
_colorType(BackGroundColorType::NONE),
_bgImageTexType(TextureResType::LOCAL),
+_backGroundImageTextureSize(Size::ZERO),
+_backGroundImageColor(Color3B::WHITE),
+_backGroundImageOpacity(255),
_colorRender(nullptr),
_gradientRender(nullptr),
_cColor(Color3B::WHITE),
@@ -65,14 +67,13 @@ _gStartColor(Color3B::WHITE),
_gEndColor(Color3B::WHITE),
_alongVector(Vec2(0.0f, -1.0f)),
_cOpacity(255),
-_backGroundImageTextureSize(Size::ZERO),
+_clippingEnabled(false),
_layoutType(Type::ABSOLUTE),
_clippingType(ClippingType::STENCIL),
_clippingStencil(nullptr),
_scissorRectDirty(false),
_clippingRect(Rect::ZERO),
_clippingParent(nullptr),
-_doLayoutDirty(true),
_clippingRectDirty(true),
_currentStencilEnabled(GL_FALSE),
_currentStencilWriteMask(~0),
@@ -86,12 +87,11 @@ _currentDepthWriteMask(GL_TRUE),
_currentAlphaTestEnabled(GL_FALSE),
_currentAlphaTestFunc(GL_ALWAYS),
_currentAlphaTestRef(1),
-_backGroundImageColor(Color3B::WHITE),
-_backGroundImageOpacity(255),
-_passFocusToChild(true),
+_doLayoutDirty(true),
+_isInterceptTouch(false),
_loopFocus(false),
-_isFocusPassing(false),
-_isInterceptTouch(false)
+_passFocusToChild(true),
+_isFocusPassing(false)
{
//no-op
}
diff --git a/cocos/ui/UILayoutComponent.cpp b/cocos/ui/UILayoutComponent.cpp
index 19c7401d16..64f6f39beb 100644
--- a/cocos/ui/UILayoutComponent.cpp
+++ b/cocos/ui/UILayoutComponent.cpp
@@ -31,10 +31,10 @@ NS_CC_BEGIN
namespace ui {
LayoutComponent::LayoutComponent()
- :_actived(true)
- ,_usingPercentContentSize(false)
- ,_usingPercentPosition(false)
- ,_referencePoint(ReferencePoint::BOTTOM_LEFT)
+ : _usingPercentContentSize(false)
+ , _referencePoint(ReferencePoint::BOTTOM_LEFT)
+ , _usingPercentPosition(false)
+ , _actived(true)
{
_name = __LAYOUT_COMPONENT_NAME;
}
diff --git a/cocos/ui/UIListView.cpp b/cocos/ui/UIListView.cpp
index 2f05a2f6d0..0b8615eafc 100644
--- a/cocos/ui/UIListView.cpp
+++ b/cocos/ui/UIListView.cpp
@@ -35,10 +35,10 @@ ListView::ListView():
_model(nullptr),
_gravity(Gravity::CENTER_VERTICAL),
_itemsMargin(0.0f),
-_listViewEventListener(nullptr),
-_listViewEventSelector(nullptr),
_curSelectedIndex(0),
_refreshViewDirty(true),
+_listViewEventListener(nullptr),
+_listViewEventSelector(nullptr),
_eventCallback(nullptr)
{
this->setTouchEnabled(true);
diff --git a/cocos/ui/UILoadingBar.cpp b/cocos/ui/UILoadingBar.cpp
index c480b8537d..acca094563 100644
--- a/cocos/ui/UILoadingBar.cpp
+++ b/cocos/ui/UILoadingBar.cpp
@@ -102,14 +102,14 @@ void LoadingBar::setDirection(cocos2d::ui::LoadingBar::Direction direction)
_barRenderer->setAnchorPoint(Vec2(0.0f,0.5f));
_barRenderer->setPosition(Vec2(0,_contentSize.height*0.5f));
if (!_scale9Enabled) {
- _barRenderer->setFlippedX(false);
+ _barRenderer->getSprite()->setFlippedX(false);
}
break;
case Direction::RIGHT:
_barRenderer->setAnchorPoint(Vec2(1.0f,0.5f));
_barRenderer->setPosition(Vec2(_totalLength,_contentSize.height*0.5f));
if (!_scale9Enabled) {
- _barRenderer->setFlippedX(true);
+ _barRenderer->getSprite()->setFlippedX(true);
}
break;
}
diff --git a/cocos/ui/UIPageView.cpp b/cocos/ui/UIPageView.cpp
index 11485d11ff..976854d302 100644
--- a/cocos/ui/UIPageView.cpp
+++ b/cocos/ui/UIPageView.cpp
@@ -31,22 +31,22 @@ namespace ui {
IMPLEMENT_CLASS_GUI_INFO(PageView)
PageView::PageView():
+_isAutoScrolling(false),
+_autoScrollDistance(0.0f),
+_autoScrollSpeed(0.0f),
+_autoScrollDirection(AutoScrollDirection::LEFT),
_curPageIdx(0),
_touchMoveDirection(TouchDirection::LEFT),
_leftBoundaryChild(nullptr),
_rightBoundaryChild(nullptr),
_leftBoundary(0.0f),
_rightBoundary(0.0f),
-_isAutoScrolling(false),
-_autoScrollDistance(0.0f),
-_autoScrollSpeed(0.0f),
-_autoScrollDirection(AutoScrollDirection::LEFT),
+_customScrollThreshold(0.0),
+_usingCustomScrollThreshold(false),
_childFocusCancelOffset(5.0f),
_pageViewEventListener(nullptr),
_pageViewEventSelector(nullptr),
-_eventCallback(nullptr),
-_customScrollThreshold(0.0),
-_usingCustomScrollThreshold(false)
+_eventCallback(nullptr)
{
this->setTouchEnabled(true);
}
diff --git a/cocos/ui/UIScale9Sprite.cpp b/cocos/ui/UIScale9Sprite.cpp
index 26ad2c0dad..0fe1510e6b 100644
--- a/cocos/ui/UIScale9Sprite.cpp
+++ b/cocos/ui/UIScale9Sprite.cpp
@@ -45,11 +45,14 @@ namespace ui {
, _bottomLeft(nullptr)
, _bottom(nullptr)
, _bottomRight(nullptr)
+ , _scale9Enabled(true)
, _insetLeft(0)
, _insetTop(0)
, _insetRight(0)
, _insetBottom(0)
- , _scale9Enabled(true)
+ ,_flippedX(false)
+ ,_flippedY(false)
+
{
this->setAnchorPoint(Vec2(0.5,0.5));
}
@@ -1021,6 +1024,9 @@ y+=ytranslate; \
this->cleanupSlicedSprites();
_protectedChildren.clear();
+ //we must invalide the transform when toggling scale9enabled
+ _transformUpdated = _transformDirty = _inverseDirty = true;
+
if (_scale9Enabled)
{
if (_scale9Image)
@@ -1208,34 +1214,17 @@ y+=ytranslate; \
void Scale9Sprite::setFlippedX(bool flippedX)
{
+
+ float realScale = this->getScaleX();
_flippedX = flippedX;
- if (_scale9Enabled)
- {
- this->setScaleX(-1);
- }
- else
- {
- if (_scale9Image)
- {
- _scale9Image->setFlippedX(flippedX);
- }
- }
+ this->setScaleX(realScale);
}
void Scale9Sprite::setFlippedY(bool flippedY)
{
+ float realScale = this->getScaleY();
_flippedY = flippedY;
- if (_scale9Enabled)
- {
- this->setScaleY(-1);
- }
- else
- {
- if (_scale9Image)
- {
- _scale9Image->setFlippedY(flippedY);
- }
- }
+ this->setScaleY(realScale);
}
bool Scale9Sprite::isFlippedX()const
@@ -1247,4 +1236,60 @@ y+=ytranslate; \
{
return _flippedY;
}
+
+ void Scale9Sprite::setScaleX(float scaleX)
+ {
+ if (_flippedX) {
+ scaleX = scaleX * -1;
+ }
+ Node::setScaleX(scaleX);
+ }
+
+ void Scale9Sprite::setScaleY(float scaleY)
+ {
+ if (_flippedY) {
+ scaleY = scaleY * -1;
+ }
+ Node::setScaleY(scaleY);
+ }
+
+ void Scale9Sprite::setScale(float scale)
+ {
+ this->setScaleX(scale);
+ this->setScaleY(scale);
+ this->setScaleZ(scale);
+ }
+
+ void Scale9Sprite::setScale(float scaleX, float scaleY)
+ {
+ this->setScaleX(scaleX);
+ this->setScaleY(scaleY);
+ }
+
+ float Scale9Sprite::getScaleX()const
+ {
+ float originalScale = Node::getScaleX();
+ if (_flippedX)
+ {
+ originalScale = originalScale * -1.0;
+ }
+ return originalScale;
+ }
+
+ float Scale9Sprite::getScaleY()const
+ {
+ float originalScale = Node::getScaleY();
+ if (_flippedY)
+ {
+ originalScale = originalScale * -1.0;
+ }
+ return originalScale;
+ }
+
+ float Scale9Sprite::getScale()const
+ {
+ CCASSERT(this->getScaleX() == this->getScaleY(), "Scale9Sprite#scale. ScaleX != ScaleY. Don't know which one to return");
+ return this->getScaleX();
+ }
+
}}
diff --git a/cocos/ui/UIScale9Sprite.h b/cocos/ui/UIScale9Sprite.h
index 19976ffef9..0923fab540 100644
--- a/cocos/ui/UIScale9Sprite.h
+++ b/cocos/ui/UIScale9Sprite.h
@@ -354,6 +354,16 @@ namespace ui {
*/
virtual bool isFlippedY()const;
+ //override the setScale function of Node
+ virtual void setScaleX(float scaleX) override;
+ virtual void setScaleY(float scaleY) override;
+ virtual void setScale(float scale) override;
+ virtual void setScale(float scalex, float scaley) override;
+ using Node::setScaleZ;
+ virtual float getScaleX() const override;
+ virtual float getScaleY() const override;
+ virtual float getScale() const override;
+ using Node::getScaleZ;
protected:
void updateCapInset();
void updatePositions();
diff --git a/cocos/ui/UISlider.cpp b/cocos/ui/UISlider.cpp
index a71fe22220..921e462e31 100644
--- a/cocos/ui/UISlider.cpp
+++ b/cocos/ui/UISlider.cpp
@@ -57,14 +57,14 @@ _capInsetsBarRenderer(Rect::ZERO),
_capInsetsProgressBarRenderer(Rect::ZERO),
_sliderEventListener(nullptr),
_sliderEventSelector(nullptr),
+_eventCallback(nullptr),
_barTexType(TextureResType::LOCAL),
_progressBarTexType(TextureResType::LOCAL),
_ballNTexType(TextureResType::LOCAL),
_ballPTexType(TextureResType::LOCAL),
_ballDTexType(TextureResType::LOCAL),
_barRendererAdaptDirty(true),
-_progressBarRendererDirty(true),
-_eventCallback(nullptr)
+_progressBarRendererDirty(true)
{
setTouchEnabled(true);
}
diff --git a/cocos/ui/UIVideoPlayer.h b/cocos/ui/UIVideoPlayer.h
index 87dc5d0022..a1ca1392ee 100644
--- a/cocos/ui/UIVideoPlayer.h
+++ b/cocos/ui/UIVideoPlayer.h
@@ -80,9 +80,11 @@ namespace experimental{
virtual cocos2d::ui::Widget* createCloneInstance() override;
virtual void copySpecialProperties(Widget* model) override;
+ CC_CONSTRUCTOR_ACCESS:
VideoPlayer();
virtual ~VideoPlayer();
+ protected:
#if CC_VIDEOPLAYER_DEBUG_DRAW
DrawNode *_debugDrawNode;
#endif
diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp
index 024e9b53a8..1ef01292f9 100644
--- a/cocos/ui/UIWidget.cpp
+++ b/cocos/ui/UIWidget.cpp
@@ -141,28 +141,28 @@ _enabled(true),
_bright(true),
_touchEnabled(false),
_highlight(false),
+_affectByClipping(false),
+_ignoreSize(false),
+_propagateTouchEvents(true),
_brightStyle(BrightStyle::NONE),
-_touchBeganPosition(Vec2::ZERO),
-_touchMovePosition(Vec2::ZERO),
-_touchEndPosition(Vec2::ZERO),
-_touchEventListener(nullptr),
-_touchEventSelector(nullptr),
+_sizeType(SizeType::ABSOLUTE),
+_positionType(PositionType::ABSOLUTE),
_actionTag(0),
_customSize(Size::ZERO),
-_ignoreSize(false),
-_affectByClipping(false),
-_sizeType(SizeType::ABSOLUTE),
_sizePercent(Vec2::ZERO),
-_positionType(PositionType::ABSOLUTE),
_positionPercent(Vec2::ZERO),
_hitted(false),
_touchListener(nullptr),
+_touchBeganPosition(Vec2::ZERO),
+_touchMovePosition(Vec2::ZERO),
+_touchEndPosition(Vec2::ZERO),
_flippedX(false),
_flippedY(false),
+_layoutParameterType(LayoutParameter::Type::NONE),
_focused(false),
_focusEnabled(true),
-_layoutParameterType(LayoutParameter::Type::NONE),
-_propagateTouchEvents(true)
+_touchEventListener(nullptr),
+_touchEventSelector(nullptr)
{
}
diff --git a/docs/CONTRIBUTE.md b/docs/CONTRIBUTE.md
new file mode 100644
index 0000000000..6df16d45fa
--- /dev/null
+++ b/docs/CONTRIBUTE.md
@@ -0,0 +1,79 @@
+# Contributing to cocos2d-x
+
+
+## For general questions
+
+
+You can ask general questions by using:
+
+- Forum (preferred way): http://discuss.cocos2d-x.org/
+- IRC: https://webchat.freenode.net/ (Use the *cocos2d* or *cocos2d-x* channels)
+- Weibo: http://t.sina.com.cn/cocos2dx
+- Twitter: http://www.twitter.com/cocos2dx
+
+## Reporting bugs
+
+To report bugs, please use the [Issue Tracker](https://github.com/cocos2d/cocos2d-x/issues)
+
+Steps to report a bug:
+* Open the [url](https://github.com/cocos2d/cocos2d-x/issues/new)
+* Add all the needed information to reproduce the bug
+
+
+## Submitting patches
+
+If you want to contribute code, please follow these steps:
+
+(If you are new to git and/or GitHub, you should read [Pro Git](http://progit.org/book/) , especially the section on [Contributing to a project:Small/Large Public Project](http://progit.org/book/ch5-2.html#public_small_project) )
+
+- Download the latest cocos2d-x develop branch from github:
+
+```
+$ git clone git://github.com/cocos2d/cocos2d-x.git
+$ cd cocos2d-x
+$ git checkout v3
+$ ./download-deps.py
+$ git submodule update --init
+```
+
+- Apply your changes in the recently downloaded repository
+- Commit your changes in your own repository
+- Create a new branch with your patch: `$ git checkout -b my_fix_branch`
+- Push your new branch to your public repository
+- Send a “pull request” to user “cocos2d”
+- It must be _complete_. See the definition below
+- It must follow the _Releases_ rules. See the definition below
+
+## Only _complete_ patches will be merged
+
+The patch must be _complete_. And by that, we mean:
+
+- Follow the [Cocos2d C++ Coding Style][1]
+- Describe what the patch does
+- Include test cases
+- Include unit tests if applicable
+- Must be tested in all supported platforms [*]
+- Must NOT degrade the performance
+- Must NOT break existing tests cases
+- Must NOT break the Continuous Integration build
+- Must NOT break backward compatibility
+- Must compile WITHOUT warnings
+- New APIs MUST be **easy to use**, **familiar** to cocos2d-x users
+- New APIs MUST be documented using Doxgen strings
+- Code MUST be **easy to extend**
+- Must be efficient (fast / low memory needs)
+- It must not duplicate existing code, unless the new code deprecates the old one
+- Patches that refactor key components will only be merged in the next major versions.
+
+[*]: If you don't have access to test your code in all the supported platforms, let us know.
+
+
+# Promoting cocos2d
+
+Help us promote cocos2d-x by using the cocos2d logo in your game, or by mentioning cocos2d in the credits.
+
+[Logo Resources of Cocos2d-x][2]
+
+
+[1]: https://github.com/cocos2d/cocos2d-x/blob/v3/docs/CODING_STYLE.md
+[2]: http://www.cocos2d-x.org/wiki/Logo_Resources_of_Cocos2d-x
diff --git a/docs/RELEASE_ENGINEERING.md b/docs/RELEASE_ENGINEERING.md
new file mode 100644
index 0000000000..2fba92ad35
--- /dev/null
+++ b/docs/RELEASE_ENGINEERING.md
@@ -0,0 +1,171 @@
+# Cocos2d-x Release Engineering
+
+
+## Tagging
+
+New releases must be tagged in github. The tag name must follow these rules:
+
+ cocos2d-x-Major.Minor[.Status]
+
+or
+
+ cocos2d-x-Major.Minor.Revision[.Status]
+
+Example of valid names:
+
+* cocos2d-x-3.0rc0
+* cocos2d-x-3.0
+* cocos2d-x-2.1.1
+* cocos2d-x-2.1.1rc0
+
+See "Naming Conventions" below
+
+## Branching
+
+Each Major version will have 2 branches, `master` and `develop`.
+For cocos2d-x v3, the branches names will be `v3-master` and `v3-develop`, for v4 the branches names will be `v4-master` and `v4-develop`, and so on.
+
+* `master` is the stable branch.
+* `develop` is the unstable branch. All new features, bug fixes, etc, are applied first to `develop`.
+
+Once a new version is released (either Major, Minor or Revision), then `develop` branch must be merged into `master` branch. To be more specific, `master` only contains _stable_ releases. _Alpha_, _Beta_, and _RC_ versions MUST NOT be merged into `master`.
+
+
+## Announcing
+
+Only stable releases must be announced on:
+
+* [Blog](http://www.cocos2d-x.org/news)
+
+All kind of releases (alpha,beta,rc, final) must be announced on:
+* [Twitter](https://twitter.com/cocos2dx)
+* [Forum](http://discuss.cocos2d-x.org/)
+
+
+## Download package
+
+A download package must be available for each released version.
+The package shall include the source code of cocos2d-x, and the needed scripts to download and install the 3rd party binaries.
+
+
+## Release Notes and Changelog
+
+**BEFORE** releasing a new version (either stable or unstable), the following documents must be updated:
+
+* [CHANGELOG](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)
+* [Release Notes](https://github.com/cocos2d/cocos2d-x/blob/v3/docs/RELEASE_NOTES.md)
+
+## Documentation
+
+**BEFORE** releasing a new Minor or Major stable release, the following tasks MUST be done:
+
+- All documentation MUST be updated to the new version. This includes:
+ - API Reference
+ - Programmers Guide
+
+## Backward compatibility
+
+- Minor versions MUST be backward compatible with previous minor versions. eg: v3.2 must be backward compatible with v3.1 and v3.0.
+- Major versions SHOULD be backward compatible with previous major versions. Breaking backward compatibility in Major versions is acceptable only if it is extremely well justified
+
+## Deprecated APIs
+
+- Only Major versions (eg: 4.0, 5.0) can introduce deprecated APIs. Deprecated APIs cannot be introduced in Point releases (eg: 3.5, 4.2).
+- Only Major versions can remove deprecated APIs. They cannot be removed in Point versions.
+- A deprecated API must live at least for the whole cycle of a Major version. Eg: if an API was deprecated in 4.0, it can be removed in 5.0, but not before. It can be removed in 6.0 or future Major releases, but it cannot be removed in Point releases, like 5.1.
+
+
+## Performance tests
+
+- Performance tests MUST be run before releasing a Release Candidate
+- If performance is worse than previous stable version, then the Release Candidate MUST NOT be released (See Naming Conventions below)
+- Results of the performance tests must be documented in this [spreadsheet](https://docs.google.com/spreadsheet/ccc?key=0AvvkdgVbWvpZdHFudzdDT3NuYTRNTHlZZzRGZWYzMmc#gid=8)
+
+
+## Samples and tests
+
+**BEFORE** releasing a new Minor or Major stable release, the following tasks MUST be done:
+
+- All the samples and tests must be updated to use the new version. This includes:
+ - The samples in [cocos2d-x-samples](https://github.com/cocos2d/cocos2d-x-samples) repository
+ - The demo games [EarthWarrior3D](https://github.com/chukong/EarthWarrior3D) and [FantasyWarrior3D](https://github.com/chukong/FantasyWarrior3D)
+ - All the tests bundled in cocos2d-x
+ - All the templates bundled in cocos2d-x
+
+## Naming conventions
+
+### Alpha
+
+The product is unstable. It could have memory leaks, or crashes, or the API is unstable. The product contains little QA.
+Although the product is not ready for production, the product should be testable.
+Alpha versions might have Core functionality that has just been refactored, meaning that Core functionality might be unstable, but should work Ok.
+
+As an example, for cocos2d-x, an _Alpha_ version means:
+
+* Basic functionality works Ok (not great, but OK), like Sprites, Scenes, actions, etc.
+_* But it might have memory leaks, or crashes, or the recently added features might be unfinished. The documentation might not be updated.
+* As an example, the Renderer refactoring must be done in "alpha" versions (but not Beta versions).
+
+Alpha versions are NOT feature freeze. New features might be added in future alpha and beta versions.
+
+### Beta
+
+The product is more stable than _Alpha_. The product might crash, but not frequently. No major changes were made in core components.
+Smaller features could be refactored in _Beta_ versions, but the core functionality is stable.
+The product has more QA.
+The only difference between _Alpha_ and _Beta_, is that _Beta_ is more stable than _Alpha_. And that in _Beta_ versions no new major features will be added.
+
+As an example, for cocos2d-x it means:
+
+* All the Core features (Sprites, Menu, Labels, Director, Transitions) are stable. Bug fixes could have been added into the Core functionality, but no major refactoring were done in the Core.
+* But perhaps new features like the new Particle Engine could be unfinished, or the Cocos Studio reader might crash.
+* Some cocos2d-x users might want to use a beta version for real games.
+
+Beta versions are NOT feature freeze. __Small__ new features might be added in future _Beta_ versions. New __BIG__ features that might affect the Core functionality must only be added in _Alpha_ versions, and not in _Beta_ versions.
+
+
+### Release Candidate
+Release candidate means that, unless major bugs are found, the product is ready for release.
+The difference between _Release Candidate__ and _Final_ is that RC has less testing than the final version.
+
+Many cocos2d-x users might want to try and use the RC releases for production.
+
+RC versions ARE feature freeze. No new features, no matter how small they are, MUST be added in RC versions, because as the name implies, it is a _Release Candiate_.
+
+
+### Final
+
+It is the new stable version.
+
+## Number conventions
+
+major.minor [revision | status]
+
+### Major
+The major number is increased when there are significant jumps in functionality such as changing the framework which could cause incompatibility with interfacing systems
+
+### Minor
+The minor number is incremented when only minor features or significant fixes have been added.
+
+### Revision
+The revision number is incremented when minor bugs are fixed.
+
+### Status
+The status could be: alphaN, betaN or rcN.
+
+'N' is a number, and the first MUST always be 0.
+
+### Examples
+
+v2.0-alpha0:
+ - New major version of cocos2d-x.
+ - Unstable
+
+v2.1.3:
+ - Stable version of cocos2d-x. It is the same as v2.1 plus some bug fixes.
+
+v2.2-beta0:
+ - Similar to v2.1.3, but some new features were added, but are not stable yet.
+
+v2.2:
+ - Similar to v2.1.3, but some small features were added. The new features are stable.
diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md
index 25da53050e..b42524d574 100644
--- a/docs/RELEASE_NOTES.md
+++ b/docs/RELEASE_NOTES.md
@@ -174,6 +174,16 @@ require "cocos.init"
```
+`cc.EditBox` and `cc.Scale9Sprite` were deprecated, you should use `ccui.EditBox` and `ccui.Scale9Sprite` instead.
+
+`ccs.NodeReader` was removed because native class `cocostudio::timeline::NodeReader` was removed.In the v3.3rc0,you could use `cc.CSLoader` instead.
+
+`sp.Skeleton` was removed because native class `spine::Skeleton` was removed after updating spine runtime.
+
+`registerSpineEventHandler` of `sp.SkeletonAnimation` has changed:
+
+* registerSpineEventHandler(fucntion) -> registerSpineEventHandler(funtion, eventType)
+
# Highlights of v3.3rc0
diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp
index c9d2f19669..da76d278b4 100644
--- a/extensions/GUI/CCScrollView/CCScrollView.cpp
+++ b/extensions/GUI/CCScrollView/CCScrollView.cpp
@@ -62,8 +62,8 @@ ScrollView::ScrollView()
, _touchLength(0.0f)
, _minScale(0.0f)
, _maxScale(0.0f)
-, _touchListener(nullptr)
, _scissorRestored(false)
+, _touchListener(nullptr)
{
}
diff --git a/extensions/assets-manager/AssetsManagerEx.cpp b/extensions/assets-manager/AssetsManagerEx.cpp
index 3011e81bda..c772f9eb14 100644
--- a/extensions/assets-manager/AssetsManagerEx.cpp
+++ b/extensions/assets-manager/AssetsManagerEx.cpp
@@ -23,7 +23,8 @@
****************************************************************************/
#include "AssetsManagerEx.h"
#include "CCEventListenerAssetsManagerEx.h"
-#include "cocos2d.h"
+#include "deprecated/CCString.h"
+#include "base/CCDirector.h"
#include
#include
@@ -31,6 +32,9 @@
#include "unzip.h"
+using namespace cocos2d;
+using namespace std;
+
NS_CC_EXT_BEGIN
#define VERSION_FILENAME "version.manifest"
@@ -50,20 +54,20 @@ const std::string AssetsManagerEx::BATCH_UPDATE_ID = "@batch_update";
AssetsManagerEx::AssetsManagerEx(const std::string& manifestUrl, const std::string& storagePath)
: _updateState(State::UNCHECKED)
-, _waitToUpdate(false)
-, _totalToDownload(0)
-, _totalWaitToDownload(0)
-, _percent(0)
-, _percentByFile(0)
-, _manifestUrl(manifestUrl)
+, _assets(nullptr)
, _storagePath("")
, _cacheVersionPath("")
, _cacheManifestPath("")
, _tempManifestPath("")
-, _assets(nullptr)
+, _manifestUrl(manifestUrl)
, _localManifest(nullptr)
, _tempManifest(nullptr)
, _remoteManifest(nullptr)
+, _waitToUpdate(false)
+, _percent(0)
+, _percentByFile(0)
+, _totalToDownload(0)
+, _totalWaitToDownload(0)
{
// Init variables
_eventDispatcher = Director::getInstance()->getEventDispatcher();
diff --git a/extensions/assets-manager/CCEventAssetsManagerEx.cpp b/extensions/assets-manager/CCEventAssetsManagerEx.cpp
index ba2c0f8d2f..7eea7d1300 100644
--- a/extensions/assets-manager/CCEventAssetsManagerEx.cpp
+++ b/extensions/assets-manager/CCEventAssetsManagerEx.cpp
@@ -31,14 +31,14 @@ NS_CC_EXT_BEGIN
EventAssetsManagerEx::EventAssetsManagerEx(const std::string& eventName, cocos2d::extension::AssetsManagerEx *manager, const EventCode &code, float percent/* = 0 */, float percentByFile/* = 0*/, const std::string& assetId/* = "" */, const std::string& message/* = "" */, int curle_code/* = CURLE_OK*/, int curlm_code/* = CURLM_OK*/)
: EventCustom(eventName)
-, _manager(manager)
, _code(code)
+, _manager(manager)
+, _message(message)
+, _assetId(assetId)
, _curle_code(curle_code)
, _curlm_code(curlm_code)
, _percent(percent)
, _percentByFile(percentByFile)
-, _assetId(assetId)
-, _message(message)
{
}
diff --git a/extensions/assets-manager/Downloader.cpp b/extensions/assets-manager/Downloader.cpp
index 7e8ef08c4a..21a7eb463b 100644
--- a/extensions/assets-manager/Downloader.cpp
+++ b/extensions/assets-manager/Downloader.cpp
@@ -145,10 +145,10 @@ int downloadProgressFunc(Downloader::ProgressData *ptr, double totalToDownload,
}
Downloader::Downloader()
-: _onError(nullptr)
+: _connectionTimeout(DEFAULT_TIMEOUT)
+, _onError(nullptr)
, _onProgress(nullptr)
, _onSuccess(nullptr)
-, _connectionTimeout(DEFAULT_TIMEOUT)
, _supportResuming(false)
{
_fileUtils = FileUtils::getInstance();
diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json
index 93c78241af..4d4e89ab73 100644
--- a/templates/cocos2dx_files.json
+++ b/templates/cocos2dx_files.json
@@ -51,6 +51,7 @@
"build/wp8/wp8_precompiled_shaders.txt",
"cmake/BuildHelpers.CMakeLists.txt",
"cmake/Modules/CMakeParseArguments.cmake",
+ "cmake/Modules/CocosBuildHelpers.cmake",
"cmake/Modules/FindChipmunk.cmake",
"cmake/Modules/FindGLFW3.cmake",
"cmake/Modules/FindPackageHandleStandardArgs.cmake",
@@ -1154,8 +1155,10 @@
"cocos/ui/proj.win32/libui.vcxproj",
"cocos/ui/proj.win32/libui.vcxproj.filters",
"docs/CODING_STYLE.md",
+ "docs/CONTRIBUTE.md",
"docs/Groups.h",
"docs/MainPage.h",
+ "docs/RELEASE_ENGINEERING.md",
"docs/RELEASE_NOTES.md",
"docs/cocos2dx_portrait.png",
"docs/doxygen.config",
@@ -5554,4 +5557,4 @@
"tools/tolua/cocos2dx_ui.ini",
"tools/tolua/genbindings.py"
]
-}
\ No newline at end of file
+}
diff --git a/templates/cpp-template-default/CMakeLists.txt b/templates/cpp-template-default/CMakeLists.txt
index 2b810ea4ec..649a4b05fb 100644
--- a/templates/cpp-template-default/CMakeLists.txt
+++ b/templates/cpp-template-default/CMakeLists.txt
@@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 2.8)
set(APP_NAME MyGame)
project (${APP_NAME})
-include(cocos2d/cmake/BuildHelpers.CMakeLists.txt)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cocos2d/cmake/Modules/")
+include(CocosBuildHelpers)
option(DEBUG_MODE "Debug or release?" ON)
diff --git a/templates/cpp-template-default/proj.android/build_native.py b/templates/cpp-template-default/proj.android/build_native.py
index 97c9f89991..9a8d26ab1b 100755
--- a/templates/cpp-template-default/proj.android/build_native.py
+++ b/templates/cpp-template-default/proj.android/build_native.py
@@ -73,7 +73,8 @@ def do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,and
ndk_path = os.path.join(ndk_root, "ndk-build")
num_of_cpu = get_num_of_cpu()
-
+
+ app_android_root = app_android_root.replace(' ', '\\ ')
if ndk_build_param == None:
command = '%s -j%d -C %s NDK_DEBUG=%d' % (ndk_path, num_of_cpu, app_android_root, build_mode=='debug')
else:
diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.cpp b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.cpp
index e0c02e3ee8..e25f12576e 100644
--- a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.cpp
+++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.cpp
@@ -35,39 +35,46 @@ using namespace Windows::Graphics::Display;
USING_NS_CC;
-Cocos2dRenderer::Cocos2dRenderer(const int width, const int height, CoreDispatcher^ dispatcher, Panel^ panel)
- : mApp(nullptr)
- , mWidth(width)
- , mHeight(height)
+Cocos2dRenderer::Cocos2dRenderer(int width, int height, float dpi, CoreDispatcher^ dispatcher, Panel^ panel)
+ : m_app(nullptr)
+ , m_width(width)
+ , m_height(height)
+ , m_dpi(dpi)
, m_dispatcher(dispatcher)
, m_panel(panel)
{
- mApp = new AppDelegate();
+ m_app = new AppDelegate();
auto director = cocos2d::Director::getInstance();
GLViewImpl* glview = GLViewImpl::create("Test Cpp");
glview->setDispatcher(dispatcher);
glview->setPanel(panel);
- glview->Create(static_cast(width), static_cast(height), DisplayOrientations::Landscape);
+ glview->Create(static_cast(width), static_cast(height), dpi, DisplayOrientations::Landscape);
director->setOpenGLView(glview);
CCApplication::getInstance()->run();
}
Cocos2dRenderer::~Cocos2dRenderer()
{
- delete mApp;
+ delete m_app;
}
// Draws a basic triangle
-void Cocos2dRenderer::Draw(GLsizei width, GLsizei height)
+void Cocos2dRenderer::Draw(GLsizei width, GLsizei height, float dpi)
{
- if (width != mWidth || height != mHeight)
+ if (width != m_width || height != m_height)
{
- mWidth = width;
- mHeight = height;
+ m_width = width;
+ m_height = height;
GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(static_cast(width), static_cast(height));
}
+ if (dpi != m_dpi)
+ {
+ m_dpi = dpi;
+ GLViewImpl::sharedOpenGLView()->SetDPI(m_dpi);
+ }
+
GLViewImpl::sharedOpenGLView()->ProcessEvents();
GLViewImpl::sharedOpenGLView()->Render();
}
diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.h b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.h
index 387445f6d5..b8d63d60b1 100644
--- a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.h
+++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.h
@@ -29,18 +29,20 @@ namespace cocos2d
class Cocos2dRenderer
{
public:
- Cocos2dRenderer(const int width, const int height, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel);
+ Cocos2dRenderer( int width, int height, float dpi, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel);
~Cocos2dRenderer();
- void Draw(GLsizei width, GLsizei height);
+ void Draw(GLsizei width, GLsizei height, float dpi);
void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
void QueueKeyBoardEvent(Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e);
private:
- int mWidth;
- int mHeight;
+ int m_width;
+ int m_height;
+ float m_dpi;
+
// The AppDelegate for the Cocos2D app
- AppDelegate* mApp;
+ AppDelegate* m_app;
Platform::Agile m_dispatcher;
Platform::Agile m_panel;
};
diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp
index c8ee9afb42..71f3c692e9 100644
--- a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp
+++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp
@@ -47,7 +47,8 @@ OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) :
mRenderSurface(EGL_NO_SURFACE),
mCustomRenderSurfaceSize(0,0),
mUseCustomRenderSurfaceSize(false),
- m_coreInput(nullptr)
+ m_coreInput(nullptr),
+ m_dpi(0.0f)
{
InitializeComponent();
@@ -225,6 +226,9 @@ void OpenGLESPage::StartRenderLoop()
return;
}
+ DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView();
+ m_dpi = currentDisplayInformation->LogicalDpi;
+
auto dispatcher = Windows::UI::Xaml::Window::Current->CoreWindow->Dispatcher;
// Create a task for rendering that will be run on a background thread.
@@ -238,16 +242,18 @@ void OpenGLESPage::StartRenderLoop()
GLsizei panelHeight = 0;
GetSwapChainPanelSize(&panelWidth, &panelHeight);
+
+
if (m_renderer.get() == nullptr)
{
- m_renderer = std::make_shared(panelWidth, panelHeight, dispatcher, swapChainPanel);
+ m_renderer = std::make_shared(panelWidth, panelHeight, m_dpi, dispatcher, swapChainPanel);
}
while (action->Status == Windows::Foundation::AsyncStatus::Started)
{
GetSwapChainPanelSize(&panelWidth, &panelHeight);
- m_renderer.get()->Draw(panelWidth, panelHeight);
+ m_renderer.get()->Draw(panelWidth, panelHeight, m_dpi);
// The call to eglSwapBuffers might not be successful (i.e. due to Device Lost)
// If the call fails, then we must reinitialize EGL and the GL resources.
diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.h b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.h
index d8ddccc63e..9b65e475b3 100644
--- a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.h
+++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.h
@@ -67,5 +67,7 @@ namespace cocos2d
void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e);
void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e);
void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e);
+
+ float m_dpi;
};
}
diff --git a/templates/lua-template-default/frameworks/CMakeLists.txt b/templates/lua-template-default/frameworks/CMakeLists.txt
index f15068fef4..3b0871ecbf 100644
--- a/templates/lua-template-default/frameworks/CMakeLists.txt
+++ b/templates/lua-template-default/frameworks/CMakeLists.txt
@@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 2.8)
set(APP_NAME HelloLua)
project (${APP_NAME})
-include(cocos2d-x/cmake/BuildHelpers.CMakeLists.txt)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cocos2d/cmake/Modules/")
+include(CocosBuildHelpers)
option(DEBUG_MODE "Debug or release?" ON)
diff --git a/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp b/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp
index 8fc0205fb2..856dbec457 100644
--- a/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp
+++ b/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp
@@ -1071,24 +1071,30 @@ int lua_cocos2dx_runtime_addSearchPath(lua_State* tolua_S)
#endif
argc = lua_gettop(tolua_S)-1;
- if (argc == 1)
+ if (argc == 1 || argc == 2)
{
std::string arg0;
+ bool arg1 = false;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
+
+ if (argc == 2) {
+ ok &= luaval_to_boolean(tolua_S, 3, &arg1);
+ }
+
if(!ok)
return 0;
std::string originPath = arg0;
if (!FileUtils::getInstance()->isAbsolutePath(originPath))
arg0 = g_resourcePath + originPath;
- cobj->addSearchPath(arg0);
+ cobj->addSearchPath(arg0, arg1);
if (!FileUtils::getInstance()->isAbsolutePath(originPath))
#if(CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
- cobj->addSearchPath(g_projectPath + originPath);
+ cobj->addSearchPath(g_projectPath + originPath, arg1);
#endif
#if(CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
- cobj->addSearchPath(originPath);
+ cobj->addSearchPath(originPath, arg1);
#endif
return 0;
}
diff --git a/templates/lua-template-runtime/src/main.lua b/templates/lua-template-runtime/src/main.lua
index e814028a2d..8b980f63b5 100644
--- a/templates/lua-template-runtime/src/main.lua
+++ b/templates/lua-template-runtime/src/main.lua
@@ -34,7 +34,7 @@ local function main()
--set FPS. the default value is 1.0/60 if you don't call this
director:setAnimationInterval(1.0 / 60)
- cc.Director:getInstance():getOpenGLView():setDesignResolutionSize(480, 320, 0)
+ cc.Director:getInstance():getOpenGLView():setDesignResolutionSize(480, 320, 1)
--create scene
local scene = require("GameScene")
diff --git a/tests/cpp-empty-test/CMakeLists.txt b/tests/cpp-empty-test/CMakeLists.txt
index b1199a8070..0fde5bb6bd 100644
--- a/tests/cpp-empty-test/CMakeLists.txt
+++ b/tests/cpp-empty-test/CMakeLists.txt
@@ -22,6 +22,10 @@ elseif(MACOSX OR APPLE)
proj.mac/main.cpp
)
+ file(GLOB_RECURSE RES_FILES Resources/*)
+ cocos_mark_resources(FILES ${RES_FILES} BASEDIR Resources)
+ list(APPEND PLATFORM_SRC ${RES_FILES})
+
elseif(LINUX)
set(PLATFORM_SRC
proj.linux/main.cpp
@@ -43,6 +47,8 @@ add_executable(${APP_NAME}
${SAMPLE_SRC}
)
+target_link_libraries(${APP_NAME} cocos2d)
+
if(MSVC)
#get our resources
@@ -64,17 +70,22 @@ if(MSVC)
set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
+elseif(MACOSX OR APPLE)
+ set_target_properties(${APP_NAME} PROPERTIES
+ MACOSX_BUNDLE 1
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
+ )
+
else()
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
set_target_properties(${APP_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
- pre_build(${APP_NAME}
- COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources
+ add_custom_command(TARGET ${APP_NAME} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E remove_directory $/Resources
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources $/Resources
)
endif()
-target_link_libraries(${APP_NAME} cocos2d)
diff --git a/tests/cpp-tests/CMakeLists.txt b/tests/cpp-tests/CMakeLists.txt
index f8a92032d0..dac761970a 100644
--- a/tests/cpp-tests/CMakeLists.txt
+++ b/tests/cpp-tests/CMakeLists.txt
@@ -8,6 +8,11 @@ elseif(MACOSX)
set(PLATFORM_SRC
proj.mac/main.cpp
)
+
+ file(GLOB_RECURSE RES_FILES Resources/*)
+ cocos_mark_resources(FILES ${RES_FILES} BASEDIR Resources)
+ list(APPEND PLATFORM_SRC ${RES_FILES})
+
elseif(LINUX)
set(PLATFORM_SRC
proj.linux/main.cpp
@@ -238,12 +243,20 @@ target_link_libraries(${APP_NAME}
cocos2d
)
-set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
+if(MACOSX OR APPLE)
+ set_target_properties(${APP_NAME} PROPERTIES
+ MACOSX_BUNDLE 1
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
+ )
-set_target_properties(${APP_NAME} PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
+else()
+ set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
+
+ set_target_properties(${APP_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
+
+ pre_build(${APP_NAME}
+ COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources
+ )
+endif()
-pre_build(${APP_NAME}
- COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources
- )
diff --git a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp
index 6e7bedf0a9..ad5c79d204 100644
--- a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp
+++ b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp
@@ -167,9 +167,8 @@ void Box2DTestLayer::onDraw()
{
Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
-
- Mat4 oldMV;
- oldMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
+
+ auto oldMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV);
world->DrawDebugData();
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, oldMV);
diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp
index a537f53642..e998a0e6ec 100644
--- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp
+++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp
@@ -81,7 +81,8 @@ static std::function createFunctions[] =
CL(LabelIssue4999Test),
CL(LabelLineHeightTest),
CL(LabelAdditionalKerningTest),
- CL(LabelIssue8492Test)
+ CL(LabelIssue8492Test),
+ CL(LabelMultilineWithOutline)
};
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
@@ -1833,3 +1834,21 @@ std::string LabelIssue8492Test::subtitle() const
{
return "Work fine when dimensions are not enough to fit one character";
}
+
+LabelMultilineWithOutline::LabelMultilineWithOutline()
+{
+ auto label = Label::createWithTTF("Multiline txet\nwith\noutline feature", "fonts/arial.ttf", 24);
+ label->enableOutline(Color4B::ORANGE,1);
+ label->setPosition(VisibleRect::center());
+ addChild(label);
+}
+
+std::string LabelMultilineWithOutline::title() const
+{
+ return "Reorder issue #9095";
+}
+
+std::string LabelMultilineWithOutline::subtitle() const
+{
+ return "end in string 'outline feature'";
+}
diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h
index 113539ef4d..90948a20f2 100644
--- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h
+++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h
@@ -520,6 +520,17 @@ public:
virtual std::string subtitle() const override;
};
+class LabelMultilineWithOutline : public AtlasDemoNew
+{
+public:
+ CREATE_FUNC(LabelMultilineWithOutline);
+
+ LabelMultilineWithOutline();
+
+ virtual std::string title() const override;
+ virtual std::string subtitle() const override;
+};
+
// we don't support linebreak mode
#endif
diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp
index 262d97c73b..30c62d2eac 100644
--- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp
+++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp
@@ -470,9 +470,9 @@ bool EffectNormalMapped::init()
_kBump = 2;
return true;
}
-bool EffectNormalMapped::initNormalMap(const std::string&normalMapFileName)
+bool EffectNormalMapped::initNormalMap(const std::string& normalMapFileName)
{
- auto normalMapTextrue = TextureCache::getInstance()->addImage(normalMapFileName.c_str());
+ auto normalMapTextrue = Director::getInstance()->getTextureCache()->addImage(normalMapFileName);
getGLProgramState()->setUniformTexture("u_normalMap", normalMapTextrue);
return true;
}
diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp
index a282f2c15c..71965a0bc3 100644
--- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp
+++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp
@@ -1027,124 +1027,50 @@ Sprite3DReskinTest::Sprite3DReskinTest()
}
void Sprite3DReskinTest::menuCallback_switchHair(Ref* sender)
{
- _useHairId++;
- if(_useHairId > 1 )
- {
- _useHairId = 0;
- }
- if(_useHairId >= 0 && _sprite)
- {
- for(int i = 0; i < 2; i++ )
- {
- auto subMesh = _sprite->getMeshByName(_girlHair[i]);
- if(subMesh)
- {
- if(i == _useHairId )
- {
- subMesh->setVisible(true);
- }
- else
- {
- subMesh->setVisible(false);
- }
- }
- }
- }
+ std::string str = _curSkin[SkinType::HAIR];
+ if (str == "Girl_Hair01")
+ _curSkin[SkinType::HAIR] = "Girl_Hair02";
+ else
+ _curSkin[SkinType::HAIR] = "Girl_Hair01";
+ applyCurSkin();
}
void Sprite3DReskinTest::menuCallback_switchGlasses(Ref* sender)
{
- auto subMesh = _sprite->getMeshByName("Girl_Glasses01");
- if(subMesh)
- {
- if(subMesh->isVisible())
- {
- subMesh->setVisible(false);
- }
- else
- {
- subMesh->setVisible(true);
- }
- }
+ std::string str = _curSkin[SkinType::GLASSES];
+ if (str == "Girl_Glasses01")
+ _curSkin[SkinType::GLASSES] = "";
+ else
+ _curSkin[SkinType::GLASSES] = "Girl_Glasses01";
+ applyCurSkin();
}
void Sprite3DReskinTest::menuCallback_switchCoat(Ref* sender)
{
- _useUpBodyId++;
- if(_useUpBodyId > 1 )
- {
- _useUpBodyId = 0;
- }
- if(_useUpBodyId >= 0 && _sprite)
- {
- for(int i = 0; i < 2; i++ )
- {
- auto subMesh = _sprite->getMeshByName(_girlUpperBody[i]);
- if(subMesh)
- {
- if(i == _useUpBodyId )
- {
- subMesh->setVisible(true);
- }
- else
- {
- subMesh->setVisible(false);
- }
- }
- }
- }
+ std::string str = _curSkin[SkinType::UPPER_BODY];
+ if (str == "Girl_UpperBody01")
+ _curSkin[SkinType::UPPER_BODY] = "Girl_UpperBody02";
+ else
+ _curSkin[SkinType::UPPER_BODY] = "Girl_UpperBody01";
+ applyCurSkin();
}
void Sprite3DReskinTest::menuCallback_switchPants(Ref* sender)
{
- _usePantsId++;
- if(_usePantsId > 1 )
- {
- _usePantsId = 0;
- }
- if(_usePantsId >= 0 && _sprite)
- {
- for(int i = 0; i < 2; i++ )
- {
- auto subMesh = _sprite->getMeshByName(_girlPants[i]);
- if(subMesh)
- {
- if(i == _usePantsId )
- {
- subMesh->setVisible(true);
- }
- else
- {
- subMesh->setVisible(false);
- }
- }
- }
- }
+ std::string str = _curSkin[SkinType::PANTS];
+ if (str == "Girl_LowerBody01")
+ _curSkin[SkinType::PANTS] = "Girl_LowerBody02";
+ else
+ _curSkin[SkinType::PANTS] = "Girl_LowerBody01";
+ applyCurSkin();
}
void Sprite3DReskinTest::menuCallback_switchShoes(Ref* sender)
{
- _useShoesId++;
- if(_useShoesId > 1 )
- {
- _useShoesId = 0;
- }
- if(_useShoesId >= 0 && _sprite)
- {
- for(int i = 0; i < 2; i++ )
- {
- auto subMesh = _sprite->getMeshByName(_girlShoes[i]);
- if(subMesh)
- {
- if(i == _useShoesId )
- {
- subMesh->setVisible(true);
- }
- else
- {
- subMesh->setVisible(false);
- }
- }
- }
- }
-
+ std::string strShoes = _curSkin[SkinType::SHOES];
+ if (strShoes == "Girl_Shoes01")
+ _curSkin[SkinType::SHOES] = "Girl_Shoes02";
+ else
+ _curSkin[SkinType::SHOES] = "Girl_Shoes01";
+ applyCurSkin();
}
+
std::string Sprite3DReskinTest::title() const
{
return "Testing Sprite3D Reskin";
@@ -1156,43 +1082,10 @@ std::string Sprite3DReskinTest::subtitle() const
void Sprite3DReskinTest::addNewSpriteWithCoords(Vec2 p)
{
- _girlPants[0]= "Girl_LowerBody01";
- _girlPants[1]= "Girl_LowerBody02";
- _girlUpperBody[0] = "Girl_UpperBody01";
- _girlUpperBody[1] = "Girl_UpperBody02";
- _girlShoes[0] = "Girl_Shoes01";
- _girlShoes[1] = "Girl_Shoes02";
- _girlHair[0]= "Girl_Hair01";
- _girlHair[1]= "Girl_Hair02";
- _usePantsId = 0;
- _useUpBodyId = 0;
- _useShoesId =0;
- _useHairId = 0;
-
std::string fileName = "Sprite3DTest/ReskinGirl.c3b";
auto sprite = Sprite3D::create(fileName);
sprite->setScale(4);
sprite->setRotation3D(Vec3(0,0,0));
- auto girlPants = sprite->getMeshByName(_girlPants[1]);
- if(girlPants)
- {
- girlPants->setVisible(false);
- }
- auto girlShoes = sprite->getMeshByName(_girlShoes[1]);
- if(girlShoes)
- {
- girlShoes->setVisible(false);
- }
- auto girlHair = sprite->getMeshByName(_girlHair[1]);
- if(girlHair)
- {
- girlHair->setVisible(false);
- }
- auto girlUpBody = sprite->getMeshByName( _girlUpperBody[1]);
- if(girlUpBody)
- {
- girlUpBody->setVisible(false);
- }
addChild(sprite);
sprite->setPosition( Vec2( p.x, p.y-60) );
auto animation = Animation3D::create(fileName);
@@ -1203,11 +1096,37 @@ void Sprite3DReskinTest::addNewSpriteWithCoords(Vec2 p)
sprite->runAction(RepeatForever::create(animate));
}
_sprite = sprite;
+
+ _curSkin[SkinType::UPPER_BODY] = "Girl_UpperBody01";
+ _curSkin[SkinType::PANTS] = "Girl_LowerBody01";
+ _curSkin[SkinType::SHOES] = "Girl_Shoes01";
+ _curSkin[SkinType::HAIR] = "Girl_Hair01";
+ _curSkin[SkinType::FACE] = "Girl_Face01";
+ _curSkin[SkinType::HAND] = "Girl_Hand01";
+ _curSkin[SkinType::GLASSES] = "";
+ applyCurSkin();
}
void Sprite3DReskinTest::onTouchesEnded(const std::vector& touches, Event* event)
{
}
+
+void Sprite3DReskinTest::applyCurSkin()
+{
+ for (ssize_t i = 0; i < _sprite->getMeshCount(); i++) {
+ auto mesh = _sprite->getMeshByIndex(static_cast(i));
+ bool isVisible = false;
+ for (auto& it : _curSkin) {
+ if (mesh->getName() == it.second)
+ {
+ isVisible = true;
+ break;
+ }
+ }
+ _sprite->getMeshByIndex(static_cast(i))->setVisible(isVisible);
+ }
+}
+
Sprite3DWithOBBPerfromanceTest::Sprite3DWithOBBPerfromanceTest()
{
auto listener = EventListenerTouchAllAtOnce::create();
@@ -1447,7 +1366,7 @@ void Sprite3DWithOBBPerfromanceTest::calculateRayByLocationInView(Ray* ray, cons
{
auto dir = Director::getInstance();
auto view = dir->getWinSize();
- Mat4 mat = dir->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
+ auto mat = dir->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
Vec3 src = Vec3(location.x, location.y, -1);
Vec3 nearPoint;
diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h
index 6fdd53c592..721d1ee105 100644
--- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h
+++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h
@@ -261,14 +261,19 @@ public:
void menuCallback_switchPants(Ref* sender);
void menuCallback_switchShoes(Ref* sender);
protected:
- std::string _girlPants[2];
- int _usePantsId;
- std::string _girlUpperBody[2];
- int _useUpBodyId;
- std::string _girlShoes[2];
- int _useShoesId;
- std::string _girlHair[2];
- int _useHairId;
+ void applyCurSkin();
+
+ enum class SkinType
+ {
+ UPPER_BODY = 0,
+ PANTS,
+ SHOES,
+ HAIR,
+ FACE,
+ HAND,
+ GLASSES,
+ };
+ std::map _curSkin;
cocos2d::Sprite3D* _sprite;
};
class Sprite3DWithOBBPerfromanceTest : public Sprite3DTestDemo
diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp
index b23723e311..68530ff885 100644
--- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp
+++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp
@@ -44,13 +44,14 @@ bool UIScale9SpriteTest::init()
auto moveTo = MoveBy::create(1.0, Vec2(30,0));
auto moveBack = moveTo->reverse();
auto rotateBy = RotateBy::create(1.0, 180);
- auto action = Sequence::create(moveTo,moveBack, rotateBy, NULL);
+ auto scaleBy = ScaleTo::create(1.0, -2.0);
+ auto action = Sequence::create(moveTo,moveBack, rotateBy,scaleBy, NULL);
Sprite *normalSprite1 = Sprite::create("cocosui/animationbuttonnormal.png");
normalSprite1->setPosition(100, 270);
-// normalSprite1->setAnchorPoint(Vec2(0.5,0.5));
-// normalSprite1->setContentSize(Size(100,100));
+ normalSprite1->setFlippedY(true);
+
this->addChild(normalSprite1);
normalSprite1->runAction((FiniteTimeAction*)action->clone());
@@ -107,7 +108,8 @@ bool UIScale9SpriteHierarchialTest::init()
auto moveBack = moveTo->reverse();
auto rotateBy = RotateBy::create(1.0f, 180);
auto fadeOut = FadeOut::create(2.0f);
- auto action = Sequence::create(moveTo,moveBack, rotateBy,fadeOut, NULL);
+ auto scaleTo = ScaleTo::create(1.0, 2.0);
+ auto action = Sequence::create(moveTo,moveBack, rotateBy,fadeOut,scaleTo, NULL);
Sprite *normalSprite1 = Sprite::create("cocosui/animationbuttonnormal.png");
normalSprite1->setPosition(100, 270);
@@ -135,6 +137,7 @@ bool UIScale9SpriteHierarchialTest::init()
cocos2d::ui::Scale9Sprite *sp2 = ui::Scale9Sprite::create("cocosui/animationbuttonnormal.png");
sp2->setPreferredSize(sp1->getContentSize() * 1.2f);
sp2->setColor(Color3B::GREEN);
+ sp2->setFlippedX(true);
sp2->setContentSize(Size(100,100));
sp1->addChild(sp2);
@@ -163,15 +166,13 @@ bool UIScale9SpriteTouchTest::init()
auto containerForSprite1 = Node::create();
auto sprite1 = cocos2d::ui::Scale9Sprite::create("Images/CyanSquare.png");
-// sprite1->setScale9Enabled(false);
sprite1->setPosition(origin+Vec2(size.width/2, size.height/2) + Vec2(-80, 80));
containerForSprite1->addChild(sprite1);
addChild(containerForSprite1, 10);
auto sprite2 = ui::Scale9Sprite::create("Images/MagentaSquare.png");
sprite2->setPosition(origin+Vec2(size.width/2, size.height/2));
-// sprite2->setCascadeOpacityEnabled(false);
-// sprite2->setScale9Enabled(false);
+
addChild(sprite2, 20);
@@ -179,7 +180,6 @@ bool UIScale9SpriteTouchTest::init()
sprite3->setPosition(Vec2(0, 0));
sprite3->setCascadeOpacityEnabled(false);
sprite2->addChild(sprite3, 1);
-// sprite3->setScale9Enabled(false);
// Make sprite1 touchable
@@ -647,6 +647,9 @@ bool UIS9Flip::init()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
+ auto statusLabel = Label::createWithSystemFont("Scale9Enabled", "Arial", 10);
+ statusLabel->setPosition(Vec2(x, winSize.height - statusLabel->getContentSize().height - 40));
+ this->addChild(statusLabel);
auto normalSprite = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
@@ -663,11 +666,11 @@ bool UIS9Flip::init()
auto flipXSprite = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
flipXSprite->setPosition(Vec2(x - 120, y ));
+ flipXSprite->setScale(1.2);
this->addChild(flipXSprite);
+ flipXSprite->setFlippedX(false);
- flipXSprite->setFlippedX(true);
-
- auto flipXLabel = Label::createWithSystemFont("Sprite FlipX","Airal",10);
+ auto flipXLabel = Label::createWithSystemFont("sprite is not flipped!","Airal",10);
flipXLabel->setPosition(flipXSprite->getPosition() + Vec2(0, flipXSprite->getContentSize().height/2 + 10));
this->addChild(flipXLabel);
@@ -677,12 +680,80 @@ bool UIS9Flip::init()
flipYSprite->setPosition(Vec2(x + 120, y));
this->addChild(flipYSprite);
+ flipYSprite->setScale(0.8);
flipYSprite->setFlippedY(true);
- auto flipYLabel = Label::createWithSystemFont("Sprite FlipY","Airal",10);
+ auto flipYLabel = Label::createWithSystemFont("sprite is flipped!","Airal",10);
flipYLabel->setPosition(flipYSprite->getPosition() + Vec2(0, flipYSprite->getContentSize().height/2 + 10));
this->addChild(flipYLabel);
+
+ auto toggleFlipXButton = Button::create();
+ toggleFlipXButton->setTitleText("Toggle FlipX");
+ toggleFlipXButton->setPosition(flipXSprite->getPosition() + Vec2(0, - 20 - flipXSprite->getContentSize().height/2));
+ toggleFlipXButton->addClickEventListener([=](Ref*){
+ flipXSprite->setFlippedX(! flipXSprite->isFlippedX());
+ if (flipXSprite->isFlippedX()) {
+ flipXLabel->setString("sprite is flipped!");
+ }
+ else{
+ flipXLabel->setString("sprite is not flipped!");
+ }
+ });
+ this->addChild(toggleFlipXButton);
+
+ auto toggleFlipYButton = Button::create();
+ toggleFlipYButton->setTitleText("Toggle FlipY");
+ toggleFlipYButton->setPosition(flipYSprite->getPosition() + Vec2(0, -20 - flipYSprite->getContentSize().height/2));
+ toggleFlipYButton->addClickEventListener([=](Ref*){
+ flipYSprite->setFlippedY(!flipYSprite->isFlippedY());
+ if (flipYSprite->isFlippedY()) {
+ flipYLabel->setString("sprite is flipped!");
+ }
+ else{
+ flipYLabel->setString("sprpite is not flipped!");
+ }
+ });
+ this->addChild(toggleFlipYButton);
+
+ auto toggleScale9Button = Button::create();
+ toggleScale9Button->setTitleText("Toggle Scale9");
+ toggleScale9Button->setPosition(normalSprite->getPosition() + Vec2(0, -20 - normalSprite->getContentSize().height/2));
+ toggleScale9Button->addClickEventListener([=](Ref*){
+ flipXSprite->setScale9Enabled(!flipXSprite->isScale9Enabled());
+ flipYSprite->setScale9Enabled(!flipYSprite->isScale9Enabled());
+ if (flipXSprite->isScale9Enabled()) {
+ statusLabel->setString("Scale9Enabled");
+ }else{
+ statusLabel->setString("Scale9Disabled");
+ }
+
+ CCLOG("scaleX = %f", flipXSprite->getScaleX());
+ CCLOG("scaleY = %f", flipYSprite->getScale());
+ if (flipXSprite->isFlippedX()) {
+ CCLOG("xxxxxxx");
+ }
+ if (flipYSprite->isFlippedY()) {
+ CCLOG("YYYYYY");
+ }
+
+ if (flipXSprite->isFlippedX()) {
+ flipXLabel->setString("sprite is flipped!");
+ }
+ else{
+ flipXLabel->setString("sprite is not flipped!");
+ }
+
+ if (flipYSprite->isFlippedY()) {
+ flipYLabel->setString("sprite is flipped!");
+ }
+ else{
+ flipYLabel->setString("sprpite is not flipped!");
+ }
+
+ });
+ this->addChild(toggleScale9Button);
+
return true;
}
return false;
diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp
index afe5aa48ee..c6776c7797 100644
--- a/tests/cpp-tests/Classes/controller.cpp
+++ b/tests/cpp-tests/Classes/controller.cpp
@@ -78,9 +78,7 @@ Controller g_aTestNames[] = {
{ "Node: Sprite", [](){return new SpriteTestScene(); } },
{ "Node: Sprite3D", [](){ return new Sprite3DTestScene(); }},
{ "Node: TileMap", [](){return new TileMapTestScene(); } },
-#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
{ "Node: FastTileMap", [](){return new TileMapTestSceneNew(); } },
-#endif
{ "Node: Text Input", [](){return new TextInputTestScene(); } },
{ "Node: UI", [](){ return new UITestScene(); }},
{ "Mouse", []() { return new MouseTestScene(); } },
diff --git a/tests/cpp-tests/Resources/Sprite3DTest/axe.c3b b/tests/cpp-tests/Resources/Sprite3DTest/axe.c3b
old mode 100755
new mode 100644
index 94ec4488f3..9d69b70fc3
Binary files a/tests/cpp-tests/Resources/Sprite3DTest/axe.c3b and b/tests/cpp-tests/Resources/Sprite3DTest/axe.c3b differ
diff --git a/tests/lua-empty-test/project/CMakeLists.txt b/tests/lua-empty-test/project/CMakeLists.txt
index d220056157..362fe2df48 100644
--- a/tests/lua-empty-test/project/CMakeLists.txt
+++ b/tests/lua-empty-test/project/CMakeLists.txt
@@ -9,11 +9,20 @@ if(LINUX)
${SAMPLE_SRC}
proj.linux/main.cpp
)
-elseif(MACOSX)
- set(SAMPLE_SRC
- ${SAMPLE_SRC}
- proj.mac/main.cpp
- )
+elseif(MACOSX OR APPLE)
+ set(SAMPLE_SRC
+ ${SAMPLE_SRC}
+ proj.mac/main.cpp
+ )
+
+ file(GLOB_RECURSE APP_RESOURCES ../res/*)
+ cocos_mark_resources(FILES ${APP_RESOURCES} BASEDIR ../res RESOURCEBASE Resources/res)
+ file(GLOB_RECURSE APP_SCRIPTS ../src/*)
+ cocos_mark_resources(FILES ${APP_SCRIPTS} BASEDIR ../src RESOURCEBASE Resources/src)
+ file(GLOB_RECURSE COCOS_SCRIPTS ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/*)
+ cocos_mark_resources(FILES ${COCOS_SCRIPTS} BASEDIR ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script RESOURCEBASE Resources/src/cocos)
+
+ list(APPEND SAMPLE_SRC ${APP_RESOURCES} ${APP_SCRIPTS} ${COCOS_SCRIPTS})
endif()
include_directories(
@@ -28,14 +37,23 @@ add_executable(${APP_NAME} ${SAMPLE_SRC})
target_link_libraries(${APP_NAME} cocos2d luacocos2d)
-set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
+if(MACOSX OR APPLE)
+ set_target_properties(${APP_NAME} PROPERTIES
+ MACOSX_BUNDLE 1
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
+ )
-set_target_properties(${APP_NAME} PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
+else()
-pre_build(${APP_NAME}
- COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${APP_BIN_DIR}/Resources/res
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../src ${APP_BIN_DIR}/Resources/src
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/ ${APP_BIN_DIR}/Resources/src/cocos
- )
+ set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
+
+ set_target_properties(${APP_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
+
+ pre_build(${APP_NAME}
+ COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${APP_BIN_DIR}/Resources/res
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../src ${APP_BIN_DIR}/Resources/src
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/ ${APP_BIN_DIR}/Resources/src/cocos
+ )
+
+endif()
diff --git a/tests/lua-tests/project/CMakeLists.txt b/tests/lua-tests/project/CMakeLists.txt
index 481472bae4..96fb6b6b87 100644
--- a/tests/lua-tests/project/CMakeLists.txt
+++ b/tests/lua-tests/project/CMakeLists.txt
@@ -12,10 +12,21 @@ if(LINUX)
proj.linux/main.cpp
)
elseif(MACOSX)
- set(SAMPLE_SRC
- ${SAMPLE_SRC}
- proj.ios_mac/mac/main.cpp
- )
+ set(SAMPLE_SRC
+ ${SAMPLE_SRC}
+ proj.ios_mac/mac/main.cpp
+ )
+
+ file(GLOB_RECURSE APP_RESOURCES ../res/*)
+ cocos_mark_resources(FILES ${APP_RESOURCES} BASEDIR ../res RESOURCEBASE Resources/res)
+ file(GLOB_RECURSE APP_SCRIPTS ../src/*)
+ cocos_mark_resources(FILES ${APP_SCRIPTS} BASEDIR ../src RESOURCEBASE Resources/src)
+ file(GLOB_RECURSE COCOS_SCRIPTS ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/*)
+ cocos_mark_resources(FILES ${COCOS_SCRIPTS} BASEDIR ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script RESOURCEBASE Resources/src/cocos)
+ file(GLOB_RECURSE TEST_RESOURCES ${CMAKE_SOURCE_DIR}/tests/cpp-tests/Resources/*)
+ cocos_mark_resources(FILES ${TEST_RESOURCES} BASEDIR ${CMAKE_SOURCE_DIR}/tests/cpp-tests/Resources RESOURCEBASE Resources/res)
+
+ list(APPEND SAMPLE_SRC ${APP_RESOURCES} ${APP_SCRIPTS} ${COCOS_SCRIPTS} ${TEST_RESOURCES})
endif()
include_directories(
@@ -27,25 +38,29 @@ include_directories(
)
# add the executable
-add_executable(${APP_NAME}
- ${SAMPLE_SRC}
-)
+add_executable(${APP_NAME} ${SAMPLE_SRC})
-target_link_libraries(${APP_NAME}
- luacocos2d
- cocos2d
-)
+target_link_libraries(${APP_NAME} luacocos2d cocos2d)
-set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
+if(MACOSX OR APPLE)
+ set_target_properties(${APP_NAME} PROPERTIES
+ MACOSX_BUNDLE 1
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
+ )
-set_target_properties(${APP_NAME} PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
+else()
-pre_build(${APP_NAME}
- COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${APP_BIN_DIR}/Resources/res
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../src ${APP_BIN_DIR}/Resources/src
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/ ${APP_BIN_DIR}/Resources/src/cocos
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/tests/cpp-tests/Resources ${APP_BIN_DIR}/Resources/res
- )
+ set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
+
+ set_target_properties(${APP_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
+
+ pre_build(${APP_NAME}
+ COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${APP_BIN_DIR}/Resources/res
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../src ${APP_BIN_DIR}/Resources/src
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/ ${APP_BIN_DIR}/Resources/src/cocos
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/tests/cpp-tests/Resources ${APP_BIN_DIR}/Resources/res
+ )
+
+endif()
diff --git a/tests/lua-tests/project/Classes/lua_test_bindings.cpp b/tests/lua-tests/project/Classes/lua_test_bindings.cpp
index 723af93e4d..5ac8be6c76 100644
--- a/tests/lua-tests/project/Classes/lua_test_bindings.cpp
+++ b/tests/lua-tests/project/Classes/lua_test_bindings.cpp
@@ -288,6 +288,49 @@ void DrawNode3D::setBlendFunc(const BlendFunc &blendFunc)
{
_blendFunc = blendFunc;
}
+
+/**
+ @since v3.3rc1
+ This class is used to check if the the value type judgement in table is correct or not.
+ eg:
+ If call `create` by passing {index1 = 111, index2 = 112, index3 = 113} from lua,
+ the type 111,112,113 would be judged as string type before 3.3rc1
+ **/
+class ValueTypeJudgeInTable:public Node
+{
+public:
+ static ValueTypeJudgeInTable* create(ValueMap valueMap);
+};
+
+ValueTypeJudgeInTable* ValueTypeJudgeInTable::create(ValueMap valueMap)
+{
+ ValueTypeJudgeInTable* ret = new (std::nothrow) ValueTypeJudgeInTable();
+ if (ret)
+ {
+ ret->autorelease();
+ }
+ else
+ {
+ CC_SAFE_DELETE(ret);
+ }
+
+ int index = 0;
+ for (auto iter : valueMap)
+ {
+ Value::Type type = iter.second.getType();
+ if (type == Value::Type::STRING) {
+ CCLOG("The type of index %d is string", index);
+ }
+
+ if (type == Value::Type::INTEGER || type == Value::Type::DOUBLE || type == Value::Type::FLOAT || type == Value::Type::BYTE) {
+ CCLOG("The type of index %d is number", index);
+ }
+
+ ++index;
+ }
+
+ return ret;
+}
NS_CC_END
int lua_cocos2dx_DrawNode3D_getBlendFunc(lua_State* L)
@@ -610,12 +653,61 @@ int lua_register_cocos2dx_DrawNode3D(lua_State* L)
return 1;
}
+int lua_cocos2dx_ValueTypeJudgeInTable_create(lua_State* L)
+{
+ int argc = 0;
+ bool ok = true;
+
+#if COCOS2D_DEBUG >= 1
+ tolua_Error tolua_err;
+#endif
+
+#if COCOS2D_DEBUG >= 1
+ if (!tolua_isusertable(L,1,"cc.ValueTypeJudgeInTable",0,&tolua_err)) goto tolua_lerror;
+#endif
+
+ argc = lua_gettop(L) - 1;
+
+ if (argc == 1)
+ {
+ cocos2d::ValueMap arg0;
+ ok &= luaval_to_ccvaluemap(L, 2, &arg0, "cc.ValueTypeJudgeInTable:create");
+ if(!ok)
+ return 0;
+ cocos2d::ValueTypeJudgeInTable* ret = cocos2d::ValueTypeJudgeInTable::create(arg0);
+ object_to_luaval(L, "cc.ValueTypeJudgeInTable",(cocos2d::ValueTypeJudgeInTable*)ret);
+ return 1;
+ }
+ CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.ValueTypeJudgeInTable:create",argc, 1);
+ return 0;
+#if COCOS2D_DEBUG >= 1
+tolua_lerror:
+ tolua_error(L, "#ferror in function 'lua_cocos2dx_ValueTypeJudgeInTable_create'.",&tolua_err);
+#endif
+ return 0;
+}
+
+int lua_register_cocos2dx_ValueTypeJudgeInTable(lua_State* L)
+{
+ tolua_usertype(L,"cc.ValueTypeJudgeInTable");
+ tolua_cclass(L,"ValueTypeJudgeInTable","cc.ValueTypeJudgeInTable","cc.Node",nullptr);
+
+ tolua_beginmodule(L,"ValueTypeJudgeInTable");
+ tolua_function(L,"create", lua_cocos2dx_ValueTypeJudgeInTable_create);
+ tolua_endmodule(L);
+ std::string typeName = typeid(cocos2d::ValueTypeJudgeInTable).name();
+ g_luaType[typeName] = "cc.ValueTypeJudgeInTable";
+ g_typeCast["ValueTypeJudgeInTable"] = "cc.ValueTypeJudgeInTable";
+ return 1;
+}
+
int register_test_binding(lua_State* L)
{
tolua_open(L);
tolua_module(L, "cc", 0);
tolua_beginmodule(L, "cc");
lua_register_cocos2dx_DrawNode3D(L);
+ lua_register_cocos2dx_ValueTypeJudgeInTable(L);
tolua_endmodule(L);
return 0;
}
diff --git a/tests/lua-tests/project/proj.ios_mac/mac/LuaObjectCBridgeTest.h b/tests/lua-tests/project/proj.ios_mac/mac/LuaObjectCBridgeTest.h
index 882dab3ed7..bcc1051da0 100644
--- a/tests/lua-tests/project/proj.ios_mac/mac/LuaObjectCBridgeTest.h
+++ b/tests/lua-tests/project/proj.ios_mac/mac/LuaObjectCBridgeTest.h
@@ -14,7 +14,7 @@
+ (int) addTwoNumbers:(NSDictionary *)dict;
+ (void) callbackScriptHandler;
-- (void) init;
+- (id) init;
@end
#endif // COCOS2DX_SAMPLES_TESTLUA_PROJ_IOS_LUAOBJECTCBRIDGETEST_H
diff --git a/tests/lua-tests/project/proj.ios_mac/mac/LuaObjectCBridgeTest.mm b/tests/lua-tests/project/proj.ios_mac/mac/LuaObjectCBridgeTest.mm
index 624e338206..c54e97ca1a 100644
--- a/tests/lua-tests/project/proj.ios_mac/mac/LuaObjectCBridgeTest.mm
+++ b/tests/lua-tests/project/proj.ios_mac/mac/LuaObjectCBridgeTest.mm
@@ -73,9 +73,10 @@ static LuaObjectCBridgeTest* s_instance = nil;
}
}
-- (void)init
+- (id)init
{
_scriptHandler = 0;
+ return self;
}
@end
diff --git a/tests/lua-tests/src/BugsTest/BugsTest.lua b/tests/lua-tests/src/BugsTest/BugsTest.lua
index 8a000ca05a..648697281c 100644
--- a/tests/lua-tests/src/BugsTest/BugsTest.lua
+++ b/tests/lua-tests/src/BugsTest/BugsTest.lua
@@ -13,7 +13,8 @@ local testNames = {
"Bug-899",
"Bug-914",
"Bug-1159",
- "Bug-1174"
+ "Bug-1174",
+ "Bug-value-type-judge-in-table"
}
local function CreateBugsTestBackMenuItem(pLayer)
@@ -554,6 +555,24 @@ local function BugTest1174()
return pLayer
end
+--BugTestValueTypeJudgeInTable
+local function BugTestValueTypeJudgeInTable()
+ local layer = cc.Layer:create()
+ local label = cc.Label:createWithTTF("Value Type Judge Error in the table:number -> string", "fonts/arial.ttf", 24)
+ label:setAnchorPoint(cc.p(0.5, 0.5))
+ label:setPosition(cc.p(VisibleRect:center().x, VisibleRect:top().y - 40))
+ layer:addChild(label)
+ local outLable = cc.Label:createWithTTF("You should see the following output in the console: \n The type of index 0 is number \n The type of index 1 is number \n The type of index 2 is number", "fonts/arial.ttf", 18)
+ outLable:setAnchorPoint(cc.p(0.5, 0.5))
+ outLable:setPosition(cc.p(VisibleRect:center().x, VisibleRect:top().y - 160))
+ layer:addChild(outLable)
+
+ local valueTypeJudge = cc.ValueTypeJudgeInTable:create({index1 = 111, index2 = 112, index3 = 113})
+ layer:addChild(valueTypeJudge)
+
+ return layer
+end
+
local CreateBugsTestTable = {
BugTest350,
BugTest422,
@@ -564,6 +583,7 @@ local CreateBugsTestTable = {
BugTest914,
BugTest1159,
BugTest1174,
+ BugTestValueTypeJudgeInTable,
}
local function CreateBugsTestScene(nBugNo)
diff --git a/tools/tolua/cocos2dx_3d.ini b/tools/tolua/cocos2dx_3d.ini
index 0e779cf550..f33c10f38d 100644
--- a/tools/tolua/cocos2dx_3d.ini
+++ b/tools/tolua/cocos2dx_3d.ini
@@ -36,7 +36,7 @@ classes = Animate3D Sprite3D Animation3D Skeleton3D ^Mesh$ AttachNode BillBoard
# functions from all classes.
skip = Mesh::[create getAABB getVertexBuffer hasVertexAttrib getMeshVertexAttribCount getMeshVertexAttribute getVertexSizeInBytes getSkin getMeshIndexData getGLProgramState getPrimitiveType getIndexCount getIndexFormat getIndexBuffer],
- Sprite3D::[getSkin getAABB setBlendFunc],
+ Sprite3D::[getSkin getAABB setBlendFunc getMeshArrayByName],
Skeleton3D::[create],
Animation3D::[getBoneCurveByName],
BillBoard::[draw]