This commit is contained in:
XiaoFeng 2015-04-13 09:18:58 +08:00
commit 613e39bcad
317 changed files with 2806 additions and 4669 deletions

38
.gitignore vendored
View File

@ -118,47 +118,13 @@ tests/*/publish/
project.properties
# Ignore prebuilt libraries folder
/external/xxhash/
/external/curl/
/external/edtaa3func/
/external/freetype2/
/external/glfw3/
/external/jpeg/
/external/json/
/external/linux-specific/
/external/lua/
/external/png/
/external/sqlite3/
/external/tiff/
/external/tinyxml2/
/external/unzip/
/external/webp/
/external/websockets/
/external/win32-specific/
/external/winrt-specific/
/external/winrt_8.1-specific/
/external/wp8-specific/
/external/wp_8.1-specific/
/external/version.json
/external/*
!/external/config.json
/templates/lua-template-runtime/runtime
/v*-deps-*.zip
/v*-lua-runtime-*.zip
/tools/fbx-conv/
external/chipmunk
tests/cpp-tests/Resources/audio
/external/Box2D/
/external/ConvertUTF/
/external/audio/
/external/xxtea/
/external/protobuf-lite/
/external/flatbuffers/
/external/android/
/external/ios/
/external/linux/
/external/mac/
/external/win32/
/external/winrt_8.1/
/external/wp_8.1/
/tests/js-tests/
/tests/lua-empty-test/src/cocos/
/tests/lua-game-controller-test/src/cocos/

View File

@ -1090,6 +1090,9 @@ Developers:
loadrunner
Added romanian languange support
Almax27
RenderQueue command buffer optimize.
Retired Core Developers:
WenSheng Yang

View File

@ -1,5 +1,12 @@
cocos2d-x-3.6beta0 Apr.14 2015
[NEW] UI:Text: add `Text::disableEffect(LabelEffect)` to disable a specific effect
[FIX] Physics: rigid body's rotation is wrong if it is attatched to a node which rotation is not 0
[FIX] Renderer: RenderQueue command buffer optimizing
[FIX] UI:Text: content size is wrong after setting outline effect
cocos2d-x-3.6alpha0 Apr.8 2015
[NEW] 3D: added texturecub support
[NEW] 3D: added texturecube support
[NEW] 3D: added skybox support
[NEW] 3D: added node animation support
[NEW] 3D: added terrian support

View File

@ -1154,7 +1154,6 @@
1AC0269D1914068200FA920D /* ConvertUTF.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC026991914068200FA920D /* ConvertUTF.h */; };
29031E0719BFE8D400EFA1DF /* libchipmunk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 29031E0619BFE8D400EFA1DF /* libchipmunk.a */; };
29031E0919BFE8DE00EFA1DF /* libchipmunk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 29031E0819BFE8DE00EFA1DF /* libchipmunk.a */; };
2905E9CD1ACD3D8C00092DD2 /* libz.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2905E9CC1ACD3D8C00092DD2 /* libz.a */; };
292DB13D19B4574100A80320 /* UIEditBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292DB12F19B4574100A80320 /* UIEditBox.cpp */; };
292DB13E19B4574100A80320 /* UIEditBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292DB12F19B4574100A80320 /* UIEditBox.cpp */; };
292DB13F19B4574100A80320 /* UIEditBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13019B4574100A80320 /* UIEditBox.h */; };
@ -4029,7 +4028,6 @@
files = (
29031E0719BFE8D400EFA1DF /* libchipmunk.a in Frameworks */,
15AE1C1A19AAE3C800C27E9E /* libwebsockets.a in Frameworks */,
2905E9CD1ACD3D8C00092DD2 /* libz.a in Frameworks */,
292F1A6B1A5250F700E479F8 /* libssl.a in Frameworks */,
292F1A631A52447100E479F8 /* libcrypto.a in Frameworks */,
B217704E1977ED9F009EE11B /* libsqlite3.dylib in Frameworks */,

View File

@ -5409,6 +5409,12 @@
"$(inherited)",
"$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib",
);
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
"-pagezero_size",
10000,
"-image_base",
100000000,
);
PRODUCT_NAME = "lua-game-controller-test iOS";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@ -5435,6 +5441,12 @@
"$(inherited)",
"$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib",
);
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
"-pagezero_size",
10000,
"-image_base",
100000000,
);
PRODUCT_NAME = "lua-game-controller-test iOS";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";

View File

@ -124,7 +124,7 @@
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>$(ProjectDir);$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir);$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8\freetype;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WP8_SHADER_COMPILER;CC_USE_PHYSICS=0;CC_STATIC;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
@ -140,7 +140,7 @@
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>$(ProjectDir);$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir);$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8\freetype;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WP8_SHADER_COMPILER;CC_USE_PHYSICS=0;CC_STATIC;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
@ -156,7 +156,7 @@
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>$(ProjectDir);$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir);$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8\freetype;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WP8_SHADER_COMPILER;CC_USE_PHYSICS=0;CC_STATIC;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
@ -172,7 +172,7 @@
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>$(ProjectDir);$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir);$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8\freetype;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WP8_SHADER_COMPILER;CC_USE_PHYSICS=0;CC_STATIC;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
@ -188,7 +188,7 @@
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>$(ProjectDir);$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir);$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8\freetype;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WP8_SHADER_COMPILER;CC_USE_PHYSICS=0;CC_STATIC;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
@ -204,7 +204,7 @@
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>$(ProjectDir);$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir);$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8\freetype;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WP8_SHADER_COMPILER;CC_USE_PHYSICS=0;CC_STATIC;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>

View File

@ -1,7 +1,7 @@
/****************************************************************************
Copyright (c) 2013 Zynga Inc.
Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
@ -29,6 +29,7 @@
#include "2d/CCSpriteBatchNode.h"
#include "renderer/CCCustomCommand.h"
#include "2d/CCFontAtlas.h"
#include "base/ccTypes.h"
NS_CC_BEGIN
@ -50,16 +51,6 @@ enum class GlyphCollection {
CUSTOM
};
/**
* @brief Possible LabelEffect used by Label.
*
*/
enum class LabelEffect {
NORMAL,
OUTLINE,
SHADOW,
GLOW
};
/**
* @struct TTFConfig
@ -70,9 +61,9 @@ typedef struct _ttfConfig
std::string fontFilePath;
int fontSize;
GlyphCollection glyphs;
GlyphCollection glyphs;
const char *customGlyphs;
bool distanceFieldEnabled;
int outlineSize;
@ -94,7 +85,7 @@ typedef struct _ttfConfig
/**
* @brief Label is a subclass of SpriteBatchNode that knows how to render text labels.
*
*
* Label can be created with:
* - A true type font file.
* - A bitmap font file.
@ -123,13 +114,13 @@ public:
*/
static Label* create();
/**
/**
* Allocates and initializes a Label, base on platform-dependent API.
*
* @param text The initial text.
* @param font A font file or a font family name.
* @param fontSize The font size. This value must be > 0.
* @param dimensions
* @param dimensions
* @param hAlignment The text horizontal alignment.
* @param vAlignment The text vertical alignment.
*
@ -147,7 +138,7 @@ public:
* @param text The initial text.
* @param fontFilePath A font file.
* @param fontSize The font size. This value must be > 0.
* @param dimensions
* @param dimensions
* @param hAlignment The text horizontal alignment.
* @param vAlignment The text vertical alignment.
*
@ -169,7 +160,7 @@ public:
* @see TTFConfig setTTFConfig setMaxLineWidth
*/
static Label* createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment hAlignment = TextHAlignment::LEFT, int maxLineWidth = 0);
/**
* Allocates and initializes a Label, with a bitmap font file.
*
@ -177,7 +168,7 @@ public:
* @param text The initial text.
* @param hAlignment Text horizontal alignment.
* @param maxLineWidth The max line width.
* @param imageOffset
* @param imageOffset
*
* @return An automatically released Label object.
* @see setBMFontFilePath setMaxLineWidth
@ -185,7 +176,7 @@ public:
static Label* createWithBMFont(const std::string& bmfontPath, const std::string& text,
const TextHAlignment& hAlignment = TextHAlignment::LEFT, int maxLineWidth = 0,
const Vec2& imageOffset = Vec2::ZERO);
/**
* Allocates and initializes a Label, with char map configuration.
*
@ -258,7 +249,7 @@ public:
virtual bool setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
/**
* Sets a new char map configuration to Label.
* Sets a new char map configuration to Label.
*
* @see `createWithCharMap(const std::string&)`
*/
@ -299,12 +290,12 @@ public:
int getStringLength() const;
/**
/**
* Sets the text color of Label.
*
* The text color is different from the color of Node.
*
* @warning Limiting use to only when the Label created with true type font or system font.
*
* @warning Limiting use to only when the Label created with true type font or system font.
*/
virtual void setTextColor(const Color4B &color);
@ -365,19 +356,19 @@ public:
/**
* Specify what happens when a line is too long for Label.
*
*
* @param breakWithoutSpace Lines are automatically broken between words if this value is false.
*/
void setLineBreakWithoutSpace(bool breakWithoutSpace);
/**
/**
* Makes the Label at most this line untransformed width.
* The Label's max line width be used for force line breaks if the value not equal zero.
*/
void setMaxLineWidth(float maxLineWidth);
float getMaxLineWidth() { return _maxLineWidth; }
/**
/**
* Makes the Label exactly this untransformed width.
*
* The Label's width be used for text align if the value not equal zero.
@ -418,14 +409,14 @@ public:
*/
void setLineHeight(float height);
/**
/**
* Returns the line height of this Label.
* @warning Not support system font.
* @since v3.2.0
*/
float getLineHeight() const;
/**
/**
* Sets the additional kerning of the Label.
*
* @warning Not support system font.
@ -433,7 +424,7 @@ public:
*/
void setAdditionalKerning(float space);
/**
/**
* Returns the additional kerning of the Label.
*
* @warning Not support system font.
@ -442,7 +433,7 @@ public:
float getAdditionalKerning() const;
FontAtlas* getFontAtlas() { return _fontAtlas; }
virtual void setBlendFunc(const BlendFunc &blendFunc) override;
virtual bool isOpacityModifyRGB() const override;
@ -522,9 +513,9 @@ protected:
bool recordPlaceholderInfo(int spriteIndex);
void setFontScale(float fontScale);
virtual void alignText();
bool computeHorizontalKernings(const std::u16string& stringToRender);
void computeStringNumLines();
@ -594,7 +585,7 @@ protected:
GLuint _uniformEffectColor;
GLuint _uniformTextColor;
CustomCommand _customCommand;
CustomCommand _customCommand;
bool _shadowDirty;
bool _shadowEnabled;

View File

@ -127,6 +127,9 @@ Node::Node(void)
, _physicsRotation(0.0f)
, _physicsTransformDirty(true)
, _updateTransformFromPhysics(true)
, _physicsWorld(nullptr)
, _physicsBodyAssociatedWith(0)
, _physicsRotationOffset(0.0f)
#endif
, _displayedOpacity(255)
, _realOpacity(255)
@ -334,8 +337,9 @@ void Node::setRotation(float rotation)
_rotationZ_X = _rotationZ_Y = rotation;
_transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
{
_physicsWorld->_updateBodyTransform = true;
}
#endif
@ -475,8 +479,9 @@ void Node::setScale(float scale)
_scaleX = _scaleY = _scaleZ = scale;
_transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
{
_physicsWorld->_updateBodyTransform = true;
}
#endif
}
@ -497,8 +502,9 @@ void Node::setScale(float scaleX,float scaleY)
_scaleY = scaleY;
_transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
{
_physicsWorld->_updateBodyTransform = true;
}
#endif
}
@ -512,8 +518,9 @@ void Node::setScaleX(float scaleX)
_scaleX = scaleX;
_transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
{
_physicsWorld->_updateBodyTransform = true;
}
#endif
}
@ -556,8 +563,9 @@ void Node::setScaleY(float scaleY)
_scaleY = scaleY;
_transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
{
_physicsWorld->_updateBodyTransform = true;
}
#endif
}
@ -592,8 +600,9 @@ void Node::setPosition(float x, float y)
_transformUpdated = _transformDirty = _inverseDirty = true;
_usingNormalizedPosition = false;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
{
_physicsWorld->_updateBodyTransform = true;
}
#endif
}
@ -661,8 +670,9 @@ void Node::setNormalizedPosition(const Vec2& position)
_normalizedPositionDirty = true;
_transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
{
_physicsWorld->_updateBodyTransform = true;
}
#endif
}
@ -1050,8 +1060,17 @@ void Node::addChildHelper(Node* child, int localZOrder, int tag, const std::stri
child->setOrderOfArrival(s_globalOrderOfArrival++);
#if CC_USE_PHYSICS
_physicsBodyAssociatedWith += child->_physicsBodyAssociatedWith;
auto parentNode = this;
while (parentNode->_parent)
{
parentNode = parentNode->_parent;
parentNode->_physicsBodyAssociatedWith += child->_physicsBodyAssociatedWith;
}
auto scene = dynamic_cast<Scene*>(parentNode);
// Recursive add children with which have physics body.
auto scene = this->getScene();
if (scene && scene->getPhysicsWorld())
{
scene->addChildToPhysicsWorld(child);
@ -2029,6 +2048,14 @@ void Node::setPhysicsBody(PhysicsBody* body)
_physicsBody->_node = nullptr;
_physicsBody->release();
_physicsBody = nullptr;
_physicsBodyAssociatedWith--;
auto parentNode = this;
while (parentNode->_parent)
{
parentNode = parentNode->_parent;
parentNode->_physicsBodyAssociatedWith--;
}
}
if (body)
@ -2052,8 +2079,17 @@ void Node::setPhysicsBody(PhysicsBody* body)
_physicsBody = body;
_physicsScaleStartX = _scaleX;
_physicsScaleStartY = _scaleY;
_physicsRotationOffset = _rotationZ_X;
auto scene = getScene();
_physicsBodyAssociatedWith++;
auto parentNode = this;
while (parentNode->_parent)
{
parentNode = parentNode->_parent;
parentNode->_physicsBodyAssociatedWith++;
}
auto scene = dynamic_cast<Scene*>(parentNode);
if (scene && scene->getPhysicsWorld())
{
_physicsTransformDirty = true;
@ -2082,7 +2118,7 @@ void Node::updatePhysicsBodyTransform(const Mat4& parentTransform, uint32_t pare
parentTransform.transformPoint(vec3, &ret);
_physicsBody->setPosition(Vec2(ret.x, ret.y));
_physicsBody->setScale(scaleX / _physicsScaleStartX, scaleY / _physicsScaleStartY);
_physicsBody->setRotation(_physicsRotation);
_physicsBody->setRotation(_physicsRotation - _physicsRotationOffset);
}
for (auto node : _children)
@ -2095,6 +2131,7 @@ void Node::updateTransformFromPhysics(const Mat4& parentTransform, uint32_t pare
{
auto& newPosition = _physicsBody->getPosition();
auto& recordedPosition = _physicsBody->_recordedPosition;
auto updateBodyTransform = _physicsWorld->_updateBodyTransform;
if (parentFlags || recordedPosition.x != newPosition.x || recordedPosition.y != newPosition.y)
{
recordedPosition = newPosition;
@ -2104,7 +2141,8 @@ void Node::updateTransformFromPhysics(const Mat4& parentTransform, uint32_t pare
setPosition(ret.x, ret.y);
}
_physicsRotation = _physicsBody->getRotation();
setRotation(_physicsRotation - _parent->_physicsRotation);
setRotation(_physicsRotation - _parent->_physicsRotation + _physicsRotationOffset);
_physicsWorld->_updateBodyTransform = updateBodyTransform;
}
#endif //CC_USE_PHYSICS

View File

@ -54,6 +54,7 @@ class GLProgram;
class GLProgramState;
#if CC_USE_PHYSICS
class PhysicsBody;
class PhysicsWorld;
#endif
/**
@ -1838,6 +1839,10 @@ protected:
float _physicsRotation;
bool _physicsTransformDirty;
bool _updateTransformFromPhysics;
PhysicsWorld* _physicsWorld; /** The PhysicsWorld associated with the node.*/
int _physicsBodyAssociatedWith; /** The count of PhysicsBody associated with the node and children.*/
float _physicsRotationOffset; /** Record the rotation value when invoke Node::setPhysicsBody.*/
#endif
// opacity controls
@ -1862,7 +1867,7 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(Node);
#if CC_USE_PHYSICS
friend class Layer;
friend class Scene;
#endif //CC_USTPS
};

View File

@ -227,6 +227,8 @@ void Scene::addChildToPhysicsWorld(Node* child)
std::function<void(Node*)> addToPhysicsWorldFunc = nullptr;
addToPhysicsWorldFunc = [this, &addToPhysicsWorldFunc](Node* node) -> void
{
node->_physicsWorld = _physicsWorld;
if (node->getPhysicsBody())
{
_physicsWorld->addBody(node->getPhysicsBody());

View File

@ -113,32 +113,32 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.5_Windows_8.1</TargetName>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.5_Windows_8.1</TargetName>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.5_Windows_8.1</TargetName>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.5_Windows_8.1</TargetName>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.5_Windows_8.1</TargetName>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.5_Windows_8.1</TargetName>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>

View File

@ -85,22 +85,22 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.5_WindowsPhone_8.1</TargetName>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.5_WindowsPhone_8.1</TargetName>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.5_WindowsPhone_8.1</TargetName>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.5_WindowsPhone_8.1</TargetName>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>

View File

@ -72,18 +72,18 @@
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<TargetName>libcocos2d_v3.5_WindowsPhone_8.0</TargetName>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.0</TargetName>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<TargetName>libcocos2d_v3.5_WindowsPhone_8.0</TargetName>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.0</TargetName>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetName>libcocos2d_v3.5_WindowsPhone_8.0</TargetName>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.0</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>libcocos2d_v3.5_WindowsPhone_8.0</TargetName>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.0</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>

View File

@ -56,7 +56,6 @@ MeshIndexData* MeshIndexData::create(const std::string& id, MeshVertexData* vert
meshindex->_indexBuffer = indexbuffer;
meshindex->_vertexData = vertexData;
indexbuffer->retain();
vertexData->retain();
meshindex->_aabb = aabb;
meshindex->autorelease();
@ -78,7 +77,6 @@ MeshIndexData::MeshIndexData()
MeshIndexData::~MeshIndexData()
{
CC_SAFE_RELEASE(_indexBuffer);
CC_SAFE_RELEASE(_vertexData);
}
MeshVertexData* MeshVertexData::create(const MeshData& meshdata)

View File

@ -86,7 +86,7 @@ CC_CONSTRUCTOR_ACCESS:
protected:
IndexBuffer* _indexBuffer; //index buffer
MeshVertexData* _vertexData; //vertex buffer
MeshVertexData* _vertexData; //vertex buffer, weak ref
AABB _aabb; // original aabb of the submesh
std::string _id; //id
GLenum _primitiveType;

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,8 @@ THE SOFTWARE.
#include "3d/CCAABB.h"
#include "3d/CCRay.h"
#include <vector>
#include "base/CCEventListenerCustom.h"
#include "base/CCEventDispatcher.h"
NS_CC_BEGIN
/**
@ -100,9 +101,9 @@ public:
DetailMap();
DetailMap(const char * detailMapSrc, float size = 35);
/*detail Image source file path*/
std::string detailMapSrc;
std::string _detailMapSrc;
/*detailMapSize determine how many tiles that Terrain represent*/
float detailMapSize;
float _detailMapSize;
};
/**
@ -122,40 +123,40 @@ public:
/**
*deterimine the chunk size,chunk is the minimal subdivision of the Terrain
*/
Size chunkSize;
Size _chunkSize;
/**height Map source path*/
std::string heightMapSrc;
std::string _heightMapSrc;
/**the source path of the alpha map*/
char* alphaMapSrc;
char* _alphaMapSrc;
/**detail maps*/
DetailMap detailMaps[4];
DetailMap _detailMaps[4];
/**terrain Maximum height*/
float mapHeight;
float _mapHeight;
/**terrain scale factor,you can combine setScale later.*/
float mapScale;
float _mapScale;
/**the amount of detailmap*/
int _detailMapAmount;
/**the skirt height ratio, only effect when terrain use skirt to fix crack*/
float skirtHeightRatio;
float _skirtHeightRatio;
};
private:
struct ChunkIndices
{
GLuint indices;
unsigned short size;
GLuint _indices;
unsigned short _size;
};
struct ChunkLODIndices
{
int relativeLod[5];
int _relativeLod[5];
ChunkIndices _chunkIndices;
};
struct ChunkLODIndicesSkirt
{
int selfLod;
int _selfLod;
ChunkIndices _chunkIndices;
};
/*
@ -167,13 +168,13 @@ private:
TerrainVertexData(){};
TerrainVertexData(Vec3 v1, Tex2F v2)
{
position = v1;
texcoord = v2;
_position = v1;
_texcoord = v2;
};
/*the vertex's attributes*/
cocos2d::Vec3 position;
cocos2d::Tex2F texcoord;
cocos2d::Vec3 normal;
cocos2d::Vec3 _position;
cocos2d::Tex2F _texcoord;
cocos2d::Vec3 _normal;
};
struct QuadTree;
@ -187,12 +188,12 @@ private:
/**destructor*/
~Chunk();
/*vertices*/
std::vector<TerrainVertexData> vertices;
std::vector<TerrainVertexData> _originalVertices;
/*LOD indices*/
struct LOD{
std::vector<GLushort> indices;
std::vector<GLushort> _indices;
};
GLuint vbo[2];
GLuint _vbo;
ChunkIndices _chunkIndices;
/**we now support four levels of detail*/
LOD _lod[4];
@ -230,16 +231,16 @@ private:
QuadTree * _parent;
/**the position X in terrain space*/
int pos_x;
int _posX;
/**the position Y in terrain space*/
int pos_y;
int _posY;
/**parent terrain*/
Terrain * _terrain;
/**chunk size*/
Size _size;
/**chunk's estimated slope*/
float _slope;
std::vector<TerrainVertexData> vertices_tmp;
std::vector<TerrainVertexData> _currentVertices;
};
/**
@ -272,7 +273,8 @@ private:
int _height;
int _width;
QuadTree * _parent;
AABB _aabb;
/**AABB's cache (in local space)*/
AABB _localAABB;
/**AABB's cache (in world space)*/
AABB _worldSpaceAABB;
Terrain * _terrain;
@ -381,15 +383,7 @@ public:
*/
QuadTree * getQuadTree();
//following methods are internal use only
ChunkIndices lookForIndicesLODSkrit(int selfLod, bool * result);
ChunkIndices lookForIndicesLOD(int neighborLod[4], int selfLod, bool * result);
ChunkIndices insertIndicesLOD(int neighborLod[4], int selfLod, GLushort * indices, int size);
ChunkIndices insertIndicesLODSkirt(int selfLod, GLushort * indices, int size);
void reload();
protected:
Terrain();
@ -418,7 +412,16 @@ protected:
/**
* cache all unifrom loactions in GLSL.
**/
void cacheUniformLocation();
void cacheUniformAttribLocation();
//IBO generate & cache
ChunkIndices lookForIndicesLODSkrit(int selfLod, bool * result);
ChunkIndices lookForIndicesLOD(int neighborLod[4], int selfLod, bool * result);
ChunkIndices insertIndicesLOD(int neighborLod[4], int selfLod, GLushort * indices, int size);
ChunkIndices insertIndicesLODSkirt(int selfLod, GLushort * indices, int size);
protected:
std::vector <ChunkLODIndices> _chunkLodIndicesSet;
std::vector<ChunkLODIndicesSkirt> _chunkLodIndicesSkirtSet;
@ -444,6 +447,8 @@ protected:
Mat4 _oldCameraModelMatrix;
Mat4 _terrainModelMatrix;
GLuint _normalLocation;
GLuint _positionLocation;
GLuint _texcordLocation;
float _maxHeight;
float _minHeight;
CrackFixedType _crackFixedType;
@ -453,6 +458,9 @@ protected:
GLint _alphaMapLocation;
GLint _alphaIsHasAlphaMapLocation;
GLint _detailMapSizeLocation[4];
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
EventListenerCustom* _backToForegroundListener;
#endif
};
// end of actions group

View File

@ -116,7 +116,9 @@ void AudioPlayer::rotateBufferThread(int offsetFrame)
ALint bufferProcessed = 0;
ExtAudioFileRef extRef = nullptr;
auto fileURL = (CFURLRef)[[NSURL fileURLWithPath:[NSString stringWithCString:_audioCache->_fileFullPath.c_str() encoding:[NSString defaultCStringEncoding]]] retain];
NSString *fileFullPath = [[NSString alloc] initWithCString:_audioCache->_fileFullPath.c_str() encoding:[NSString defaultCStringEncoding]];
auto fileURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:fileFullPath];
[fileFullPath release];
char* tmpBuffer = (char*)malloc(_audioCache->_queBufferBytes);
auto frames = _audioCache->_queBufferFrames;

View File

@ -45,7 +45,7 @@ NS_CC_BEGIN
struct Color4B;
struct Color4F;
/**
/**
* RGB color composed of bytes 3 bytes.
* @since v3.0
*/
@ -71,7 +71,7 @@ struct CC_DLL Color3B
GLubyte r;
GLubyte g;
GLubyte b;
static const Color3B WHITE;
static const Color3B YELLOW;
static const Color3B BLUE;
@ -83,7 +83,7 @@ struct CC_DLL Color3B
static const Color3B GRAY;
};
/**
/**
* RGBA color composed of 4 bytes.
* @since v3.0
*/
@ -118,7 +118,7 @@ struct CC_DLL Color4B
};
/**
/**
* RGBA color composed of 4 floats.
* @since v3.0
*/
@ -140,7 +140,7 @@ struct CC_DLL Color4F
{
return (*this == other);
}
GLfloat r;
GLfloat g;
GLfloat b;
@ -163,9 +163,9 @@ struct CC_DLL Color4F
// struct Vertex2F
// {
// Vertex2F(float _x, float _y) :x(_x), y(_y) {}
// Vertex2F(): x(0.f), y(0.f) {}
// GLfloat x;
// GLfloat y;
// };
@ -181,23 +181,23 @@ struct CC_DLL Color4F
// , y(_y)
// , z(_z)
// {}
// Vertex3F(): x(0.f), y(0.f), z(0.f) {}
// GLfloat x;
// GLfloat y;
// GLfloat z;
// };
/** @struct Tex2F
* A TEXCOORD composed of 2 floats: u, y
* @since v3.0
*/
struct CC_DLL Tex2F {
Tex2F(float _u, float _v): u(_u), v(_v) {}
Tex2F(): u(0.f), v(0.f) {}
GLfloat u;
GLfloat v;
};
@ -222,7 +222,7 @@ struct CC_DLL Quad2
Vec2 bl;
Vec2 br;
};
/** @struct Quad3
* A 3D Quad. 4 * 3 floats.
*/
@ -307,7 +307,7 @@ struct CC_DLL V2F_C4B_T2F_Triangle
V2F_C4B_T2F b;
V2F_C4B_T2F c;
};
/** @struct V2F_C4B_T2F_Quad
* A Quad of V2F_C4B_T2F.
*/
@ -354,7 +354,7 @@ struct CC_DLL V2F_C4F_T2F_Quad
};
/** @struct V3F_T2F_Quad
*
*
*/
struct CC_DLL V3F_T2F_Quad
{
@ -451,7 +451,7 @@ struct CC_DLL AnimationFrameData
{
T2F_Quad texCoords;
float delay;
Size size;
Size size;
};
/**
@ -464,7 +464,7 @@ struct CC_DLL AnimationFrameData
struct CC_DLL FontShadow
{
public:
// shadow is not enabled by default
FontShadow()
: _shadowEnabled(false)
@ -488,7 +488,7 @@ public:
struct CC_DLL FontStroke
{
public:
// stroke is disabled by default
FontStroke()
: _strokeEnabled(false)
@ -496,7 +496,7 @@ public:
, _strokeAlpha(255)
, _strokeSize(0)
{}
/// true if stroke enabled
bool _strokeEnabled;
/// stroke color
@ -505,7 +505,7 @@ public:
GLubyte _strokeAlpha;
/// stroke size
float _strokeSize;
};
/** @struct FontDefinition
@ -526,7 +526,7 @@ public:
, _fontFillColor(Color3B::WHITE)
, _fontAlpha(255)
{}
/// font name
std::string _fontName;
/// font size
@ -545,7 +545,18 @@ public:
FontShadow _shadow;
/// font stroke
FontStroke _stroke;
};
/**
* @brief Possible LabelEffect used by Label.
*
*/
enum class LabelEffect {
NORMAL,
OUTLINE,
SHADOW,
GLOW
};
/** @struct Acceleration
@ -558,9 +569,9 @@ public:
double x;
double y;
double z;
double timestamp;
Acceleration(): x(0), y(0), z(0), timestamp(0) {}
};

View File

@ -817,11 +817,6 @@ void PhysicsWorld::step(float delta)
void PhysicsWorld::update(float delta, bool userCall/* = false*/)
{
if (delta < FLT_EPSILON)
{
return;
}
if(_updateBodyTransform || !_delayAddBodies.empty())
{
_scene->updatePhysicsBodyTransform(_scene->getNodeToParentTransform(), 0, 1.0f, 1.0f);
@ -832,12 +827,17 @@ void PhysicsWorld::update(float delta, bool userCall/* = false*/)
{
updateBodies();
}
if (!_delayAddJoints.empty() || !_delayRemoveJoints.empty())
{
updateJoints();
}
if (delta < FLT_EPSILON)
{
return;
}
if (userCall)
{
cpSpaceStep(_cpSpace, delta);

View File

@ -70,6 +70,8 @@ void Cocos2dRenderer::Resume()
else
{
Application::getInstance()->applicationWillEnterForeground();
cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND);
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent);
}
}
@ -77,8 +79,8 @@ void Cocos2dRenderer::Pause()
{
if (Director::getInstance()->getOpenGLView()) {
Application::getInstance()->applicationDidEnterBackground();
//cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);
//cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent);
cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent);
}
}
@ -135,9 +137,4 @@ void Cocos2dRenderer::QueuePointerEvent(cocos2d::PointerEventType type, Windows:
GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args);
}
void Cocos2dRenderer::QueueKeyBoardEvent(cocos2d::Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e)
{
//GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, e);
}

View File

@ -35,7 +35,6 @@ namespace cocos2d
~Cocos2dRenderer();
void Draw(GLsizei width, GLsizei height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation);
void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
void QueueKeyBoardEvent(Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e);
void Pause();
void Resume();
void DeviceLost();

View File

@ -613,7 +613,7 @@ unsigned char* CCFreeTypeFont::loadFont(const char *pFontName, ssize_t *size)
return nullptr;
}
return FileUtils::sharedFileUtils()->getFileData(fullpath.c_str(), "rb", size);
return FileUtils::getInstance()->getFileData(fullpath.c_str(), "rb", size);
}
unsigned char* CCFreeTypeFont::loadSystemFont(const char *pFontName, ssize_t *size)

View File

@ -389,8 +389,9 @@ void GLViewImpl::UpdateWindowSize()
ResolutionPolicy resPolicy=view->getResolutionPolicy();
view->setFrameSize(width, height);
view->setDesignResolutionSize(resSize.width, resSize.height, resPolicy);
Director::getInstance()->setViewport();
Director::sharedDirector()->setProjection(Director::sharedDirector()->getProjection());
auto director = Director::getInstance();
director->setViewport();
director->setProjection(director->getProjection());
}
}

View File

@ -133,7 +133,7 @@ void CC_DLL CCLogIPAddresses()
if (hn->IPInformation != nullptr)
{
std::string s = PlatformStringToString(hn->DisplayName);
CCLog("IP Address: %s:", s.c_str());
log("IP Address: %s:", s.c_str());
}
}
#endif

View File

@ -57,6 +57,10 @@ static bool compare3DCommand(RenderCommand* a, RenderCommand* b)
}
// queue
RenderQueue::RenderQueue()
{
}
void RenderQueue::push_back(RenderCommand* command)
{
@ -128,10 +132,18 @@ RenderCommand* RenderQueue::operator[](ssize_t index) const
void RenderQueue::clear()
{
_commands.clear();
for(int index = 0; index < QUEUE_COUNT; ++index)
for(int i = 0; i < QUEUE_COUNT; ++i)
{
_commands.push_back(std::vector<RenderCommand*>());
_commands[i].clear();
}
}
void RenderQueue::realloc(size_t reserveSize)
{
for(int i = 0; i < QUEUE_COUNT; ++i)
{
_commands[i] = std::vector<RenderCommand*>();
_commands[i].reserve(reserveSize);
}
}

View File

@ -73,10 +73,7 @@ public:
public:
/**Constructor.*/
RenderQueue()
{
clear();
}
RenderQueue();
/**Push a renderCommand into current renderqueue.*/
void push_back(RenderCommand* command);
/**Return the number of render commands.*/
@ -87,6 +84,8 @@ public:
RenderCommand* operator[](ssize_t index) const;
/**Clear all rendered commands.*/
void clear();
/**Realloc command queues and reserve with given size. Note: this clears any existing commands.*/
void realloc(size_t reserveSize);
/**Get a sub group of the render queue.*/
inline std::vector<RenderCommand*>& getSubQueue(QUEUE_GROUP group) { return _commands[group]; }
/**Get the number of render commands contained in a subqueue.*/
@ -99,7 +98,7 @@ public:
protected:
/**The commands in the render queue.*/
std::vector<std::vector<RenderCommand*>> _commands;
std::vector<RenderCommand*> _commands[QUEUE_COUNT];
/**Cull state.*/
bool _isCullEnabled;

View File

@ -238,7 +238,7 @@
--------------------------------
-- Sets the text color of Label.<br>
-- The text color is different from the color of Node.<br>
-- warning Limiting use to only when the Label created with true type font or system font.
-- warning Limiting use to only when the Label created with true type font or system font.
-- @function [parent=#Label] setTextColor
-- @param self
-- @param #color4b_table color
@ -330,7 +330,7 @@
-- param text The initial text.<br>
-- param hAlignment Text horizontal alignment.<br>
-- param maxLineWidth The max line width.<br>
-- param imageOffset <br>
-- param imageOffset<br>
-- return An automatically released Label object.<br>
-- see setBMFontFilePath setMaxLineWidth
-- @function [parent=#Label] createWithBMFont
@ -366,7 +366,7 @@
-- param text The initial text.<br>
-- param font A font file or a font family name.<br>
-- param fontSize The font size. This value must be > 0.<br>
-- param dimensions <br>
-- param dimensions<br>
-- param hAlignment The text horizontal alignment.<br>
-- param vAlignment The text vertical alignment.<br>
-- warning It will generate texture by the platform-dependent code.<br>

View File

@ -11,44 +11,6 @@
-- @param #char heightMap
-- @return bool#bool ret (return value: bool)
--------------------------------
-- set the MaxDetailAmount.
-- @function [parent=#Terrain] setMaxDetailMapAmount
-- @param self
-- @param #int maxValue
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
-- show the wireline instead of the surface,Debug Use only.<br>
-- Note only support desktop platform
-- @function [parent=#Terrain] setDrawWire
-- @param self
-- @param #bool boolValue
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
-- Switch frustum Culling Flag<br>
-- Note frustum culling will remarkable improve your terrain rendering performance.
-- @function [parent=#Terrain] setIsEnableFrustumCull
-- @param self
-- @param #bool boolValue
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
-- set the Detail Map
-- @function [parent=#Terrain] setDetailMap
-- @param self
-- @param #unsigned int index
-- @param #cc.Terrain::DetailMap detailMap
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
-- reset the heightmap data.
-- @function [parent=#Terrain] resetHeightMap
-- @param self
-- @param #char heightMap
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
-- set the alpha map
-- @function [parent=#Terrain] setAlphaMap
@ -82,16 +44,6 @@
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Set threshold distance of each LOD level,must equal or gereater than the chunk size<br>
-- Note when invoke initHeightMap, the LOD distance will be automatic calculated.
-- @function [parent=#Terrain] setLODDistance
-- @param self
-- @param #float lod1
-- @param #float lod2
-- @param #float lod3
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
-- get the normal of the specified pistion in terrain<br>
-- return the normal vector of the specified position of the terrain.<br>
@ -102,6 +54,28 @@
-- @param #int pixelY
-- @return vec3_table#vec3_table ret (return value: vec3_table)
--------------------------------
-- show the wireline instead of the surface,Debug Use only.<br>
-- Note only support desktop platform
-- @function [parent=#Terrain] setDrawWire
-- @param self
-- @param #bool boolValue
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
--
-- @function [parent=#Terrain] reload
-- @param self
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
-- set the Detail Map
-- @function [parent=#Terrain] setDetailMap
-- @param self
-- @param #unsigned int index
-- @param #cc.Terrain::DetailMap detailMap
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
-- get height from the raw height filed
-- @function [parent=#Terrain] getImageHeight
@ -110,6 +84,29 @@
-- @param #int pixelY
-- @return float#float ret (return value: float)
--------------------------------
-- get the terrain's mininal height.
-- @function [parent=#Terrain] getMinHeight
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Set threshold distance of each LOD level,must equal or gereater than the chunk size<br>
-- Note when invoke initHeightMap, the LOD distance will be automatic calculated.
-- @function [parent=#Terrain] setLODDistance
-- @param self
-- @param #float lod1
-- @param #float lod2
-- @param #float lod3
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
-- reset the heightmap data.
-- @function [parent=#Terrain] resetHeightMap
-- @param self
-- @param #char heightMap
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
-- get the terrain's maximum height.
-- @function [parent=#Terrain] getMaxHeight
@ -117,10 +114,19 @@
-- @return float#float ret (return value: float)
--------------------------------
-- get the terrain's mininal height.
-- @function [parent=#Terrain] getMinHeight
-- set the MaxDetailAmount.
-- @function [parent=#Terrain] setMaxDetailMapAmount
-- @param self
-- @return float#float ret (return value: float)
-- @param #int maxValue
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
-- Switch frustum Culling Flag<br>
-- Note frustum culling will remarkable improve your terrain rendering performance.
-- @function [parent=#Terrain] setIsEnableFrustumCull
-- @param self
-- @param #bool boolValue
-- @return Terrain#Terrain self (return value: cc.Terrain)
--------------------------------
--

View File

@ -28,11 +28,13 @@
-- @return string#string ret (return value: string)
--------------------------------
-- Disable shadow/outline/glow rendering.
-- @function [parent=#Text] disableEffect
-- @overload self, int
-- @overload self
-- @function [parent=#Text] disableEffect
-- @param self
-- @param #int effect
-- @return Text#Text self (return value: ccui.Text)
--------------------------------
-- Gets text color.<br>
-- return Text color.
@ -52,9 +54,15 @@
-- Sets the font name of label.<br>
-- If you are trying to use a system font, you could just pass a font name<br>
-- If you are trying to use a TTF, you should pass a file path to the TTF file<br>
-- Usage: Text *text = Text::create("Hello", "Arial", 20);create a system font UIText<br>
-- text->setFontName("Marfelt"); it will change the font to system font no matter the previous font type is TTF or system font<br>
-- text->setFontName("xxxx/xxx.ttf");it will change the font to TTF font no matter the previous font type is TTF or system font<br>
-- Usage:<br>
-- code<br>
-- create a system font UIText<br>
-- Text *text = Text::create("Hello", "Arial", 20);<br>
-- it will change the font to system font no matter the previous font type is TTF or system font<br>
-- text->setFontName("Marfelt");<br>
-- it will change the font to TTF font no matter the previous font type is TTF or system font<br>
-- text->setFontName("xxxx/xxx.ttf");<br>
-- endcode<br>
-- param name Font name.
-- @function [parent=#Text] setFontName
-- @param self
@ -103,7 +111,8 @@
--------------------------------
-- Gets the string length of the label.<br>
-- Note: This length will be larger than the raw string length,<br>
-- if you want to get the raw string length, you should call this->getString().size() instead.<br>
-- if you want to get the raw string length,<br>
-- you should call this->getString().size() instead.<br>
-- return String length.
-- @function [parent=#Text] getStringLength
-- @param self

View File

@ -3459,260 +3459,6 @@ int lua_cocos2dx_3d_Terrain_initHeightMap(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_3d_Terrain_setMaxDetailMapAmount(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_setMaxDetailMapAmount'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Terrain:setMaxDetailMapAmount");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_setMaxDetailMapAmount'", nullptr);
return 0;
}
cobj->setMaxDetailMapAmount(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:setMaxDetailMapAmount",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_setMaxDetailMapAmount'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_setDrawWire(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_setDrawWire'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Terrain:setDrawWire");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_setDrawWire'", nullptr);
return 0;
}
cobj->setDrawWire(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:setDrawWire",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_setDrawWire'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_setIsEnableFrustumCull(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_setIsEnableFrustumCull'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Terrain:setIsEnableFrustumCull");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_setIsEnableFrustumCull'", nullptr);
return 0;
}
cobj->setIsEnableFrustumCull(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:setIsEnableFrustumCull",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_setIsEnableFrustumCull'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_setDetailMap(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_setDetailMap'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 2)
{
unsigned int arg0;
cocos2d::Terrain::DetailMap arg1;
ok &= luaval_to_uint32(tolua_S, 2,&arg0, "cc.Terrain:setDetailMap");
#pragma warning NO CONVERSION TO NATIVE FOR DetailMap
ok = false;
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_setDetailMap'", nullptr);
return 0;
}
cobj->setDetailMap(arg0, arg1);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:setDetailMap",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_setDetailMap'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_resetHeightMap(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_resetHeightMap'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
const char* arg0;
std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Terrain:resetHeightMap"); arg0 = arg0_tmp.c_str();
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_resetHeightMap'", nullptr);
return 0;
}
cobj->resetHeightMap(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:resetHeightMap",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_resetHeightMap'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_setAlphaMap(lua_State* tolua_S)
{
int argc = 0;
@ -3957,62 +3703,6 @@ int lua_cocos2dx_3d_Terrain_initProperties(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_3d_Terrain_setLODDistance(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_setLODDistance'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 3)
{
double arg0;
double arg1;
double arg2;
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Terrain:setLODDistance");
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.Terrain:setLODDistance");
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.Terrain:setLODDistance");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_setLODDistance'", nullptr);
return 0;
}
cobj->setLODDistance(arg0, arg1, arg2);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:setLODDistance",argc, 3);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_setLODDistance'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_getNormal(lua_State* tolua_S)
{
int argc = 0;
@ -4066,6 +3756,157 @@ int lua_cocos2dx_3d_Terrain_getNormal(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_3d_Terrain_setDrawWire(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_setDrawWire'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Terrain:setDrawWire");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_setDrawWire'", nullptr);
return 0;
}
cobj->setDrawWire(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:setDrawWire",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_setDrawWire'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_reload(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_reload'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_reload'", nullptr);
return 0;
}
cobj->reload();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:reload",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_reload'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_setDetailMap(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_setDetailMap'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 2)
{
unsigned int arg0;
cocos2d::Terrain::DetailMap arg1;
ok &= luaval_to_uint32(tolua_S, 2,&arg0, "cc.Terrain:setDetailMap");
#pragma warning NO CONVERSION TO NATIVE FOR DetailMap
ok = false;
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_setDetailMap'", nullptr);
return 0;
}
cobj->setDetailMap(arg0, arg1);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:setDetailMap",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_setDetailMap'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_getImageHeight(lua_State* tolua_S)
{
int argc = 0;
@ -4119,53 +3960,6 @@ int lua_cocos2dx_3d_Terrain_getImageHeight(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_3d_Terrain_getMaxHeight(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_getMaxHeight'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_getMaxHeight'", nullptr);
return 0;
}
double ret = cobj->getMaxHeight();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:getMaxHeight",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_getMaxHeight'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_getMinHeight(lua_State* tolua_S)
{
int argc = 0;
@ -4213,6 +4007,259 @@ int lua_cocos2dx_3d_Terrain_getMinHeight(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_3d_Terrain_setLODDistance(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_setLODDistance'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 3)
{
double arg0;
double arg1;
double arg2;
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Terrain:setLODDistance");
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.Terrain:setLODDistance");
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.Terrain:setLODDistance");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_setLODDistance'", nullptr);
return 0;
}
cobj->setLODDistance(arg0, arg1, arg2);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:setLODDistance",argc, 3);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_setLODDistance'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_resetHeightMap(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_resetHeightMap'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
const char* arg0;
std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Terrain:resetHeightMap"); arg0 = arg0_tmp.c_str();
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_resetHeightMap'", nullptr);
return 0;
}
cobj->resetHeightMap(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:resetHeightMap",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_resetHeightMap'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_getMaxHeight(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_getMaxHeight'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_getMaxHeight'", nullptr);
return 0;
}
double ret = cobj->getMaxHeight();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:getMaxHeight",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_getMaxHeight'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_setMaxDetailMapAmount(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_setMaxDetailMapAmount'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Terrain:setMaxDetailMapAmount");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_setMaxDetailMapAmount'", nullptr);
return 0;
}
cobj->setMaxDetailMapAmount(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:setMaxDetailMapAmount",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_setMaxDetailMapAmount'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Terrain_setIsEnableFrustumCull(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Terrain* 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.Terrain",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Terrain*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Terrain_setIsEnableFrustumCull'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Terrain:setIsEnableFrustumCull");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_setIsEnableFrustumCull'", nullptr);
return 0;
}
cobj->setIsEnableFrustumCull(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Terrain:setIsEnableFrustumCull",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Terrain_setIsEnableFrustumCull'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_3d_Terrain_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Terrain)");
@ -4226,21 +4273,22 @@ int lua_register_cocos2dx_3d_Terrain(lua_State* tolua_S)
tolua_beginmodule(tolua_S,"Terrain");
tolua_function(tolua_S,"initHeightMap",lua_cocos2dx_3d_Terrain_initHeightMap);
tolua_function(tolua_S,"setMaxDetailMapAmount",lua_cocos2dx_3d_Terrain_setMaxDetailMapAmount);
tolua_function(tolua_S,"setDrawWire",lua_cocos2dx_3d_Terrain_setDrawWire);
tolua_function(tolua_S,"setIsEnableFrustumCull",lua_cocos2dx_3d_Terrain_setIsEnableFrustumCull);
tolua_function(tolua_S,"setDetailMap",lua_cocos2dx_3d_Terrain_setDetailMap);
tolua_function(tolua_S,"resetHeightMap",lua_cocos2dx_3d_Terrain_resetHeightMap);
tolua_function(tolua_S,"setAlphaMap",lua_cocos2dx_3d_Terrain_setAlphaMap);
tolua_function(tolua_S,"setSkirtHeightRatio",lua_cocos2dx_3d_Terrain_setSkirtHeightRatio);
tolua_function(tolua_S,"convertToTerrainSpace",lua_cocos2dx_3d_Terrain_convertToTerrainSpace);
tolua_function(tolua_S,"initTextures",lua_cocos2dx_3d_Terrain_initTextures);
tolua_function(tolua_S,"initProperties",lua_cocos2dx_3d_Terrain_initProperties);
tolua_function(tolua_S,"setLODDistance",lua_cocos2dx_3d_Terrain_setLODDistance);
tolua_function(tolua_S,"getNormal",lua_cocos2dx_3d_Terrain_getNormal);
tolua_function(tolua_S,"setDrawWire",lua_cocos2dx_3d_Terrain_setDrawWire);
tolua_function(tolua_S,"reload",lua_cocos2dx_3d_Terrain_reload);
tolua_function(tolua_S,"setDetailMap",lua_cocos2dx_3d_Terrain_setDetailMap);
tolua_function(tolua_S,"getImageHeight",lua_cocos2dx_3d_Terrain_getImageHeight);
tolua_function(tolua_S,"getMaxHeight",lua_cocos2dx_3d_Terrain_getMaxHeight);
tolua_function(tolua_S,"getMinHeight",lua_cocos2dx_3d_Terrain_getMinHeight);
tolua_function(tolua_S,"setLODDistance",lua_cocos2dx_3d_Terrain_setLODDistance);
tolua_function(tolua_S,"resetHeightMap",lua_cocos2dx_3d_Terrain_resetHeightMap);
tolua_function(tolua_S,"getMaxHeight",lua_cocos2dx_3d_Terrain_getMaxHeight);
tolua_function(tolua_S,"setMaxDetailMapAmount",lua_cocos2dx_3d_Terrain_setMaxDetailMapAmount);
tolua_function(tolua_S,"setIsEnableFrustumCull",lua_cocos2dx_3d_Terrain_setIsEnableFrustumCull);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Terrain).name();
g_luaType[typeName] = "cc.Terrain";

View File

@ -101,6 +101,7 @@ int register_all_cocos2dx_3d(lua_State* tolua_S);
#endif // __cocos2dx_3d_h__

View File

@ -8941,39 +8941,43 @@ int lua_cocos2dx_ui_Text_disableEffect(lua_State* tolua_S)
int argc = 0;
cocos2d::ui::Text* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_disableEffect'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Text_disableEffect'", nullptr);
return 0;
do{
if (argc == 1) {
cocos2d::LabelEffect arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.Text:disableEffect");
if (!ok) { break; }
cobj->disableEffect(arg0);
lua_settop(tolua_S, 1);
return 1;
}
cobj->disableEffect();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:disableEffect",argc, 0);
}while(0);
ok = true;
do{
if (argc == 0) {
cobj->disableEffect();
lua_settop(tolua_S, 1);
return 1;
}
}while(0);
ok = true;
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:disableEffect",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1

View File

@ -229,29 +229,29 @@ bool luaval_to_terraindata(lua_State* L, int lo, cocos2d::Terrain::TerrainData*
if (ok)
{
lua_pushstring(L, "chunkSize");
lua_pushstring(L, "_chunkSize");
lua_gettable(L,lo);
if (!lua_isnil(L, -1))
{
luaval_to_size(L, -1, &(outValue->chunkSize));
luaval_to_size(L, -1, &(outValue->_chunkSize));
}
else
{
outValue->chunkSize = cocos2d::Size(32, 32);
outValue->_chunkSize = cocos2d::Size(32, 32);
}
lua_pop(L, 1);
lua_pushstring(L, "heightMapSrc");
lua_pushstring(L, "_heightMapSrc");
lua_gettable(L,lo);
outValue->heightMapSrc = tolua_tocppstring(L, -1, "");
outValue->_heightMapSrc = tolua_tocppstring(L, -1, "");
lua_pop(L,1);
lua_pushstring(L, "alphaMapSrc");
lua_pushstring(L, "_alphaMapSrc");
lua_gettable(L,lo);
outValue->alphaMapSrc = const_cast<char*>(tolua_tocppstring(L, -1, ""));
outValue->_alphaMapSrc = const_cast<char*>(tolua_tocppstring(L, -1, ""));
lua_pop(L,1);
lua_pushstring(L, "detailMaps");
lua_pushstring(L, "_detailMaps");
lua_gettable(L,lo);
if (lua_istable(L, -1))
{
@ -262,14 +262,14 @@ bool luaval_to_terraindata(lua_State* L, int lo, cocos2d::Terrain::TerrainData*
lua_gettable(L,-2);
if (lua_istable(L, -1))
{
lua_pushstring(L, "detailMapSrc");
lua_pushstring(L, "_detailMapSrc");
lua_gettable(L,-2);
outValue->detailMaps[i].detailMapSrc = tolua_tocppstring(L, -1, "");
outValue->_detailMaps[i]._detailMapSrc = tolua_tocppstring(L, -1, "");
lua_pop(L,1);
lua_pushstring(L, "detailMapSize");
lua_pushstring(L, "_detailMapSize");
lua_gettable(L,-2);
outValue->detailMaps[i].detailMapSize = lua_isnil(L,-1) ? 0.0f : (float)lua_tonumber(L,-1);
outValue->_detailMaps[i]._detailMapSize = lua_isnil(L,-1) ? 0.0f : (float)lua_tonumber(L,-1);
lua_pop(L,1);
}
lua_pop(L, 1);
@ -277,14 +277,14 @@ bool luaval_to_terraindata(lua_State* L, int lo, cocos2d::Terrain::TerrainData*
}
lua_pop(L,1);
lua_pushstring(L, "mapHeight");
lua_pushstring(L, "_mapHeight");
lua_gettable(L,lo);
outValue->mapHeight = lua_isnil(L,-1) ? 2.0f : (float)lua_tonumber(L,-1);
outValue->_mapHeight = lua_isnil(L,-1) ? 2.0f : (float)lua_tonumber(L,-1);
lua_pop(L,1);
lua_pushstring(L, "mapScale");
lua_pushstring(L, "_mapScale");
lua_gettable(L,lo);
outValue->mapScale = lua_isnil(L,-1) ? 0.1f : (float)lua_tonumber(L,-1);
outValue->_mapScale = lua_isnil(L,-1) ? 0.1f : (float)lua_tonumber(L,-1);
lua_pop(L,1);
lua_pushstring(L, "_detailMapAmount");
@ -292,9 +292,9 @@ bool luaval_to_terraindata(lua_State* L, int lo, cocos2d::Terrain::TerrainData*
outValue->_detailMapAmount = lua_isnil(L,-1) ? 0 : (int)lua_tonumber(L,-1);
lua_pop(L,1);
lua_pushstring(L, "skirtHeightRatio");
lua_pushstring(L, "_skirtHeightRatio");
lua_gettable(L,lo);
outValue->skirtHeightRatio = lua_isnil(L,-1) ? 1.0f : (float)lua_tonumber(L,-1);
outValue->_skirtHeightRatio = lua_isnil(L,-1) ? 1.0f : (float)lua_tonumber(L,-1);
lua_pop(L,1);
}
@ -307,25 +307,25 @@ void terraindata_to_luaval(lua_State* L,const cocos2d::Terrain::TerrainData& inV
return;
lua_newtable(L);
lua_pushstring(L, "chunkSize");
size_to_luaval(L, inValue.chunkSize);
lua_pushstring(L, "_chunkSize");
size_to_luaval(L, inValue._chunkSize);
lua_rawset(L, -3);
if (inValue.heightMapSrc.length() > 0)
if (inValue._heightMapSrc.length() > 0)
{
lua_pushstring(L, "heightMapSrc");
lua_pushstring(L, inValue.heightMapSrc.c_str());
lua_pushstring(L, "_heightMapSrc");
lua_pushstring(L, inValue._heightMapSrc.c_str());
lua_rawset(L, -3);
}
if (nullptr != inValue.alphaMapSrc)
if (nullptr != inValue._alphaMapSrc)
{
lua_pushstring(L, "alphaMapSrc");
lua_pushstring(L, inValue.alphaMapSrc);
lua_pushstring(L, "_alphaMapSrc");
lua_pushstring(L, inValue._alphaMapSrc);
lua_rawset(L, -3);
}
lua_pushstring(L, "detailMaps");
lua_pushstring(L, "_detailMaps");
lua_newtable(L);
for (int i = 0; i < 4; i++)
{
@ -333,12 +333,12 @@ void terraindata_to_luaval(lua_State* L,const cocos2d::Terrain::TerrainData& inV
lua_pushnumber(L, (lua_Number) i + 1);
lua_newtable(L);
lua_pushstring(L, "detailMapSrc");
lua_pushstring(L, inValue.detailMaps[i].detailMapSrc.c_str());
lua_pushstring(L, "_detailMapSrc");
lua_pushstring(L, inValue._detailMaps[i]._detailMapSrc.c_str());
lua_rawset(L, -3);
lua_pushstring(L, "detailMapSize");
lua_pushnumber(L, (lua_Number)inValue.detailMaps[i].detailMapSize);
lua_pushstring(L, "_detailMapSize");
lua_pushnumber(L, (lua_Number)inValue._detailMaps[i]._detailMapSize);
lua_rawset(L, -3);
lua_rawset(L, -3);
@ -346,20 +346,20 @@ void terraindata_to_luaval(lua_State* L,const cocos2d::Terrain::TerrainData& inV
lua_rawset(L, -3);
lua_pushstring(L, "mapHeight");
lua_pushnumber(L, (lua_Number)inValue.mapHeight);
lua_pushstring(L, "_mapHeight");
lua_pushnumber(L, (lua_Number)inValue._mapHeight);
lua_rawset(L, -3);
lua_pushstring(L, "mapScale");
lua_pushnumber(L, (lua_Number)inValue.mapScale);
lua_pushstring(L, "_mapScale");
lua_pushnumber(L, (lua_Number)inValue._mapScale);
lua_rawset(L, -3);
lua_pushstring(L, "_detailMapAmount");
lua_pushnumber(L, (lua_Number)inValue._detailMapAmount);
lua_rawset(L, -3);
lua_pushstring(L, "skirtHeightRatio");
lua_pushnumber(L, (lua_Number)inValue.skirtHeightRatio);
lua_pushstring(L, "_skirtHeightRatio");
lua_pushnumber(L, (lua_Number)inValue._skirtHeightRatio);
lua_rawset(L, -3);
}

View File

@ -31,7 +31,7 @@ NS_CC_BEGIN
namespace ui {
static const int LABEL_RENDERER_Z = (-1);
IMPLEMENT_CLASS_GUI_INFO(Text)
Text::Text():
@ -49,7 +49,7 @@ _type(Type::SYSTEM)
Text::~Text()
{
}
Text* Text::create()
@ -72,7 +72,7 @@ bool Text::init()
}
return false;
}
Text* Text::create(const std::string &textContent, const std::string &fontName, int fontSize)
{
Text *text = new (std::nothrow) Text;
@ -84,7 +84,7 @@ Text* Text::create(const std::string &textContent, const std::string &fontName,
CC_SAFE_DELETE(text);
return nullptr;
}
bool Text::init(const std::string &textContent, const std::string &fontName, int fontSize)
{
bool ret = true;
@ -108,7 +108,7 @@ void Text::initRenderer()
addProtectedChild(_labelRenderer, LABEL_RENDERER_Z, -1);
}
void Text::setString(const std::string &text)
{
if (text == _labelRenderer->getString())
@ -119,7 +119,7 @@ void Text::setString(const std::string &text)
updateContentSizeWithTextureSize(_labelRenderer->getContentSize());
_labelRendererAdaptDirty = true;
}
const std::string& Text::getString() const
{
return _labelRenderer->getString();
@ -146,7 +146,7 @@ void Text::setFontSize(int size)
updateContentSizeWithTextureSize(_labelRenderer->getContentSize());
_labelRendererAdaptDirty = true;
}
int Text::getFontSize()const
{
return _fontSize;
@ -175,12 +175,12 @@ void Text::setFontName(const std::string& name)
updateContentSizeWithTextureSize(_labelRenderer->getContentSize());
_labelRendererAdaptDirty = true;
}
const std::string& Text::getFontName()const
{
return _fontName;
}
Text::Type Text::getType() const
{
return _type;
@ -196,7 +196,7 @@ void Text::setTextAreaSize(const Size &size)
updateContentSizeWithTextureSize(_labelRenderer->getContentSize());
_labelRendererAdaptDirty = true;
}
const Size& Text::getTextAreaSize()const
{
return _labelRenderer->getDimensions();
@ -206,7 +206,7 @@ void Text::setTextHorizontalAlignment(TextHAlignment alignment)
{
_labelRenderer->setHorizontalAlignment(alignment);
}
TextHAlignment Text::getTextHorizontalAlignment()const
{
return _labelRenderer->getHorizontalAlignment();
@ -216,17 +216,17 @@ void Text::setTextVerticalAlignment(TextVAlignment alignment)
{
_labelRenderer->setVerticalAlignment(alignment);
}
TextVAlignment Text::getTextVerticalAlignment()const
{
return _labelRenderer->getVerticalAlignment();
}
void Text::setTextColor(const Color4B color)
{
_labelRenderer->setTextColor(color);
}
const Color4B& Text::getTextColor() const
{
return _labelRenderer->getTextColor();
@ -236,7 +236,7 @@ void Text::setTouchScaleChangeEnabled(bool enable)
{
_touchScaleChangeEnabled = enable;
}
bool Text::isTouchScaleChangeEnabled()const
{
return _touchScaleChangeEnabled;
@ -264,7 +264,7 @@ void Text::onPressStateChangedToPressed()
void Text::onPressStateChangedToDisabled()
{
}
void Text::onSizeChanged()
@ -272,7 +272,7 @@ void Text::onSizeChanged()
Widget::onSizeChanged();
_labelRendererAdaptDirty = true;
}
void Text::adaptRenderers()
{
if (_labelRendererAdaptDirty)
@ -336,7 +336,7 @@ std::string Text::getDescription() const
{
return "Label";
}
void Text::enableShadow(const Color4B& shadowColor,const Size &offset, int blurRadius)
{
_labelRenderer->enableShadow(shadowColor, offset, blurRadius);
@ -345,8 +345,10 @@ void Text::enableShadow(const Color4B& shadowColor,const Size &offset, int blurR
void Text::enableOutline(const Color4B& outlineColor,int outlineSize)
{
_labelRenderer->enableOutline(outlineColor, outlineSize);
updateContentSizeWithTextureSize(_labelRenderer->getContentSize());
_labelRendererAdaptDirty = true;
}
void Text::enableGlow(const Color4B& glowColor)
{
if (_type == Type::TTF)
@ -356,6 +358,19 @@ void Text::enableGlow(const Color4B& glowColor)
void Text::disableEffect()
{
_labelRenderer->disableEffect();
updateContentSizeWithTextureSize(_labelRenderer->getContentSize());
_labelRendererAdaptDirty = true;
}
void Text::disableEffect(LabelEffect effect)
{
_labelRenderer->disableEffect(effect);
//only outline effect will affect the content size of label
if(LabelEffect::OUTLINE == effect)
{
updateContentSizeWithTextureSize(_labelRenderer->getContentSize());
_labelRendererAdaptDirty = true;
}
}
Widget* Text::createCloneInstance()

View File

@ -27,6 +27,7 @@ THE SOFTWARE.
#include "ui/UIWidget.h"
#include "ui/GUIExport.h"
#include "base/ccTypes.h"
/**
* @addtogroup ui
@ -44,9 +45,9 @@ namespace ui {
*/
class CC_GUI_DLL Text : public Widget
{
DECLARE_CLASS_GUI_INFO
public:
/** Type Text type.
*/
@ -75,12 +76,17 @@ public:
* @return An autoreleased Text object.
*/
static Text* create();
/**
* Create a Text object with textContent, fontName and fontSize.
* The fontName could be a system font name or a TTF file path.
* Usage: Text *text = Text::create("Hello", "Arial", 20); //create a system font UIText.
* Text *text = Text::create("Hello", "xxx\xxx.ttf", 20); //create a TTF font UIText.
* Usage:
* @code
* //create a system font UIText.
* Text *text = Text::create("Hello", "Arial", 20);
* //create a TTF font UIText.
* Text *text = Text::create("Hello", "xxx\xxx.ttf", 20);
* @endcode
*
* @param textContent Text content string.
* @param fontName A given font name.
@ -96,7 +102,10 @@ public:
*
* @param text String value.
*/
CC_DEPRECATED_ATTRIBUTE void setText(const std::string& text){this->setString(text);}
CC_DEPRECATED_ATTRIBUTE void setText(const std::string& text)
{
this->setString(text);
}
void setString(const std::string& text);
/**
@ -104,13 +113,17 @@ public:
*
* @return String value.
*/
CC_DEPRECATED_ATTRIBUTE const std::string& getStringValue(){ return this->getString();}
CC_DEPRECATED_ATTRIBUTE const std::string& getStringValue()
{
return this->getString();
}
const std::string& getString()const;
/**
* Gets the string length of the label.
* Note: This length will be larger than the raw string length,
* if you want to get the raw string length, you should call this->getString().size() instead.
* if you want to get the raw string length,
* you should call this->getString().size() instead.
*
* @return String length.
*/
@ -134,9 +147,15 @@ public:
* Sets the font name of label.
* If you are trying to use a system font, you could just pass a font name
* If you are trying to use a TTF, you should pass a file path to the TTF file
* Usage: Text *text = Text::create("Hello", "Arial", 20); //create a system font UIText
* text->setFontName("Marfelt"); // it will change the font to system font no matter the previous font type is TTF or system font
* text->setFontName("xxxx/xxx.ttf"); //it will change the font to TTF font no matter the previous font type is TTF or system font
* Usage:
* @code
* //create a system font UIText
* Text *text = Text::create("Hello", "Arial", 20);
* // it will change the font to system font no matter the previous font type is TTF or system font
* text->setFontName("Marfelt");
* //it will change the font to TTF font no matter the previous font type is TTF or system font
* text->setFontName("xxxx/xxx.ttf");
* @endcode
* @param name Font name.
*/
void setFontName(const std::string& name);
@ -146,7 +165,7 @@ public:
* @return Font name.
*/
const std::string& getFontName()const;
/** Gets the font type.
* @return The font type.
*/
@ -222,19 +241,19 @@ public:
* @return Vertical text alignment type
*/
TextVAlignment getTextVerticalAlignment()const;
/** Sets text color.
*
* @param color Text color.
*/
void setTextColor(const Color4B color);
/** Gets text color.
*
* @return Text color.
*/
const Color4B& getTextColor() const;
/**
* Enable shadow for the label.
*
@ -244,27 +263,37 @@ public:
* @param offset The offset of shadow effect.
* @param blurRadius The blur radius of shadow effect.
*/
void enableShadow(const Color4B& shadowColor = Color4B::BLACK,const Size &offset = Size(2,-2), int blurRadius = 0);
void enableShadow(const Color4B& shadowColor = Color4B::BLACK,
const Size &offset = Size(2,-2),
int blurRadius = 0);
/**
* Enable outline for the label.
* It only works on IOS and Android when you use System fonts.
*
* @param outlineColor The color of outline.
* @param outlineSize The size of outline.
*/
*/
void enableOutline(const Color4B& outlineColor,int outlineSize = 1);
/** Only support for TTF.
*
* @param glowColor The color of glow.
*/
void enableGlow(const Color4B& glowColor);
/** Disable shadow/outline/glow rendering.
/** Disable all text effects, including shadow, outline and glow.
*/
void disableEffect();
/**
* Disable specific text effect.
* Use LabelEffect parameter to specify which effect should be disabled.
*
* @see `LabelEffect`
*/
void disableEffect(LabelEffect effect);
CC_CONSTRUCTOR_ACCESS:
virtual bool init() override;
virtual bool init(const std::string& textContent,
@ -277,7 +306,7 @@ protected:
virtual void onPressStateChangedToPressed() override;
virtual void onPressStateChangedToDisabled() override;
virtual void onSizeChanged() override;
void labelScaleChangedWithSize();
virtual Widget* createCloneInstance() override;
virtual void copySpecialProperties(Widget* model) override;

View File

@ -18,6 +18,7 @@
- [Features in detail](#features-in-detail-1)
- [3D TextureCube](#3d-texturecube)
- [3D Skybox](#3d-skybox)
- [3D Terrain](#3d-terrain)
- [Animate3D Quality Control](#animate3d-quality-control)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@ -118,6 +119,11 @@ Please refer to this document: [ReadMe](../README.md)
* 3D: added terrian support
* uses luajit v2.1-20150331 on 64-bit iOS devices
* added test automation support for cpp-tests
* 3rd: updated libcurl to v7.4 on all supported platforms except WP8/WP8.1 universal
* 3rd: updated chipmunk to v6.2.2
* 3rd: updated openssl to v1.0.11
* 3rd: updated freetype to v2.5.5
* 3rd: updated png to v1.6.16 on all supported platforms except WP8/WP8.1 universal because it is not needed on these two platforms
## Features in detail
@ -177,6 +183,30 @@ addChild(_skyBox);
For more information please refer to cpp-tests/Sprite3DTest/Sprite3DCubeMapTest.
### 3D Terrain
Terrain is an important component in 3D game. A texture is used to stand for the height map. And up to 4 textures can be used to blend the details of the terrain, grass, road, and so on.
Usage of terrain
```c++
//blended layers
Terrain::DetailMap dirt("TerrainTest/dirt.jpg"), grass("TerrainTest/Grass2.jpg"), road("TerrainTest/road.jpg"), green("TerrainTest/GreenSkin.jpg");
//height map, alpha map (blend weight), and blended layers
Terrain::TerrainData data("TerrainTest/heightmap16.jpg", "TerrainTest/alphamap.png", dirt, grass, road, green);
//create terrain here
_terrain = Terrain::create(data,Terrain::CrackFixedType::SKIRT);
//set lod distance
_terrain->setLODDistance(3.2,6.4,9.6);
//it must be less than 5
_terrain->setMaxDetailMapAmount(4);
addChild(_terrain);
```
For more information please refer to cpp-tests/Sprite3DTest/TerrainTest.
### Animate3D Quality Control
In order to make `Animate3D` run fast, you can use low quality animation.

View File

@ -284,15 +284,11 @@ void PURibbonTrail::updateTrail(size_t index, const Node* node)
Element& nextElem = _chainElementList[seg.start + nextElemIdx];
// Vary the head elem, but bake new version if that exceeds element len
Mat4 toWMat = node->getNodeToWorldTransform();
Vec3 newPos(toWMat.m[12], toWMat.m[13], toWMat.m[14]);
Vec3 newPos = node->getPosition3D();
if (_parentNode)
{
Mat4 toLMat = _parentNode->getWorldToNodeTransform() * toWMat;
// Transform position to ourself space
newPos.x = (toLMat).m[12];
newPos.y = (toLMat).m[13];
newPos.z = (toLMat).m[14];
_parentNode->getWorldToNodeTransform().transformPoint(newPos, &newPos);
}
Vec3 diff = newPos - nextElem.position;
float sqlen = diff.lengthSquared();
@ -344,7 +340,7 @@ void PURibbonTrail::updateTrail(size_t index, const Node* node)
}
} // end while
_vertexContentDirty = true;
// Need to dirty the parent node, but can't do it using needUpdate() here
// since we're in the middle of the scene graph update (node listener),
// so re-entrant calls don't work. Queue.
@ -393,15 +389,11 @@ void PURibbonTrail::resetTrail(size_t index, const Node* node)
seg.head = seg.tail = SEGMENT_EMPTY;
// Create new element, v coord is always 0.0f
// need to convert to take parent node's position into account
Mat4 toWMat = node->getNodeToWorldTransform();
Vec3 position(toWMat.m[12], toWMat.m[13], toWMat.m[14]);
Vec3 position = node->getPosition3D();
if (_parentNode)
{
Mat4 toLMat = _parentNode->getWorldToNodeTransform() * toWMat;
// Transform position to ourself space
position.x = (toLMat).m[12];
position.y = (toLMat).m[13];
position.z = (toLMat).m[14];
_parentNode->getWorldToNodeTransform().transformPoint(position, &position);
}
Element e(position,
_initialWidth[index], 0.0f, _initialColor[index], node->getRotationQuat());

View File

@ -1,511 +0,0 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2013 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
# define Z_PREFIX_SET
/* all linked symbols */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_bits z__tr_flush_bits
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# ifndef Z_SOLO
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# endif
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
# define deflatePending z_deflatePending
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateResetKeep z_deflateResetKeep
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# ifdef _WIN32
# define gzopen_w z_gzopen_w
# endif
# define gzprintf z_gzprintf
# define gzvprintf z_gzvprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzwrite z_gzwrite
# endif
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit_ z_inflateBackInit_
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetHeader z_inflateGetHeader
# define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateSetDictionary z_inflateSetDictionary
# define inflateGetDictionary z_inflateGetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflateResetKeep z_inflateResetKeep
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# ifndef Z_SOLO
# define uncompress z_uncompress
# endif
# define zError z_zError
# ifndef Z_SOLO
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# ifndef Z_SOLO
# define gzFile z_gzFile
# endif
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
#else
# define z_const
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
#ifndef Z_ARG /* function prototypes for stdarg */
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
# define Z_ARG(args) args
# else
# define Z_ARG(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# elif (ULONG_MAX == 0xffffffffUL)
# define Z_U4 unsigned long
# elif (USHRT_MAX == 0xffffffffUL)
# define Z_U4 unsigned short
# endif
#endif
#ifdef Z_U4
typedef Z_U4 z_crc_t;
#else
typedef unsigned long z_crc_t;
#endif
#if 1 /* was set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#if 1 /* was set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
#endif
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
# include <stdarg.h> /* for va_list */
# endif
#endif
#ifdef _WIN32
# ifndef Z_SOLO
# include <stddef.h> /* for wchar_t */
# endif
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
# define Z_HAVE_UNISTD_H
#endif
#ifndef Z_SOLO
# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET) && !defined(Z_SOLO)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos_zlib_static
LOCAL_MODULE_FILENAME := zlib
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libz.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../include
include $(PREBUILT_STATIC_LIBRARY)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2177,103 +2177,13 @@
"external/freetype2/include/win32/freetype2/tttables.h",
"external/freetype2/include/win32/freetype2/tttags.h",
"external/freetype2/include/win32/freetype2/ttunpat.h",
"external/freetype2/include/winrt/README.txt",
"external/freetype2/include/winrt/freetype/config/ftconfig.h",
"external/freetype2/include/winrt/freetype/config/ftheader.h",
"external/freetype2/include/winrt/freetype/config/ftmodule.h",
"external/freetype2/include/winrt/freetype/config/ftoption.h",
"external/freetype2/include/winrt/freetype/config/ftstdlib.h",
"external/freetype2/include/winrt/freetype/freetype.h",
"external/freetype2/include/winrt/freetype/ftadvanc.h",
"external/freetype2/include/winrt/freetype/ftautoh.h",
"external/freetype2/include/winrt/freetype/ftbbox.h",
"external/freetype2/include/winrt/freetype/ftbdf.h",
"external/freetype2/include/winrt/freetype/ftbitmap.h",
"external/freetype2/include/winrt/freetype/ftbzip2.h",
"external/freetype2/include/winrt/freetype/ftcache.h",
"external/freetype2/include/winrt/freetype/ftcffdrv.h",
"external/freetype2/include/winrt/freetype/ftchapters.h",
"external/freetype2/include/winrt/freetype/ftcid.h",
"external/freetype2/include/winrt/freetype/fterrdef.h",
"external/freetype2/include/winrt/freetype/fterrors.h",
"external/freetype2/include/winrt/freetype/ftgasp.h",
"external/freetype2/include/winrt/freetype/ftglyph.h",
"external/freetype2/include/winrt/freetype/ftgxval.h",
"external/freetype2/include/winrt/freetype/ftgzip.h",
"external/freetype2/include/winrt/freetype/ftimage.h",
"external/freetype2/include/winrt/freetype/ftincrem.h",
"external/freetype2/include/winrt/freetype/ftlcdfil.h",
"external/freetype2/include/winrt/freetype/ftlist.h",
"external/freetype2/include/winrt/freetype/ftlzw.h",
"external/freetype2/include/winrt/freetype/ftmac.h",
"external/freetype2/include/winrt/freetype/ftmm.h",
"external/freetype2/include/winrt/freetype/ftmodapi.h",
"external/freetype2/include/winrt/freetype/ftmoderr.h",
"external/freetype2/include/winrt/freetype/ftotval.h",
"external/freetype2/include/winrt/freetype/ftoutln.h",
"external/freetype2/include/winrt/freetype/ftpfr.h",
"external/freetype2/include/winrt/freetype/ftrender.h",
"external/freetype2/include/winrt/freetype/ftsizes.h",
"external/freetype2/include/winrt/freetype/ftsnames.h",
"external/freetype2/include/winrt/freetype/ftstroke.h",
"external/freetype2/include/winrt/freetype/ftsynth.h",
"external/freetype2/include/winrt/freetype/ftsystem.h",
"external/freetype2/include/winrt/freetype/fttrigon.h",
"external/freetype2/include/winrt/freetype/ftttdrv.h",
"external/freetype2/include/winrt/freetype/fttypes.h",
"external/freetype2/include/winrt/freetype/ftwinfnt.h",
"external/freetype2/include/winrt/freetype/ftxf86.h",
"external/freetype2/include/winrt/freetype/internal/autohint.h",
"external/freetype2/include/winrt/freetype/internal/ftcalc.h",
"external/freetype2/include/winrt/freetype/internal/ftdebug.h",
"external/freetype2/include/winrt/freetype/internal/ftdriver.h",
"external/freetype2/include/winrt/freetype/internal/ftgloadr.h",
"external/freetype2/include/winrt/freetype/internal/ftmemory.h",
"external/freetype2/include/winrt/freetype/internal/ftobjs.h",
"external/freetype2/include/winrt/freetype/internal/ftpic.h",
"external/freetype2/include/winrt/freetype/internal/ftrfork.h",
"external/freetype2/include/winrt/freetype/internal/ftserv.h",
"external/freetype2/include/winrt/freetype/internal/ftstream.h",
"external/freetype2/include/winrt/freetype/internal/fttrace.h",
"external/freetype2/include/winrt/freetype/internal/ftvalid.h",
"external/freetype2/include/winrt/freetype/internal/internal.h",
"external/freetype2/include/winrt/freetype/internal/psaux.h",
"external/freetype2/include/winrt/freetype/internal/pshints.h",
"external/freetype2/include/winrt/freetype/internal/services/svbdf.h",
"external/freetype2/include/winrt/freetype/internal/services/svcid.h",
"external/freetype2/include/winrt/freetype/internal/services/svgldict.h",
"external/freetype2/include/winrt/freetype/internal/services/svgxval.h",
"external/freetype2/include/winrt/freetype/internal/services/svkern.h",
"external/freetype2/include/winrt/freetype/internal/services/svmm.h",
"external/freetype2/include/winrt/freetype/internal/services/svotval.h",
"external/freetype2/include/winrt/freetype/internal/services/svpfr.h",
"external/freetype2/include/winrt/freetype/internal/services/svpostnm.h",
"external/freetype2/include/winrt/freetype/internal/services/svprop.h",
"external/freetype2/include/winrt/freetype/internal/services/svpscmap.h",
"external/freetype2/include/winrt/freetype/internal/services/svpsinfo.h",
"external/freetype2/include/winrt/freetype/internal/services/svsfnt.h",
"external/freetype2/include/winrt/freetype/internal/services/svttcmap.h",
"external/freetype2/include/winrt/freetype/internal/services/svtteng.h",
"external/freetype2/include/winrt/freetype/internal/services/svttglyf.h",
"external/freetype2/include/winrt/freetype/internal/services/svwinfnt.h",
"external/freetype2/include/winrt/freetype/internal/services/svxf86nm.h",
"external/freetype2/include/winrt/freetype/internal/sfnt.h",
"external/freetype2/include/winrt/freetype/internal/t1types.h",
"external/freetype2/include/winrt/freetype/internal/tttypes.h",
"external/freetype2/include/winrt/freetype/t1tables.h",
"external/freetype2/include/winrt/freetype/ttnameid.h",
"external/freetype2/include/winrt/freetype/tttables.h",
"external/freetype2/include/winrt/freetype/tttags.h",
"external/freetype2/include/winrt/freetype/ttunpat.h",
"external/freetype2/include/winrt/ft2build.h",
"external/freetype2/include/winrt/proj.winrt/freetype.vcxproj",
"external/freetype2/include/winrt/proj.winrt/freetype.vcxproj.filters",
"external/freetype2/include/winrt_8.1/freetype/config/ftconfig.h",
"external/freetype2/include/winrt_8.1/freetype/config/ftheader.h",
"external/freetype2/include/winrt_8.1/freetype/config/ftmodule.h",
"external/freetype2/include/winrt_8.1/freetype/config/ftoption.h",
"external/freetype2/include/winrt_8.1/freetype/config/ftstdlib.h",
"external/freetype2/include/winrt_8.1/freetype/freetype.h",
"external/freetype2/include/winrt_8.1/freetype/ft2build.h",
"external/freetype2/include/winrt_8.1/freetype/ftadvanc.h",
"external/freetype2/include/winrt_8.1/freetype/ftautoh.h",
"external/freetype2/include/winrt_8.1/freetype/ftbbox.h",
@ -2355,14 +2265,16 @@
"external/freetype2/include/winrt_8.1/freetype/tttables.h",
"external/freetype2/include/winrt_8.1/freetype/tttags.h",
"external/freetype2/include/winrt_8.1/freetype/ttunpat.h",
"external/freetype2/include/winrt_8.1/ft2build.h",
"external/freetype2/include/wp8/README.txt",
"external/freetype2/include/wp8/freetype/FTL.TXT",
"external/freetype2/include/wp8/freetype/GPLv2.TXT",
"external/freetype2/include/wp8/freetype/LICENSE.TXT",
"external/freetype2/include/wp8/freetype/config/ftconfig.h",
"external/freetype2/include/wp8/freetype/config/ftheader.h",
"external/freetype2/include/wp8/freetype/config/ftmodule.h",
"external/freetype2/include/wp8/freetype/config/ftoption.h",
"external/freetype2/include/wp8/freetype/config/ftstdlib.h",
"external/freetype2/include/wp8/freetype/freetype.h",
"external/freetype2/include/wp8/freetype/ft2build.h",
"external/freetype2/include/wp8/freetype/ftadvanc.h",
"external/freetype2/include/wp8/freetype/ftautoh.h",
"external/freetype2/include/wp8/freetype/ftbbox.h",
@ -2444,16 +2356,13 @@
"external/freetype2/include/wp8/freetype/tttables.h",
"external/freetype2/include/wp8/freetype/tttags.h",
"external/freetype2/include/wp8/freetype/ttunpat.h",
"external/freetype2/include/wp8/ft2build.h",
"external/freetype2/include/wp8/proj.wp8/freetype.sln",
"external/freetype2/include/wp8/proj.wp8/freetype.vcxproj",
"external/freetype2/include/wp8/proj.wp8/freetype.vcxproj.filters",
"external/freetype2/include/wp_8.1/freetype/config/ftconfig.h",
"external/freetype2/include/wp_8.1/freetype/config/ftheader.h",
"external/freetype2/include/wp_8.1/freetype/config/ftmodule.h",
"external/freetype2/include/wp_8.1/freetype/config/ftoption.h",
"external/freetype2/include/wp_8.1/freetype/config/ftstdlib.h",
"external/freetype2/include/wp_8.1/freetype/freetype.h",
"external/freetype2/include/wp_8.1/freetype/ft2build.h",
"external/freetype2/include/wp_8.1/freetype/ftadvanc.h",
"external/freetype2/include/wp_8.1/freetype/ftautoh.h",
"external/freetype2/include/wp_8.1/freetype/ftbbox.h",
@ -2535,7 +2444,6 @@
"external/freetype2/include/wp_8.1/freetype/tttables.h",
"external/freetype2/include/wp_8.1/freetype/tttags.h",
"external/freetype2/include/wp_8.1/freetype/ttunpat.h",
"external/freetype2/include/wp_8.1/ft2build.h",
"external/freetype2/prebuilt/android/Android.mk",
"external/freetype2/prebuilt/android/armeabi-v7a/libfreetype.a",
"external/freetype2/prebuilt/android/armeabi/libfreetype.a",
@ -2545,8 +2453,6 @@
"external/freetype2/prebuilt/linux/64-bit/libfreetype.a",
"external/freetype2/prebuilt/mac/libfreetype.a",
"external/freetype2/prebuilt/win32/freetype250.lib",
"external/freetype2/prebuilt/winrt/ARM/freetype.lib",
"external/freetype2/prebuilt/winrt/Win32/freetype.lib",
"external/freetype2/prebuilt/winrt_8.1/arm/freetype250.lib",
"external/freetype2/prebuilt/winrt_8.1/win32/freetype250.lib",
"external/freetype2/prebuilt/wp8/ARM/freetype.lib",

View File

@ -70,6 +70,8 @@ void Cocos2dRenderer::Resume()
else
{
Application::getInstance()->applicationWillEnterForeground();
cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND);
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent);
}
}
@ -77,8 +79,8 @@ void Cocos2dRenderer::Pause()
{
if (Director::getInstance()->getOpenGLView()) {
Application::getInstance()->applicationDidEnterBackground();
//cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);
//cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent);
cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent);
}
}
@ -135,9 +137,4 @@ void Cocos2dRenderer::QueuePointerEvent(cocos2d::PointerEventType type, Windows:
GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args);
}
void Cocos2dRenderer::QueueKeyBoardEvent(cocos2d::Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e)
{
//GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, e);
}

View File

@ -35,7 +35,6 @@ namespace cocos2d
~Cocos2dRenderer();
void Draw(GLsizei width, GLsizei height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation);
void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
void QueueKeyBoardEvent(Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e);
void Pause();
void Resume();
void DeviceLost();

View File

@ -2,6 +2,8 @@
#include "../testResource.h"
#include "cocos2d.h"
USING_NS_CC;
enum
{
kTagNode,

View File

@ -9,7 +9,7 @@ DEFINE_TEST_SUITE(ActionManagerTests);
class ActionManagerTest : public TestCase
{
protected:
TextureAtlas* _atlas;
cocos2d::TextureAtlas* _atlas;
std::string _title;

View File

@ -26,6 +26,8 @@
#include "ActionsEaseTest.h"
#include "../testResource.h"
USING_NS_CC;
enum {
kTagAction1 = 1,
kTagAction2 = 2,

View File

@ -30,16 +30,14 @@
#include "../testBasic.h"
#include "../BaseTest.h"
USING_NS_CC;
DEFINE_TEST_SUITE(ActionsEaseTests);
class EaseSpriteDemo : public TestCase
{
protected:
Sprite* _grossini;
Sprite* _tamara;
Sprite* _kathia;
cocos2d::Sprite* _grossini;
cocos2d::Sprite* _tamara;
cocos2d::Sprite* _kathia;
std::string _title;

View File

@ -26,6 +26,8 @@
#include "ActionsProgressTest.h"
#include "../testResource.h"
USING_NS_CC;
ActionsProgressTests::ActionsProgressTests()
{
ADD_TEST_CASE(SpriteProgressToRadial);

View File

@ -31,6 +31,8 @@
#include "renderer/CCCustomCommand.h"
#include "renderer/CCGroupCommand.h"
USING_NS_CC;
ActionsTests::ActionsTests()
{
ADD_TEST_CASE(ActionManual);
@ -1397,9 +1399,9 @@ void ActionStacked::onEnter()
this->centerSprites(0);
/*auto listener = EventListenerTouchAllAtOnce::create();
auto listener = EventListenerTouchAllAtOnce::create();
listener->onTouchesEnded = CC_CALLBACK_2(ActionStacked::onTouchesEnded, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);*/
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
auto s = Director::getInstance()->getWinSize();
this->addNewSpriteWithCoords(Vec2(s.width/2, s.height/2));
@ -1425,14 +1427,13 @@ void ActionStacked::runActionsInSprite(Sprite *sprite)
// override me
}
/*
void ActionStacked::onTouchesEnded(const std::vector<Touch*>& touches, Event* event)
{
for ( auto &touch: touches ) {
auto location = touch->getLocation();
addNewSpriteWithCoords( location );
}
}*/
}
std::string ActionStacked::title() const
{

View File

@ -29,16 +29,14 @@
#include "../testBasic.h"
#include "../BaseTest.h"
USING_NS_CC;
DEFINE_TEST_SUITE(ActionsTests);
class ActionsDemo : public TestCase
{
protected:
Sprite* _grossini;
Sprite* _tamara;
Sprite* _kathia;
cocos2d::Sprite* _grossini;
cocos2d::Sprite* _tamara;
cocos2d::Sprite* _kathia;
public:
virtual void onEnter() override;
virtual void onExit() override;
@ -194,7 +192,7 @@ public:
virtual std::string subtitle() const override;
private:
EventListenerCustom* _frameDisplayedListener;
cocos2d::EventListenerCustom* _frameDisplayedListener;
};
class ActionSequence : public ActionsDemo
@ -405,9 +403,9 @@ public:
virtual void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void addNewSpriteWithCoords(Vec2 p);
virtual void runActionsInSprite(Sprite* sprite);
//void onTouchesEnded(const std::vector<Touch*>& touches, Event* event) override;
virtual void addNewSpriteWithCoords(cocos2d::Vec2 p);
virtual void runActionsInSprite(cocos2d::Sprite* sprite);
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
};
class ActionMoveStacked : public ActionStacked
@ -416,7 +414,7 @@ public:
CREATE_FUNC(ActionMoveStacked);
virtual std::string title() const override;
virtual void runActionsInSprite(Sprite* sprite) override;
virtual void runActionsInSprite(cocos2d::Sprite* sprite) override;
};
class ActionMoveJumpStacked : public ActionStacked
@ -425,7 +423,7 @@ public:
CREATE_FUNC(ActionMoveJumpStacked);
virtual std::string title() const override;
virtual void runActionsInSprite(Sprite* sprite) override;
virtual void runActionsInSprite(cocos2d::Sprite* sprite) override;
};
class ActionMoveBezierStacked : public ActionStacked
@ -434,7 +432,7 @@ public:
CREATE_FUNC(ActionMoveBezierStacked);
virtual std::string title() const override;
virtual void runActionsInSprite(Sprite* sprite) override;
virtual void runActionsInSprite(cocos2d::Sprite* sprite) override;
};
class ActionCatmullRomStacked : public ActionsDemo
@ -470,7 +468,7 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
private:
Sprite* _spriteTmp;
cocos2d::Sprite* _spriteTmp;
};
class Issue1305_2 : public ActionsDemo
@ -515,7 +513,7 @@ public:
virtual void onEnter() override;
virtual std::string subtitle() const override;
virtual std::string title() const override;
void logSprRotation(Sprite* sender);
void logSprRotation(cocos2d::Sprite* sender);
};
class Issue1398 : public ActionsDemo
@ -579,7 +577,7 @@ public:
virtual std::string subtitle() const override;
virtual std::string title() const override;
private:
Vector<Node*> _pausedTargets;
cocos2d::Vector<Node*> _pausedTargets;
};
#endif

View File

@ -27,6 +27,10 @@
#include "cocos2d.h"
#include <chrono>
USING_NS_CC;
USING_NS_CC_EXT;
using namespace cocos2d::ui;
AllocatorTests::AllocatorTests()
{
ADD_TEST_CASE(AllocatorTest);

View File

@ -43,7 +43,7 @@ public:
virtual void initGLContextAttrs();
/**
@brief Implement Director and Scene init code here.
@brief Implement Director and cocos2d::Scene* init code here.
@return true Initialize success, app continue.
@return false Initialize failed, app terminate.
*/

View File

@ -27,6 +27,9 @@
#include "controller.h"
USING_NS_CC;
USING_NS_CC_EXT;
#define TABEL_LABEL_TAG 1024
TestBase::TestBase()
: _parentTest(nullptr)
@ -50,9 +53,82 @@ void TestBase::backsUpOneLevel()
}
//TestList
class TestCustomTableView : public TableView
{
public:
static TestCustomTableView* create(TableViewDataSource* dataSource, Size size)
{
auto table = new (std::nothrow) TestCustomTableView();
table->initWithViewSize(size, nullptr);
table->autorelease();
table->setDataSource(dataSource);
table->_updateCellPositions();
table->_updateContentSize();
return table;
}
virtual void onTouchEnded(Touch *touch, Event *event) override
{
if (!this->isVisible())
{
return;
}
if (_touchedCell)
{
auto label = (Label*)_touchedCell->getChildByTag(TABEL_LABEL_TAG);
Rect bbox = label->getBoundingBox();
bbox.origin = _touchedCell->convertToWorldSpace(bbox.origin);
if (bbox.containsPoint(touch->getLocation()) && _tableViewDelegate != nullptr)
{
_tableViewDelegate->tableCellUnhighlight(this, _touchedCell);
_tableViewDelegate->tableCellTouched(this, _touchedCell);
}
_touchedCell = nullptr;
}
ScrollView::onTouchEnded(touch, event);
}
void onMouseScroll(Event *event)
{
auto mouseEvent = static_cast<EventMouse*>(event);
float moveY = mouseEvent->getScrollY() * 20;
auto minOffset = this->minContainerOffset();
auto maxOffset = this->maxContainerOffset();
auto offset = this->getContentOffset();
offset.y += moveY;
if (offset.y < minOffset.y)
{
offset.y = minOffset.y;
}
else if (offset.y > maxOffset.y)
{
offset.y = maxOffset.y;
}
this->setContentOffset(offset);
}
protected:
TestCustomTableView()
{
auto mouseListener = EventListenerMouse::create();
mouseListener->onMouseScroll = CC_CALLBACK_1(TestCustomTableView::onMouseScroll, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(mouseListener, this);
}
};
TestList::TestList()
{
_isTestList = true;
_shouldRestoreTableOffset = false;
}
void TestList::addTest(const std::string& testName, std::function<TestBase*()> callback)
@ -73,7 +149,7 @@ void TestList::runThisTest()
auto visibleSize = director->getVisibleSize();
auto origin = director->getVisibleOrigin();
TableView* tableView = TableView::create(this, Size(400,visibleSize.height));
auto tableView = TestCustomTableView::create(this, Size(400, visibleSize.height));
tableView->setPosition(origin.x + (visibleSize.width - 400) / 2, origin.y);
tableView->setDirection(ScrollView::Direction::VERTICAL);
tableView->setVerticalFillOrder(TableView::VerticalFillOrder::TOP_DOWN);
@ -81,7 +157,7 @@ void TestList::runThisTest()
scene->addChild(tableView);
tableView->reloadData();
if (_tableOffset != Vec2::ZERO)
if (_shouldRestoreTableOffset)
{
tableView->setContentOffset(_tableOffset);
}
@ -142,7 +218,7 @@ void TestList::tableCellTouched(TableView* table, TableViewCell* cell)
if (test->getChildTestCount() > 0)
{
_tableOffset = table->getContentOffset();
_shouldRestoreTableOffset = true;
_cellTouchEnabled = false;
test->setTestParent(this);
test->runThisTest();
@ -162,13 +238,13 @@ TableViewCell* TestList::tableCellAtIndex(TableView *table, ssize_t idx)
{
cell = TableViewCell::create();
auto label = Label::createWithTTF(_childTestNames[idx], "fonts/arial.ttf", 20.0f);
label->setTag(1024);
label->setTag(TABEL_LABEL_TAG);
label->setPosition(200, 15);
cell->addChild(label);
}
else
{
auto label = (Label*)cell->getChildByTag(1024);
auto label = (Label*)cell->getChildByTag(TABEL_LABEL_TAG);
label->setString(_childTestNames[idx]);
}
@ -215,14 +291,14 @@ void TestSuite::runThisTest()
{
if (!_childTestNames.empty())
{
TestController::getInstance()->setCurrTestSuite(this);
_currTestIndex = 0;
auto scene = _testCallbacks[0]();
auto testCase = getTestCase(scene);
testCase->setTestSuite(this);
testCase->setTestCaseName(_childTestNames[_currTestIndex]);
Director::getInstance()->replaceScene(scene);
}
}
@ -362,6 +438,11 @@ void TestCase::onEnter()
_titleLabel->setString(title());
_subtitleLabel->setString(subtitle());
if (_testSuite == nullptr)
{
setTestSuite(TestController::getInstance()->getCurrTestSuite());
}
if (_testSuite && _testSuite->getChildTestCount() < 2)
{
_priorTestItem->setVisible(false);

View File

@ -29,15 +29,12 @@
#include "extensions/cocos-ext.h"
#include "VisibleRect.h"
USING_NS_CC;
USING_NS_CC_EXT;
class TestSuite;
/**
* Each test case should inherit from TestCase, and add to a TestSuite object.
*/
class TestCase : public Scene
class TestCase : public cocos2d::Scene
{
public:
/** TestCase test type.*/
@ -73,10 +70,10 @@ public:
virtual std::string getActualOutput() const { return ""; }
/** Callback functions.*/
virtual void restartTestCallback(Ref* sender);
virtual void nextTestCallback(Ref* sender);
virtual void priorTestCallback(Ref* sender);
virtual void onBackCallback(Ref* sender);
virtual void restartTestCallback(cocos2d::Ref* sender);
virtual void nextTestCallback(cocos2d::Ref* sender);
virtual void priorTestCallback(cocos2d::Ref* sender);
virtual void onBackCallback(cocos2d::Ref* sender);
/**
* You should NEVER call this method, unless you know what you are doing.
@ -98,12 +95,12 @@ CC_CONSTRUCTOR_ACCESS:
virtual bool init() override;
protected:
MenuItemImage* _priorTestItem;
MenuItemImage* _restartTestItem;
MenuItemImage* _nextTestItem;
cocos2d::MenuItemImage* _priorTestItem;
cocos2d::MenuItemImage* _restartTestItem;
cocos2d::MenuItemImage* _nextTestItem;
Label* _titleLabel;
Label* _subtitleLabel;
cocos2d::Label* _titleLabel;
cocos2d::Label* _subtitleLabel;
private:
TestSuite* _testSuite;
@ -119,7 +116,7 @@ private:
*
* @note You should not inherit from TestBase directly.
*/
class TestBase : public Ref
class TestBase : public cocos2d::Ref
{
public:
virtual ~TestBase();
@ -159,7 +156,7 @@ class TestController;
class TestSuite : public TestBase
{
public:
void addTestCase(const std::string& testName, std::function<Scene*()> callback);
void addTestCase(const std::string& testName, std::function<cocos2d::Scene*()> callback);
virtual void restartCurrTest();
virtual void enterNextTest();
@ -168,7 +165,7 @@ public:
virtual void runThisTest() override;
private:
std::vector<std::function<Scene*()>> _testCallbacks;
std::vector<std::function<cocos2d::Scene*()>> _testCallbacks;
int _currTestIndex;
friend class TestController;
@ -177,7 +174,7 @@ private:
/**
* An instance of TestList is a means for displaying hierarchical lists of TestSuite.
*/
class TestList : public TestBase, public TableViewDataSource, public TableViewDelegate
class TestList : public TestBase, public cocos2d::extension::TableViewDataSource, public cocos2d::extension::TableViewDelegate
{
public:
TestList();
@ -187,10 +184,10 @@ public:
virtual void runThisTest() override;
virtual void tableCellTouched(TableView* table, TableViewCell* cell) override;
virtual TableViewCell* tableCellAtIndex(TableView *table, ssize_t idx) override;
virtual Size tableCellSizeForIndex(TableView *table, ssize_t idx) override;
virtual ssize_t numberOfCellsInTableView(TableView *table) override;
virtual void tableCellTouched(cocos2d::extension::TableView* table, cocos2d::extension::TableViewCell* cell) override;
virtual cocos2d::extension::TableViewCell* tableCellAtIndex(cocos2d::extension::TableView *table, ssize_t idx) override;
virtual cocos2d::Size tableCellSizeForIndex(cocos2d::extension::TableView *table, ssize_t idx) override;
virtual ssize_t numberOfCellsInTableView(cocos2d::extension::TableView *table) override;
virtual void scrollViewDidScroll(cocos2d::extension::ScrollView* view) override{}
virtual void scrollViewDidZoom(cocos2d::extension::ScrollView* view) override{}
@ -198,7 +195,8 @@ public:
private:
std::vector<std::function<TestBase*()>> _testCallbacks;
bool _cellTouchEnabled;
Vec2 _tableOffset;
bool _shouldRestoreTableOffset;
cocos2d::Vec2 _tableOffset;
friend class TestController;
};
@ -222,9 +220,9 @@ public:
virtual std::string title() const { return ""; }
virtual std::string subtitle() const{ return ""; }
virtual void restartCallback(Ref* sender) {}
virtual void nextCallback(Ref* sender){}
virtual void backCallback(Ref* sender){}
virtual void restartCallback(cocos2d::Ref* sender) {}
virtual void nextCallback(cocos2d::Ref* sender){}
virtual void backCallback(cocos2d::Ref* sender){}
virtual void onEnter() override{}
virtual void onExit() override{}

View File

@ -29,6 +29,11 @@
#include <algorithm>
#include "../testResource.h"
USING_NS_CC;
USING_NS_CC_EXT;
using namespace cocos2d::ui;
BillBoardTests::BillBoardTests()
{
ADD_TEST_CASE(BillBoardRotationTest);
@ -108,9 +113,9 @@ BillBoardTest::BillBoardTest()
: _camera(nullptr)
{
//Create touch listener
/*auto listener = EventListenerTouchAllAtOnce::create();
auto listener = EventListenerTouchAllAtOnce::create();
listener->onTouchesMoved = CC_CALLBACK_2(BillBoardTest::onTouchesMoved, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);*/
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
auto layer3D=Layer::create();
addChild(layer3D,0);
@ -271,7 +276,6 @@ void BillBoardTest::update(float dt)
{
}
/*
void BillBoardTest::onTouchesMoved(const std::vector<Touch*>& touches, Event* event)
{
if(touches.size()==1)
@ -294,7 +298,7 @@ void BillBoardTest::onTouchesMoved(const std::vector<Touch*>& touches, Event* ev
cameraPos+=cameraRightDir*newPos.x*0.5;
_camera->setPosition3D(cameraPos);
}
}*/
}
void BillBoardTest::rotateCameraCallback(Ref* sender,float value)
{

View File

@ -55,19 +55,19 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void update(float dt) override;
void addNewBillBoradWithCoords(Vec3 p);
void addNewAniBillBoradWithCoords(Vec3 p);
void rotateCameraCallback(Ref* sender,float value);
//void onTouchesMoved(const std::vector<Touch*>& touches, Event* event) override;
void addNewBillBoradWithCoords(cocos2d::Vec3 p);
void addNewAniBillBoradWithCoords(cocos2d::Vec3 p);
void rotateCameraCallback(cocos2d::Ref* sender,float value);
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
void menuCallback_orientedPoint(Ref* sender);
void menuCallback_orientedPlane(Ref* sender);
void menuCallback_orientedPoint(cocos2d::Ref* sender);
void menuCallback_orientedPlane(cocos2d::Ref* sender);
protected:
Camera* _camera;
Layer* _layerBillBorad;
cocos2d::Camera* _camera;
cocos2d::Layer* _layerBillBorad;
std::vector<BillBoard*> _billboards;
std::vector<cocos2d::BillBoard*> _billboards;
};
DEFINE_TEST_SUITE(BillBoardTests);

View File

@ -4,6 +4,7 @@
#include "renderer/CCRenderer.h"
#include "renderer/CCCustomCommand.h"
USING_NS_CC;
USING_NS_CC_EXT;
#define PTM_RATIO 32

View File

@ -9,7 +9,7 @@ DEFINE_TEST_SUITE(Box2DTests);
class Box2DTest : public TestCase
{
Texture2D* _spriteTexture; // weak ref
cocos2d::Texture2D* _spriteTexture; // weak ref
b2World* world;
// GLESDebugDraw* _debugDraw;
@ -19,17 +19,17 @@ public:
void initPhysics();
void createResetButton();
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
virtual void draw(cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t flags) override;
void addNewSpriteAtPosition(Vec2 p);
void addNewSpriteAtPosition(cocos2d::Vec2 p);
void update(float dt) override;
void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
#if CC_ENABLE_BOX2D_INTEGRATION
protected:
Mat4 _modelViewMV;
void onDraw();
CustomCommand _customCommand;
cocos2d::CustomCommand _customCommand;
#endif
} ;

View File

@ -3,6 +3,8 @@
#include "Test.h"
#include "renderer/CCRenderer.h"
USING_NS_CC;
#define kAccelerometerFrequency 30
#define FRAMES_BETWEEN_PRESSES_FOR_DOUBLE_CLICK 10

View File

@ -9,7 +9,7 @@ DEFINE_TEST_SUITE(Box2dTestBedSuite);
class Box2dTestBed : public TestCase
{
int m_entryID;
EventListenerTouchOneByOne* _touchListener;
cocos2d::EventListenerTouchOneByOne* _touchListener;
public:
static Box2dTestBed* createWithEntryID(int entryId);
@ -18,16 +18,16 @@ public:
bool initWithEntryID(int entryId);
bool onTouchBegan(Touch* touch, Event* event);
void onTouchMoved(Touch* touch, Event* event);
bool onTouchBegan(cocos2d::Touch* touch, cocos2d::Event* event);
void onTouchMoved(cocos2d::Touch* touch, cocos2d::Event* event);
};
struct TestEntry;
class Test;
class Box2DView : public Layer
class Box2DView : public cocos2d::Layer
{
EventListenerTouchOneByOne* _touchListener;
EventListenerKeyboard* _keyboardListener;
cocos2d::EventListenerTouchOneByOne* _touchListener;
cocos2d::EventListenerKeyboard* _keyboardListener;
TestEntry* m_entry;
Test* m_test;
int m_entryID;
@ -37,22 +37,22 @@ public:
bool initWithEntryID(int entryId);
std::string title() const;
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
virtual void draw(cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t flags) override;
// virtual void registerWithTouchDispatcher();
bool onTouchBegan(Touch* touch, Event* event);
void onTouchMoved(Touch* touch, Event* event);
void onTouchEnded(Touch* touch, Event* event);
bool onTouchBegan(cocos2d::Touch* touch, cocos2d::Event* event);
void onTouchMoved(cocos2d::Touch* touch, cocos2d::Event* event);
void onTouchEnded(cocos2d::Touch* touch, cocos2d::Event* event);
void onKeyPressed(EventKeyboard::KeyCode code, Event* event);
void onKeyReleased(EventKeyboard::KeyCode code, Event* event);
//virtual void accelerometer(UIAccelerometer* accelerometer, Acceleration* acceleration);
void onKeyPressed(cocos2d::EventKeyboard::KeyCode code, cocos2d::Event* event);
void onKeyReleased(cocos2d::EventKeyboard::KeyCode code, cocos2d::Event* event);
//virtual void accelerometer(UIAccelerometer* accelerometer, cocos2d::Acceleration* acceleration);
static Box2DView* viewWithEntryID(int entryId);
protected:
void onDraw(const Mat4 &transform, uint32_t flags);
void onDraw(const cocos2d::Mat4& transform, uint32_t flags);
CustomCommand _customCmd;
cocos2d::CustomCommand _customCmd;
};
#endif

View File

@ -9,14 +9,7 @@
#include "Bug-1159.h"
Scene* Bug1159Layer::scene()
{
auto scene = Scene::create();
auto layer = Bug1159Layer::create();
scene->addChild(layer);
return scene;
}
USING_NS_CC;
bool Bug1159Layer::init()
{
@ -57,7 +50,7 @@ bool Bug1159Layer::init()
void Bug1159Layer::callBack(Ref* sender)
{
Director::getInstance()->replaceScene(TransitionPageTurn::create(1.0f, Bug1159Layer::scene(), false));
Director::getInstance()->replaceScene(TransitionPageTurn::create(1.0f, Bug1159Layer::create(), false));
}
void Bug1159Layer::onExit()

View File

@ -8,8 +8,8 @@ class Bug1159Layer : public BugsTestBase
public:
virtual bool init() override;
virtual void onExit() override;
static Scene* scene();
void callBack(Ref* sender);
void callBack(cocos2d::Ref* sender);
CREATE_FUNC(Bug1159Layer);
};

View File

@ -5,6 +5,8 @@
#include "Bug-1174.h"
USING_NS_CC;
int check_for_error( Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float s, float t );
int check_for_error( Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float s, float t )

View File

@ -5,6 +5,8 @@
#include "Bug-350.h"
USING_NS_CC;
bool Bug350Layer::init()
{
if (BugsTestBase::init())

View File

@ -5,6 +5,8 @@
#include "Bug-422.h"
USING_NS_CC;
bool Bug422Layer::init()
{
if (BugsTestBase::init())

View File

@ -12,7 +12,7 @@ public:
void reset();
void check(Node* target);
void menuCallback(Ref* sender);
void menuCallback(cocos2d::Ref* sender);
};
#endif // __BUG_422_H__

View File

@ -6,6 +6,8 @@
#include "Bug-458.h"
#include "QuestionContainerSprite.h"
USING_NS_CC;
bool Bug458Layer::init()
{
if(BugsTestBase::init())

View File

@ -9,7 +9,7 @@ public:
CREATE_FUNC(Bug458Layer);
virtual bool init() override;
void selectAnswer(Ref* sender);
void selectAnswer(cocos2d::Ref* sender);
};
#endif // __BUG_458_H__

View File

@ -5,6 +5,8 @@
#include "Bug-624.h"
USING_NS_CC;
////////////////////////////////////////////////////////
//
// Bug624Layer

View File

@ -9,7 +9,7 @@ public:
virtual ~Bug624Layer();
virtual bool init() override;
void switchLayer(float dt);
virtual void onAcceleration(Acceleration* acc, Event* event);
virtual void onAcceleration(cocos2d::Acceleration* acc, cocos2d::Event* event);
CREATE_FUNC(Bug624Layer);
};
@ -20,7 +20,7 @@ public:
virtual ~Bug624Layer2();
virtual bool init() override;
void switchLayer(float dt);
virtual void onAcceleration(Acceleration* acc, Event* event);
virtual void onAcceleration(cocos2d::Acceleration* acc, cocos2d::Event* event);
CREATE_FUNC(Bug624Layer2);
};

View File

@ -5,6 +5,8 @@
#include "Bug-886.h"
USING_NS_CC;
bool Bug886Layer::init()
{
if(BugsTestBase::init())

View File

@ -7,6 +7,8 @@
#include "Bug-899.h"
USING_NS_CC;
bool Bug899Layer::init()
{
// Director::getInstance()->enableRetinaDisplay(true);

View File

@ -9,19 +9,7 @@
// Import the interfaces
#include"Bug-914.h"
Scene* Bug914Layer::scene()
{
// 'scene' is an autorelease object.
auto scene = Scene::create();
// 'layer' is an autorelease object.
auto layer = Bug914Layer::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
USING_NS_CC;
// on "init" you need to initialize your instance
bool Bug914Layer::init()
@ -79,5 +67,5 @@ void Bug914Layer::onTouchesBegan(const std::vector<Touch*>& touches, Event * eve
void Bug914Layer::restart(Ref* sender)
{
Director::getInstance()->replaceScene(Bug914Layer::scene());
Director::getInstance()->replaceScene(Bug914Layer::create());
}

View File

@ -6,12 +6,11 @@
class Bug914Layer : public BugsTestBase
{
public:
static Scene* scene();
virtual bool init() override;
void onTouchesMoved(const std::vector<Touch*>& touches, Event * event);
void onTouchesBegan(const std::vector<Touch*>& touches, Event * event);
void restart(Ref* sender);
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
void onTouchesBegan(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
void restart(cocos2d::Ref* sender);
CREATE_FUNC(Bug914Layer);
};

View File

@ -8,6 +8,8 @@
#include "Bug-Child.h"
USING_NS_CC;
bool BugChild::init()
{
if (BugsTestBase::init())

View File

@ -18,16 +18,16 @@ public:
virtual bool init() override;
void switchChild(Ref* sender);
void switchChild(cocos2d::Ref* sender);
protected:
Sprite* parent1;
Sprite* parent2;
cocos2d::Sprite* parent1;
cocos2d::Sprite* parent2;
Sprite* child;
cocos2d::Sprite* child;
Menu* menu;
cocos2d::Menu* menu;
};
#endif /* defined(__Bug_Child__) */

View File

@ -25,6 +25,8 @@ THE SOFTWARE.
#include "Camera3DTest.h"
USING_NS_CC;
enum
{
IDC_NEXT = 100,

View File

@ -65,10 +65,10 @@ class CameraBaseTest : public TestCase
public:
protected:
BillBoard* bill1;
BillBoard* bill2;
Label* l1;
Label* l2;
cocos2d::BillBoard* bill1;
cocos2d::BillBoard* bill2;
cocos2d::Label* l1;
cocos2d::Label* l2;
};
class CameraRotationTest : public CameraBaseTest {
@ -89,9 +89,9 @@ public:
protected:
Node* _camControlNode;
Node* _camNode;
EventListenerTouchOneByOne* _lis;
cocos2d::Node* _camControlNode;
cocos2d::Node* _camNode;
cocos2d::EventListenerTouchOneByOne* _lis;
};
class Camera3DTestDemo : public CameraBaseTest
@ -105,50 +105,50 @@ public:
virtual void onExit() override;
// overrides
virtual std::string title() const override;
void addNewSpriteWithCoords(Vec3 p,std::string fileName,bool playAnimation=false,float scale=1.0f,bool bindCamera=false);
void addNewSpriteWithCoords(cocos2d::Vec3 p,std::string fileName,bool playAnimation=false,float scale=1.0f,bool bindCamera=false);
void onTouchesBegan(const std::vector<Touch*>& touches, cocos2d::Event *event);
void onTouchesMoved(const std::vector<Touch*>& touches, cocos2d::Event *event);
void onTouchesEnded(const std::vector<Touch*>& touches, cocos2d::Event *event);
void onTouchesBegan(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void scaleCameraCallback(Ref* sender,float value);
void rotateCameraCallback(Ref* sender,float value);
void SwitchViewCallback(Ref* sender,CameraType cameraType);
void scaleCameraCallback(cocos2d::Ref* sender,float value);
void rotateCameraCallback(cocos2d::Ref* sender,float value);
void SwitchViewCallback(cocos2d::Ref* sender,CameraType cameraType);
void updateCamera(float fDelta);
void move3D(float elapsedTime);
void updateState(float elapsedTime);
bool isState(unsigned int state,unsigned int bit) const;
void reachEndCallBack();
bool onTouchesCommon(Touch* touch, Event* event, bool* touchProperty);
bool onTouchesZoomOut(Touch* touch, Event* event);
void onTouchesZoomOutEnd(Touch* touch, Event* event);
bool onTouchesZoomIn(Touch* touch, Event* event);
void onTouchesZoomInEnd(Touch* touch, Event* event);
bool onTouchesCommon(cocos2d::Touch* touch, cocos2d::Event* event, bool* touchProperty);
bool onTouchesZoomOut(cocos2d::Touch* touch, cocos2d::Event* event);
void onTouchesZoomOutEnd(cocos2d::Touch* touch, cocos2d::Event* event);
bool onTouchesZoomIn(cocos2d::Touch* touch, cocos2d::Event* event);
void onTouchesZoomInEnd(cocos2d::Touch* touch, cocos2d::Event* event);
bool onTouchesRotateLeft(Touch* touch, Event* event);
void onTouchesRotateLeftEnd(Touch* touch, Event* event);
bool onTouchesRotateRight(Touch* touch, Event* event);
void onTouchesRotateRightEnd(Touch* touch, Event* event);
bool onTouchesRotateLeft(cocos2d::Touch* touch, cocos2d::Event* event);
void onTouchesRotateLeftEnd(cocos2d::Touch* touch, cocos2d::Event* event);
bool onTouchesRotateRight(cocos2d::Touch* touch, cocos2d::Event* event);
void onTouchesRotateRightEnd(cocos2d::Touch* touch, cocos2d::Event* event);
protected:
std::string _title;
Layer* _layer3D;
Sprite3D* _sprite3D;
Vec3 _targetPos;
cocos2d::Layer* _layer3D;
cocos2d::Sprite3D* _sprite3D;
cocos2d::Vec3 _targetPos;
CameraType _cameraType;
MenuItem* _incRot;
MenuItem* _decRot;
cocos2d::MenuItem* _incRot;
cocos2d::MenuItem* _decRot;
unsigned int _curState;
Camera* _camera;
MoveTo* _moveAction;
cocos2d::Camera* _camera;
cocos2d::MoveTo* _moveAction;
bool _bZoomOut;
bool _bZoomIn;
bool _bRotateLeft;
bool _bRotateRight;
Label* _RotateRightlabel;
Label* _RotateLeftlabel;
Label* _ZoomInlabel;
Label* _ZoomOutlabel;
cocos2d::Label* _RotateRightlabel;
cocos2d::Label* _RotateLeftlabel;
cocos2d::Label* _ZoomInlabel;
cocos2d::Label* _ZoomOutlabel;
};
class CameraCullingDemo : public CameraBaseTest
@ -166,22 +166,22 @@ public:
// overrides
virtual std::string title() const override;
void reachEndCallBack();
void switchViewCallback(Ref* sender);
void addSpriteCallback(Ref* sender);
void delSpriteCallback(Ref* sender);
void switchViewCallback(cocos2d::Ref* sender);
void addSpriteCallback(cocos2d::Ref* sender);
void delSpriteCallback(cocos2d::Ref* sender);
void drawCameraFrustum();
protected:
Label* _labelSprite3DCount;
Layer* _layer3D;
std::vector<Sprite3D*> _objects;
CameraType _cameraType;
Camera* _cameraFirst;
Camera* _cameraThird;
MoveBy* _moveAction;
DrawNode3D* _drawAABB;
DrawNode3D* _drawFrustum;
cocos2d::Label* _labelSprite3DCount;
cocos2d::Layer* _layer3D;
std::vector<cocos2d::Sprite3D*> _objects;
CameraType _cameraType;
cocos2d::Camera* _cameraFirst;
cocos2d::Camera* _cameraThird;
cocos2d::MoveBy* _moveAction;
cocos2d::DrawNode3D* _drawAABB;
cocos2d::DrawNode3D* _drawFrustum;
int _row;
};
@ -200,26 +200,26 @@ public:
// overrides
virtual std::string title() const override;
void switchOperateCallback(Ref* sender);
void switchTargetCallback(Ref* sender);
void switchOperateCallback(cocos2d::Ref* sender);
void switchTargetCallback(cocos2d::Ref* sender);
void onTouchsMoved(const std::vector<cocos2d::Touch*> &touchs, cocos2d::Event *event);
void updateCameraTransform();
void calculateArcBall( cocos2d::Vec3 & axis, float & angle, float p1x, float p1y, float p2x, float p2y );//calculate rotation quaternion parameters
float projectToSphere( float r, float x, float y );//points on the screen project to arc ball
protected:
Layer* _layer3D;
CameraType _cameraType;
Camera* _camera;
DrawNode3D* _drawGrid;
Quaternion _rotationQuat; //rotation Quaternion
float _radius; //arc ball radius
float _distanceZ;
OperateCamType _operate; //switch rotate or zoom
Vec3 _center; //camera look target
int _target; //switch camera look target
Sprite3D* _sprite3D1;
Sprite3D* _sprite3D2;
cocos2d::Layer* _layer3D;
CameraType _cameraType;
cocos2d::Camera* _camera;
cocos2d::DrawNode3D* _drawGrid;
cocos2d::Quaternion _rotationQuat; //rotation Quaternion
float _radius; //arc ball radius
float _distanceZ;
OperateCamType _operate; //switch rotate or zoom
cocos2d::Vec3 _center; //camera look target
int _target; //switch camera look target
cocos2d::Sprite3D* _sprite3D1;
cocos2d::Sprite3D* _sprite3D2;
};
class FogTestDemo : public CameraBaseTest
@ -237,21 +237,21 @@ public:
// overrides
virtual std::string title() const override;
void onTouchesMoved(const std::vector<Touch*>& touches, cocos2d::Event *event);
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void switchTypeCallback(Ref* sender,int type);
void switchTypeCallback(cocos2d::Ref* sender,int type);
protected:
Layer* _layer3D;
cocos2d::Layer* _layer3D;
CameraType _cameraType;
Camera* _camera;
Sprite3D* _sprite3D1;
Sprite3D* _sprite3D2;
GLProgram* _shader;
GLProgramState* _state;
cocos2d::Camera* _camera;
cocos2d::Sprite3D* _sprite3D1;
cocos2d::Sprite3D* _sprite3D2;
cocos2d::GLProgram* _shader;
cocos2d::GLProgramState* _state;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
EventListenerCustom* _backToForegroundListener;
cocos2d::EventListenerCustom* _backToForegroundListener;
#endif
};

View File

@ -8,6 +8,8 @@
#include "ChipmunkTest.h"
USING_NS_CC;
USING_NS_CC_EXT;
enum {
kTagParentNode = 1,

View File

@ -9,8 +9,6 @@
#include "../BaseTest.h"
#include "extensions/cocos-ext.h"
USING_NS_CC_EXT;
class ChipmunkTest : public TestCase
{
public:
@ -21,18 +19,18 @@ public:
void onEnter() override;
void initPhysics();
void createResetButton();
void reset(Ref* sender);
void reset(cocos2d::Ref* sender);
void addNewSpriteAtPosition(cocos2d::Vec2 p);
void update(float dt) override;
void toggleDebugCallback(Ref* sender);
void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
virtual void onAcceleration(Acceleration* acc, Event* event);
void toggleDebugCallback(cocos2d::Ref* sender);
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
virtual void onAcceleration(cocos2d::Acceleration* acc, cocos2d::Event* event);
private:
Texture2D* _spriteTexture; // weak ref
cocos2d::Texture2D* _spriteTexture; // weak ref
#if CC_ENABLE_CHIPMUNK_INTEGRATION
PhysicsDebugNode* _debugLayer; // weak ref
cocos2d::extension::PhysicsDebugNode* _debugLayer; // weak ref
#endif
cpSpace* _space; // strong ref
cpShape* _walls[4];

View File

@ -1,6 +1,8 @@
#include "ClickAndMoveTest.h"
#include "../testResource.h"
USING_NS_CC;
enum
{
kTagSprite = 1,

View File

@ -11,8 +11,8 @@ public:
CREATE_FUNC(ClickAndMoveTestCase);
ClickAndMoveTestCase();
bool onTouchBegan(Touch* touch, Event *event);
void onTouchEnded(Touch* touch, Event *event);
bool onTouchBegan(cocos2d::Touch* touch, cocos2d::Event* event);
void onTouchEnded(cocos2d::Touch* touch, cocos2d::Event* event);
};
#endif

View File

@ -9,6 +9,8 @@
#include "../testResource.h"
#include "renderer/CCRenderer.h"
USING_NS_CC;
enum {
kTagTitleLabel = 1,
kTagSubtitleLabel = 2,

View File

@ -28,15 +28,15 @@ public:
virtual std::string subtitle() const override;
virtual void setup() override;
virtual Action* actionRotate();
virtual Action* actionScale();
virtual cocos2d::Action* actionRotate();
virtual cocos2d::Action* actionScale();
virtual DrawNode* shape();
virtual Sprite* grossini();
virtual cocos2d::DrawNode* shape();
virtual cocos2d::Sprite* grossini();
virtual Node* stencil();
virtual ClippingNode* clipper();
virtual Node* content();
virtual cocos2d::Node* stencil();
virtual cocos2d::ClippingNode* clipper();
virtual cocos2d::Node* content();
};
class ShapeTest : public BasicTest
@ -47,8 +47,8 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual Node* stencil() override;
virtual Node* content() override;
virtual cocos2d::Node* stencil() override;
virtual cocos2d::Node* content() override;
};
class ShapeInvertedTest : public ShapeTest
@ -58,7 +58,7 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual ClippingNode* clipper() override;
virtual cocos2d::ClippingNode* clipper() override;
};
class SpriteTest : public BasicTest
@ -69,9 +69,9 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual Node* stencil() override;
virtual ClippingNode* clipper() override;
virtual Node* content() override;
virtual cocos2d::Node* stencil() override;
virtual cocos2d::ClippingNode* clipper() override;
virtual cocos2d::Node* content() override;
};
class SpriteNoAlphaTest : public SpriteTest
@ -81,7 +81,7 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual ClippingNode* clipper() override;
virtual cocos2d::ClippingNode* clipper() override;
};
class SpriteInvertedTest : public SpriteTest
@ -91,7 +91,7 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual ClippingNode* clipper() override;
virtual cocos2d::ClippingNode* clipper() override;
};
class NestedTest : public BaseClippingNodeTest
@ -113,12 +113,12 @@ public:
virtual void setup() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
void pokeHoleAtPoint(Vec2 point);
void onTouchesBegan(const std::vector<Touch*>& touches, Event *event);
void pokeHoleAtPoint(cocos2d::Vec2 point);
void onTouchesBegan(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
private:
ClippingNode* _outerClipper;
Node* _holes;
Node* _holesStencil;
cocos2d::ClippingNode* _outerClipper;
cocos2d::Node* _holes;
cocos2d::Node* _holesStencil;
};
class ScrollViewDemo : public BaseClippingNodeTest
@ -129,12 +129,12 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void setup() override;
void onTouchesBegan(const std::vector<Touch*>& touches, Event *event);
void onTouchesMoved(const std::vector<Touch*>& touches, Event *event);
void onTouchesEnded(const std::vector<Touch*>& touches, Event *event);
void onTouchesBegan(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
private:
bool _scrolling;
Vec2 _lastPoint;
cocos2d::Vec2 _lastPoint;
};
//#if COCOS2D_DEBUG > 1
@ -149,20 +149,20 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void setup() override;
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
virtual void draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t flags) override;
virtual void setupStencilForClippingOnPlane(GLint plane);
virtual void setupStencilForDrawingOnPlane(GLint plane);
protected:
std::list<CustomCommand> _renderCmds;
std::list<cocos2d::CustomCommand> _renderCmds;
void onEnableStencil();
void onDisableStencil();
void onBeforeDrawClip(int planeIndex, const Vec2& pt);
void onBeforeDrawSprite(int planeIndex, const Vec2& pt);
void onBeforeDrawClip(int planeIndex, const cocos2d::Vec2& pt);
void onBeforeDrawSprite(int planeIndex, const cocos2d::Vec2& pt);
protected:
Vector<Sprite*> _sprites;
Vector<Sprite*> _spritesStencil;
cocos2d::Vector<cocos2d::Sprite*> _sprites;
cocos2d::Vector<cocos2d::Sprite*> _spritesStencil;
};
class RawStencilBufferTest2 : public RawStencilBufferTest

View File

@ -26,6 +26,8 @@
#include "CocosStudio3DTest.h"
#include "cocostudio/CocoStudio.h"
USING_NS_CC;
enum
{
IDC_NEXT = 100,

View File

@ -3,6 +3,8 @@
#include "../testResource.h"
#include "cocos2d.h"
USING_NS_CC;
ConfigurationTests::ConfigurationTests()
{
ADD_TEST_CASE(ConfigurationLoadConfig);

View File

@ -4,8 +4,6 @@
#include "../testBasic.h"
#include "../BaseTest.h"
USING_NS_CC;
DEFINE_TEST_SUITE(ConfigurationTests);
class ConfigurationBase : public TestCase

View File

@ -41,6 +41,8 @@
#include <sstream>
#endif
USING_NS_CC;
//------------------------------------------------------------------
//
// ConsoleTest

View File

@ -27,8 +27,6 @@
#include "../BaseTest.h"
USING_NS_CC;
DEFINE_TEST_SUITE(ConsoleTests);
class BaseTestConsole : public TestCase

View File

@ -3,6 +3,8 @@
#include "stdlib.h"
#include "curl/curl.h"
USING_NS_CC;
CurlTests::CurlTests()
{
ADD_TEST_CASE(CurlTest);

View File

@ -14,7 +14,7 @@ public:
CurlTest();
~CurlTest();
void onTouchesEnded(const std::vector<Touch*>& touches, cocos2d::Event *event);
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
private:
cocos2d::Label* _label;

View File

@ -1,5 +1,7 @@
#include "CurrentLanguageTest.h"
USING_NS_CC;
CurrentLanguageTests::CurrentLanguageTests()
{
ADD_TEST_CASE(CurrentLanguageTest);

View File

@ -1,6 +1,8 @@
#include "DataVisitorTest.h"
#include "../testResource.h"
USING_NS_CC;
DataVisitorTests::DataVisitorTests()
{
ADD_TEST_CASE(PrettyPrinterDemo);

View File

@ -2,6 +2,8 @@
#include "renderer/CCRenderer.h"
#include "renderer/CCCustomCommand.h"
USING_NS_CC;
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif _MSC_VER >= 1400 //vs 2005 or higher

View File

@ -22,11 +22,11 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
virtual void draw(cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t flags) override;
protected:
void onDraw(const Mat4 &transform, uint32_t flags);
CustomCommand _customCommand;
void onDraw(const cocos2d::Mat4& transform, uint32_t flags);
cocos2d::CustomCommand _customCommand;
};
class DrawNodeTest : public DrawPrimitivesBaseTest

Some files were not shown because too many files have changed in this diff Show More