mirror of https://github.com/axmolengine/axmol.git
merge bundle modification
This commit is contained in:
commit
eccfbe5c59
4
AUTHORS
4
AUTHORS
|
@ -820,6 +820,7 @@ Developers:
|
|||
|
||||
aeonmine
|
||||
Fixed ActionObject memory leak in ActionManagerEx::initWithDictionary
|
||||
Fixed memory leak in cocos studiov2.0 reader
|
||||
|
||||
LoungeKatt
|
||||
Corrected a mistake of building android project in README.md
|
||||
|
@ -1049,6 +1050,9 @@ Developers:
|
|||
|
||||
liamcindy
|
||||
update ui button size changed logic
|
||||
|
||||
vovkasm
|
||||
Fix warnings for Xcode6.1
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
|
|
11
CHANGELOG
11
CHANGELOG
|
@ -1,12 +1,17 @@
|
|||
cocos2d-x-3.3 ??
|
||||
[NEW] Vec2: added greater than operator
|
||||
|
||||
[FIX] Button: when the dimension of button title is larger than the button, button will scale to fit the dimension of the button title
|
||||
[FIX] Button: when the dimension of button title is larger than the button, button will scale to fit the dimension of the button title
|
||||
[FIX] Camera: does not work correctly when the up is not (0, 1, 0)
|
||||
[FIX] Cocos console: compile failure on windows if using VS express version
|
||||
[FIX] GrawNode: drawPoint() may cause crash
|
||||
[FIX] DrawNode: drawPoint() may cause crash
|
||||
[FIX] GLProgramCache: doesn't release old program with the same key before adding a new one
|
||||
[FIX] GLProgramState: enabled GLProgramState restoring on render recreated on WP8
|
||||
[FIX] Label: label shifting when outline feature enabled
|
||||
[FIX] Label: when applying additionalKerning to a Label that displays a string with only 1 character, the character is shifted
|
||||
[FIX] Scale9Sprite: will be flipped if both flipX and flipY are false
|
||||
[FIX] Scale9Sprite: if scale and flip property are set at the same time, the result would be wrong.
|
||||
[FIX] Sprite3D: did not create attached sprite from cache
|
||||
[FIX] WP/WinRT: Windows 8.1 universal app support; `UIEditBox` support
|
||||
|
||||
|
@ -33,7 +38,7 @@ cocos2d-x-3.3-rc0 Oct.21 2014
|
|||
[FIX] C++: remove armv7s in VALID_ARCHS for Xcode projects
|
||||
[FIX] Cocos Studio reader: UI animation playing crash if GUI JSON file is loaded again
|
||||
[FIX] Cocos Studio reader: improvement ImageViewReader don't necessary loadTexture when imageFilePath is empty
|
||||
[FIX] EditBox: view rendereed in wrong position if click EditBox on iOS 8
|
||||
[FIX] EditBox: view rendered in wrong position if click EditBox on iOS 8
|
||||
[FIX] FileUtils: can not remove files/directory on iOS devices
|
||||
[FIX] GLProgram: crashed on some Android devices that do not support more than 8 attributes
|
||||
[FIX] Label: getStringNumLines() may returns wrong result if label is dirty
|
||||
|
@ -103,7 +108,7 @@ cocos2d-x-3.3alpha0 Aug.28 2014
|
|||
[NEW] Sprite3D: added getBoundingBox() and getAABB()
|
||||
[NEW] SpriteFrameCache: load from plist file content data
|
||||
[NEW] utils: added gettime()
|
||||
[NEW] UI: Added Added UIScale9Sprite
|
||||
[NEW] UI: Added UIScale9Sprite
|
||||
[NEW] UI: ui::Button: support customize how much zoom scale is when pressing a button
|
||||
[NEW] UI: ui::PageView: added `customScrollThreshold`, could determine the swipe distance to trigger a PageView scroll event
|
||||
[NEW] UI: ui::TextField: support utf8
|
||||
|
|
|
@ -23,7 +23,7 @@ mac build Instructions
|
|||
|
||||
cd cocos2d-x
|
||||
mkdir macbuild && cd macbuild
|
||||
cmake -G "Unix Makefile" -DBUILD_CPP_TESTS=OFF -DBUILD_LUA_LIBS=OFF ..
|
||||
cmake -G "Unix Makefiles" -DBUILD_CPP_TESTS=OFF -DBUILD_LUA_LIBS=OFF ..
|
||||
|
||||
Android Build Instructions
|
||||
|
||||
|
@ -35,6 +35,6 @@ mingw64 with msys2 build Instructions
|
|||
|
||||
cd cocos2d-x
|
||||
mkdir mingwbuild && cd mingwbuild
|
||||
cmake -G "MSYS Makefile" -DBUILD_CPP_TESTS=OFF -DBUILD_LUA_LIBS=OFF ..
|
||||
cmake -G "MSYS Makefiles" -DBUILD_CPP_TESTS=OFF -DBUILD_LUA_LIBS=OFF ..
|
||||
|
||||
todo: structure this document in markdown with better examples and more details
|
||||
todo: structure this document in markdown with better examples and more details
|
||||
|
|
|
@ -15,15 +15,8 @@ def get_num_of_cpu():
|
|||
''' The build process can be accelerated by running multiple concurrent job processes using the -j-option.
|
||||
'''
|
||||
try:
|
||||
platform = sys.platform
|
||||
if platform == 'win32':
|
||||
if 'NUMBER_OF_PROCESSORS' in os.environ:
|
||||
return int(os.environ['NUMBER_OF_PROCESSORS'])
|
||||
else:
|
||||
return 1
|
||||
else:
|
||||
from numpy.distutils import cpuinfo
|
||||
return cpuinfo.cpu._getNCPUs()
|
||||
import multiprocessing
|
||||
return multiprocessing.cpu_count()
|
||||
except Exception:
|
||||
print "Can't know cpuinfo, use default 1 cpu"
|
||||
return 1
|
||||
|
|
|
@ -7231,7 +7231,6 @@
|
|||
CC_KEYBOARD_SUPPORT,
|
||||
_USRDLL,
|
||||
);
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
LD_DYLIB_INSTALL_NAME = "";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
|
@ -7266,7 +7265,6 @@
|
|||
CC_TARGET_OS_MAC,
|
||||
_USRDLL,
|
||||
);
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
LD_DYLIB_INSTALL_NAME = "";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
|
@ -7296,7 +7294,6 @@
|
|||
"$(inherited)",
|
||||
CC_TARGET_OS_IPHONE,
|
||||
);
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
|
||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
||||
|
@ -7329,7 +7326,6 @@
|
|||
"$(inherited)",
|
||||
CC_TARGET_OS_IPHONE,
|
||||
);
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
|
||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
||||
|
|
|
@ -5706,6 +5706,7 @@
|
|||
"CC_ENABLE_CHIPMUNK_INTEGRATION=1",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
|
@ -5733,6 +5734,7 @@
|
|||
"CC_ENABLE_CHIPMUNK_INTEGRATION=1",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
|
|
|
@ -66,9 +66,9 @@ Camera* Camera::createOrthographic(float zoomX, float zoomY, float nearPlane, fl
|
|||
}
|
||||
|
||||
Camera::Camera()
|
||||
: _cameraFlag(1)
|
||||
, _scene(nullptr)
|
||||
: _scene(nullptr)
|
||||
, _viewProjectionDirty(true)
|
||||
, _cameraFlag(1)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -130,12 +130,15 @@ void Camera::lookAt(const Vec3& lookAtPos, const Vec3& up)
|
|||
rotation.m[9] = zaxis.y;
|
||||
rotation.m[10] = zaxis.z;
|
||||
rotation.m[11] = 0;
|
||||
|
||||
Quaternion quaternion;
|
||||
Quaternion::createFromRotationMatrix(rotation,&quaternion);
|
||||
float fRoll = atan2(2 * (quaternion.w * quaternion.z + quaternion.x * quaternion.y) , 1 - 2 * (quaternion.z * quaternion.z + quaternion.x * quaternion.x));
|
||||
float fPitch = asin(clampf(2 * (quaternion.w * quaternion.x - quaternion.y * quaternion.z) , -1.0f , 1.0f));
|
||||
float fYaw = atan2(2 * (quaternion.w * quaternion.y + quaternion.z * quaternion.x) , 1 - 2 * (quaternion.x * quaternion.x + quaternion.y * quaternion.y));
|
||||
setRotation3D(Vec3(CC_RADIANS_TO_DEGREES(fPitch),CC_RADIANS_TO_DEGREES(fYaw),CC_RADIANS_TO_DEGREES(fRoll)));
|
||||
|
||||
float rotx = atan2f(2 * (quaternion.w * quaternion.x + quaternion.y * quaternion.z), 1 - 2 * (quaternion.x * quaternion.x + quaternion.y * quaternion.y));
|
||||
float roty = asin(clampf(2 * (quaternion.w * quaternion.y - quaternion.z * quaternion.x) , -1.0f , 1.0f));
|
||||
float rotz = -atan2(2 * (quaternion.w * quaternion.z + quaternion.x * quaternion.y) , 1 - 2 * (quaternion.y * quaternion.y + quaternion.z * quaternion.z));
|
||||
|
||||
setRotation3D(Vec3(CC_RADIANS_TO_DEGREES(rotx),CC_RADIANS_TO_DEGREES(roty),CC_RADIANS_TO_DEGREES(rotz)));
|
||||
}
|
||||
|
||||
const Mat4& Camera::getViewProjectionMatrix() const
|
||||
|
|
|
@ -106,23 +106,23 @@ static inline Tex2F __t(const Vec2 &v)
|
|||
DrawNode::DrawNode()
|
||||
: _vao(0)
|
||||
, _vbo(0)
|
||||
, _vaoGLPoint(0)
|
||||
, _vboGLPoint(0)
|
||||
, _vaoGLLine(0)
|
||||
, _vboGLLine(0)
|
||||
, _bufferCapacity(0)
|
||||
, _bufferCount(0)
|
||||
, _buffer(nullptr)
|
||||
, _dirty(false)
|
||||
, _vaoGLPoint(0)
|
||||
, _vboGLPoint(0)
|
||||
, _bufferCapacityGLPoint(0)
|
||||
, _bufferCountGLPoint(0)
|
||||
, _bufferGLPoint(nullptr)
|
||||
, _pointColor(1,1,1,1)
|
||||
, _pointSize(1)
|
||||
, _dirtyGLPoint(false)
|
||||
, _vaoGLLine(0)
|
||||
, _vboGLLine(0)
|
||||
, _bufferCapacityGLLine(0)
|
||||
, _bufferCountGLLine(0)
|
||||
, _bufferGLLine(nullptr)
|
||||
, _dirty(false)
|
||||
, _dirtyGLPoint(false)
|
||||
, _dirtyGLLine(false)
|
||||
{
|
||||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||
|
@ -348,6 +348,7 @@ void DrawNode::onDraw(const Mat4 &transform, uint32_t flags)
|
|||
}
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, _bufferCount);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _bufferCount);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
@ -382,6 +383,7 @@ void DrawNode::onDrawGLLine(const Mat4 &transform, uint32_t flags)
|
|||
}
|
||||
glLineWidth(2);
|
||||
glDrawArrays(GL_LINES, 0, _bufferCountGLLine);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_bufferCountGLLine);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
@ -418,6 +420,7 @@ void DrawNode::onDrawGLPoint(const Mat4 &transform, uint32_t flags)
|
|||
}
|
||||
|
||||
glDrawArrays(GL_POINTS, 0, _bufferCountGLPoint);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_bufferCountGLPoint);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
|
|
@ -113,11 +113,11 @@ TMXLayer::TMXLayer()
|
|||
, _tiles(nullptr)
|
||||
, _tileSet(nullptr)
|
||||
, _layerOrientation(FAST_TMX_ORIENTATION_ORTHO)
|
||||
,_texture(nullptr)
|
||||
, _texture(nullptr)
|
||||
, _vertexZvalue(0)
|
||||
, _useAutomaticVertexZ(false)
|
||||
, _dirty(true)
|
||||
, _quadsDirty(true)
|
||||
, _dirty(true)
|
||||
, _vertexBuffer(nullptr)
|
||||
, _vData(nullptr)
|
||||
, _indexBuffer(nullptr)
|
||||
|
|
|
@ -94,9 +94,9 @@ FT_Library FontFreeType::getFTLibrary()
|
|||
|
||||
FontFreeType::FontFreeType(bool distanceFieldEnabled /* = false */,int outline /* = 0 */)
|
||||
: _fontRef(nullptr)
|
||||
,_distanceFieldEnabled(distanceFieldEnabled)
|
||||
,_outlineSize(0.0f)
|
||||
,_stroker(nullptr)
|
||||
, _stroker(nullptr)
|
||||
, _distanceFieldEnabled(distanceFieldEnabled)
|
||||
, _outlineSize(0.0f)
|
||||
{
|
||||
if (outline > 0)
|
||||
{
|
||||
|
|
|
@ -235,30 +235,30 @@ bool Label::setCharMap(const std::string& charMapFile, int itemWidth, int itemHe
|
|||
|
||||
Label::Label(FontAtlas *atlas /* = nullptr */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */,
|
||||
TextVAlignment vAlignment /* = TextVAlignment::TOP */,bool useDistanceField /* = false */,bool useA8Shader /* = false */)
|
||||
: _reusedLetter(nullptr)
|
||||
, _commonLineHeight(0.0f)
|
||||
: _isOpacityModifyRGB(false)
|
||||
, _contentDirty(false)
|
||||
, _fontAtlas(atlas)
|
||||
, _textSprite(nullptr)
|
||||
, _compatibleMode(false)
|
||||
, _reusedLetter(nullptr)
|
||||
, _additionalKerning(0.0f)
|
||||
, _commonLineHeight(0.0f)
|
||||
, _lineBreakWithoutSpaces(false)
|
||||
, _horizontalKernings(nullptr)
|
||||
, _maxLineWidth(0)
|
||||
, _labelDimensions(Size::ZERO)
|
||||
, _labelWidth(0)
|
||||
, _labelHeight(0)
|
||||
, _labelDimensions(Size::ZERO)
|
||||
, _hAlignment(hAlignment)
|
||||
, _vAlignment(vAlignment)
|
||||
, _horizontalKernings(nullptr)
|
||||
, _fontAtlas(atlas)
|
||||
, _isOpacityModifyRGB(false)
|
||||
, _currNumLines(-1)
|
||||
, _fontScale(1.0f)
|
||||
, _useDistanceField(useDistanceField)
|
||||
, _useA8Shader(useA8Shader)
|
||||
, _fontScale(1.0f)
|
||||
, _uniformEffectColor(0)
|
||||
, _currNumLines(-1)
|
||||
, _textSprite(nullptr)
|
||||
, _contentDirty(false)
|
||||
, _shadowDirty(false)
|
||||
, _compatibleMode(false)
|
||||
, _insideBounds(true)
|
||||
, _effectColorF(Color4F::BLACK)
|
||||
, _uniformEffectColor(0)
|
||||
, _shadowDirty(false)
|
||||
, _insideBounds(true)
|
||||
{
|
||||
setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
reset();
|
||||
|
|
|
@ -273,7 +273,7 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE virtual void setFontDefinition(const FontDefinition& textDefinition);
|
||||
CC_DEPRECATED_ATTRIBUTE const FontDefinition& getFontDefinition() const { return _fontDefinition; }
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE int getCommonLineHeight() const { return getLineHeight();}
|
||||
CC_DEPRECATED_ATTRIBUTE int getCommonLineHeight() const { return (int)getLineHeight();}
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
/**
|
||||
|
|
|
@ -44,8 +44,8 @@ void BaseLight::setRotationFromDirection( const Vec3 &direction )
|
|||
|
||||
BaseLight::BaseLight()
|
||||
: _intensity(1.0f)
|
||||
, _enabled(true)
|
||||
, _lightFlag(LightFlag::LIGHT0)
|
||||
, _enabled(true)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -82,16 +82,18 @@ Node::Node(void)
|
|||
, _scaleX(1.0f)
|
||||
, _scaleY(1.0f)
|
||||
, _scaleZ(1.0f)
|
||||
, _positionZ(0.0f)
|
||||
, _position(Vec2::ZERO)
|
||||
, _positionZ(0.0f)
|
||||
, _usingNormalizedPosition(false)
|
||||
, _normalizedPositionDirty(false)
|
||||
, _skewX(0.0f)
|
||||
, _skewY(0.0f)
|
||||
, _anchorPointInPoints(Vec2::ZERO)
|
||||
, _anchorPoint(Vec2::ZERO)
|
||||
, _contentSize(Size::ZERO)
|
||||
, _useAdditionalTransform(false)
|
||||
, _transformDirty(true)
|
||||
, _inverseDirty(true)
|
||||
, _useAdditionalTransform(false)
|
||||
, _transformUpdated(true)
|
||||
// children (lazy allocs)
|
||||
// lazy alloc
|
||||
|
@ -100,6 +102,8 @@ Node::Node(void)
|
|||
, _parent(nullptr)
|
||||
// "whole screen" objects. like Scenes and Layers, should set _ignoreAnchorPointForPosition to true
|
||||
, _tag(Node::INVALID_TAG)
|
||||
, _name("")
|
||||
, _hashOfName(0)
|
||||
// userData is always inited as nil
|
||||
, _userData(nullptr)
|
||||
, _userObject(nullptr)
|
||||
|
@ -125,10 +129,6 @@ Node::Node(void)
|
|||
, _realColor(Color3B::WHITE)
|
||||
, _cascadeColorEnabled(false)
|
||||
, _cascadeOpacityEnabled(false)
|
||||
, _usingNormalizedPosition(false)
|
||||
, _normalizedPositionDirty(false)
|
||||
, _name("")
|
||||
, _hashOfName(0)
|
||||
, _cameraMask(1)
|
||||
{
|
||||
// set default scheduler and actionManager
|
||||
|
|
|
@ -40,7 +40,11 @@ NS_CC_BEGIN
|
|||
|
||||
// implementation RenderTexture
|
||||
RenderTexture::RenderTexture()
|
||||
: _FBO(0)
|
||||
: _keepMatrix(false)
|
||||
, _rtTextureRect(Rect::ZERO)
|
||||
, _fullRect(Rect::ZERO)
|
||||
, _fullviewPort(Rect::ZERO)
|
||||
, _FBO(0)
|
||||
, _depthRenderBufffer(0)
|
||||
, _oldFBO(0)
|
||||
, _texture(0)
|
||||
|
@ -53,10 +57,6 @@ RenderTexture::RenderTexture()
|
|||
, _clearStencil(0)
|
||||
, _autoDraw(false)
|
||||
, _sprite(nullptr)
|
||||
, _keepMatrix(false)
|
||||
, _rtTextureRect(Rect::ZERO)
|
||||
, _fullRect(Rect::ZERO)
|
||||
, _fullviewPort(Rect::ZERO)
|
||||
, _saveFileCallback(nullptr)
|
||||
{
|
||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||
|
@ -553,7 +553,7 @@ void RenderTexture::onBegin()
|
|||
director->setProjection(director->getProjection());
|
||||
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||
Mat4 modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
auto modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
modifiedProjection = GLViewImpl::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION,modifiedProjection);
|
||||
#endif
|
||||
|
@ -572,7 +572,7 @@ void RenderTexture::onBegin()
|
|||
else
|
||||
{
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||
Mat4 modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
auto modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
modifiedProjection = GLViewImpl::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, modifiedProjection);
|
||||
#endif
|
||||
|
|
|
@ -259,10 +259,10 @@ bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect, bool rotated)
|
|||
}
|
||||
|
||||
Sprite::Sprite(void)
|
||||
: _shouldBeHidden(false)
|
||||
: _batchNode(nullptr)
|
||||
, _shouldBeHidden(false)
|
||||
, _texture(nullptr)
|
||||
, _insideBounds(true)
|
||||
, _batchNode(nullptr)
|
||||
{
|
||||
#if CC_SPRITE_DEBUG_DRAW
|
||||
_debugDrawNode = DrawNode::create();
|
||||
|
|
|
@ -55,8 +55,8 @@ TextFieldTTF::TextFieldTTF()
|
|||
, _charCount(0)
|
||||
, _inputText("")
|
||||
, _placeHolder("") // prevent Label initWithString assertion
|
||||
, _secureTextEntry(false)
|
||||
, _colorText(Color4B::WHITE)
|
||||
, _secureTextEntry(false)
|
||||
{
|
||||
_colorSpaceHolder.r = _colorSpaceHolder.g = _colorSpaceHolder.b = 127;
|
||||
_colorSpaceHolder.a = 255;
|
||||
|
|
|
@ -247,13 +247,13 @@ void Animate3D::setWeight(float weight)
|
|||
}
|
||||
|
||||
Animate3D::Animate3D()
|
||||
: _absSpeed(1.f)
|
||||
: _state(Animate3D::Animate3DState::Running)
|
||||
, _animation(nullptr)
|
||||
, _absSpeed(1.f)
|
||||
, _weight(1.f)
|
||||
, _start(0.f)
|
||||
, _last(1.f)
|
||||
, _animation(nullptr)
|
||||
, _playReverse(false)
|
||||
, _state(Animate3D::Animate3DState::Running)
|
||||
, _accTransTime(0.0f)
|
||||
, _lastTime(0.0f)
|
||||
{
|
||||
|
|
|
@ -103,8 +103,8 @@ float AnimationCurve<componentSize>::getEndTime() const
|
|||
|
||||
template <int componentSize>
|
||||
AnimationCurve<componentSize>::AnimationCurve()
|
||||
: _keytime(nullptr)
|
||||
, _value(nullptr)
|
||||
: _value(nullptr)
|
||||
, _keytime(nullptr)
|
||||
, _count(0)
|
||||
, _componentSizeByte(0)
|
||||
, _evaluateFun(nullptr)
|
||||
|
|
|
@ -87,7 +87,6 @@ static const char* TRANSLATION = "translation";
|
|||
static const char* ROTATION = "rotation";
|
||||
static const char* SCALE = "scale";
|
||||
static const char* KEYTIME = "keytime";
|
||||
static const char* AABBS = "aabb";
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -290,8 +289,8 @@ bool Bundle3D::loadObj(MeshDatas& meshdatas, MaterialDatas& materialdatas, NodeD
|
|||
materialdata.textures.push_back(tex);
|
||||
materialdata.id = str;
|
||||
materialdatas.materials.push_back(materialdata);
|
||||
|
||||
meshdata->subMeshIndices.push_back(it.mesh.indices);
|
||||
meshdata->subMeshAABB.push_back(calculateAABB(meshdata->vertex, meshdata->getPerVertexSize(), it.mesh.indices));
|
||||
meshdata->subMeshIds.push_back(str);
|
||||
auto node = new (std::nothrow) NodeData();
|
||||
auto modelnode = new (std::nothrow) ModelData();
|
||||
|
@ -376,7 +375,6 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
|
|||
for(int i = 0; i < meshSize ; i++ )
|
||||
{
|
||||
MeshData* meshData = new (std::nothrow) MeshData();
|
||||
|
||||
unsigned int attribSize=0;
|
||||
// read mesh data
|
||||
if (_binaryReader.read(&attribSize, 4, 1) != 1 || attribSize < 1)
|
||||
|
@ -426,7 +424,6 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
|
|||
std::vector<unsigned short> indexArray;
|
||||
std:: string meshPartid = _binaryReader.readString();
|
||||
meshData->subMeshIds.push_back(meshPartid);
|
||||
|
||||
unsigned int nIndexCount;
|
||||
if (_binaryReader.read(&nIndexCount, 4, 1) != 1)
|
||||
{
|
||||
|
@ -441,22 +438,6 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
|
|||
}
|
||||
meshData->subMeshIndices.push_back(indexArray);
|
||||
meshData->numIndex = (int)meshData->subMeshIndices.size();
|
||||
|
||||
if (_version != "0.3" && _version != "0.4")
|
||||
{
|
||||
//read mesh aabb
|
||||
float aabb[6];
|
||||
if (_binaryReader.read(aabb, 4, 6) != 1)
|
||||
{
|
||||
CCLOG("warning: Failed to read meshdata: aabb '%s'.", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
meshData->subMeshAABB.push_back(AABB(Vec3(aabb[0], aabb[1], aabb[2]), Vec3(aabb[3], aabb[4], aabb[5])));
|
||||
}
|
||||
else
|
||||
{
|
||||
meshData->subMeshAABB.push_back(calculateAABB(meshData->vertex, meshData->getPerVertexSize(), indexArray));
|
||||
}
|
||||
}
|
||||
meshdatas.meshDatas.push_back(meshData);
|
||||
}
|
||||
|
@ -564,7 +545,6 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
|
|||
}
|
||||
|
||||
meshdata->subMeshIndices.push_back(indices);
|
||||
meshdata->subMeshAABB.push_back(calculateAABB(meshdata->vertex, meshdata->getPerVertexSize(), indices));
|
||||
}
|
||||
|
||||
meshdatas.meshDatas.push_back(meshdata);
|
||||
|
@ -679,14 +659,12 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
|
|||
}
|
||||
|
||||
meshdata->subMeshIndices.push_back(indices);
|
||||
meshdata->subMeshAABB.push_back(calculateAABB(meshdata->vertex, meshdata->getPerVertexSize(), indices));
|
||||
}
|
||||
|
||||
meshdatas.meshDatas.push_back(meshdata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bundle3D::loadMeshDatasJson(MeshDatas& meshdatas)
|
||||
{
|
||||
const rapidjson::Value& mesh_data_array = _jsonReader[MESHES];
|
||||
|
@ -694,7 +672,6 @@ bool Bundle3D::loadMeshDatasJson(MeshDatas& meshdatas)
|
|||
{
|
||||
MeshData* meshData = new (std::nothrow) MeshData();
|
||||
const rapidjson::Value& mesh_data = mesh_data_array[index];
|
||||
|
||||
// mesh_vertex_attribute
|
||||
const rapidjson::Value& mesh_vertex_attribute = mesh_data[ATTRIBUTES];
|
||||
MeshVertexAttrib tempAttrib;
|
||||
|
@ -737,18 +714,6 @@ bool Bundle3D::loadMeshDatasJson(MeshDatas& meshdatas)
|
|||
|
||||
meshData->subMeshIndices.push_back(indexArray);
|
||||
meshData->numIndex = (int)meshData->subMeshIndices.size();
|
||||
//mesh_aabb
|
||||
const rapidjson::Value& mesh_part_aabb = mesh_part[AABBS];
|
||||
if (mesh_part_aabb.Size() == 6)
|
||||
{
|
||||
Vec3 min = Vec3(mesh_part_aabb[(rapidjson::SizeType)0].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)1].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)2].GetDouble());
|
||||
Vec3 max = Vec3(mesh_part_aabb[(rapidjson::SizeType)3].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)4].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)5].GetDouble());
|
||||
meshData->subMeshAABB.push_back(AABB(min, max));
|
||||
}
|
||||
else
|
||||
{
|
||||
meshData->subMeshAABB.push_back(calculateAABB(meshData->vertex, meshData->getPerVertexSize(), indexArray));
|
||||
}
|
||||
}
|
||||
meshdatas.meshDatas.push_back(meshData);
|
||||
}
|
||||
|
@ -1116,7 +1081,6 @@ bool Bundle3D::loadMeshDataJson_0_1(MeshDatas& meshdatas)
|
|||
|
||||
meshdata->subMeshIndices.push_back(indices);
|
||||
meshdatas.meshDatas.push_back(meshdata);
|
||||
meshdata->subMeshAABB.push_back(calculateAABB(meshdata->vertex, meshdata->getPerVertexSize(), indices));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1170,7 +1134,6 @@ bool Bundle3D::loadMeshDataJson_0_2(MeshDatas& meshdatas)
|
|||
indices[j] = (unsigned short)indices_val_array[j].GetUint();
|
||||
|
||||
meshdata->subMeshIndices.push_back(indices);
|
||||
meshdata->subMeshAABB.push_back(calculateAABB(meshdata->vertex, meshdata->getPerVertexSize(), indices));
|
||||
}
|
||||
meshdatas.meshDatas.push_back(meshdata);
|
||||
return true;
|
||||
|
@ -1441,7 +1404,8 @@ bool Bundle3D::loadAnimationDataJson(const std::string& id, Animation3DData* ani
|
|||
|
||||
bool Bundle3D::loadAnimationDataBinary(const std::string& id, Animation3DData* animationdata)
|
||||
{
|
||||
if(_version == "0.1" || _version == "0.3" || _version == "0.4")
|
||||
|
||||
if( _version == "0.1"|| _version == "0.2" || _version == "0.3"|| _version == "0.4")
|
||||
{
|
||||
if (!seekToFirstType(BUNDLE_TYPE_ANIMATIONS))
|
||||
return false;
|
||||
|
@ -1457,7 +1421,7 @@ bool Bundle3D::loadAnimationDataBinary(const std::string& id, Animation3DData* a
|
|||
}
|
||||
|
||||
unsigned int animNum = 1;
|
||||
if(_version == "0.3" || _version == "0.4")
|
||||
if( _version == "0.1"|| _version == "0.2" || _version == "0.3"|| _version == "0.4")
|
||||
{
|
||||
if (!_binaryReader.read(&animNum))
|
||||
{
|
||||
|
@ -1509,7 +1473,7 @@ bool Bundle3D::loadAnimationDataBinary(const std::string& id, Animation3DData* a
|
|||
|
||||
// transform flag
|
||||
unsigned char transformFlag(0);
|
||||
if (_version != "0.1" && _version != "0.3")
|
||||
if (_version != "0.1" && _version != "0.2" && _version != "0.3")
|
||||
{
|
||||
if (!_binaryReader.read(&transformFlag))
|
||||
{
|
||||
|
@ -1520,7 +1484,7 @@ bool Bundle3D::loadAnimationDataBinary(const std::string& id, Animation3DData* a
|
|||
|
||||
// rotation
|
||||
bool hasRotate = true;
|
||||
if (_version != "0.1" && _version != "0.3")
|
||||
if (_version != "0.1" && _version != "0.2" && _version != "0.3")
|
||||
hasRotate = transformFlag & 0x01;
|
||||
|
||||
if (hasRotate)
|
||||
|
@ -1536,7 +1500,7 @@ bool Bundle3D::loadAnimationDataBinary(const std::string& id, Animation3DData* a
|
|||
|
||||
// scale
|
||||
bool hasScale = true;
|
||||
if (_version != "0.1" && _version != "0.3")
|
||||
if (_version != "0.1" && _version != "0.2" && _version != "0.3")
|
||||
hasScale = (transformFlag >> 1) & 0x01;
|
||||
|
||||
if (hasScale)
|
||||
|
@ -1552,7 +1516,7 @@ bool Bundle3D::loadAnimationDataBinary(const std::string& id, Animation3DData* a
|
|||
|
||||
// translation
|
||||
bool hasTranslation = true;
|
||||
if (_version != "0.1" && _version != "0.3")
|
||||
if (_version != "0.1" && _version != "0.2" && _version != "0.3")
|
||||
hasTranslation = (transformFlag >> 2) & 0x01;
|
||||
|
||||
if (hasTranslation)
|
||||
|
@ -2014,16 +1978,15 @@ Reference* Bundle3D::seekToFirstType(unsigned int type, const std::string& id)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Bundle3D::Bundle3D()
|
||||
:_isBinary(false),
|
||||
_modelPath(""),
|
||||
: _modelPath(""),
|
||||
_path(""),
|
||||
_version(""),
|
||||
_jsonBuffer(nullptr),
|
||||
_binaryBuffer(nullptr),
|
||||
_referenceCount(0),
|
||||
_references(nullptr)
|
||||
_references(nullptr),
|
||||
_isBinary(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -2033,16 +1996,4 @@ Bundle3D::~Bundle3D()
|
|||
|
||||
}
|
||||
|
||||
AABB Bundle3D::calculateAABB(const std::vector<float>& vertex, int stride, const std::vector<unsigned short>& index)
|
||||
{
|
||||
AABB aabb;
|
||||
stride /= 4;
|
||||
for(const auto& it : index)
|
||||
{
|
||||
Vec3 point = Vec3(vertex[it * stride ], vertex[ it * stride + 1], vertex[it * stride + 2 ]);
|
||||
aabb.updateMinMax(&point, 1);
|
||||
}
|
||||
return aabb;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -144,17 +144,15 @@ protected:
|
|||
void getModelRelativePath(const std::string& path);
|
||||
|
||||
/*
|
||||
* set the read position in buffer to the target type
|
||||
* @param The data type
|
||||
* @param The data id
|
||||
*/
|
||||
* set the read position in buffer to the target type
|
||||
* @param The data type
|
||||
* @param The data id
|
||||
*/
|
||||
Reference* seekToFirstType(unsigned int type, const std::string& id = "");
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
Bundle3D();
|
||||
virtual ~Bundle3D();
|
||||
|
||||
static AABB calculateAABB(const std::vector<float>& vertex, int stride, const std::vector<unsigned short>& index);
|
||||
|
||||
protected:
|
||||
static Bundle3D* _instance;
|
||||
|
|
|
@ -367,10 +367,10 @@ public:
|
|||
}
|
||||
|
||||
Animation3DData(const Animation3DData& other)
|
||||
: _totalTime(other._totalTime)
|
||||
, _translationKeys(other._translationKeys)
|
||||
: _translationKeys(other._translationKeys)
|
||||
, _rotationKeys(other._rotationKeys)
|
||||
, _scaleKeys(other._scaleKeys)
|
||||
, _totalTime(other._totalTime)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -36,14 +36,14 @@ using namespace std;
|
|||
NS_CC_BEGIN
|
||||
|
||||
Mesh::Mesh()
|
||||
: _visible(true)
|
||||
, _texture(nullptr)
|
||||
: _texture(nullptr)
|
||||
, _skin(nullptr)
|
||||
, _visible(true)
|
||||
, _isTransparent(false)
|
||||
, _meshIndexData(nullptr)
|
||||
, _visibleChanged(nullptr)
|
||||
, _glProgramState(nullptr)
|
||||
, _blend(BlendFunc::ALPHA_NON_PREMULTIPLIED)
|
||||
, _isTransparent(false)
|
||||
, _visibleChanged(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ static int PALETTE_ROWS = 3;
|
|||
|
||||
MeshSkin::MeshSkin()
|
||||
: _rootBone(nullptr)
|
||||
, _matrixPalette(nullptr)
|
||||
, _skeleton(nullptr)
|
||||
, _matrixPalette(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -94,15 +94,12 @@ MeshVertexData* MeshVertexData::create(const MeshData& meshdata)
|
|||
vertexdata->_vertexData->setStream(vertexdata->_vertexBuffer, VertexStreamAttribute(offset, it.vertexAttrib, it.type, it.size));
|
||||
offset += it.attribSizeBytes;
|
||||
}
|
||||
vertexdata->_vertexData->setStream(vertexdata->_vertexBuffer, VertexStreamAttribute(0, GLProgram::VERTEX_ATTRIB_POSITION, GL_FLOAT, 3));
|
||||
vertexdata->_vertexData->setStream(vertexdata->_vertexBuffer, VertexStreamAttribute(offsetof(V3F_C4B_T2F, colors), GLProgram::VERTEX_ATTRIB_COLOR, GL_UNSIGNED_BYTE, 4, true));
|
||||
vertexdata->_vertexData->setStream(vertexdata->_vertexBuffer, VertexStreamAttribute(offsetof(V3F_C4B_T2F, texCoords), GLProgram::VERTEX_ATTRIB_TEX_COORD, GL_FLOAT, 2));
|
||||
|
||||
vertexdata->_attribs = meshdata.attribs;
|
||||
|
||||
if(vertexdata->_vertexBuffer)
|
||||
{
|
||||
vertexdata->_vertexBuffer->updateVertices((void*)&meshdata.vertex[0], (int)meshdata.vertex.size() * 4, 0);
|
||||
vertexdata->_vertexBuffer->updateVertices((void*)&meshdata.vertex[0], (int)meshdata.vertex.size() * 4 / vertexdata->_vertexBuffer->getSizePerVertex(), 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -684,7 +684,7 @@ Mesh* Sprite3D::getMeshByIndex(int index) const
|
|||
return _meshes.at(index);
|
||||
}
|
||||
|
||||
/**get SubMeshState by Name */
|
||||
/**get Mesh by Name */
|
||||
Mesh* Sprite3D::getMeshByName(const std::string& name) const
|
||||
{
|
||||
for (const auto& it : _meshes) {
|
||||
|
@ -694,6 +694,16 @@ Mesh* Sprite3D::getMeshByName(const std::string& name) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<Mesh*> Sprite3D::getMeshArrayByName(const std::string& name) const
|
||||
{
|
||||
std::vector<Mesh*> meshes;
|
||||
for (const auto& it : _meshes) {
|
||||
if (it->getName() == name)
|
||||
meshes.push_back(it);
|
||||
}
|
||||
return meshes;
|
||||
}
|
||||
|
||||
MeshSkin* Sprite3D::getSkin() const
|
||||
{
|
||||
for (const auto& it : _meshes) {
|
||||
|
|
|
@ -60,11 +60,14 @@ public:
|
|||
void setTexture(const std::string& texFile);
|
||||
void setTexture(Texture2D* texture);
|
||||
|
||||
/**get SubMeshState by index*/
|
||||
/**get Mesh by index*/
|
||||
Mesh* getMeshByIndex(int index) const;
|
||||
|
||||
/**get SubMeshState by Name */
|
||||
/**get Mesh by Name, it returns the first one if there are more than one mesh with the same name */
|
||||
Mesh* getMeshByName(const std::string& name) const;
|
||||
|
||||
/** get mesh array by name, returns all meshes with the given name */
|
||||
std::vector<Mesh*> getMeshArrayByName(const std::string& name) const;
|
||||
|
||||
/**get mesh*/
|
||||
Mesh* getMesh() const { return _meshes.at(0); }
|
||||
|
|
|
@ -540,15 +540,15 @@ void Director::multiplyMatrix(MATRIX_STACK_TYPE type, const Mat4& mat)
|
|||
|
||||
void Director::pushMatrix(MATRIX_STACK_TYPE type)
|
||||
{
|
||||
if(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW == type)
|
||||
if(type == MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW)
|
||||
{
|
||||
_modelViewMatrixStack.push(_modelViewMatrixStack.top());
|
||||
}
|
||||
else if(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION == type)
|
||||
else if(type == MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION)
|
||||
{
|
||||
_projectionMatrixStack.push(_projectionMatrixStack.top());
|
||||
}
|
||||
else if(MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE == type)
|
||||
else if(type == MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE)
|
||||
{
|
||||
_textureMatrixStack.push(_textureMatrixStack.top());
|
||||
}
|
||||
|
@ -558,36 +558,23 @@ void Director::pushMatrix(MATRIX_STACK_TYPE type)
|
|||
}
|
||||
}
|
||||
|
||||
Mat4 Director::getMatrix(MATRIX_STACK_TYPE type)
|
||||
const Mat4& Director::getMatrix(MATRIX_STACK_TYPE type)
|
||||
{
|
||||
Mat4 result;
|
||||
if(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW == type)
|
||||
if(type == MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW)
|
||||
{
|
||||
result = _modelViewMatrixStack.top();
|
||||
return _modelViewMatrixStack.top();
|
||||
}
|
||||
else if(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION == type)
|
||||
else if(type == MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION)
|
||||
{
|
||||
result = _projectionMatrixStack.top();
|
||||
return _projectionMatrixStack.top();
|
||||
}
|
||||
else if(MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE == type)
|
||||
else if(type == MATRIX_STACK_TYPE::MATRIX_STACK_TEXTURE)
|
||||
{
|
||||
result = _textureMatrixStack.top();
|
||||
return _textureMatrixStack.top();
|
||||
}
|
||||
else
|
||||
{
|
||||
CCASSERT(false, "unknow matrix stack type, will return modelview matrix instead");
|
||||
result = _modelViewMatrixStack.top();
|
||||
}
|
||||
// float diffResult(0);
|
||||
// for (int index = 0; index <16; ++index)
|
||||
// {
|
||||
// diffResult += abs(result2.mat[index] - result.mat[index]);
|
||||
// }
|
||||
// if(diffResult > 1e-30)
|
||||
// {
|
||||
// CCASSERT(false, "Error in director matrix stack");
|
||||
// }
|
||||
return result;
|
||||
|
||||
CCASSERT(false, "unknow matrix stack type, will return modelview matrix instead");
|
||||
return _modelViewMatrixStack.top();
|
||||
}
|
||||
|
||||
void Director::setProjection(Projection projection)
|
||||
|
@ -717,17 +704,15 @@ static void GLToClipTransform(Mat4 *transformOut)
|
|||
|
||||
Director* director = Director::getInstance();
|
||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
||||
|
||||
Mat4 projection;
|
||||
projection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
|
||||
auto projection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||
//if needed, we need to undo the rotation for Landscape orientation in order to get the correct positions
|
||||
projection = Director::getInstance()->getOpenGLView()->getReverseOrientationMatrix() * projection;
|
||||
#endif
|
||||
|
||||
Mat4 modelview;
|
||||
modelview = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
auto modelview = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
*transformOut = projection * modelview;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,27 +90,12 @@ enum class MATRIX_STACK_TYPE
|
|||
|
||||
class CC_DLL Director : public Ref
|
||||
{
|
||||
private:
|
||||
std::stack<Mat4> _modelViewMatrixStack;
|
||||
std::stack<Mat4> _projectionMatrixStack;
|
||||
std::stack<Mat4> _textureMatrixStack;
|
||||
protected:
|
||||
void initMatrixStack();
|
||||
public:
|
||||
void pushMatrix(MATRIX_STACK_TYPE type);
|
||||
void popMatrix(MATRIX_STACK_TYPE type);
|
||||
void loadIdentityMatrix(MATRIX_STACK_TYPE type);
|
||||
void loadMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
|
||||
void multiplyMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
|
||||
Mat4 getMatrix(MATRIX_STACK_TYPE type);
|
||||
void resetMatrixStack();
|
||||
public:
|
||||
static const char *EVENT_PROJECTION_CHANGED;
|
||||
static const char* EVENT_AFTER_UPDATE;
|
||||
static const char* EVENT_AFTER_VISIT;
|
||||
static const char* EVENT_AFTER_DRAW;
|
||||
|
||||
|
||||
/** @typedef ccDirectorProjection
|
||||
Possible OpenGL projections used by director
|
||||
*/
|
||||
|
@ -399,6 +384,14 @@ public:
|
|||
*/
|
||||
float getFrameRate() const { return _frameRate; }
|
||||
|
||||
void pushMatrix(MATRIX_STACK_TYPE type);
|
||||
void popMatrix(MATRIX_STACK_TYPE type);
|
||||
void loadIdentityMatrix(MATRIX_STACK_TYPE type);
|
||||
void loadMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
|
||||
void multiplyMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
|
||||
const Mat4& getMatrix(MATRIX_STACK_TYPE type);
|
||||
void resetMatrixStack();
|
||||
|
||||
protected:
|
||||
void purgeDirector();
|
||||
bool _purgeDirectorInNextLoop; // this flag will be set to true in end()
|
||||
|
@ -417,6 +410,12 @@ protected:
|
|||
void initTextureCache();
|
||||
void destroyTextureCache();
|
||||
|
||||
void initMatrixStack();
|
||||
|
||||
std::stack<Mat4> _modelViewMatrixStack;
|
||||
std::stack<Mat4> _projectionMatrixStack;
|
||||
std::stack<Mat4> _textureMatrixStack;
|
||||
|
||||
/** Scheduler associated with this director
|
||||
@since v2.0
|
||||
*/
|
||||
|
|
|
@ -30,8 +30,8 @@ NS_CC_BEGIN
|
|||
EventController::EventController(ControllerEventType type, Controller* controller, int keyCode)
|
||||
: Event(Type::GAME_CONTROLLER)
|
||||
, _controllerEventType(type)
|
||||
, _keyCode(keyCode)
|
||||
, _controller(controller)
|
||||
, _keyCode(keyCode)
|
||||
, _isConnected(true)
|
||||
{
|
||||
|
||||
|
@ -41,8 +41,8 @@ EventController::EventController(ControllerEventType type, Controller* controlle
|
|||
: Event(Type::GAME_CONTROLLER)
|
||||
, _controllerEventType(type)
|
||||
, _controller(controller)
|
||||
, _isConnected(isConnected)
|
||||
, _keyCode(0)
|
||||
, _isConnected(isConnected)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ NS_CC_BEGIN
|
|||
|
||||
EventFocus::EventFocus(ui::Widget *widgetLoseFocus, ui::Widget* widgetGetFocus)
|
||||
:Event(Type::FOCUS),
|
||||
_widgetLoseFocus(widgetLoseFocus),
|
||||
_widgetGetFocus(widgetGetFocus)
|
||||
_widgetGetFocus(widgetGetFocus),
|
||||
_widgetLoseFocus(widgetLoseFocus)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@ using namespace cocos2d;
|
|||
namespace cocosbuilder {
|
||||
|
||||
CCBKeyframe::CCBKeyframe()
|
||||
: _time(0.0f)
|
||||
: _object(nullptr)
|
||||
, _time(0.0f)
|
||||
, _easingType(EasingType::INSTANT)
|
||||
, _easingOpt(0.0f)
|
||||
, _object(nullptr)
|
||||
{}
|
||||
|
||||
CCBKeyframe::~CCBKeyframe()
|
||||
|
|
|
@ -733,11 +733,15 @@ ActionTimeline* ActionTimelineCache::loadAnimationActionWithFileFromXML(const st
|
|||
// xml read
|
||||
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(fileName).c_str();
|
||||
ssize_t size;
|
||||
std::string content =(char*)FileUtils::getInstance()->getFileData(fullpath, "r", &size);
|
||||
|
||||
//fix memory leak for v3.3
|
||||
unsigned char* pByte = FileUtils::getInstance()->getFileData(fullpath, "r", &size);
|
||||
|
||||
// xml parse
|
||||
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();
|
||||
document->Parse(content.c_str());
|
||||
document->Parse((const char*)pByte);
|
||||
|
||||
free(pByte);
|
||||
|
||||
const tinyxml2::XMLElement* rootElement = document->RootElement();// Root
|
||||
CCLOG("rootElement name = %s", rootElement->Name());
|
||||
|
|
|
@ -449,7 +449,8 @@ void CSLoader::initNode(Node* node, const rapidjson::Value& json)
|
|||
Node* CSLoader::loadSimpleNode(const rapidjson::Value& json)
|
||||
{
|
||||
Node* node = Node::create();
|
||||
node->retain();
|
||||
// fix memory leak for v3.3
|
||||
//node->retain();
|
||||
initNode(node, json);
|
||||
|
||||
return node;
|
||||
|
@ -468,8 +469,8 @@ Node* CSLoader::loadSubGraph(const rapidjson::Value& json)
|
|||
{
|
||||
node = Node::create();
|
||||
}
|
||||
|
||||
node->retain();
|
||||
// fix memory leak for v3.3
|
||||
//node->retain();
|
||||
|
||||
initNode(node, json);
|
||||
|
||||
|
@ -507,7 +508,8 @@ Node* CSLoader::loadSprite(const rapidjson::Value& json)
|
|||
sprite = Sprite::create();
|
||||
}
|
||||
|
||||
sprite->retain();
|
||||
// fix memory leak for v3.3
|
||||
//sprite->retain();
|
||||
|
||||
initNode(sprite, json);
|
||||
|
||||
|
@ -529,7 +531,8 @@ Node* CSLoader::loadParticle(const rapidjson::Value& json)
|
|||
|
||||
ParticleSystemQuad* particle = ParticleSystemQuad::create(filePath);
|
||||
particle->setTotalParticles(num);
|
||||
particle->retain();
|
||||
// fix memory leak for v3.3
|
||||
//particle->retain();
|
||||
|
||||
initNode(particle, json);
|
||||
|
||||
|
@ -578,7 +581,8 @@ Node* CSLoader::loadWidget(const rapidjson::Value& json)
|
|||
|
||||
std::string guiClassName = getGUIClassName(classname);
|
||||
widget = dynamic_cast<Widget*>(ObjectFactory::getInstance()->createObject(guiClassName));
|
||||
widget->retain();
|
||||
// fix memory leak for v3.3
|
||||
//widget->retain();
|
||||
|
||||
WidgetReaderProtocol* reader = dynamic_cast<WidgetReaderProtocol*>(ObjectFactory::getInstance()->createObject(readerName));
|
||||
|
||||
|
@ -587,7 +591,9 @@ Node* CSLoader::loadWidget(const rapidjson::Value& json)
|
|||
else if (isCustomWidget(classname))
|
||||
{
|
||||
widget = dynamic_cast<Widget*>(ObjectFactory::getInstance()->createObject(classname));
|
||||
widget->retain();
|
||||
|
||||
//fix memory leak for v3.3
|
||||
//widget->retain();
|
||||
|
||||
//
|
||||
// 1st., custom widget parse properties of parent widget with parent widget reader
|
||||
|
@ -826,7 +832,8 @@ Node* CSLoader::nodeFromProtocolBuffers(const protocolbuffers::NodeTree &nodetre
|
|||
readerName.append("Reader");
|
||||
|
||||
Widget* widget = dynamic_cast<Widget*>(ObjectFactory::getInstance()->createObject(guiClassName));
|
||||
widget->retain();
|
||||
//fix memory leak for v3.3
|
||||
//widget->retain();
|
||||
|
||||
WidgetReaderProtocol* reader = dynamic_cast<WidgetReaderProtocol*>(ObjectFactory::getInstance()->createObject(readerName));
|
||||
reader->setPropsFromProtocolBuffers(widget, nodetree);
|
||||
|
@ -840,7 +847,9 @@ Node* CSLoader::nodeFromProtocolBuffers(const protocolbuffers::NodeTree &nodetre
|
|||
else if (isCustomWidget(classname))
|
||||
{
|
||||
Widget* widget = dynamic_cast<Widget*>(ObjectFactory::getInstance()->createObject(classname));
|
||||
widget->retain();
|
||||
|
||||
//fix memory leak for v3.3
|
||||
//widget->retain();
|
||||
|
||||
//
|
||||
// 1st., custom widget parse properties of parent widget with parent widget reader
|
||||
|
@ -1046,8 +1055,8 @@ void CSLoader::setPropsForSpriteFromProtocolBuffers(cocos2d::Node *node,
|
|||
CCLOG("filePath is empty. Create a sprite with no texture");
|
||||
}
|
||||
*/
|
||||
|
||||
sprite->retain();
|
||||
//fix memory leak for v3.3
|
||||
//sprite->retain();
|
||||
|
||||
setPropsForNodeFromProtocolBuffers(sprite, nodeOptions);
|
||||
|
||||
|
@ -1245,11 +1254,15 @@ Node* CSLoader::nodeFromXMLFile(const std::string &fileName)
|
|||
// xml read
|
||||
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(fileName).c_str();
|
||||
ssize_t size;
|
||||
std::string content =(char*)FileUtils::getInstance()->getFileData(fullpath, "r", &size);
|
||||
|
||||
//fix memory leak for v3.3
|
||||
unsigned char* pByte = FileUtils::getInstance()->getFileData(fullpath, "r", &size);
|
||||
|
||||
// xml parse
|
||||
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();
|
||||
document->Parse(content.c_str());
|
||||
document->Parse((const char*)pByte);
|
||||
|
||||
free(pByte);
|
||||
|
||||
const tinyxml2::XMLElement* rootElement = document->RootElement();// Root
|
||||
CCLOG("rootElement name = %s", rootElement->Name());
|
||||
|
@ -1408,7 +1421,9 @@ Node* CSLoader::nodeFromXML(const tinyxml2::XMLElement *objectData, const std::s
|
|||
readerName.append("Reader");
|
||||
|
||||
Widget* widget = dynamic_cast<Widget*>(ObjectFactory::getInstance()->createObject(guiClassName));
|
||||
widget->retain();
|
||||
|
||||
//fix memory leak for v3.3
|
||||
//widget->retain();
|
||||
|
||||
WidgetReaderProtocol* reader = dynamic_cast<WidgetReaderProtocol*>(ObjectFactory::getInstance()->createObject(readerName));
|
||||
reader->setPropsFromXML(widget, objectData);
|
||||
|
|
|
@ -330,7 +330,7 @@ void DataReaderHelper::addDataFromFile(const std::string& filePath)
|
|||
DataReaderHelper::addDataFromBinaryCache(contentStr.c_str(),&dataInfo);
|
||||
}
|
||||
|
||||
CC_SAFE_DELETE_ARRAY(pBytes);
|
||||
free(pBytes);
|
||||
}
|
||||
|
||||
void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const std::string& plistPath, const std::string& filePath, Ref *target, SEL_SCHEDULE selector)
|
||||
|
@ -429,7 +429,9 @@ void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const
|
|||
Data bytecpy;
|
||||
bytecpy.copy(pBytes, size);
|
||||
data->fileContent = std::string((const char*)bytecpy.getBytes(), size);
|
||||
CC_SAFE_DELETE_ARRAY(pBytes);
|
||||
|
||||
// fix memory leak for v3.3
|
||||
free(pBytes);
|
||||
|
||||
if (str == ".xml")
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ SceneReader::SceneReader()
|
|||
ObjectFactory::getInstance()->registerType(CREATE_CLASS_COMPONENT_INFO(ComAttribute));
|
||||
ObjectFactory::getInstance()->registerType(CREATE_CLASS_COMPONENT_INFO(ComRender));
|
||||
ObjectFactory::getInstance()->registerType(CREATE_CLASS_COMPONENT_INFO(ComAudio));
|
||||
ObjectFactory::getInstance()->registerType(CREATE_CLASS_COMPONENT_INFO(ComController));
|
||||
ObjectFactory::getInstance()->registerType(CREATE_CLASS_COMPONENT_INFO(ComController));
|
||||
}
|
||||
|
||||
SceneReader::~SceneReader()
|
||||
|
@ -57,13 +57,13 @@ const char* SceneReader::sceneReaderVersion()
|
|||
cocos2d::Node* SceneReader::createNodeWithSceneFile(const std::string &fileName, AttachComponentType attachComponent /*= AttachComponentType::EMPTY_NODE*/)
|
||||
{
|
||||
std::string reDir = fileName;
|
||||
std::string file_extension = "";
|
||||
size_t pos = reDir.find_last_of('.');
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
file_extension = reDir.substr(pos, reDir.length());
|
||||
std::transform(file_extension.begin(),file_extension.end(), file_extension.begin(), (int(*)(int))toupper);
|
||||
}
|
||||
std::string file_extension = "";
|
||||
size_t pos = reDir.find_last_of('.');
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
file_extension = reDir.substr(pos, reDir.length());
|
||||
std::transform(file_extension.begin(),file_extension.end(), file_extension.begin(), (int(*)(int))toupper);
|
||||
}
|
||||
if (file_extension == ".JSON")
|
||||
{
|
||||
_node = nullptr;
|
||||
|
@ -78,7 +78,7 @@ cocos2d::Node* SceneReader::createNodeWithSceneFile(const std::string &fileName,
|
|||
}
|
||||
else if(file_extension == ".CSB")
|
||||
{
|
||||
do {
|
||||
do {
|
||||
std::string binaryFilePath = CCFileUtils::getInstance()->fullPathForFilename(fileName);
|
||||
auto fileData = FileUtils::getInstance()->getDataFromFile(binaryFilePath);
|
||||
auto fileDataBytes = fileData.getBytes();
|
||||
|
@ -86,90 +86,90 @@ cocos2d::Node* SceneReader::createNodeWithSceneFile(const std::string &fileName,
|
|||
CocoLoader tCocoLoader;
|
||||
if (tCocoLoader.ReadCocoBinBuff((char*)fileDataBytes))
|
||||
{
|
||||
stExpCocoNode *tpRootCocoNode = tCocoLoader.GetRootCocoNode();
|
||||
rapidjson::Type tType = tpRootCocoNode->GetType(&tCocoLoader);
|
||||
if (rapidjson::kObjectType == tType)
|
||||
{
|
||||
stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray(&tCocoLoader);
|
||||
CC_BREAK_IF(tpRootCocoNode->GetChildNum() == 0);
|
||||
_node = Node::create();
|
||||
int nCount = 0;
|
||||
std::vector<Component*> _vecComs;
|
||||
ComRender *pRender = nullptr;
|
||||
std::string key = tpChildArray[15].GetName(&tCocoLoader);
|
||||
if (key == "components")
|
||||
{
|
||||
nCount = tpChildArray[15].GetChildNum();
|
||||
}
|
||||
stExpCocoNode *pComponents = tpChildArray[15].GetChildArray(&tCocoLoader);
|
||||
SerData *data = new (std::nothrow) SerData();
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
stExpCocoNode *subDict = pComponents[i].GetChildArray(&tCocoLoader);
|
||||
if (subDict == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
std::string key1 = subDict[1].GetName(&tCocoLoader);
|
||||
const char *comName = subDict[1].GetValue(&tCocoLoader);
|
||||
Component *pCom = nullptr;
|
||||
if (key1 == "classname" && comName != nullptr)
|
||||
{
|
||||
pCom = createComponent(comName);
|
||||
}
|
||||
CCLOG("classname = %s", comName);
|
||||
if (pCom != nullptr)
|
||||
{
|
||||
data->_rData = nullptr;
|
||||
data->_cocoNode = subDict;
|
||||
stExpCocoNode *tpRootCocoNode = tCocoLoader.GetRootCocoNode();
|
||||
rapidjson::Type tType = tpRootCocoNode->GetType(&tCocoLoader);
|
||||
if (rapidjson::kObjectType == tType)
|
||||
{
|
||||
stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray(&tCocoLoader);
|
||||
CC_BREAK_IF(tpRootCocoNode->GetChildNum() == 0);
|
||||
_node = Node::create();
|
||||
int nCount = 0;
|
||||
std::vector<Component*> _vecComs;
|
||||
ComRender *pRender = nullptr;
|
||||
std::string key = tpChildArray[15].GetName(&tCocoLoader);
|
||||
if (key == "components")
|
||||
{
|
||||
nCount = tpChildArray[15].GetChildNum();
|
||||
}
|
||||
stExpCocoNode *pComponents = tpChildArray[15].GetChildArray(&tCocoLoader);
|
||||
SerData *data = new (std::nothrow) SerData();
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
stExpCocoNode *subDict = pComponents[i].GetChildArray(&tCocoLoader);
|
||||
if (subDict == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
std::string key1 = subDict[1].GetName(&tCocoLoader);
|
||||
const char *comName = subDict[1].GetValue(&tCocoLoader);
|
||||
Component *pCom = nullptr;
|
||||
if (key1 == "classname" && comName != nullptr)
|
||||
{
|
||||
pCom = createComponent(comName);
|
||||
}
|
||||
CCLOG("classname = %s", comName);
|
||||
if (pCom != nullptr)
|
||||
{
|
||||
data->_rData = nullptr;
|
||||
data->_cocoNode = subDict;
|
||||
data->_cocoLoader = &tCocoLoader;
|
||||
if (pCom->serialize(data))
|
||||
{
|
||||
ComRender *pTRender = dynamic_cast<ComRender*>(pCom);
|
||||
if (pTRender != nullptr)
|
||||
{
|
||||
pRender = pTRender;
|
||||
}
|
||||
else
|
||||
{
|
||||
_vecComs.push_back(pCom);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(pCom);
|
||||
}
|
||||
}
|
||||
if (pCom->serialize(data))
|
||||
{
|
||||
ComRender *pTRender = dynamic_cast<ComRender*>(pCom);
|
||||
if (pTRender != nullptr)
|
||||
{
|
||||
pRender = pTRender;
|
||||
}
|
||||
else
|
||||
{
|
||||
_vecComs.push_back(pCom);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(pCom);
|
||||
}
|
||||
}
|
||||
if(_fnSelector != nullptr)
|
||||
{
|
||||
_fnSelector(pCom, (void*)(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setPropertyFromJsonDict(&tCocoLoader, tpRootCocoNode, _node);
|
||||
for (std::vector<Component*>::iterator iter = _vecComs.begin(); iter != _vecComs.end(); ++iter)
|
||||
{
|
||||
_node->addComponent(*iter);
|
||||
}
|
||||
setPropertyFromJsonDict(&tCocoLoader, tpRootCocoNode, _node);
|
||||
for (std::vector<Component*>::iterator iter = _vecComs.begin(); iter != _vecComs.end(); ++iter)
|
||||
{
|
||||
_node->addComponent(*iter);
|
||||
}
|
||||
|
||||
stExpCocoNode *pGameObjects = tpChildArray[11].GetChildArray(&tCocoLoader);
|
||||
int length = tpChildArray[11].GetChildNum();
|
||||
for (int i = 0; i < length; ++i)
|
||||
{
|
||||
createObject(&tCocoLoader, &pGameObjects[i], _node, attachComponent);
|
||||
}
|
||||
TriggerMng::getInstance()->parse(&tCocoLoader, tpChildArray);
|
||||
}
|
||||
|
||||
}
|
||||
}while (0);
|
||||
return _node;
|
||||
stExpCocoNode *pGameObjects = tpChildArray[11].GetChildArray(&tCocoLoader);
|
||||
int length = tpChildArray[11].GetChildNum();
|
||||
for (int i = 0; i < length; ++i)
|
||||
{
|
||||
createObject(&tCocoLoader, &pGameObjects[i], _node, attachComponent);
|
||||
}
|
||||
TriggerMng::getInstance()->parse(&tCocoLoader, tpChildArray);
|
||||
}
|
||||
|
||||
}
|
||||
}while (0);
|
||||
return _node;
|
||||
}
|
||||
else
|
||||
{
|
||||
log("read file [%s] error!\n", fileName.c_str());
|
||||
}
|
||||
return nullptr;
|
||||
{
|
||||
log("read file [%s] error!\n", fileName.c_str());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool SceneReader::readJson(const std::string &fileName, rapidjson::Document &doc)
|
||||
|
@ -282,7 +282,7 @@ Node* SceneReader::createObject(const rapidjson::Value &dict, cocos2d::Node* par
|
|||
if (com != nullptr)
|
||||
{
|
||||
data->_rData = &subDict;
|
||||
data->_cocoNode = nullptr;
|
||||
data->_cocoNode = nullptr;
|
||||
data->_cocoLoader = nullptr;
|
||||
if (com->serialize(data))
|
||||
{
|
||||
|
@ -531,7 +531,7 @@ void SceneReader::setPropertyFromJsonDict(CocoLoader *cocoLoader, stExpCocoNode
|
|||
}
|
||||
else if (key == "visible")
|
||||
{
|
||||
bVisible = (bool)atoi(value.c_str());
|
||||
bVisible = atoi(value.c_str()) != 0;
|
||||
node->setVisible(bVisible);
|
||||
}
|
||||
else if (key == "objecttag")
|
||||
|
|
|
@ -222,7 +222,7 @@ Mat4 Skin::getNodeToWorldTransformAR() const
|
|||
|
||||
void Skin::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||
{
|
||||
Mat4 mv = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
auto mv = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
|
||||
//TODO: implement z order
|
||||
_quadCommand.init(_globalZOrder, _texture->getName(), getGLProgramState(), _blendFunc, &_quad, 1, mv);
|
||||
|
|
|
@ -163,15 +163,7 @@ namespace cocostudio
|
|||
label->setFontSize(fontSize);
|
||||
|
||||
std::string fontName = options.has_fontname() ? options.fontname() : "微软雅黑";
|
||||
|
||||
std::string fontFilePath = protocolBuffersPath.append(fontName);
|
||||
if (FileUtils::getInstance()->isFileExist(fontFilePath))
|
||||
{
|
||||
label->setFontName(fontFilePath);
|
||||
}
|
||||
else{
|
||||
label->setFontName(fontName);
|
||||
}
|
||||
label->setFontName(fontName);
|
||||
|
||||
bool aw = options.has_areawidth();
|
||||
bool ah = options.has_areaheight();
|
||||
|
|
|
@ -69,12 +69,12 @@ namespace cocostudio
|
|||
WidgetReader::WidgetReader()
|
||||
:_sizePercentX(0.0f),
|
||||
_sizePercentY(0.0f),
|
||||
_isAdaptScreen(false),
|
||||
_width(0.0f),
|
||||
_height(0.0f),
|
||||
_positionPercentX(0.0f),
|
||||
_positionPercentY(0.0f),
|
||||
_opacity(255)
|
||||
_width(0.0f),
|
||||
_height(0.0f),
|
||||
_opacity(255),
|
||||
_isAdaptScreen(false)
|
||||
{
|
||||
valueToInt = [=](const std::string& str) -> int{
|
||||
return atoi(str.c_str());
|
||||
|
|
|
@ -222,15 +222,15 @@ enum WS_MSG {
|
|||
WebSocket::WebSocket()
|
||||
: _readyState(State::CONNECTING)
|
||||
, _port(80)
|
||||
, _pendingFrameDataLen(0)
|
||||
, _currentDataLen(0)
|
||||
, _currentData(nullptr)
|
||||
, _wsHelper(nullptr)
|
||||
, _wsInstance(nullptr)
|
||||
, _wsContext(nullptr)
|
||||
, _delegate(nullptr)
|
||||
, _SSLConnection(0)
|
||||
, _wsProtocols(nullptr)
|
||||
, _pendingFrameDataLen(0)
|
||||
, _currentDataLen(0)
|
||||
, _currentData(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,11 @@ extern "C" {
|
|||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnPause() {
|
||||
Application::getInstance()->applicationDidEnterBackground();
|
||||
cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);
|
||||
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent);
|
||||
if (Director::getInstance()->getOpenGLView()) {
|
||||
Application::getInstance()->applicationDidEnterBackground();
|
||||
cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);
|
||||
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume() {
|
||||
|
|
|
@ -36,6 +36,10 @@ THE SOFTWARE.
|
|||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef CC_RESOURCE_FOLDER_LINUX
|
||||
#define CC_RESOURCE_FOLDER_LINUX ("/Resources/")
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
@ -71,7 +75,7 @@ bool FileUtilsLinux::init()
|
|||
fullpath[length] = '\0';
|
||||
std::string appPath = fullpath;
|
||||
_defaultResRootPath = appPath.substr(0, appPath.find_last_of("/"));
|
||||
_defaultResRootPath += "/Resources/";
|
||||
_defaultResRootPath += CC_RESOURCE_FOLDER_LINUX;
|
||||
|
||||
// Set writable path to $XDG_CONFIG_HOME or ~/.config/<app name>/ if $XDG_CONFIG_HOME not exists.
|
||||
const char* xdg_config_path = getenv("XDG_CONFIG_HOME");
|
||||
|
|
|
@ -844,15 +844,14 @@ void GLProgram::setUniformsForBuiltins()
|
|||
Director* director = Director::getInstance();
|
||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
||||
|
||||
Mat4 matrixMV;
|
||||
matrixMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
auto matrixMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
|
||||
setUniformsForBuiltins(matrixMV);
|
||||
}
|
||||
|
||||
void GLProgram::setUniformsForBuiltins(const Mat4 &matrixMV)
|
||||
{
|
||||
Mat4 matrixP = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
auto matrixP = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
|
||||
if(_flags.usesP)
|
||||
setUniformLocationWithMatrix4fv(_builtInUniforms[UNIFORM_P_MATRIX], matrixP.m, 1);
|
||||
|
|
|
@ -439,7 +439,7 @@ GLProgram* GLProgramCache::getGLProgram(const std::string &key)
|
|||
void GLProgramCache::addGLProgram(GLProgram* program, const std::string &key)
|
||||
{
|
||||
// release old one
|
||||
auto prev = getProgram(key);
|
||||
auto prev = getGLProgram(key);
|
||||
if( prev == program )
|
||||
return;
|
||||
|
||||
|
@ -447,17 +447,21 @@ void GLProgramCache::addGLProgram(GLProgram* program, const std::string &key)
|
|||
CC_SAFE_RELEASE_NULL(prev);
|
||||
|
||||
if (program)
|
||||
program->retain();
|
||||
program->retain();
|
||||
_programs[key] = program;
|
||||
}
|
||||
|
||||
std::string GLProgramCache::getShaderMacrosForLight() const
|
||||
{
|
||||
GLchar def[256];
|
||||
sprintf(def, "\n#define MAX_DIRECTIONAL_LIGHT_NUM %d \n"
|
||||
auto conf = Configuration::getInstance();
|
||||
|
||||
snprintf(def, sizeof(def)-1, "\n#define MAX_DIRECTIONAL_LIGHT_NUM %d \n"
|
||||
"\n#define MAX_POINT_LIGHT_NUM %d \n"
|
||||
"\n#define MAX_SPOT_LIGHT_NUM %d \n"
|
||||
, Configuration::getInstance()->getMaxSupportDirLightInShader(), Configuration::getInstance()->getMaxSupportPointLightInShader(), Configuration::getInstance()->getMaxSupportSpotLightInShader());
|
||||
"\n#define MAX_SPOT_LIGHT_NUM %d \n",
|
||||
conf->getMaxSupportDirLightInShader(),
|
||||
conf->getMaxSupportPointLightInShader(),
|
||||
conf->getMaxSupportSpotLightInShader());
|
||||
return std::string(def);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,16 +48,16 @@ NS_CC_BEGIN
|
|||
//
|
||||
|
||||
UniformValue::UniformValue()
|
||||
: _useCallback(false)
|
||||
, _uniform(nullptr)
|
||||
: _uniform(nullptr)
|
||||
, _glprogram(nullptr)
|
||||
, _useCallback(false)
|
||||
{
|
||||
}
|
||||
|
||||
UniformValue::UniformValue(Uniform *uniform, GLProgram* glprogram)
|
||||
: _useCallback(false)
|
||||
, _uniform(uniform)
|
||||
: _uniform(uniform)
|
||||
, _glprogram(glprogram)
|
||||
, _useCallback(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -182,15 +182,15 @@ void UniformValue::setMat4(const Mat4& value)
|
|||
//
|
||||
|
||||
VertexAttribValue::VertexAttribValue()
|
||||
: _useCallback(false)
|
||||
, _vertexAttrib(nullptr)
|
||||
: _vertexAttrib(nullptr)
|
||||
, _useCallback(false)
|
||||
, _enabled(false)
|
||||
{
|
||||
}
|
||||
|
||||
VertexAttribValue::VertexAttribValue(VertexAttrib *vertexAttrib)
|
||||
: _useCallback(false)
|
||||
, _vertexAttrib(vertexAttrib)
|
||||
: _vertexAttrib(vertexAttrib)
|
||||
, _useCallback(false)
|
||||
, _enabled(false)
|
||||
{
|
||||
}
|
||||
|
@ -274,10 +274,10 @@ GLProgramState* GLProgramState::getOrCreateWithGLProgram(GLProgram *glprogram)
|
|||
}
|
||||
|
||||
GLProgramState::GLProgramState()
|
||||
: _vertexAttribsFlags(0)
|
||||
, _glprogram(nullptr)
|
||||
: _uniformAttributeValueDirty(true)
|
||||
, _textureUnitIndex(1)
|
||||
, _uniformAttributeValueDirty(true)
|
||||
, _vertexAttribsFlags(0)
|
||||
, _glprogram(nullptr)
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||
/** listen the event that renderer was recreated on Android/WP8 */
|
||||
|
|
|
@ -78,17 +78,17 @@ static const char *s_ambientLightUniformColorName = "u_AmbientLightSour
|
|||
|
||||
MeshCommand::MeshCommand()
|
||||
: _textureID(0)
|
||||
, _blendType(BlendFunc::DISABLE)
|
||||
, _glProgramState(nullptr)
|
||||
, _cullFaceEnabled(false)
|
||||
, _cullFace(GL_BACK)
|
||||
, _depthTestEnabled(false)
|
||||
, _depthWriteEnabled(false)
|
||||
, _blendType(BlendFunc::DISABLE)
|
||||
, _displayColor(1.0f, 1.0f, 1.0f, 1.0f)
|
||||
, _matrixPalette(nullptr)
|
||||
, _matrixPaletteSize(0)
|
||||
, _materialID(0)
|
||||
, _vao(0)
|
||||
, _cullFaceEnabled(false)
|
||||
, _cullFace(GL_BACK)
|
||||
, _depthTestEnabled(false)
|
||||
, _depthWriteEnabled(false)
|
||||
, _lightMask(-1)
|
||||
{
|
||||
_type = RenderCommand::Type::MESH_COMMAND;
|
||||
|
|
|
@ -56,10 +56,10 @@ VertexBuffer* VertexBuffer::create(int sizePerVertex, int vertexNumber)
|
|||
}
|
||||
|
||||
VertexBuffer::VertexBuffer()
|
||||
: _vbo(0)
|
||||
, _vertexNumber(0)
|
||||
: _recreateVBOEventListener(nullptr)
|
||||
, _vbo(0)
|
||||
, _sizePerVertex(0)
|
||||
, _recreateVBOEventListener(nullptr)
|
||||
, _vertexNumber(0)
|
||||
{
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
|
|
|
@ -35,17 +35,17 @@ class VertexBuffer;
|
|||
struct CC_DLL VertexStreamAttribute
|
||||
{
|
||||
VertexStreamAttribute()
|
||||
: _offset(0),_semantic(0),_type(0),_size(0), _normalize(false)
|
||||
: _normalize(false),_offset(0),_semantic(0),_type(0),_size(0)
|
||||
{
|
||||
}
|
||||
|
||||
VertexStreamAttribute(int offset, int semantic, int type, int size)
|
||||
: _offset(offset),_semantic(semantic),_type(type),_size(size), _normalize(false)
|
||||
: _normalize(false),_offset(offset),_semantic(semantic),_type(type),_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
VertexStreamAttribute(int offset, int semantic, int type, int size, bool normalize)
|
||||
: _offset(offset),_semantic(semantic),_type(type),_size(size), _normalize(normalize)
|
||||
: _normalize(normalize),_offset(offset),_semantic(semantic),_type(type),_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -18,19 +18,13 @@
|
|||
-- @param #cc.EventDispatcher dispatcher
|
||||
|
||||
--------------------------------
|
||||
-- Suspends the execution of the running scene, pushing it on the stack of suspended scenes.<br>
|
||||
-- The new scene will be executed.<br>
|
||||
-- Try to avoid big stacks of pushed scenes to reduce memory allocation. <br>
|
||||
-- ONLY call it if there is a running scene.
|
||||
-- @function [parent=#Director] pushScene
|
||||
-- The size in pixels of the surface. It could be different than the screen size.<br>
|
||||
-- High-res devices might have a higher surface size than the screen size.<br>
|
||||
-- Only available when compiled using SDK >= 4.0.<br>
|
||||
-- since v0.99.4
|
||||
-- @function [parent=#Director] setContentScaleFactor
|
||||
-- @param self
|
||||
-- @param #cc.Scene scene
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Director] getDeltaTime
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
-- @param #float scaleFactor
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
|
@ -44,18 +38,11 @@
|
|||
-- @param self
|
||||
-- @return size_table#size_table ret (return value: size_table)
|
||||
|
||||
--------------------------------
|
||||
-- Returns the Console <br>
|
||||
-- since v3.0
|
||||
-- @function [parent=#Director] getConsole
|
||||
-- @param self
|
||||
-- @return Console#Console ret (return value: cc.Console)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Director] pushMatrix
|
||||
-- @function [parent=#Director] getDeltaTime
|
||||
-- @param self
|
||||
-- @param #int type
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
-- sets the OpenGL default values
|
||||
|
@ -148,6 +135,11 @@
|
|||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Director] resetMatrixStack
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- converts an OpenGL coordinate to a UIKit coordinate<br>
|
||||
-- Useful to convert node points to window points for calls such as glScissor
|
||||
|
@ -156,6 +148,12 @@
|
|||
-- @param #vec2_table point
|
||||
-- @return vec2_table#vec2_table ret (return value: vec2_table)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Director] pushMatrix
|
||||
-- @param self
|
||||
-- @param #int type
|
||||
|
||||
--------------------------------
|
||||
-- sets the default values based on the Configuration info
|
||||
-- @function [parent=#Director] setDefaultValues
|
||||
|
@ -206,15 +204,6 @@
|
|||
-- @function [parent=#Director] stopAnimation
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- The size in pixels of the surface. It could be different than the screen size.<br>
|
||||
-- High-res devices might have a higher surface size than the screen size.<br>
|
||||
-- Only available when compiled using SDK >= 4.0.<br>
|
||||
-- since v0.99.4
|
||||
-- @function [parent=#Director] setContentScaleFactor
|
||||
-- @param self
|
||||
-- @param #float scaleFactor
|
||||
|
||||
--------------------------------
|
||||
-- Pops out all scenes from the stack until it reaches `level`.<br>
|
||||
-- If level is 0, it will end the director.<br>
|
||||
|
@ -292,12 +281,6 @@
|
|||
-- @function [parent=#Director] drawScene
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- / FIXME: missing description
|
||||
-- @function [parent=#Director] getZEye
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Director] getMatrix
|
||||
|
@ -313,6 +296,12 @@
|
|||
-- @function [parent=#Director] popScene
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Director] loadIdentityMatrix
|
||||
-- @param self
|
||||
-- @param #int type
|
||||
|
||||
--------------------------------
|
||||
-- Whether or not to display the FPS on the bottom-left corner
|
||||
-- @function [parent=#Director] isDisplayStats
|
||||
|
@ -325,11 +314,25 @@
|
|||
-- @param self
|
||||
-- @param #int projection
|
||||
|
||||
--------------------------------
|
||||
-- Returns the Console <br>
|
||||
-- since v3.0
|
||||
-- @function [parent=#Director] getConsole
|
||||
-- @param self
|
||||
-- @return Console#Console ret (return value: cc.Console)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Director] loadIdentityMatrix
|
||||
-- @function [parent=#Director] multiplyMatrix
|
||||
-- @param self
|
||||
-- @param #int type
|
||||
-- @param #mat4_table mat
|
||||
|
||||
--------------------------------
|
||||
-- / FIXME: missing description
|
||||
-- @function [parent=#Director] getZEye
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
|
@ -337,11 +340,6 @@
|
|||
-- @param self
|
||||
-- @param #bool nextDeltaTimeZero
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Director] resetMatrixStack
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Director] popMatrix
|
||||
|
@ -364,10 +362,13 @@
|
|||
-- @return Scheduler#Scheduler ret (return value: cc.Scheduler)
|
||||
|
||||
--------------------------------
|
||||
-- Set the FPS value.
|
||||
-- @function [parent=#Director] setAnimationInterval
|
||||
-- Suspends the execution of the running scene, pushing it on the stack of suspended scenes.<br>
|
||||
-- The new scene will be executed.<br>
|
||||
-- Try to avoid big stacks of pushed scenes to reduce memory allocation. <br>
|
||||
-- ONLY call it if there is a running scene.
|
||||
-- @function [parent=#Director] pushScene
|
||||
-- @param self
|
||||
-- @param #double interval
|
||||
-- @param #cc.Scene scene
|
||||
|
||||
--------------------------------
|
||||
-- Get the FPS value
|
||||
|
@ -402,11 +403,10 @@
|
|||
-- @param #cc.Scene scene
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Director] multiplyMatrix
|
||||
-- Set the FPS value.
|
||||
-- @function [parent=#Director] setAnimationInterval
|
||||
-- @param self
|
||||
-- @param #int type
|
||||
-- @param #mat4_table mat
|
||||
-- @param #double interval
|
||||
|
||||
--------------------------------
|
||||
-- Gets the ActionManager associated with this director<br>
|
||||
|
|
|
@ -259,6 +259,30 @@
|
|||
-- @param self
|
||||
-- @param #vec2_table anchorPoint
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] setScaleY
|
||||
-- @param self
|
||||
-- @param #float scaleY
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] setScaleX
|
||||
-- @param self
|
||||
-- @param #float scaleX
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] getScaleY
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] getScaleX
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] updateDisplayedOpacity
|
||||
|
@ -270,6 +294,14 @@
|
|||
-- @function [parent=#Scale9Sprite] cleanup
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- @overload self, float, float
|
||||
-- @overload self, float
|
||||
-- @function [parent=#Scale9Sprite] setScale
|
||||
-- @param self
|
||||
-- @param #float scalex
|
||||
-- @param #float scaley
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] updateDisplayedColor
|
||||
|
@ -282,6 +314,12 @@
|
|||
-- @param self
|
||||
-- @param #size_table size
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Scale9Sprite] getScale
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
-- js ctor
|
||||
-- @function [parent=#Scale9Sprite] Scale9Sprite
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
-- @param self
|
||||
-- @return Mesh#Mesh ret (return value: cc.Mesh)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Sprite3D] setCullFace
|
||||
-- @param self
|
||||
-- @param #unsigned int cullFace
|
||||
|
||||
--------------------------------
|
||||
-- light mask getter & setter, light works only when _lightmask & light's flag is true, default value of _lightmask is 0xffff
|
||||
-- @function [parent=#Sprite3D] setLightMask
|
||||
|
@ -60,30 +66,24 @@
|
|||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Sprite3D] setCullFace
|
||||
-- @function [parent=#Sprite3D] getSkeleton
|
||||
-- @param self
|
||||
-- @param #unsigned int cullFace
|
||||
-- @return Skeleton3D#Skeleton3D ret (return value: cc.Skeleton3D)
|
||||
|
||||
--------------------------------
|
||||
-- get SubMeshState by index
|
||||
-- get Mesh by index
|
||||
-- @function [parent=#Sprite3D] getMeshByIndex
|
||||
-- @param self
|
||||
-- @param #int index
|
||||
-- @return Mesh#Mesh ret (return value: cc.Mesh)
|
||||
|
||||
--------------------------------
|
||||
-- get SubMeshState by Name
|
||||
-- get Mesh by Name, it returns the first one if there are more than one mesh with the same name
|
||||
-- @function [parent=#Sprite3D] getMeshByName
|
||||
-- @param self
|
||||
-- @param #string name
|
||||
-- @return Mesh#Mesh ret (return value: cc.Mesh)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Sprite3D] getSkeleton
|
||||
-- @param self
|
||||
-- @return Skeleton3D#Skeleton3D ret (return value: cc.Skeleton3D)
|
||||
|
||||
--------------------------------
|
||||
-- get AttachNode by bone name, return nullptr if not exist
|
||||
-- @function [parent=#Sprite3D] getAttachNode
|
||||
|
|
|
@ -580,6 +580,52 @@ int lua_cocos2dx_3d_Sprite3D_getMesh(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_3d_Sprite3D_setCullFace(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Sprite3D* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Sprite3D",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Sprite3D*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_setCullFace'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
unsigned int arg0;
|
||||
|
||||
ok &= luaval_to_uint32(tolua_S, 2,&arg0, "cc.Sprite3D:setCullFace");
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->setCullFace(arg0);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:setCullFace",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_setCullFace'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_3d_Sprite3D_setLightMask(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -760,7 +806,7 @@ int lua_cocos2dx_3d_Sprite3D_removeAttachNode(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_3d_Sprite3D_setCullFace(lua_State* tolua_S)
|
||||
int lua_cocos2dx_3d_Sprite3D_getSkeleton(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Sprite3D* cobj = nullptr;
|
||||
|
@ -780,28 +826,26 @@ int lua_cocos2dx_3d_Sprite3D_setCullFace(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_setCullFace'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_getSkeleton'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
if (argc == 0)
|
||||
{
|
||||
unsigned int arg0;
|
||||
|
||||
ok &= luaval_to_uint32(tolua_S, 2,&arg0, "cc.Sprite3D:setCullFace");
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->setCullFace(arg0);
|
||||
return 0;
|
||||
cocos2d::Skeleton3D* ret = cobj->getSkeleton();
|
||||
object_to_luaval<cocos2d::Skeleton3D>(tolua_S, "cc.Skeleton3D",(cocos2d::Skeleton3D*)ret);
|
||||
return 1;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:setCullFace",argc, 1);
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:getSkeleton",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_setCullFace'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_getSkeleton'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -900,50 +944,6 @@ int lua_cocos2dx_3d_Sprite3D_getMeshByName(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_3d_Sprite3D_getSkeleton(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Sprite3D* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Sprite3D",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Sprite3D*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_getSkeleton'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
return 0;
|
||||
cocos2d::Skeleton3D* ret = cobj->getSkeleton();
|
||||
object_to_luaval<cocos2d::Skeleton3D>(tolua_S, "cc.Skeleton3D",(cocos2d::Skeleton3D*)ret);
|
||||
return 1;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:getSkeleton",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_getSkeleton'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_3d_Sprite3D_getAttachNode(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -1059,14 +1059,14 @@ int lua_register_cocos2dx_3d_Sprite3D(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getLightMask",lua_cocos2dx_3d_Sprite3D_getLightMask);
|
||||
tolua_function(tolua_S,"removeAllAttachNode",lua_cocos2dx_3d_Sprite3D_removeAllAttachNode);
|
||||
tolua_function(tolua_S,"getMesh",lua_cocos2dx_3d_Sprite3D_getMesh);
|
||||
tolua_function(tolua_S,"setCullFace",lua_cocos2dx_3d_Sprite3D_setCullFace);
|
||||
tolua_function(tolua_S,"setLightMask",lua_cocos2dx_3d_Sprite3D_setLightMask);
|
||||
tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_3d_Sprite3D_getBlendFunc);
|
||||
tolua_function(tolua_S,"getMeshCount",lua_cocos2dx_3d_Sprite3D_getMeshCount);
|
||||
tolua_function(tolua_S,"removeAttachNode",lua_cocos2dx_3d_Sprite3D_removeAttachNode);
|
||||
tolua_function(tolua_S,"setCullFace",lua_cocos2dx_3d_Sprite3D_setCullFace);
|
||||
tolua_function(tolua_S,"getSkeleton",lua_cocos2dx_3d_Sprite3D_getSkeleton);
|
||||
tolua_function(tolua_S,"getMeshByIndex",lua_cocos2dx_3d_Sprite3D_getMeshByIndex);
|
||||
tolua_function(tolua_S,"getMeshByName",lua_cocos2dx_3d_Sprite3D_getMeshByName);
|
||||
tolua_function(tolua_S,"getSkeleton",lua_cocos2dx_3d_Sprite3D_getSkeleton);
|
||||
tolua_function(tolua_S,"getAttachNode",lua_cocos2dx_3d_Sprite3D_getAttachNode);
|
||||
tolua_function(tolua_S,"create", lua_cocos2dx_3d_Sprite3D_create);
|
||||
tolua_endmodule(tolua_S);
|
||||
|
|
|
@ -10763,7 +10763,7 @@ int lua_cocos2dx_Director_setEventDispatcher(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_pushScene(lua_State* tolua_S)
|
||||
int lua_cocos2dx_Director_setContentScaleFactor(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
|
@ -10783,7 +10783,7 @@ int lua_cocos2dx_Director_pushScene(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_pushScene'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_setContentScaleFactor'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -10791,64 +10791,20 @@ int lua_cocos2dx_Director_pushScene(lua_State* tolua_S)
|
|||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::Scene* arg0;
|
||||
double arg0;
|
||||
|
||||
ok &= luaval_to_object<cocos2d::Scene>(tolua_S, 2, "cc.Scene",&arg0);
|
||||
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Director:setContentScaleFactor");
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->pushScene(arg0);
|
||||
cobj->setContentScaleFactor(arg0);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:pushScene",argc, 1);
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:setContentScaleFactor",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_pushScene'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_getDeltaTime(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getDeltaTime'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
return 0;
|
||||
double ret = cobj->getDeltaTime();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getDeltaTime",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getDeltaTime'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_setContentScaleFactor'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -10941,7 +10897,7 @@ int lua_cocos2dx_Director_getWinSizeInPixels(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_getConsole(lua_State* tolua_S)
|
||||
int lua_cocos2dx_Director_getDeltaTime(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
|
@ -10961,7 +10917,7 @@ int lua_cocos2dx_Director_getConsole(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getConsole'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getDeltaTime'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -10971,62 +10927,16 @@ int lua_cocos2dx_Director_getConsole(lua_State* tolua_S)
|
|||
{
|
||||
if(!ok)
|
||||
return 0;
|
||||
cocos2d::Console* ret = cobj->getConsole();
|
||||
object_to_luaval<cocos2d::Console>(tolua_S, "cc.Console",(cocos2d::Console*)ret);
|
||||
double ret = cobj->getDeltaTime();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getConsole",argc, 0);
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getDeltaTime",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getConsole'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_pushMatrix(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_pushMatrix'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::MATRIX_STACK_TYPE arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:pushMatrix");
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->pushMatrix(arg0);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:pushMatrix",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_pushMatrix'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getDeltaTime'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -11655,6 +11565,49 @@ int lua_cocos2dx_Director_getSecondsPerFrame(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_resetMatrixStack(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_resetMatrixStack'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->resetMatrixStack();
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:resetMatrixStack",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_resetMatrixStack'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_convertToUI(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -11702,6 +11655,52 @@ int lua_cocos2dx_Director_convertToUI(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_pushMatrix(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_pushMatrix'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::MATRIX_STACK_TYPE arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:pushMatrix");
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->pushMatrix(arg0);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:pushMatrix",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_pushMatrix'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_setDefaultValues(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -12052,52 +12051,6 @@ int lua_cocos2dx_Director_stopAnimation(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_setContentScaleFactor(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_setContentScaleFactor'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
double arg0;
|
||||
|
||||
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Director:setContentScaleFactor");
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->setContentScaleFactor(arg0);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:setContentScaleFactor",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_setContentScaleFactor'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_popToSceneStackLevel(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -12589,50 +12542,6 @@ int lua_cocos2dx_Director_drawScene(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_getZEye(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getZEye'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
return 0;
|
||||
double ret = cobj->getZEye();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getZEye",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getZEye'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_getMatrix(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -12666,7 +12575,7 @@ int lua_cocos2dx_Director_getMatrix(lua_State* tolua_S)
|
|||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:getMatrix");
|
||||
if(!ok)
|
||||
return 0;
|
||||
cocos2d::Mat4 ret = cobj->getMatrix(arg0);
|
||||
const cocos2d::Mat4& ret = cobj->getMatrix(arg0);
|
||||
mat4_to_luaval(tolua_S, ret);
|
||||
return 1;
|
||||
}
|
||||
|
@ -12723,6 +12632,52 @@ int lua_cocos2dx_Director_popScene(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_loadIdentityMatrix(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_loadIdentityMatrix'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::MATRIX_STACK_TYPE arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:loadIdentityMatrix");
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->loadIdentityMatrix(arg0);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:loadIdentityMatrix",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_loadIdentityMatrix'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_isDisplayStats(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -12813,7 +12768,7 @@ int lua_cocos2dx_Director_setProjection(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_loadIdentityMatrix(lua_State* tolua_S)
|
||||
int lua_cocos2dx_Director_getConsole(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
|
@ -12833,28 +12788,119 @@ int lua_cocos2dx_Director_loadIdentityMatrix(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_loadIdentityMatrix'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getConsole'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
if (argc == 0)
|
||||
{
|
||||
cocos2d::MATRIX_STACK_TYPE arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:loadIdentityMatrix");
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->loadIdentityMatrix(arg0);
|
||||
return 0;
|
||||
cocos2d::Console* ret = cobj->getConsole();
|
||||
object_to_luaval<cocos2d::Console>(tolua_S, "cc.Console",(cocos2d::Console*)ret);
|
||||
return 1;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:loadIdentityMatrix",argc, 1);
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getConsole",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_loadIdentityMatrix'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getConsole'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_multiplyMatrix(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_multiplyMatrix'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 2)
|
||||
{
|
||||
cocos2d::MATRIX_STACK_TYPE arg0;
|
||||
cocos2d::Mat4 arg1;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:multiplyMatrix");
|
||||
|
||||
ok &= luaval_to_mat4(tolua_S, 3, &arg1, "cc.Director:multiplyMatrix");
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->multiplyMatrix(arg0, arg1);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:multiplyMatrix",argc, 2);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_multiplyMatrix'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_getZEye(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getZEye'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
return 0;
|
||||
double ret = cobj->getZEye();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getZEye",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getZEye'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -12905,49 +12951,6 @@ int lua_cocos2dx_Director_setNextDeltaTimeZero(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_resetMatrixStack(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_resetMatrixStack'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->resetMatrixStack();
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:resetMatrixStack",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_resetMatrixStack'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_popMatrix(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -13082,7 +13085,7 @@ int lua_cocos2dx_Director_getScheduler(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_setAnimationInterval(lua_State* tolua_S)
|
||||
int lua_cocos2dx_Director_pushScene(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
|
@ -13102,7 +13105,7 @@ int lua_cocos2dx_Director_setAnimationInterval(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_setAnimationInterval'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_pushScene'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -13110,20 +13113,20 @@ int lua_cocos2dx_Director_setAnimationInterval(lua_State* tolua_S)
|
|||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
double arg0;
|
||||
cocos2d::Scene* arg0;
|
||||
|
||||
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Director:setAnimationInterval");
|
||||
ok &= luaval_to_object<cocos2d::Scene>(tolua_S, 2, "cc.Scene",&arg0);
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->setAnimationInterval(arg0);
|
||||
cobj->pushScene(arg0);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:setAnimationInterval",argc, 1);
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:pushScene",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_setAnimationInterval'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_pushScene'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -13352,7 +13355,7 @@ int lua_cocos2dx_Director_replaceScene(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Director_multiplyMatrix(lua_State* tolua_S)
|
||||
int lua_cocos2dx_Director_setAnimationInterval(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Director* cobj = nullptr;
|
||||
|
@ -13372,31 +13375,28 @@ int lua_cocos2dx_Director_multiplyMatrix(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_multiplyMatrix'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_setAnimationInterval'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 2)
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::MATRIX_STACK_TYPE arg0;
|
||||
cocos2d::Mat4 arg1;
|
||||
double arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Director:multiplyMatrix");
|
||||
|
||||
ok &= luaval_to_mat4(tolua_S, 3, &arg1, "cc.Director:multiplyMatrix");
|
||||
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Director:setAnimationInterval");
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->multiplyMatrix(arg0, arg1);
|
||||
cobj->setAnimationInterval(arg0);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:multiplyMatrix",argc, 2);
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:setAnimationInterval",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_multiplyMatrix'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_setAnimationInterval'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -13490,12 +13490,10 @@ int lua_register_cocos2dx_Director(lua_State* tolua_S)
|
|||
tolua_beginmodule(tolua_S,"Director");
|
||||
tolua_function(tolua_S,"pause",lua_cocos2dx_Director_pause);
|
||||
tolua_function(tolua_S,"setEventDispatcher",lua_cocos2dx_Director_setEventDispatcher);
|
||||
tolua_function(tolua_S,"pushScene",lua_cocos2dx_Director_pushScene);
|
||||
tolua_function(tolua_S,"getDeltaTime",lua_cocos2dx_Director_getDeltaTime);
|
||||
tolua_function(tolua_S,"setContentScaleFactor",lua_cocos2dx_Director_setContentScaleFactor);
|
||||
tolua_function(tolua_S,"getContentScaleFactor",lua_cocos2dx_Director_getContentScaleFactor);
|
||||
tolua_function(tolua_S,"getWinSizeInPixels",lua_cocos2dx_Director_getWinSizeInPixels);
|
||||
tolua_function(tolua_S,"getConsole",lua_cocos2dx_Director_getConsole);
|
||||
tolua_function(tolua_S,"pushMatrix",lua_cocos2dx_Director_pushMatrix);
|
||||
tolua_function(tolua_S,"getDeltaTime",lua_cocos2dx_Director_getDeltaTime);
|
||||
tolua_function(tolua_S,"setGLDefaultValues",lua_cocos2dx_Director_setGLDefaultValues);
|
||||
tolua_function(tolua_S,"setActionManager",lua_cocos2dx_Director_setActionManager);
|
||||
tolua_function(tolua_S,"setAlphaBlending",lua_cocos2dx_Director_setAlphaBlending);
|
||||
|
@ -13510,7 +13508,9 @@ int lua_register_cocos2dx_Director(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"setDepthTest",lua_cocos2dx_Director_setDepthTest);
|
||||
tolua_function(tolua_S,"getFrameRate",lua_cocos2dx_Director_getFrameRate);
|
||||
tolua_function(tolua_S,"getSecondsPerFrame",lua_cocos2dx_Director_getSecondsPerFrame);
|
||||
tolua_function(tolua_S,"resetMatrixStack",lua_cocos2dx_Director_resetMatrixStack);
|
||||
tolua_function(tolua_S,"convertToUI",lua_cocos2dx_Director_convertToUI);
|
||||
tolua_function(tolua_S,"pushMatrix",lua_cocos2dx_Director_pushMatrix);
|
||||
tolua_function(tolua_S,"setDefaultValues",lua_cocos2dx_Director_setDefaultValues);
|
||||
tolua_function(tolua_S,"init",lua_cocos2dx_Director_init);
|
||||
tolua_function(tolua_S,"setScheduler",lua_cocos2dx_Director_setScheduler);
|
||||
|
@ -13519,7 +13519,6 @@ int lua_register_cocos2dx_Director(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getRunningScene",lua_cocos2dx_Director_getRunningScene);
|
||||
tolua_function(tolua_S,"setViewport",lua_cocos2dx_Director_setViewport);
|
||||
tolua_function(tolua_S,"stopAnimation",lua_cocos2dx_Director_stopAnimation);
|
||||
tolua_function(tolua_S,"setContentScaleFactor",lua_cocos2dx_Director_setContentScaleFactor);
|
||||
tolua_function(tolua_S,"popToSceneStackLevel",lua_cocos2dx_Director_popToSceneStackLevel);
|
||||
tolua_function(tolua_S,"resume",lua_cocos2dx_Director_resume);
|
||||
tolua_function(tolua_S,"isNextDeltaTimeZero",lua_cocos2dx_Director_isNextDeltaTimeZero);
|
||||
|
@ -13531,24 +13530,25 @@ int lua_register_cocos2dx_Director(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"runWithScene",lua_cocos2dx_Director_runWithScene);
|
||||
tolua_function(tolua_S,"setNotificationNode",lua_cocos2dx_Director_setNotificationNode);
|
||||
tolua_function(tolua_S,"drawScene",lua_cocos2dx_Director_drawScene);
|
||||
tolua_function(tolua_S,"getZEye",lua_cocos2dx_Director_getZEye);
|
||||
tolua_function(tolua_S,"getMatrix",lua_cocos2dx_Director_getMatrix);
|
||||
tolua_function(tolua_S,"popScene",lua_cocos2dx_Director_popScene);
|
||||
tolua_function(tolua_S,"loadIdentityMatrix",lua_cocos2dx_Director_loadIdentityMatrix);
|
||||
tolua_function(tolua_S,"isDisplayStats",lua_cocos2dx_Director_isDisplayStats);
|
||||
tolua_function(tolua_S,"setProjection",lua_cocos2dx_Director_setProjection);
|
||||
tolua_function(tolua_S,"loadIdentityMatrix",lua_cocos2dx_Director_loadIdentityMatrix);
|
||||
tolua_function(tolua_S,"getConsole",lua_cocos2dx_Director_getConsole);
|
||||
tolua_function(tolua_S,"multiplyMatrix",lua_cocos2dx_Director_multiplyMatrix);
|
||||
tolua_function(tolua_S,"getZEye",lua_cocos2dx_Director_getZEye);
|
||||
tolua_function(tolua_S,"setNextDeltaTimeZero",lua_cocos2dx_Director_setNextDeltaTimeZero);
|
||||
tolua_function(tolua_S,"resetMatrixStack",lua_cocos2dx_Director_resetMatrixStack);
|
||||
tolua_function(tolua_S,"popMatrix",lua_cocos2dx_Director_popMatrix);
|
||||
tolua_function(tolua_S,"getVisibleSize",lua_cocos2dx_Director_getVisibleSize);
|
||||
tolua_function(tolua_S,"getScheduler",lua_cocos2dx_Director_getScheduler);
|
||||
tolua_function(tolua_S,"setAnimationInterval",lua_cocos2dx_Director_setAnimationInterval);
|
||||
tolua_function(tolua_S,"pushScene",lua_cocos2dx_Director_pushScene);
|
||||
tolua_function(tolua_S,"getAnimationInterval",lua_cocos2dx_Director_getAnimationInterval);
|
||||
tolua_function(tolua_S,"isPaused",lua_cocos2dx_Director_isPaused);
|
||||
tolua_function(tolua_S,"setDisplayStats",lua_cocos2dx_Director_setDisplayStats);
|
||||
tolua_function(tolua_S,"getEventDispatcher",lua_cocos2dx_Director_getEventDispatcher);
|
||||
tolua_function(tolua_S,"replaceScene",lua_cocos2dx_Director_replaceScene);
|
||||
tolua_function(tolua_S,"multiplyMatrix",lua_cocos2dx_Director_multiplyMatrix);
|
||||
tolua_function(tolua_S,"setAnimationInterval",lua_cocos2dx_Director_setAnimationInterval);
|
||||
tolua_function(tolua_S,"getActionManager",lua_cocos2dx_Director_getActionManager);
|
||||
tolua_function(tolua_S,"getInstance", lua_cocos2dx_Director_getInstance);
|
||||
tolua_endmodule(tolua_S);
|
||||
|
|
|
@ -773,7 +773,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L)
|
|||
(unsigned char*)stack->_xxteaKey,
|
||||
(xxtea_long)stack->_xxteaKeyLen,
|
||||
&len);
|
||||
delete []zipFileData;
|
||||
free(zipFileData);
|
||||
zipFileData = nullptr;
|
||||
zip = ZipFile::createWithBuffer(buffer, len);
|
||||
} else {
|
||||
|
@ -797,7 +797,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L)
|
|||
lua_setfield(L, -2, filename.c_str());
|
||||
++count;
|
||||
}
|
||||
delete []zbuffer;
|
||||
free(zbuffer);
|
||||
}
|
||||
filename = zip->getNextFilename();
|
||||
}
|
||||
|
@ -812,7 +812,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L)
|
|||
}
|
||||
|
||||
if (zipFileData) {
|
||||
delete []zipFileData;
|
||||
free(zipFileData);
|
||||
}
|
||||
|
||||
if (buffer) {
|
||||
|
|
|
@ -108,7 +108,7 @@ extern "C"
|
|||
{
|
||||
LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
|
||||
stack->luaLoadBuffer(L, (char*)chunk, (int)chunkSize, chunkName.c_str());
|
||||
delete []chunk;
|
||||
free(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -46,6 +46,7 @@ _buttonNormalRenderer(nullptr),
|
|||
_buttonClickedRenderer(nullptr),
|
||||
_buttonDisableRenderer(nullptr),
|
||||
_titleRenderer(nullptr),
|
||||
_zoomScale(0.1f),
|
||||
_normalFileName(""),
|
||||
_clickedFileName(""),
|
||||
_disabledFileName(""),
|
||||
|
@ -65,7 +66,6 @@ _normalTextureScaleXInSize(1.0f),
|
|||
_normalTextureScaleYInSize(1.0f),
|
||||
_pressedTextureScaleXInSize(1.0f),
|
||||
_pressedTextureScaleYInSize(1.0f),
|
||||
_zoomScale(0.1f),
|
||||
_normalTextureLoaded(false),
|
||||
_pressedTextureLoaded(false),
|
||||
_disabledTextureLoaded(false),
|
||||
|
|
|
@ -38,13 +38,13 @@ EditBox::EditBox(void)
|
|||
, _editBoxInputMode(EditBox::InputMode::SINGLE_LINE)
|
||||
, _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS)
|
||||
, _keyboardReturnType(KeyboardReturnType::DEFAULT)
|
||||
, _backgroundSprite(nullptr)
|
||||
, _fontSize(-1)
|
||||
, _placeholderFontSize(-1)
|
||||
, _colText(Color3B::WHITE)
|
||||
, _colPlaceHolder(Color3B::GRAY)
|
||||
, _maxLength(0)
|
||||
, _adjustHeight(0.0f)
|
||||
, _backgroundSprite(nullptr)
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
, _scriptEditBoxHandler(0)
|
||||
#endif
|
||||
|
|
|
@ -51,13 +51,15 @@ static GLint s_layer = -1;
|
|||
IMPLEMENT_CLASS_GUI_INFO(Layout)
|
||||
|
||||
Layout::Layout():
|
||||
_clippingEnabled(false),
|
||||
_backGroundScale9Enabled(false),
|
||||
_backGroundImage(nullptr),
|
||||
_backGroundImageFileName(""),
|
||||
_backGroundImageCapInsets(Rect::ZERO),
|
||||
_colorType(BackGroundColorType::NONE),
|
||||
_bgImageTexType(TextureResType::LOCAL),
|
||||
_backGroundImageTextureSize(Size::ZERO),
|
||||
_backGroundImageColor(Color3B::WHITE),
|
||||
_backGroundImageOpacity(255),
|
||||
_colorRender(nullptr),
|
||||
_gradientRender(nullptr),
|
||||
_cColor(Color3B::WHITE),
|
||||
|
@ -65,14 +67,13 @@ _gStartColor(Color3B::WHITE),
|
|||
_gEndColor(Color3B::WHITE),
|
||||
_alongVector(Vec2(0.0f, -1.0f)),
|
||||
_cOpacity(255),
|
||||
_backGroundImageTextureSize(Size::ZERO),
|
||||
_clippingEnabled(false),
|
||||
_layoutType(Type::ABSOLUTE),
|
||||
_clippingType(ClippingType::STENCIL),
|
||||
_clippingStencil(nullptr),
|
||||
_scissorRectDirty(false),
|
||||
_clippingRect(Rect::ZERO),
|
||||
_clippingParent(nullptr),
|
||||
_doLayoutDirty(true),
|
||||
_clippingRectDirty(true),
|
||||
_currentStencilEnabled(GL_FALSE),
|
||||
_currentStencilWriteMask(~0),
|
||||
|
@ -86,12 +87,11 @@ _currentDepthWriteMask(GL_TRUE),
|
|||
_currentAlphaTestEnabled(GL_FALSE),
|
||||
_currentAlphaTestFunc(GL_ALWAYS),
|
||||
_currentAlphaTestRef(1),
|
||||
_backGroundImageColor(Color3B::WHITE),
|
||||
_backGroundImageOpacity(255),
|
||||
_passFocusToChild(true),
|
||||
_doLayoutDirty(true),
|
||||
_isInterceptTouch(false),
|
||||
_loopFocus(false),
|
||||
_isFocusPassing(false),
|
||||
_isInterceptTouch(false)
|
||||
_passFocusToChild(true),
|
||||
_isFocusPassing(false)
|
||||
{
|
||||
//no-op
|
||||
}
|
||||
|
|
|
@ -31,10 +31,10 @@ NS_CC_BEGIN
|
|||
|
||||
namespace ui {
|
||||
LayoutComponent::LayoutComponent()
|
||||
:_actived(true)
|
||||
,_usingPercentContentSize(false)
|
||||
,_usingPercentPosition(false)
|
||||
,_referencePoint(ReferencePoint::BOTTOM_LEFT)
|
||||
: _usingPercentContentSize(false)
|
||||
, _referencePoint(ReferencePoint::BOTTOM_LEFT)
|
||||
, _usingPercentPosition(false)
|
||||
, _actived(true)
|
||||
{
|
||||
_name = __LAYOUT_COMPONENT_NAME;
|
||||
}
|
||||
|
|
|
@ -35,10 +35,10 @@ ListView::ListView():
|
|||
_model(nullptr),
|
||||
_gravity(Gravity::CENTER_VERTICAL),
|
||||
_itemsMargin(0.0f),
|
||||
_listViewEventListener(nullptr),
|
||||
_listViewEventSelector(nullptr),
|
||||
_curSelectedIndex(0),
|
||||
_refreshViewDirty(true),
|
||||
_listViewEventListener(nullptr),
|
||||
_listViewEventSelector(nullptr),
|
||||
_eventCallback(nullptr)
|
||||
{
|
||||
this->setTouchEnabled(true);
|
||||
|
|
|
@ -102,14 +102,14 @@ void LoadingBar::setDirection(cocos2d::ui::LoadingBar::Direction direction)
|
|||
_barRenderer->setAnchorPoint(Vec2(0.0f,0.5f));
|
||||
_barRenderer->setPosition(Vec2(0,_contentSize.height*0.5f));
|
||||
if (!_scale9Enabled) {
|
||||
_barRenderer->setFlippedX(false);
|
||||
_barRenderer->getSprite()->setFlippedX(false);
|
||||
}
|
||||
break;
|
||||
case Direction::RIGHT:
|
||||
_barRenderer->setAnchorPoint(Vec2(1.0f,0.5f));
|
||||
_barRenderer->setPosition(Vec2(_totalLength,_contentSize.height*0.5f));
|
||||
if (!_scale9Enabled) {
|
||||
_barRenderer->setFlippedX(true);
|
||||
_barRenderer->getSprite()->setFlippedX(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -31,22 +31,22 @@ namespace ui {
|
|||
IMPLEMENT_CLASS_GUI_INFO(PageView)
|
||||
|
||||
PageView::PageView():
|
||||
_isAutoScrolling(false),
|
||||
_autoScrollDistance(0.0f),
|
||||
_autoScrollSpeed(0.0f),
|
||||
_autoScrollDirection(AutoScrollDirection::LEFT),
|
||||
_curPageIdx(0),
|
||||
_touchMoveDirection(TouchDirection::LEFT),
|
||||
_leftBoundaryChild(nullptr),
|
||||
_rightBoundaryChild(nullptr),
|
||||
_leftBoundary(0.0f),
|
||||
_rightBoundary(0.0f),
|
||||
_isAutoScrolling(false),
|
||||
_autoScrollDistance(0.0f),
|
||||
_autoScrollSpeed(0.0f),
|
||||
_autoScrollDirection(AutoScrollDirection::LEFT),
|
||||
_customScrollThreshold(0.0),
|
||||
_usingCustomScrollThreshold(false),
|
||||
_childFocusCancelOffset(5.0f),
|
||||
_pageViewEventListener(nullptr),
|
||||
_pageViewEventSelector(nullptr),
|
||||
_eventCallback(nullptr),
|
||||
_customScrollThreshold(0.0),
|
||||
_usingCustomScrollThreshold(false)
|
||||
_eventCallback(nullptr)
|
||||
{
|
||||
this->setTouchEnabled(true);
|
||||
}
|
||||
|
|
|
@ -45,11 +45,14 @@ namespace ui {
|
|||
, _bottomLeft(nullptr)
|
||||
, _bottom(nullptr)
|
||||
, _bottomRight(nullptr)
|
||||
, _scale9Enabled(true)
|
||||
, _insetLeft(0)
|
||||
, _insetTop(0)
|
||||
, _insetRight(0)
|
||||
, _insetBottom(0)
|
||||
, _scale9Enabled(true)
|
||||
,_flippedX(false)
|
||||
,_flippedY(false)
|
||||
|
||||
{
|
||||
this->setAnchorPoint(Vec2(0.5,0.5));
|
||||
}
|
||||
|
@ -1021,6 +1024,9 @@ y+=ytranslate; \
|
|||
this->cleanupSlicedSprites();
|
||||
_protectedChildren.clear();
|
||||
|
||||
//we must invalide the transform when toggling scale9enabled
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
|
||||
if (_scale9Enabled)
|
||||
{
|
||||
if (_scale9Image)
|
||||
|
@ -1208,34 +1214,17 @@ y+=ytranslate; \
|
|||
|
||||
void Scale9Sprite::setFlippedX(bool flippedX)
|
||||
{
|
||||
|
||||
float realScale = this->getScaleX();
|
||||
_flippedX = flippedX;
|
||||
if (_scale9Enabled)
|
||||
{
|
||||
this->setScaleX(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_scale9Image)
|
||||
{
|
||||
_scale9Image->setFlippedX(flippedX);
|
||||
}
|
||||
}
|
||||
this->setScaleX(realScale);
|
||||
}
|
||||
|
||||
void Scale9Sprite::setFlippedY(bool flippedY)
|
||||
{
|
||||
float realScale = this->getScaleY();
|
||||
_flippedY = flippedY;
|
||||
if (_scale9Enabled)
|
||||
{
|
||||
this->setScaleY(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_scale9Image)
|
||||
{
|
||||
_scale9Image->setFlippedY(flippedY);
|
||||
}
|
||||
}
|
||||
this->setScaleY(realScale);
|
||||
}
|
||||
|
||||
bool Scale9Sprite::isFlippedX()const
|
||||
|
@ -1247,4 +1236,60 @@ y+=ytranslate; \
|
|||
{
|
||||
return _flippedY;
|
||||
}
|
||||
|
||||
void Scale9Sprite::setScaleX(float scaleX)
|
||||
{
|
||||
if (_flippedX) {
|
||||
scaleX = scaleX * -1;
|
||||
}
|
||||
Node::setScaleX(scaleX);
|
||||
}
|
||||
|
||||
void Scale9Sprite::setScaleY(float scaleY)
|
||||
{
|
||||
if (_flippedY) {
|
||||
scaleY = scaleY * -1;
|
||||
}
|
||||
Node::setScaleY(scaleY);
|
||||
}
|
||||
|
||||
void Scale9Sprite::setScale(float scale)
|
||||
{
|
||||
this->setScaleX(scale);
|
||||
this->setScaleY(scale);
|
||||
this->setScaleZ(scale);
|
||||
}
|
||||
|
||||
void Scale9Sprite::setScale(float scaleX, float scaleY)
|
||||
{
|
||||
this->setScaleX(scaleX);
|
||||
this->setScaleY(scaleY);
|
||||
}
|
||||
|
||||
float Scale9Sprite::getScaleX()const
|
||||
{
|
||||
float originalScale = Node::getScaleX();
|
||||
if (_flippedX)
|
||||
{
|
||||
originalScale = originalScale * -1.0;
|
||||
}
|
||||
return originalScale;
|
||||
}
|
||||
|
||||
float Scale9Sprite::getScaleY()const
|
||||
{
|
||||
float originalScale = Node::getScaleY();
|
||||
if (_flippedY)
|
||||
{
|
||||
originalScale = originalScale * -1.0;
|
||||
}
|
||||
return originalScale;
|
||||
}
|
||||
|
||||
float Scale9Sprite::getScale()const
|
||||
{
|
||||
CCASSERT(this->getScaleX() == this->getScaleY(), "Scale9Sprite#scale. ScaleX != ScaleY. Don't know which one to return");
|
||||
return this->getScaleX();
|
||||
}
|
||||
|
||||
}}
|
||||
|
|
|
@ -354,6 +354,16 @@ namespace ui {
|
|||
*/
|
||||
virtual bool isFlippedY()const;
|
||||
|
||||
//override the setScale function of Node
|
||||
virtual void setScaleX(float scaleX) override;
|
||||
virtual void setScaleY(float scaleY) override;
|
||||
virtual void setScale(float scale) override;
|
||||
virtual void setScale(float scalex, float scaley) override;
|
||||
using Node::setScaleZ;
|
||||
virtual float getScaleX() const override;
|
||||
virtual float getScaleY() const override;
|
||||
virtual float getScale() const override;
|
||||
using Node::getScaleZ;
|
||||
protected:
|
||||
void updateCapInset();
|
||||
void updatePositions();
|
||||
|
|
|
@ -57,14 +57,14 @@ _capInsetsBarRenderer(Rect::ZERO),
|
|||
_capInsetsProgressBarRenderer(Rect::ZERO),
|
||||
_sliderEventListener(nullptr),
|
||||
_sliderEventSelector(nullptr),
|
||||
_eventCallback(nullptr),
|
||||
_barTexType(TextureResType::LOCAL),
|
||||
_progressBarTexType(TextureResType::LOCAL),
|
||||
_ballNTexType(TextureResType::LOCAL),
|
||||
_ballPTexType(TextureResType::LOCAL),
|
||||
_ballDTexType(TextureResType::LOCAL),
|
||||
_barRendererAdaptDirty(true),
|
||||
_progressBarRendererDirty(true),
|
||||
_eventCallback(nullptr)
|
||||
_progressBarRendererDirty(true)
|
||||
{
|
||||
setTouchEnabled(true);
|
||||
}
|
||||
|
|
|
@ -141,28 +141,28 @@ _enabled(true),
|
|||
_bright(true),
|
||||
_touchEnabled(false),
|
||||
_highlight(false),
|
||||
_affectByClipping(false),
|
||||
_ignoreSize(false),
|
||||
_propagateTouchEvents(true),
|
||||
_brightStyle(BrightStyle::NONE),
|
||||
_touchBeganPosition(Vec2::ZERO),
|
||||
_touchMovePosition(Vec2::ZERO),
|
||||
_touchEndPosition(Vec2::ZERO),
|
||||
_touchEventListener(nullptr),
|
||||
_touchEventSelector(nullptr),
|
||||
_sizeType(SizeType::ABSOLUTE),
|
||||
_positionType(PositionType::ABSOLUTE),
|
||||
_actionTag(0),
|
||||
_customSize(Size::ZERO),
|
||||
_ignoreSize(false),
|
||||
_affectByClipping(false),
|
||||
_sizeType(SizeType::ABSOLUTE),
|
||||
_sizePercent(Vec2::ZERO),
|
||||
_positionType(PositionType::ABSOLUTE),
|
||||
_positionPercent(Vec2::ZERO),
|
||||
_hitted(false),
|
||||
_touchListener(nullptr),
|
||||
_touchBeganPosition(Vec2::ZERO),
|
||||
_touchMovePosition(Vec2::ZERO),
|
||||
_touchEndPosition(Vec2::ZERO),
|
||||
_flippedX(false),
|
||||
_flippedY(false),
|
||||
_layoutParameterType(LayoutParameter::Type::NONE),
|
||||
_focused(false),
|
||||
_focusEnabled(true),
|
||||
_layoutParameterType(LayoutParameter::Type::NONE),
|
||||
_propagateTouchEvents(true)
|
||||
_touchEventListener(nullptr),
|
||||
_touchEventSelector(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
# Contributing to cocos2d-x
|
||||
|
||||
|
||||
## For general questions
|
||||
|
||||
|
||||
You can ask general questions by using:
|
||||
|
||||
- Forum (preferred way): http://discuss.cocos2d-x.org/
|
||||
- IRC: https://webchat.freenode.net/ (Use the *cocos2d* or *cocos2d-x* channels)
|
||||
- Weibo: http://t.sina.com.cn/cocos2dx
|
||||
- Twitter: http://www.twitter.com/cocos2dx
|
||||
|
||||
## Reporting bugs
|
||||
|
||||
To report bugs, please use the [Issue Tracker](https://github.com/cocos2d/cocos2d-x/issues)
|
||||
|
||||
Steps to report a bug:
|
||||
* Open the [url](https://github.com/cocos2d/cocos2d-x/issues/new)
|
||||
* Add all the needed information to reproduce the bug
|
||||
|
||||
|
||||
## Submitting patches
|
||||
|
||||
If you want to contribute code, please follow these steps:
|
||||
|
||||
(If you are new to git and/or GitHub, you should read [Pro Git](http://progit.org/book/) , especially the section on [Contributing to a project:Small/Large Public Project](http://progit.org/book/ch5-2.html#public_small_project) )
|
||||
|
||||
- Download the latest cocos2d-x develop branch from github:
|
||||
|
||||
```
|
||||
$ git clone git://github.com/cocos2d/cocos2d-x.git
|
||||
$ cd cocos2d-x
|
||||
$ git checkout v3
|
||||
$ ./download-deps.py
|
||||
$ git submodule update --init
|
||||
```
|
||||
|
||||
- Apply your changes in the recently downloaded repository
|
||||
- Commit your changes in your own repository
|
||||
- Create a new branch with your patch: `$ git checkout -b my_fix_branch`
|
||||
- Push your new branch to your public repository
|
||||
- Send a “pull request” to user “cocos2d”
|
||||
- It must be _complete_. See the definition below
|
||||
- It must follow the _Releases_ rules. See the definition below
|
||||
|
||||
## Only _complete_ patches will be merged
|
||||
|
||||
The patch must be _complete_. And by that, we mean:
|
||||
|
||||
- Follow the [Cocos2d C++ Coding Style][1]
|
||||
- Describe what the patch does
|
||||
- Include test cases
|
||||
- Include unit tests if applicable
|
||||
- Must be tested in all supported platforms [*]
|
||||
- Must NOT degrade the performance
|
||||
- Must NOT break existing tests cases
|
||||
- Must NOT break the Continuous Integration build
|
||||
- Must NOT break backward compatibility
|
||||
- Must compile WITHOUT warnings
|
||||
- New APIs MUST be **easy to use**, **familiar** to cocos2d-x users
|
||||
- New APIs MUST be documented using Doxgen strings
|
||||
- Code MUST be **easy to extend**
|
||||
- Must be efficient (fast / low memory needs)
|
||||
- It must not duplicate existing code, unless the new code deprecates the old one
|
||||
- Patches that refactor key components will only be merged in the next major versions.
|
||||
|
||||
[*]: If you don't have access to test your code in all the supported platforms, let us know.
|
||||
|
||||
|
||||
# Promoting cocos2d
|
||||
|
||||
Help us promote cocos2d-x by using the cocos2d logo in your game, or by mentioning cocos2d in the credits.
|
||||
|
||||
[Logo Resources of Cocos2d-x][2]
|
||||
|
||||
|
||||
[1]: https://github.com/cocos2d/cocos2d-x/blob/v3/docs/CODING_STYLE.md
|
||||
[2]: http://www.cocos2d-x.org/wiki/Logo_Resources_of_Cocos2d-x
|
|
@ -0,0 +1,171 @@
|
|||
# Cocos2d-x Release Engineering
|
||||
|
||||
|
||||
## Tagging
|
||||
|
||||
New releases must be tagged in github. The tag name must follow these rules:
|
||||
|
||||
cocos2d-x-Major.Minor[.Status]
|
||||
|
||||
or
|
||||
|
||||
cocos2d-x-Major.Minor.Revision[.Status]
|
||||
|
||||
Example of valid names:
|
||||
|
||||
* cocos2d-x-3.0rc0
|
||||
* cocos2d-x-3.0
|
||||
* cocos2d-x-2.1.1
|
||||
* cocos2d-x-2.1.1rc0
|
||||
|
||||
See "Naming Conventions" below
|
||||
|
||||
## Branching
|
||||
|
||||
Each Major version will have 2 branches, `master` and `develop`.
|
||||
For cocos2d-x v3, the branches names will be `v3-master` and `v3-develop`, for v4 the branches names will be `v4-master` and `v4-develop`, and so on.
|
||||
|
||||
* `master` is the stable branch.
|
||||
* `develop` is the unstable branch. All new features, bug fixes, etc, are applied first to `develop`.
|
||||
|
||||
Once a new version is released (either Major, Minor or Revision), then `develop` branch must be merged into `master` branch. To be more specific, `master` only contains _stable_ releases. _Alpha_, _Beta_, and _RC_ versions MUST NOT be merged into `master`.
|
||||
|
||||
|
||||
## Announcing
|
||||
|
||||
Only stable releases must be announced on:
|
||||
|
||||
* [Blog](http://www.cocos2d-x.org/news)
|
||||
|
||||
All kind of releases (alpha,beta,rc, final) must be announced on:
|
||||
* [Twitter](https://twitter.com/cocos2dx)
|
||||
* [Forum](http://discuss.cocos2d-x.org/)
|
||||
|
||||
|
||||
## Download package
|
||||
|
||||
A download package must be available for each released version.
|
||||
The package shall include the source code of cocos2d-x, and the needed scripts to download and install the 3rd party binaries.
|
||||
|
||||
|
||||
## Release Notes and Changelog
|
||||
|
||||
**BEFORE** releasing a new version (either stable or unstable), the following documents must be updated:
|
||||
|
||||
* [CHANGELOG](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)
|
||||
* [Release Notes](https://github.com/cocos2d/cocos2d-x/blob/v3/docs/RELEASE_NOTES.md)
|
||||
|
||||
## Documentation
|
||||
|
||||
**BEFORE** releasing a new Minor or Major stable release, the following tasks MUST be done:
|
||||
|
||||
- All documentation MUST be updated to the new version. This includes:
|
||||
- API Reference
|
||||
- Programmers Guide
|
||||
|
||||
## Backward compatibility
|
||||
|
||||
- Minor versions MUST be backward compatible with previous minor versions. eg: v3.2 must be backward compatible with v3.1 and v3.0.
|
||||
- Major versions SHOULD be backward compatible with previous major versions. Breaking backward compatibility in Major versions is acceptable only if it is extremely well justified
|
||||
|
||||
## Deprecated APIs
|
||||
|
||||
- Only Major versions (eg: 4.0, 5.0) can introduce deprecated APIs. Deprecated APIs cannot be introduced in Point releases (eg: 3.5, 4.2).
|
||||
- Only Major versions can remove deprecated APIs. They cannot be removed in Point versions.
|
||||
- A deprecated API must live at least for the whole cycle of a Major version. Eg: if an API was deprecated in 4.0, it can be removed in 5.0, but not before. It can be removed in 6.0 or future Major releases, but it cannot be removed in Point releases, like 5.1.
|
||||
|
||||
|
||||
## Performance tests
|
||||
|
||||
- Performance tests MUST be run before releasing a Release Candidate
|
||||
- If performance is worse than previous stable version, then the Release Candidate MUST NOT be released (See Naming Conventions below)
|
||||
- Results of the performance tests must be documented in this [spreadsheet](https://docs.google.com/spreadsheet/ccc?key=0AvvkdgVbWvpZdHFudzdDT3NuYTRNTHlZZzRGZWYzMmc#gid=8)
|
||||
|
||||
|
||||
## Samples and tests
|
||||
|
||||
**BEFORE** releasing a new Minor or Major stable release, the following tasks MUST be done:
|
||||
|
||||
- All the samples and tests must be updated to use the new version. This includes:
|
||||
- The samples in [cocos2d-x-samples](https://github.com/cocos2d/cocos2d-x-samples) repository
|
||||
- The demo games [EarthWarrior3D](https://github.com/chukong/EarthWarrior3D) and [FantasyWarrior3D](https://github.com/chukong/FantasyWarrior3D)
|
||||
- All the tests bundled in cocos2d-x
|
||||
- All the templates bundled in cocos2d-x
|
||||
|
||||
## Naming conventions
|
||||
|
||||
### Alpha
|
||||
|
||||
The product is unstable. It could have memory leaks, or crashes, or the API is unstable. The product contains little QA.
|
||||
Although the product is not ready for production, the product should be testable.
|
||||
Alpha versions might have Core functionality that has just been refactored, meaning that Core functionality might be unstable, but should work Ok.
|
||||
|
||||
As an example, for cocos2d-x, an _Alpha_ version means:
|
||||
|
||||
* Basic functionality works Ok (not great, but OK), like Sprites, Scenes, actions, etc.
|
||||
_* But it might have memory leaks, or crashes, or the recently added features might be unfinished. The documentation might not be updated.
|
||||
* As an example, the Renderer refactoring must be done in "alpha" versions (but not Beta versions).
|
||||
|
||||
Alpha versions are NOT feature freeze. New features might be added in future alpha and beta versions.
|
||||
|
||||
### Beta
|
||||
|
||||
The product is more stable than _Alpha_. The product might crash, but not frequently. No major changes were made in core components.
|
||||
Smaller features could be refactored in _Beta_ versions, but the core functionality is stable.
|
||||
The product has more QA.
|
||||
The only difference between _Alpha_ and _Beta_, is that _Beta_ is more stable than _Alpha_. And that in _Beta_ versions no new major features will be added.
|
||||
|
||||
As an example, for cocos2d-x it means:
|
||||
|
||||
* All the Core features (Sprites, Menu, Labels, Director, Transitions) are stable. Bug fixes could have been added into the Core functionality, but no major refactoring were done in the Core.
|
||||
* But perhaps new features like the new Particle Engine could be unfinished, or the Cocos Studio reader might crash.
|
||||
* Some cocos2d-x users might want to use a beta version for real games.
|
||||
|
||||
Beta versions are NOT feature freeze. __Small__ new features might be added in future _Beta_ versions. New __BIG__ features that might affect the Core functionality must only be added in _Alpha_ versions, and not in _Beta_ versions.
|
||||
|
||||
|
||||
### Release Candidate
|
||||
Release candidate means that, unless major bugs are found, the product is ready for release.
|
||||
The difference between _Release Candidate__ and _Final_ is that RC has less testing than the final version.
|
||||
|
||||
Many cocos2d-x users might want to try and use the RC releases for production.
|
||||
|
||||
RC versions ARE feature freeze. No new features, no matter how small they are, MUST be added in RC versions, because as the name implies, it is a _Release Candiate_.
|
||||
|
||||
|
||||
### Final
|
||||
|
||||
It is the new stable version.
|
||||
|
||||
## Number conventions
|
||||
|
||||
major.minor [revision | status]
|
||||
|
||||
### Major
|
||||
The major number is increased when there are significant jumps in functionality such as changing the framework which could cause incompatibility with interfacing systems
|
||||
|
||||
### Minor
|
||||
The minor number is incremented when only minor features or significant fixes have been added.
|
||||
|
||||
### Revision
|
||||
The revision number is incremented when minor bugs are fixed.
|
||||
|
||||
### Status
|
||||
The status could be: alphaN, betaN or rcN.
|
||||
|
||||
'N' is a number, and the first MUST always be 0.
|
||||
|
||||
### Examples
|
||||
|
||||
v2.0-alpha0:
|
||||
- New major version of cocos2d-x.
|
||||
- Unstable
|
||||
|
||||
v2.1.3:
|
||||
- Stable version of cocos2d-x. It is the same as v2.1 plus some bug fixes.
|
||||
|
||||
v2.2-beta0:
|
||||
- Similar to v2.1.3, but some new features were added, but are not stable yet.
|
||||
|
||||
v2.2:
|
||||
- Similar to v2.1.3, but some small features were added. The new features are stable.
|
|
@ -62,8 +62,8 @@ ScrollView::ScrollView()
|
|||
, _touchLength(0.0f)
|
||||
, _minScale(0.0f)
|
||||
, _maxScale(0.0f)
|
||||
, _touchListener(nullptr)
|
||||
, _scissorRestored(false)
|
||||
, _touchListener(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -50,20 +50,20 @@ const std::string AssetsManagerEx::BATCH_UPDATE_ID = "@batch_update";
|
|||
|
||||
AssetsManagerEx::AssetsManagerEx(const std::string& manifestUrl, const std::string& storagePath)
|
||||
: _updateState(State::UNCHECKED)
|
||||
, _waitToUpdate(false)
|
||||
, _totalToDownload(0)
|
||||
, _totalWaitToDownload(0)
|
||||
, _percent(0)
|
||||
, _percentByFile(0)
|
||||
, _manifestUrl(manifestUrl)
|
||||
, _assets(nullptr)
|
||||
, _storagePath("")
|
||||
, _cacheVersionPath("")
|
||||
, _cacheManifestPath("")
|
||||
, _tempManifestPath("")
|
||||
, _assets(nullptr)
|
||||
, _manifestUrl(manifestUrl)
|
||||
, _localManifest(nullptr)
|
||||
, _tempManifest(nullptr)
|
||||
, _remoteManifest(nullptr)
|
||||
, _waitToUpdate(false)
|
||||
, _percent(0)
|
||||
, _percentByFile(0)
|
||||
, _totalToDownload(0)
|
||||
, _totalWaitToDownload(0)
|
||||
{
|
||||
// Init variables
|
||||
_eventDispatcher = Director::getInstance()->getEventDispatcher();
|
||||
|
|
|
@ -31,14 +31,14 @@ NS_CC_EXT_BEGIN
|
|||
|
||||
EventAssetsManagerEx::EventAssetsManagerEx(const std::string& eventName, cocos2d::extension::AssetsManagerEx *manager, const EventCode &code, float percent/* = 0 */, float percentByFile/* = 0*/, const std::string& assetId/* = "" */, const std::string& message/* = "" */, int curle_code/* = CURLE_OK*/, int curlm_code/* = CURLM_OK*/)
|
||||
: EventCustom(eventName)
|
||||
, _manager(manager)
|
||||
, _code(code)
|
||||
, _manager(manager)
|
||||
, _message(message)
|
||||
, _assetId(assetId)
|
||||
, _curle_code(curle_code)
|
||||
, _curlm_code(curlm_code)
|
||||
, _percent(percent)
|
||||
, _percentByFile(percentByFile)
|
||||
, _assetId(assetId)
|
||||
, _message(message)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -145,10 +145,10 @@ int downloadProgressFunc(Downloader::ProgressData *ptr, double totalToDownload,
|
|||
}
|
||||
|
||||
Downloader::Downloader()
|
||||
: _onError(nullptr)
|
||||
: _connectionTimeout(DEFAULT_TIMEOUT)
|
||||
, _onError(nullptr)
|
||||
, _onProgress(nullptr)
|
||||
, _onSuccess(nullptr)
|
||||
, _connectionTimeout(DEFAULT_TIMEOUT)
|
||||
, _supportResuming(false)
|
||||
{
|
||||
_fileUtils = FileUtils::getInstance();
|
||||
|
|
|
@ -1154,9 +1154,11 @@
|
|||
"cocos/ui/proj.win32/libui.vcxproj",
|
||||
"cocos/ui/proj.win32/libui.vcxproj.filters",
|
||||
"docs/CODING_STYLE.md",
|
||||
"docs/CONTRIBUTE.md",
|
||||
"docs/Groups.h",
|
||||
"docs/MainPage.h",
|
||||
"docs/RELEASE_NOTES.md",
|
||||
"docs/RELEASING_RULES.md",
|
||||
"docs/cocos2dx_portrait.png",
|
||||
"docs/doxygen.config",
|
||||
"download-deps.py",
|
||||
|
|
|
@ -34,7 +34,7 @@ local function main()
|
|||
--set FPS. the default value is 1.0/60 if you don't call this
|
||||
director:setAnimationInterval(1.0 / 60)
|
||||
|
||||
cc.Director:getInstance():getOpenGLView():setDesignResolutionSize(480, 320, 0)
|
||||
cc.Director:getInstance():getOpenGLView():setDesignResolutionSize(480, 320, 1)
|
||||
|
||||
--create scene
|
||||
local scene = require("GameScene")
|
||||
|
|
|
@ -167,9 +167,8 @@ void Box2DTestLayer::onDraw()
|
|||
{
|
||||
Director* director = Director::getInstance();
|
||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
||||
|
||||
Mat4 oldMV;
|
||||
oldMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
|
||||
auto oldMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV);
|
||||
world->DrawDebugData();
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, oldMV);
|
||||
|
|
|
@ -470,9 +470,9 @@ bool EffectNormalMapped::init()
|
|||
_kBump = 2;
|
||||
return true;
|
||||
}
|
||||
bool EffectNormalMapped::initNormalMap(const std::string&normalMapFileName)
|
||||
bool EffectNormalMapped::initNormalMap(const std::string& normalMapFileName)
|
||||
{
|
||||
auto normalMapTextrue = TextureCache::getInstance()->addImage(normalMapFileName.c_str());
|
||||
auto normalMapTextrue = Director::getInstance()->getTextureCache()->addImage(normalMapFileName);
|
||||
getGLProgramState()->setUniformTexture("u_normalMap", normalMapTextrue);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ static std::function<Layer*()> createFunctions[] =
|
|||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
|
||||
// 3DEffect use custom shader which is not supported on WP8/WinRT yet.
|
||||
CL(Sprite3DEffectTest),
|
||||
CL(Sprite3DUVAnimationTest),
|
||||
#endif
|
||||
CL(Sprite3DWithSkinTest),
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
|
||||
|
@ -227,11 +228,106 @@ std::string Sprite3DBasicTest::subtitle() const
|
|||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// Sprite3DHitTest
|
||||
// Sprite3DUVAnimationTest
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
Sprite3DUVAnimationTest::Sprite3DUVAnimationTest()
|
||||
{
|
||||
//the offset use to translating texture
|
||||
_cylinder_texture_offset = 0;
|
||||
_shining_duraion = 0;
|
||||
Size visibleSize = Director::getInstance()->getVisibleSize();
|
||||
|
||||
//use custom camera
|
||||
auto camera = Camera::createPerspective(60,visibleSize.width/visibleSize.height,0.1,200);
|
||||
camera->setCameraFlag(CameraFlag::USER1);
|
||||
|
||||
//create cylinder
|
||||
auto cylinder = Sprite3D::create("Sprite3DTest/cylinder.c3b");
|
||||
|
||||
//create and set our custom shader
|
||||
auto shader =GLProgram::createWithFilenames("Sprite3DTest/cylinder.vert","Sprite3DTest/cylinder.frag");
|
||||
_state = GLProgramState::create(shader);
|
||||
cylinder->setGLProgramState(_state);
|
||||
|
||||
_state->setUniformFloat("offset",_cylinder_texture_offset);
|
||||
_state->setUniformFloat("duration",_shining_duraion);
|
||||
//pass mesh's attribute to shader
|
||||
long offset = 0;
|
||||
auto attributeCount = cylinder->getMesh()->getMeshVertexAttribCount();
|
||||
for (auto i = 0; i < attributeCount; i++) {
|
||||
auto meshattribute = cylinder->getMesh()->getMeshVertexAttribute(i);
|
||||
_state->setVertexAttribPointer(s_attributeNames[meshattribute.vertexAttrib],
|
||||
meshattribute.size,
|
||||
meshattribute.type,
|
||||
GL_FALSE,
|
||||
cylinder->getMesh()->getVertexSizeInBytes(),
|
||||
(GLvoid*)offset);
|
||||
offset += meshattribute.attribSizeBytes;
|
||||
}
|
||||
|
||||
//create the second texture for cylinder
|
||||
auto shining_texture = Director::getInstance()->getTextureCache()->addImage("Sprite3DTest/caustics.png");
|
||||
Texture2D::TexParams tRepeatParams;//set texture parameters
|
||||
tRepeatParams.magFilter = GL_LINEAR_MIPMAP_LINEAR;
|
||||
tRepeatParams.minFilter = GL_LINEAR;
|
||||
tRepeatParams.wrapS = GL_REPEAT;
|
||||
tRepeatParams.wrapT = GL_REPEAT;
|
||||
shining_texture->setTexParameters(tRepeatParams);
|
||||
//pass the texture sampler to our custom shader
|
||||
_state->setUniformTexture("caustics",shining_texture);
|
||||
|
||||
|
||||
this->addChild(cylinder);
|
||||
this->setCameraMask(2);
|
||||
this->addChild(camera);
|
||||
|
||||
//adjust cylinder's position & rotation
|
||||
cylinder->setPosition3D(Vec3(0,-15,-50));
|
||||
cylinder->setRotation3D(Vec3(-90,0,0));
|
||||
|
||||
//the callback function update cylinder's texcoord
|
||||
schedule(schedule_selector(Sprite3DUVAnimationTest::cylinderUpdate));
|
||||
}
|
||||
|
||||
std::string Sprite3DUVAnimationTest::title() const
|
||||
{
|
||||
return "Testing UV Animation";
|
||||
}
|
||||
|
||||
std::string Sprite3DUVAnimationTest::subtitle() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void Sprite3DUVAnimationTest::cylinderUpdate(float dt)
|
||||
{
|
||||
//callback function to update cylinder's texcoord
|
||||
static bool fade_in = true;
|
||||
_cylinder_texture_offset += 0.3*dt;
|
||||
_cylinder_texture_offset = (_cylinder_texture_offset >1) ? 0 : _cylinder_texture_offset;
|
||||
if(fade_in)
|
||||
{
|
||||
_shining_duraion += 0.5*dt;
|
||||
if(_shining_duraion>1) fade_in = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_shining_duraion -= 0.5*dt;
|
||||
if(_shining_duraion<0) fade_in = true;
|
||||
}
|
||||
|
||||
//pass the result to shader
|
||||
_state->setUniformFloat("offset",_cylinder_texture_offset);
|
||||
_state->setUniformFloat("duration",_shining_duraion);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// Sprite3DHitTest
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
Sprite3DHitTest::Sprite3DHitTest()
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
|
@ -1027,124 +1123,50 @@ Sprite3DReskinTest::Sprite3DReskinTest()
|
|||
}
|
||||
void Sprite3DReskinTest::menuCallback_switchHair(Ref* sender)
|
||||
{
|
||||
_useHairId++;
|
||||
if(_useHairId > 1 )
|
||||
{
|
||||
_useHairId = 0;
|
||||
}
|
||||
if(_useHairId >= 0 && _sprite)
|
||||
{
|
||||
for(int i = 0; i < 2; i++ )
|
||||
{
|
||||
auto subMesh = _sprite->getMeshByName(_girlHair[i]);
|
||||
if(subMesh)
|
||||
{
|
||||
if(i == _useHairId )
|
||||
{
|
||||
subMesh->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
subMesh->setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string str = _curSkin[SkinType::HAIR];
|
||||
if (str == "Girl_Hair01")
|
||||
_curSkin[SkinType::HAIR] = "Girl_Hair02";
|
||||
else
|
||||
_curSkin[SkinType::HAIR] = "Girl_Hair01";
|
||||
applyCurSkin();
|
||||
}
|
||||
void Sprite3DReskinTest::menuCallback_switchGlasses(Ref* sender)
|
||||
{
|
||||
auto subMesh = _sprite->getMeshByName("Girl_Glasses01");
|
||||
if(subMesh)
|
||||
{
|
||||
if(subMesh->isVisible())
|
||||
{
|
||||
subMesh->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
subMesh->setVisible(true);
|
||||
}
|
||||
}
|
||||
std::string str = _curSkin[SkinType::GLASSES];
|
||||
if (str == "Girl_Glasses01")
|
||||
_curSkin[SkinType::GLASSES] = "";
|
||||
else
|
||||
_curSkin[SkinType::GLASSES] = "Girl_Glasses01";
|
||||
applyCurSkin();
|
||||
}
|
||||
void Sprite3DReskinTest::menuCallback_switchCoat(Ref* sender)
|
||||
{
|
||||
_useUpBodyId++;
|
||||
if(_useUpBodyId > 1 )
|
||||
{
|
||||
_useUpBodyId = 0;
|
||||
}
|
||||
if(_useUpBodyId >= 0 && _sprite)
|
||||
{
|
||||
for(int i = 0; i < 2; i++ )
|
||||
{
|
||||
auto subMesh = _sprite->getMeshByName(_girlUpperBody[i]);
|
||||
if(subMesh)
|
||||
{
|
||||
if(i == _useUpBodyId )
|
||||
{
|
||||
subMesh->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
subMesh->setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string str = _curSkin[SkinType::UPPER_BODY];
|
||||
if (str == "Girl_UpperBody01")
|
||||
_curSkin[SkinType::UPPER_BODY] = "Girl_UpperBody02";
|
||||
else
|
||||
_curSkin[SkinType::UPPER_BODY] = "Girl_UpperBody01";
|
||||
applyCurSkin();
|
||||
}
|
||||
void Sprite3DReskinTest::menuCallback_switchPants(Ref* sender)
|
||||
{
|
||||
_usePantsId++;
|
||||
if(_usePantsId > 1 )
|
||||
{
|
||||
_usePantsId = 0;
|
||||
}
|
||||
if(_usePantsId >= 0 && _sprite)
|
||||
{
|
||||
for(int i = 0; i < 2; i++ )
|
||||
{
|
||||
auto subMesh = _sprite->getMeshByName(_girlPants[i]);
|
||||
if(subMesh)
|
||||
{
|
||||
if(i == _usePantsId )
|
||||
{
|
||||
subMesh->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
subMesh->setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string str = _curSkin[SkinType::PANTS];
|
||||
if (str == "Girl_LowerBody01")
|
||||
_curSkin[SkinType::PANTS] = "Girl_LowerBody02";
|
||||
else
|
||||
_curSkin[SkinType::PANTS] = "Girl_LowerBody01";
|
||||
applyCurSkin();
|
||||
}
|
||||
void Sprite3DReskinTest::menuCallback_switchShoes(Ref* sender)
|
||||
{
|
||||
_useShoesId++;
|
||||
if(_useShoesId > 1 )
|
||||
{
|
||||
_useShoesId = 0;
|
||||
}
|
||||
if(_useShoesId >= 0 && _sprite)
|
||||
{
|
||||
for(int i = 0; i < 2; i++ )
|
||||
{
|
||||
auto subMesh = _sprite->getMeshByName(_girlShoes[i]);
|
||||
if(subMesh)
|
||||
{
|
||||
if(i == _useShoesId )
|
||||
{
|
||||
subMesh->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
subMesh->setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string strShoes = _curSkin[SkinType::SHOES];
|
||||
if (strShoes == "Girl_Shoes01")
|
||||
_curSkin[SkinType::SHOES] = "Girl_Shoes02";
|
||||
else
|
||||
_curSkin[SkinType::SHOES] = "Girl_Shoes01";
|
||||
applyCurSkin();
|
||||
}
|
||||
|
||||
std::string Sprite3DReskinTest::title() const
|
||||
{
|
||||
return "Testing Sprite3D Reskin";
|
||||
|
@ -1156,43 +1178,10 @@ std::string Sprite3DReskinTest::subtitle() const
|
|||
|
||||
void Sprite3DReskinTest::addNewSpriteWithCoords(Vec2 p)
|
||||
{
|
||||
_girlPants[0]= "Girl_LowerBody01";
|
||||
_girlPants[1]= "Girl_LowerBody02";
|
||||
_girlUpperBody[0] = "Girl_UpperBody01";
|
||||
_girlUpperBody[1] = "Girl_UpperBody02";
|
||||
_girlShoes[0] = "Girl_Shoes01";
|
||||
_girlShoes[1] = "Girl_Shoes02";
|
||||
_girlHair[0]= "Girl_Hair01";
|
||||
_girlHair[1]= "Girl_Hair02";
|
||||
_usePantsId = 0;
|
||||
_useUpBodyId = 0;
|
||||
_useShoesId =0;
|
||||
_useHairId = 0;
|
||||
|
||||
std::string fileName = "Sprite3DTest/ReskinGirl.c3b";
|
||||
auto sprite = Sprite3D::create(fileName);
|
||||
sprite->setScale(4);
|
||||
sprite->setRotation3D(Vec3(0,0,0));
|
||||
auto girlPants = sprite->getMeshByName(_girlPants[1]);
|
||||
if(girlPants)
|
||||
{
|
||||
girlPants->setVisible(false);
|
||||
}
|
||||
auto girlShoes = sprite->getMeshByName(_girlShoes[1]);
|
||||
if(girlShoes)
|
||||
{
|
||||
girlShoes->setVisible(false);
|
||||
}
|
||||
auto girlHair = sprite->getMeshByName(_girlHair[1]);
|
||||
if(girlHair)
|
||||
{
|
||||
girlHair->setVisible(false);
|
||||
}
|
||||
auto girlUpBody = sprite->getMeshByName( _girlUpperBody[1]);
|
||||
if(girlUpBody)
|
||||
{
|
||||
girlUpBody->setVisible(false);
|
||||
}
|
||||
addChild(sprite);
|
||||
sprite->setPosition( Vec2( p.x, p.y-60) );
|
||||
auto animation = Animation3D::create(fileName);
|
||||
|
@ -1203,11 +1192,37 @@ void Sprite3DReskinTest::addNewSpriteWithCoords(Vec2 p)
|
|||
sprite->runAction(RepeatForever::create(animate));
|
||||
}
|
||||
_sprite = sprite;
|
||||
|
||||
_curSkin[SkinType::UPPER_BODY] = "Girl_UpperBody01";
|
||||
_curSkin[SkinType::PANTS] = "Girl_LowerBody01";
|
||||
_curSkin[SkinType::SHOES] = "Girl_Shoes01";
|
||||
_curSkin[SkinType::HAIR] = "Girl_Hair01";
|
||||
_curSkin[SkinType::FACE] = "Girl_Face01";
|
||||
_curSkin[SkinType::HAND] = "Girl_Hand01";
|
||||
_curSkin[SkinType::GLASSES] = "";
|
||||
applyCurSkin();
|
||||
}
|
||||
|
||||
void Sprite3DReskinTest::onTouchesEnded(const std::vector<Touch*>& touches, Event* event)
|
||||
{
|
||||
}
|
||||
|
||||
void Sprite3DReskinTest::applyCurSkin()
|
||||
{
|
||||
for (ssize_t i = 0; i < _sprite->getMeshCount(); i++) {
|
||||
auto mesh = _sprite->getMeshByIndex(static_cast<int>(i));
|
||||
bool isVisible = false;
|
||||
for (auto& it : _curSkin) {
|
||||
if (mesh->getName() == it.second)
|
||||
{
|
||||
isVisible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_sprite->getMeshByIndex(static_cast<int>(i))->setVisible(isVisible);
|
||||
}
|
||||
}
|
||||
|
||||
Sprite3DWithOBBPerfromanceTest::Sprite3DWithOBBPerfromanceTest()
|
||||
{
|
||||
auto listener = EventListenerTouchAllAtOnce::create();
|
||||
|
@ -1447,7 +1462,7 @@ void Sprite3DWithOBBPerfromanceTest::calculateRayByLocationInView(Ray* ray, cons
|
|||
{
|
||||
auto dir = Director::getInstance();
|
||||
auto view = dir->getWinSize();
|
||||
Mat4 mat = dir->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
auto mat = dir->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
|
||||
Vec3 src = Vec3(location.x, location.y, -1);
|
||||
Vec3 nearPoint;
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace cocos2d {
|
|||
class Delay;
|
||||
class Ray;
|
||||
class DrawNode3D;
|
||||
class GLProgramState;
|
||||
}
|
||||
|
||||
class Sprite3DTestDemo : public BaseTest
|
||||
|
@ -51,9 +52,6 @@ public:
|
|||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
std::string _title;
|
||||
};
|
||||
|
||||
class Sprite3DBasicTest : public Sprite3DTestDemo
|
||||
|
@ -68,6 +66,21 @@ public:
|
|||
void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
|
||||
};
|
||||
|
||||
class Sprite3DUVAnimationTest : public Sprite3DTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(Sprite3DUVAnimationTest);
|
||||
Sprite3DUVAnimationTest();
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
protected:
|
||||
void cylinderUpdate(float dt);
|
||||
|
||||
float _cylinder_texture_offset;
|
||||
float _shining_duraion;
|
||||
GLProgramState * _state;
|
||||
};
|
||||
class EffectSprite3D;
|
||||
|
||||
class Effect3D : public Ref
|
||||
|
@ -261,14 +274,19 @@ public:
|
|||
void menuCallback_switchPants(Ref* sender);
|
||||
void menuCallback_switchShoes(Ref* sender);
|
||||
protected:
|
||||
std::string _girlPants[2];
|
||||
int _usePantsId;
|
||||
std::string _girlUpperBody[2];
|
||||
int _useUpBodyId;
|
||||
std::string _girlShoes[2];
|
||||
int _useShoesId;
|
||||
std::string _girlHair[2];
|
||||
int _useHairId;
|
||||
void applyCurSkin();
|
||||
|
||||
enum class SkinType
|
||||
{
|
||||
UPPER_BODY = 0,
|
||||
PANTS,
|
||||
SHOES,
|
||||
HAIR,
|
||||
FACE,
|
||||
HAND,
|
||||
GLASSES,
|
||||
};
|
||||
std::map<SkinType, std::string> _curSkin;
|
||||
cocos2d::Sprite3D* _sprite;
|
||||
};
|
||||
class Sprite3DWithOBBPerfromanceTest : public Sprite3DTestDemo
|
||||
|
|
|
@ -44,13 +44,14 @@ bool UIScale9SpriteTest::init()
|
|||
auto moveTo = MoveBy::create(1.0, Vec2(30,0));
|
||||
auto moveBack = moveTo->reverse();
|
||||
auto rotateBy = RotateBy::create(1.0, 180);
|
||||
auto action = Sequence::create(moveTo,moveBack, rotateBy, NULL);
|
||||
auto scaleBy = ScaleTo::create(1.0, -2.0);
|
||||
auto action = Sequence::create(moveTo,moveBack, rotateBy,scaleBy, NULL);
|
||||
|
||||
|
||||
Sprite *normalSprite1 = Sprite::create("cocosui/animationbuttonnormal.png");
|
||||
normalSprite1->setPosition(100, 270);
|
||||
// normalSprite1->setAnchorPoint(Vec2(0.5,0.5));
|
||||
// normalSprite1->setContentSize(Size(100,100));
|
||||
normalSprite1->setFlippedY(true);
|
||||
|
||||
|
||||
this->addChild(normalSprite1);
|
||||
normalSprite1->runAction((FiniteTimeAction*)action->clone());
|
||||
|
@ -107,7 +108,8 @@ bool UIScale9SpriteHierarchialTest::init()
|
|||
auto moveBack = moveTo->reverse();
|
||||
auto rotateBy = RotateBy::create(1.0f, 180);
|
||||
auto fadeOut = FadeOut::create(2.0f);
|
||||
auto action = Sequence::create(moveTo,moveBack, rotateBy,fadeOut, NULL);
|
||||
auto scaleTo = ScaleTo::create(1.0, 2.0);
|
||||
auto action = Sequence::create(moveTo,moveBack, rotateBy,fadeOut,scaleTo, NULL);
|
||||
|
||||
Sprite *normalSprite1 = Sprite::create("cocosui/animationbuttonnormal.png");
|
||||
normalSprite1->setPosition(100, 270);
|
||||
|
@ -135,6 +137,7 @@ bool UIScale9SpriteHierarchialTest::init()
|
|||
cocos2d::ui::Scale9Sprite *sp2 = ui::Scale9Sprite::create("cocosui/animationbuttonnormal.png");
|
||||
sp2->setPreferredSize(sp1->getContentSize() * 1.2f);
|
||||
sp2->setColor(Color3B::GREEN);
|
||||
sp2->setFlippedX(true);
|
||||
sp2->setContentSize(Size(100,100));
|
||||
|
||||
sp1->addChild(sp2);
|
||||
|
@ -163,15 +166,13 @@ bool UIScale9SpriteTouchTest::init()
|
|||
|
||||
auto containerForSprite1 = Node::create();
|
||||
auto sprite1 = cocos2d::ui::Scale9Sprite::create("Images/CyanSquare.png");
|
||||
// sprite1->setScale9Enabled(false);
|
||||
sprite1->setPosition(origin+Vec2(size.width/2, size.height/2) + Vec2(-80, 80));
|
||||
containerForSprite1->addChild(sprite1);
|
||||
addChild(containerForSprite1, 10);
|
||||
|
||||
auto sprite2 = ui::Scale9Sprite::create("Images/MagentaSquare.png");
|
||||
sprite2->setPosition(origin+Vec2(size.width/2, size.height/2));
|
||||
// sprite2->setCascadeOpacityEnabled(false);
|
||||
// sprite2->setScale9Enabled(false);
|
||||
|
||||
|
||||
addChild(sprite2, 20);
|
||||
|
||||
|
@ -179,7 +180,6 @@ bool UIScale9SpriteTouchTest::init()
|
|||
sprite3->setPosition(Vec2(0, 0));
|
||||
sprite3->setCascadeOpacityEnabled(false);
|
||||
sprite2->addChild(sprite3, 1);
|
||||
// sprite3->setScale9Enabled(false);
|
||||
|
||||
|
||||
// Make sprite1 touchable
|
||||
|
@ -647,6 +647,9 @@ bool UIS9Flip::init()
|
|||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
auto statusLabel = Label::createWithSystemFont("Scale9Enabled", "Arial", 10);
|
||||
statusLabel->setPosition(Vec2(x, winSize.height - statusLabel->getContentSize().height - 40));
|
||||
this->addChild(statusLabel);
|
||||
|
||||
auto normalSprite = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
|
||||
|
||||
|
@ -663,11 +666,11 @@ bool UIS9Flip::init()
|
|||
auto flipXSprite = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
|
||||
|
||||
flipXSprite->setPosition(Vec2(x - 120, y ));
|
||||
flipXSprite->setScale(1.2);
|
||||
this->addChild(flipXSprite);
|
||||
flipXSprite->setFlippedX(false);
|
||||
|
||||
flipXSprite->setFlippedX(true);
|
||||
|
||||
auto flipXLabel = Label::createWithSystemFont("Sprite FlipX","Airal",10);
|
||||
auto flipXLabel = Label::createWithSystemFont("sprite is not flipped!","Airal",10);
|
||||
flipXLabel->setPosition(flipXSprite->getPosition() + Vec2(0, flipXSprite->getContentSize().height/2 + 10));
|
||||
this->addChild(flipXLabel);
|
||||
|
||||
|
@ -677,12 +680,80 @@ bool UIS9Flip::init()
|
|||
flipYSprite->setPosition(Vec2(x + 120, y));
|
||||
this->addChild(flipYSprite);
|
||||
|
||||
flipYSprite->setScale(0.8);
|
||||
flipYSprite->setFlippedY(true);
|
||||
|
||||
auto flipYLabel = Label::createWithSystemFont("Sprite FlipY","Airal",10);
|
||||
auto flipYLabel = Label::createWithSystemFont("sprite is flipped!","Airal",10);
|
||||
flipYLabel->setPosition(flipYSprite->getPosition() + Vec2(0, flipYSprite->getContentSize().height/2 + 10));
|
||||
this->addChild(flipYLabel);
|
||||
|
||||
|
||||
auto toggleFlipXButton = Button::create();
|
||||
toggleFlipXButton->setTitleText("Toggle FlipX");
|
||||
toggleFlipXButton->setPosition(flipXSprite->getPosition() + Vec2(0, - 20 - flipXSprite->getContentSize().height/2));
|
||||
toggleFlipXButton->addClickEventListener([=](Ref*){
|
||||
flipXSprite->setFlippedX(! flipXSprite->isFlippedX());
|
||||
if (flipXSprite->isFlippedX()) {
|
||||
flipXLabel->setString("sprite is flipped!");
|
||||
}
|
||||
else{
|
||||
flipXLabel->setString("sprite is not flipped!");
|
||||
}
|
||||
});
|
||||
this->addChild(toggleFlipXButton);
|
||||
|
||||
auto toggleFlipYButton = Button::create();
|
||||
toggleFlipYButton->setTitleText("Toggle FlipY");
|
||||
toggleFlipYButton->setPosition(flipYSprite->getPosition() + Vec2(0, -20 - flipYSprite->getContentSize().height/2));
|
||||
toggleFlipYButton->addClickEventListener([=](Ref*){
|
||||
flipYSprite->setFlippedY(!flipYSprite->isFlippedY());
|
||||
if (flipYSprite->isFlippedY()) {
|
||||
flipYLabel->setString("sprite is flipped!");
|
||||
}
|
||||
else{
|
||||
flipYLabel->setString("sprpite is not flipped!");
|
||||
}
|
||||
});
|
||||
this->addChild(toggleFlipYButton);
|
||||
|
||||
auto toggleScale9Button = Button::create();
|
||||
toggleScale9Button->setTitleText("Toggle Scale9");
|
||||
toggleScale9Button->setPosition(normalSprite->getPosition() + Vec2(0, -20 - normalSprite->getContentSize().height/2));
|
||||
toggleScale9Button->addClickEventListener([=](Ref*){
|
||||
flipXSprite->setScale9Enabled(!flipXSprite->isScale9Enabled());
|
||||
flipYSprite->setScale9Enabled(!flipYSprite->isScale9Enabled());
|
||||
if (flipXSprite->isScale9Enabled()) {
|
||||
statusLabel->setString("Scale9Enabled");
|
||||
}else{
|
||||
statusLabel->setString("Scale9Disabled");
|
||||
}
|
||||
|
||||
CCLOG("scaleX = %f", flipXSprite->getScaleX());
|
||||
CCLOG("scaleY = %f", flipYSprite->getScale());
|
||||
if (flipXSprite->isFlippedX()) {
|
||||
CCLOG("xxxxxxx");
|
||||
}
|
||||
if (flipYSprite->isFlippedY()) {
|
||||
CCLOG("YYYYYY");
|
||||
}
|
||||
|
||||
if (flipXSprite->isFlippedX()) {
|
||||
flipXLabel->setString("sprite is flipped!");
|
||||
}
|
||||
else{
|
||||
flipXLabel->setString("sprite is not flipped!");
|
||||
}
|
||||
|
||||
if (flipYSprite->isFlippedY()) {
|
||||
flipYLabel->setString("sprite is flipped!");
|
||||
}
|
||||
else{
|
||||
flipYLabel->setString("sprpite is not flipped!");
|
||||
}
|
||||
|
||||
});
|
||||
this->addChild(toggleScale9Button);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
@ -0,0 +1,16 @@
|
|||
#ifdef GL_ES
|
||||
varying mediump vec2 TextureCoordOut;
|
||||
#else
|
||||
varying vec2 TextureCoordOut;
|
||||
#endif
|
||||
|
||||
uniform vec4 u_color;
|
||||
uniform float offset;
|
||||
uniform float duration;
|
||||
uniform sampler2D caustics;
|
||||
void main(void)
|
||||
{
|
||||
vec4 golden = duration*vec4(0,0.8,0.4,1.0);
|
||||
//blend two texture
|
||||
gl_FragColor = texture2D(CC_Texture0, vec2(TextureCoordOut.x- 2.0 * offset,TextureCoordOut.y)) * vec4(0.3,0.3,0.3,1)+texture2D(caustics,vec2(TextureCoordOut.x-offset,TextureCoordOut.y)).r*golden;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
attribute vec4 a_position;
|
||||
attribute vec2 a_texCoord;
|
||||
uniform float offset;
|
||||
varying vec2 TextureCoordOut;
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = CC_MVPMatrix * a_position;
|
||||
TextureCoordOut = a_texCoord;
|
||||
TextureCoordOut.y = (1.0 - TextureCoordOut.y);
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
|
@ -14,7 +14,7 @@
|
|||
+ (int) addTwoNumbers:(NSDictionary *)dict;
|
||||
+ (void) callbackScriptHandler;
|
||||
|
||||
- (void) init;
|
||||
- (id) init;
|
||||
@end
|
||||
|
||||
#endif // COCOS2DX_SAMPLES_TESTLUA_PROJ_IOS_LUAOBJECTCBRIDGETEST_H
|
||||
|
|
|
@ -73,9 +73,10 @@ static LuaObjectCBridgeTest* s_instance = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)init
|
||||
- (id)init
|
||||
{
|
||||
_scriptHandler = 0;
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -36,7 +36,7 @@ classes = Animate3D Sprite3D Animation3D Skeleton3D ^Mesh$ AttachNode BillBoard
|
|||
# functions from all classes.
|
||||
|
||||
skip = Mesh::[create getAABB getVertexBuffer hasVertexAttrib getMeshVertexAttribCount getMeshVertexAttribute getVertexSizeInBytes getSkin getMeshIndexData getGLProgramState getPrimitiveType getIndexCount getIndexFormat getIndexBuffer],
|
||||
Sprite3D::[getSkin getAABB setBlendFunc],
|
||||
Sprite3D::[getSkin getAABB setBlendFunc getMeshArrayByName],
|
||||
Skeleton3D::[create],
|
||||
Animation3D::[getBoneCurveByName],
|
||||
BillBoard::[draw]
|
||||
|
|
Loading…
Reference in New Issue