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

This commit is contained in:
samuele3hu 2014-07-09 18:08:09 +08:00
commit 243fa49c09
43 changed files with 878 additions and 868 deletions

View File

@ -908,6 +908,9 @@ Developers:
Teivaz
Custom uniform search optimization
chareice
Make `setup.py` work on zsh
Retired Core Developers:
WenSheng Yang
Author of windows port, CCTextField,

View File

@ -1,7 +1,17 @@
cocos2d-x-3.2 ??
[FIX] GLView: cursor position is not correct if design resolution is different from device resolution
[FIX] Label: color can not be set correctly if using system font
[FIX] Node: setRotation3D not work based on anchor point
[FIX] Setup.py: not work if using zsh
[FIX] SpriteBatchNode: opacity can not work
[FIX] Sprite3D: may crash on Android if playing animation and replace Scene after come from background
[FIX] UIdget: opacity is wrong when replace texture
[FIX] UITextField: keyboard can not hide if touching space outside of keyboard
[FIX] Others: don't release singleton objects correctly that are needed in the whole game, which will be treated
as memory leak when using VLD.
cocos2d-x-3.2rc0 Jul.7 2014
[NEW] FastTMXTiledMap: added fast tmx, which is much more faster for static tiled map
[NEW] GLProgramState: can use uniform location to get/set uniform values

View File

@ -25,7 +25,6 @@ THE SOFTWARE.
****************************************************************************/
#include "2d/CCMenu.h"
#include "base/CCDirector.h"
#include "CCApplication.h"
#include "base/CCTouch.h"
#include "CCStdC.h"
#include "base/CCEventListenerTouch.h"

View File

@ -1635,17 +1635,19 @@ const Mat4& Node::getNodeToParentTransform() const
bool needsSkewMatrix = ( _skewX || _skewY );
Vec2 anchorPoint;
anchorPoint.x = _anchorPointInPoints.x * _scaleX;
anchorPoint.y = _anchorPointInPoints.y * _scaleY;
// optimization:
// inline anchor point calculation if skew is not needed
// Adjusted transform calculation for rotational skew
if (! needsSkewMatrix && !_anchorPointInPoints.equals(Vec2::ZERO))
{
x += cy * -_anchorPointInPoints.x * _scaleX + -sx * -_anchorPointInPoints.y * _scaleY;
y += sy * -_anchorPointInPoints.x * _scaleX + cx * -_anchorPointInPoints.y * _scaleY;
x += cy * -anchorPoint.x + -sx * -anchorPoint.y;
y += sy * -anchorPoint.x + cx * -anchorPoint.y;
}
// Build Transform Matrix
// Adjusted transform calculation for rotational skew
float mat[] = {
@ -1656,6 +1658,11 @@ const Mat4& Node::getNodeToParentTransform() const
_transform.set(mat);
if(!_ignoreAnchorPointForPosition)
{
_transform.translate(anchorPoint.x, anchorPoint.y, 0);
}
// XXX
// FIX ME: Expensive operation.
// FIX ME: It should be done together with the rotationZ
@ -1670,6 +1677,11 @@ const Mat4& Node::getNodeToParentTransform() const
_transform = _transform * rotX;
}
if(!_ignoreAnchorPointForPosition)
{
_transform.translate(-anchorPoint.x, -anchorPoint.y, 0);
}
// XXX: Try to inline skew
// If skew is needed, apply skew and then anchor point
if (needsSkewMatrix)

View File

@ -85,6 +85,10 @@ bool SpriteBatchNode::initWithTexture(Texture2D *tex, ssize_t capacity)
CCASSERT(capacity>=0, "Capacity must be >= 0");
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
if(tex->hasPremultipliedAlpha())
{
_blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;
}
_textureAtlas = new TextureAtlas();
if (capacity == 0)

View File

@ -447,8 +447,7 @@ bool Bundle3D::loadBinary(const std::string& path)
return false;
}
// Create bundle reader
//CC_SAFE_DELETE(_bundleReader);
// Initialise bundle reader
_binaryReader.init( (char*)_binaryBuffer->getBytes(), _binaryBuffer->getSize() );
// Read identifier info
@ -463,8 +462,11 @@ bool Bundle3D::loadBinary(const std::string& path)
// Read version
unsigned char ver[2];
if (_binaryReader.read(ver, 1, 2) == 2)
{
if (_binaryReader.read(ver, 1, 2)!= 2){
CCLOG("Failed to read version:");
return false;
}
if (ver[0] != 0) {
clear();
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
@ -476,7 +478,7 @@ bool Bundle3D::loadBinary(const std::string& path)
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
return false;
}
}
// Read ref table size
if (_binaryReader.read(&_referenceCount, 4, 1) != 1)
@ -766,17 +768,37 @@ bool Bundle3D::loadAnimationDataBinary(Animation3DData* animationdata)
GLenum Bundle3D::parseGLType(const std::string& str)
{
if (str == "GL_FLOAT")
if (str == "GL_BYTE")
{
return GL_FLOAT;
return GL_BYTE;
}
else if(str == "GL_UNSIGNED_BYTE")
{
return GL_UNSIGNED_BYTE;
}
else if(str == "GL_SHORT")
{
return GL_SHORT;
}
else if(str == "GL_UNSIGNED_SHORT")
{
return GL_UNSIGNED_SHORT;
}
else if(str == "GL_INT")
{
return GL_INT;
}
else if (str == "GL_UNSIGNED_INT")
{
return GL_UNSIGNED_INT;
}
else if (str == "GL_FLOAT")
{
return GL_FLOAT;
}
else
{
assert(0);
CCASSERT(false, "Wrong GL type");
return 0;
}
}

View File

@ -65,7 +65,7 @@ char* BundleReader::readLine(int num,char* line)
char* p = line;
char c;
ssize_t readNum = 0;
while((c=*buffer) != 10 && readNum < (ssize_t)num && m_position<(long int)m_length)
while((c=*buffer) != 10 && readNum < (ssize_t)num && m_position < m_length)
{
*p = c;
p++;
@ -91,7 +91,7 @@ ssize_t BundleReader::length()
return m_length;
}
long int BundleReader::tell()
ssize_t BundleReader::tell()
{
if (!m_buffer)
return -1;

View File

@ -112,7 +112,7 @@ public:
bool readMatrix(float* m);
private:
long int m_position;
ssize_t m_position;
ssize_t m_length;
char* m_buffer;
};
@ -136,6 +136,7 @@ inline bool BundleReader::readArray(unsigned int *length, std::vector<T> *values
{
return false;
}
if (*length > 0 && values)
{
values->resize(*length);

View File

@ -192,7 +192,7 @@ bool Mesh::init(const std::vector<float>& positions, const std::vector<float>& n
if (!bRet)
return false;
restore();
buildBuffer();
return true;
}
@ -202,7 +202,7 @@ bool Mesh::init(const std::vector<float>& vertices, int vertexSizeInFloat, const
if (!bRet)
return false;
restore();
buildBuffer();
return true;
}
@ -242,20 +242,20 @@ void Mesh::buildBuffer()
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
unsigned int indexSize = 2;
IndexFormat indexformat = IndexFormat::INDEX16;
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexSize * _renderdata._indices.size(), &_renderdata._indices[0], GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
_primitiveType = PrimitiveType::TRIANGLES;
_indexFormat = indexformat;
_indexFormat = IndexFormat::INDEX16;
_indexCount = _renderdata._indices.size();
}
void Mesh::restore()
{
cleanAndFreeBuffers();
_vertexBuffer = 0;
_indexBuffer = 0;
buildBuffer();
}

View File

@ -114,8 +114,6 @@ public:
GCController* _gcController;
};
std::vector<Controller*> Controller::s_allController;
void Controller::startDiscoveryController()
{
[GCController startWirelessControllerDiscoveryWithCompletionHandler: nil];

View File

@ -177,7 +177,6 @@ Director::~Director(void)
CC_SAFE_RELEASE(_scheduler);
CC_SAFE_RELEASE(_actionManager);
delete _eventAfterUpdate;
delete _eventAfterDraw;
delete _eventAfterVisit;
@ -191,12 +190,11 @@ Director::~Director(void)
CC_SAFE_RELEASE(_eventDispatcher);
// clean auto release pool
PoolManager::destroyInstance();
// delete _lastUpdate
CC_SAFE_DELETE(_lastUpdate);
Configuration::destroyInstance();
s_SharedDirector = nullptr;
}
@ -976,7 +974,6 @@ void Director::purgeDirector()
GLProgramCache::destroyInstance();
GLProgramStateCache::destroyInstance();
FileUtils::destroyInstance();
Configuration::destroyInstance();
// cocos2d-x specific data structures
UserDefault::destroyInstance();

View File

@ -30,7 +30,7 @@ NS_CC_BEGIN
EventMouse::EventMouse(MouseEventType mouseEventCode)
: Event(Type::MOUSE)
, _mouseEventType(mouseEventCode)
, _mouseButton(0)
, _mouseButton(-1)
, _x(0.0f)
, _y(0.0f)
, _scrollX(0.0f)

View File

@ -261,6 +261,10 @@ THE SOFTWARE.
//3d
#include "3d/CCSprite3D.h"
#include "3d/CCMesh.h"
#include "3d/CCMeshSkin.h"
#include "3d/CCAnimate3D.h"
#include "3d/CCAnimation3D.h"
#include "3d/CCSprite3DMaterial.h"
// Audio
#include "audio/include/SimpleAudioEngine.h"

View File

@ -278,8 +278,8 @@ void ActionTimeline::emitFrameEvent(Frame* frame)
void ActionTimeline::gotoFrame(int frameIndex)
{
int size = _timelineList.size();
for(int i = 0; i<size; i++)
ssize_t size = _timelineList.size();
for(ssize_t i = 0; i < size; i++)
{
_timelineList.at(i)->gotoFrame(frameIndex);
}
@ -287,8 +287,8 @@ void ActionTimeline::gotoFrame(int frameIndex)
void ActionTimeline::stepToFrame(int frameIndex)
{
int size = _timelineList.size();
for(int i = 0; i<size; i++)
ssize_t size = _timelineList.size();
for(ssize_t i = 0; i < size; i++)
{
_timelineList.at(i)->stepToFrame(frameIndex);
}

View File

@ -176,7 +176,7 @@ bool CocoLoader::ReadCocoBinBuff(char* pBinBuff)
char* pDestBuff = new char[m_pFileHeader->m_nDataSize];
uLongf dwSrcSize = m_pFileHeader->m_nCompressSize;
uLongf dwDestSize = m_pFileHeader->m_nDataSize;
int nRes = uncompress((Bytef*)pDestBuff,&dwDestSize,(Bytef*)m_pMemoryBuff,dwSrcSize);
uncompress((Bytef*)pDestBuff,&dwDestSize,(Bytef*)m_pMemoryBuff,dwSrcSize);
pStartAddr = m_pMemoryBuff = pDestBuff;
}

View File

@ -18,8 +18,6 @@ namespace cocostudio
static const char* P_BallDisabledData = "ballDisabledData";
static const char* P_ProgressBarData = "progressBarData";
static const char* P_BarFileName = "barFileName";
static SliderReader* instanceSliderReader = NULL;
IMPLEMENT_CLASS_WIDGET_READER_INFO(SliderReader)

View File

@ -15,9 +15,6 @@ namespace cocostudio
static const char* P_ItemHeight = "itemHeight";
static const char* P_StartCharMap = "startCharMap";
static const char* P_CharMapFile = "charMapFile";
static TextAtlasReader* instanceTextAtalsReader = NULL;
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextAtlasReader)

View File

@ -27,6 +27,8 @@ THE SOFTWARE.
#define __CC_APPLICATION_PROTOCOL_H__
#include "base/CCPlatformMacros.h"
#include "base/CCScriptSupport.h"
#include "base/CCAutoreleasePool.h"
NS_CC_BEGIN
@ -61,7 +63,11 @@ public:
* @js NA
* @lua NA
*/
virtual ~ApplicationProtocol() {}
virtual ~ApplicationProtocol(){
ScriptEngineManager::destroyInstance();
// clean auto release pool
PoolManager::destroyInstance();
}
/**
@brief Implement Director and Scene init code here.

View File

@ -565,19 +565,21 @@ void GLView::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int
}
}
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here
float cursorX = (_mouseX - _viewPortRect.origin.x) / _scaleX;
float cursorY = (_viewPortRect.origin.y + _viewPortRect.size.height - _mouseY) / _scaleY;
if(GLFW_PRESS == action)
{
EventMouse event(EventMouse::MouseEventType::MOUSE_DOWN);
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here
event.setCursorPosition(_mouseX, this->getViewPortRect().size.height - _mouseY);
event.setCursorPosition(cursorX, cursorY);
event.setMouseButton(button);
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
}
else if(GLFW_RELEASE == action)
{
EventMouse event(EventMouse::MouseEventType::MOUSE_UP);
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here
event.setCursorPosition(_mouseX, this->getViewPortRect().size.height - _mouseY);
event.setCursorPosition(cursorX, cursorY);
event.setMouseButton(button);
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
}
@ -606,9 +608,25 @@ void GLView::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y)
this->handleTouchesMove(1, &id, &_mouseX, &_mouseY);
}
EventMouse event(EventMouse::MouseEventType::MOUSE_MOVE);
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here
event.setCursorPosition(_mouseX, this->getViewPortRect().size.height - _mouseY);
float cursorX = (_mouseX - _viewPortRect.origin.x) / _scaleX;
float cursorY = (_viewPortRect.origin.y + _viewPortRect.size.height - _mouseY) / _scaleY;
EventMouse event(EventMouse::MouseEventType::MOUSE_MOVE);
// Set current button
if (glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS)
{
event.setMouseButton(GLFW_MOUSE_BUTTON_LEFT);
}
else if (glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS)
{
event.setMouseButton(GLFW_MOUSE_BUTTON_RIGHT);
}
else if (glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_MIDDLE) == GLFW_PRESS)
{
event.setMouseButton(GLFW_MOUSE_BUTTON_MIDDLE);
}
event.setCursorPosition(cursorX, cursorY);
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
}

View File

@ -172,7 +172,7 @@ void MeshCommand::genMaterialID(GLuint texID, void* glProgramState, void* mesh,
void MeshCommand::MatrixPalleteCallBack( GLProgram* glProgram, Uniform* uniform)
{
glProgram->setUniformLocationWith4fv(uniform->location, (const float*)_matrixPalette, _matrixPaletteSize);
glUniform4fv( uniform->location, (GLsizei)_matrixPaletteSize, (const float*)_matrixPalette );
}
void MeshCommand::preBatchDraw()
@ -183,12 +183,11 @@ void MeshCommand::preBatchDraw()
GL::bindTexture2D(_textureID);
GL::blendFunc(_blendType.src, _blendType.dst);
if (_vao == 0)
if (Configuration::getInstance()->supportsShareableVAO() && _vao == 0)
buildVAO();
if (_vao)
{
GL::bindVAO(_vao);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
}
else
{
@ -265,8 +264,6 @@ void MeshCommand::execute()
void MeshCommand::buildVAO()
{
releaseVAO();
if (Configuration::getInstance()->supportsShareableVAO())
{
glGenVertexArrays(1, &_vao);
GL::bindVAO(_vao);
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
@ -285,10 +282,9 @@ void MeshCommand::buildVAO()
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
}
void MeshCommand::releaseVAO()
{
if (Configuration::getInstance()->supportsShareableVAO() && _vao)
if (_vao)
{
glDeleteVertexArrays(1, &_vao);
_vao = 0;
@ -299,7 +295,7 @@ void MeshCommand::releaseVAO()
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
void MeshCommand::listenBackToForeground(EventCustom* event)
{
releaseVAO();
_vao = 0;
}
#endif

View File

@ -15,7 +15,7 @@ void main(void)
);
const char* cc3D_SkinPositionTex_vert = STRINGIFY(
attribute vec4 a_position;
attribute vec3 a_position;
attribute vec4 a_blendWeight;
attribute vec4 a_blendIndex;
@ -70,10 +70,11 @@ vec4 getPosition()
vec4 _skinnedPosition;
_skinnedPosition.x = dot(a_position, matrixPalette1);
_skinnedPosition.y = dot(a_position, matrixPalette2);
_skinnedPosition.z = dot(a_position, matrixPalette3);
_skinnedPosition.w = a_position.w;
vec4 postion = vec4(a_position, 1.0);
_skinnedPosition.x = dot(postion, matrixPalette1);
_skinnedPosition.y = dot(postion, matrixPalette2);
_skinnedPosition.z = dot(postion, matrixPalette3);
_skinnedPosition.w = postion.w;
return _skinnedPosition;
}

View File

@ -672,12 +672,6 @@
-- @param self
-- @param #cc.Ref ref
--------------------------------
-- @function [parent=#Node] enumerateChildren
-- @param self
-- @param #string str
-- @param #function func
--------------------------------
-- @function [parent=#Node] getonExitTransitionDidStartCallback
-- @param self

View File

@ -1211,16 +1211,6 @@
-- @field [parent=#cc] Mesh#Mesh Mesh preloaded module
--------------------------------------------------------
-- the cc SimpleAudioEngine
-- @field [parent=#cc] SimpleAudioEngine#SimpleAudioEngine SimpleAudioEngine preloaded module
--------------------------------------------------------
-- the cc ProtectedNode
-- @field [parent=#cc] ProtectedNode#ProtectedNode ProtectedNode preloaded module
--------------------------------------------------------
-- the cc Animation3D
-- @field [parent=#cc] Animation3D#Animation3D Animation3D preloaded module
@ -1231,4 +1221,14 @@
-- @field [parent=#cc] Animate3D#Animate3D Animate3D preloaded module
--------------------------------------------------------
-- the cc SimpleAudioEngine
-- @field [parent=#cc] SimpleAudioEngine#SimpleAudioEngine SimpleAudioEngine preloaded module
--------------------------------------------------------
-- the cc ProtectedNode
-- @field [parent=#cc] ProtectedNode#ProtectedNode ProtectedNode preloaded module
return nil

View File

@ -9245,59 +9245,6 @@ int lua_cocos2dx_Node_setUserObject(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Node_enumerateChildren(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Node* 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.Node",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_enumerateChildren'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 2)
{
std::string arg0;
std::function<bool (cocos2d::Node *)> arg1;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
do {
// Lambda binding for lua is not supported.
assert(false);
} while(0)
;
if(!ok)
return 0;
cobj->enumerateChildren(arg0, arg1);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "enumerateChildren",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_enumerateChildren'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Node_getonExitTransitionDidStartCallback(lua_State* tolua_S)
{
int argc = 0;
@ -10093,7 +10040,6 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S)
tolua_function(tolua_S,"getGlobalZOrder",lua_cocos2dx_Node_getGlobalZOrder);
tolua_function(tolua_S,"draw",lua_cocos2dx_Node_draw);
tolua_function(tolua_S,"setUserObject",lua_cocos2dx_Node_setUserObject);
tolua_function(tolua_S,"enumerateChildren",lua_cocos2dx_Node_enumerateChildren);
tolua_function(tolua_S,"getonExitTransitionDidStartCallback",lua_cocos2dx_Node_getonExitTransitionDidStartCallback);
tolua_function(tolua_S,"removeFromParent",lua_cocos2dx_Node_removeFromParentAndCleanup);
tolua_function(tolua_S,"setPosition3D",lua_cocos2dx_Node_setPosition3D);
@ -63135,6 +63081,466 @@ int lua_register_cocos2dx_Mesh(lua_State* tolua_S)
return 1;
}
int lua_cocos2dx_Animation3D_getDuration(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animation3D* 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.Animation3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animation3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animation3D_getDuration'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
double ret = cobj->getDuration();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getDuration",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animation3D_getDuration'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animation3D_getOrCreate(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.Animation3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
if(!ok)
return 0;
cocos2d::Animation3D* ret = cocos2d::Animation3D::getOrCreate(arg0);
object_to_luaval<cocos2d::Animation3D>(tolua_S, "cc.Animation3D",(cocos2d::Animation3D*)ret);
return 1;
}
if (argc == 2)
{
std::string arg0;
std::string arg1;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
ok &= luaval_to_std_string(tolua_S, 3,&arg1);
if(!ok)
return 0;
cocos2d::Animation3D* ret = cocos2d::Animation3D::getOrCreate(arg0, arg1);
object_to_luaval<cocos2d::Animation3D>(tolua_S, "cc.Animation3D",(cocos2d::Animation3D*)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "getOrCreate",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animation3D_getOrCreate'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_Animation3D_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Animation3D)");
return 0;
}
int lua_register_cocos2dx_Animation3D(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.Animation3D");
tolua_cclass(tolua_S,"Animation3D","cc.Animation3D","cc.Ref",nullptr);
tolua_beginmodule(tolua_S,"Animation3D");
tolua_function(tolua_S,"getDuration",lua_cocos2dx_Animation3D_getDuration);
tolua_function(tolua_S,"getOrCreate", lua_cocos2dx_Animation3D_getOrCreate);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Animation3D).name();
g_luaType[typeName] = "cc.Animation3D";
g_typeCast["Animation3D"] = "cc.Animation3D";
return 1;
}
int lua_cocos2dx_Animate3D_getSpeed(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getSpeed'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
double ret = cobj->getSpeed();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getSpeed",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getSpeed'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_setWeight(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setWeight'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0);
if(!ok)
return 0;
cobj->setWeight(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setWeight",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setWeight'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_getPlayBack(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getPlayBack'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
bool ret = cobj->getPlayBack();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getPlayBack",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getPlayBack'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_setPlayBack(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setPlayBack'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0);
if(!ok)
return 0;
cobj->setPlayBack(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setPlayBack",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setPlayBack'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_setSpeed(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setSpeed'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0);
if(!ok)
return 0;
cobj->setSpeed(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setSpeed",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setSpeed'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_getWeight(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getWeight'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
double ret = cobj->getWeight();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getWeight",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getWeight'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_create(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S)-1;
do
{
if (argc == 3)
{
cocos2d::Animation3D* arg0;
ok &= luaval_to_object<cocos2d::Animation3D>(tolua_S, 2, "cc.Animation3D",&arg0);
if (!ok) { break; }
double arg1;
ok &= luaval_to_number(tolua_S, 3,&arg1);
if (!ok) { break; }
double arg2;
ok &= luaval_to_number(tolua_S, 4,&arg2);
if (!ok) { break; }
cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0, arg1, arg2);
object_to_luaval<cocos2d::Animate3D>(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 1)
{
cocos2d::Animation3D* arg0;
ok &= luaval_to_object<cocos2d::Animation3D>(tolua_S, 2, "cc.Animation3D",&arg0);
if (!ok) { break; }
cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0);
object_to_luaval<cocos2d::Animate3D>(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret);
return 1;
}
} while (0);
ok = true;
CCLOG("%s has wrong number of arguments: %d, was expecting %d", "create",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_create'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_Animate3D_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Animate3D)");
return 0;
}
int lua_register_cocos2dx_Animate3D(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.Animate3D");
tolua_cclass(tolua_S,"Animate3D","cc.Animate3D","cc.ActionInterval",nullptr);
tolua_beginmodule(tolua_S,"Animate3D");
tolua_function(tolua_S,"getSpeed",lua_cocos2dx_Animate3D_getSpeed);
tolua_function(tolua_S,"setWeight",lua_cocos2dx_Animate3D_setWeight);
tolua_function(tolua_S,"getPlayBack",lua_cocos2dx_Animate3D_getPlayBack);
tolua_function(tolua_S,"setPlayBack",lua_cocos2dx_Animate3D_setPlayBack);
tolua_function(tolua_S,"setSpeed",lua_cocos2dx_Animate3D_setSpeed);
tolua_function(tolua_S,"getWeight",lua_cocos2dx_Animate3D_getWeight);
tolua_function(tolua_S,"create", lua_cocos2dx_Animate3D_create);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Animate3D).name();
g_luaType[typeName] = "cc.Animate3D";
g_typeCast["Animate3D"] = "cc.Animate3D";
return 1;
}
int lua_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic(lua_State* tolua_S)
{
int argc = 0;
@ -64797,466 +65203,6 @@ int lua_register_cocos2dx_ProtectedNode(lua_State* tolua_S)
g_typeCast["ProtectedNode"] = "cc.ProtectedNode";
return 1;
}
int lua_cocos2dx_Animation3D_getDuration(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animation3D* 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.Animation3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animation3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animation3D_getDuration'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
double ret = cobj->getDuration();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getDuration",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animation3D_getDuration'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animation3D_getOrCreate(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.Animation3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
if(!ok)
return 0;
cocos2d::Animation3D* ret = cocos2d::Animation3D::getOrCreate(arg0);
object_to_luaval<cocos2d::Animation3D>(tolua_S, "cc.Animation3D",(cocos2d::Animation3D*)ret);
return 1;
}
if (argc == 2)
{
std::string arg0;
std::string arg1;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
ok &= luaval_to_std_string(tolua_S, 3,&arg1);
if(!ok)
return 0;
cocos2d::Animation3D* ret = cocos2d::Animation3D::getOrCreate(arg0, arg1);
object_to_luaval<cocos2d::Animation3D>(tolua_S, "cc.Animation3D",(cocos2d::Animation3D*)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "getOrCreate",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animation3D_getOrCreate'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_Animation3D_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Animation3D)");
return 0;
}
int lua_register_cocos2dx_Animation3D(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.Animation3D");
tolua_cclass(tolua_S,"Animation3D","cc.Animation3D","cc.Ref",nullptr);
tolua_beginmodule(tolua_S,"Animation3D");
tolua_function(tolua_S,"getDuration",lua_cocos2dx_Animation3D_getDuration);
tolua_function(tolua_S,"getOrCreate", lua_cocos2dx_Animation3D_getOrCreate);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Animation3D).name();
g_luaType[typeName] = "cc.Animation3D";
g_typeCast["Animation3D"] = "cc.Animation3D";
return 1;
}
int lua_cocos2dx_Animate3D_getSpeed(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getSpeed'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
double ret = cobj->getSpeed();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getSpeed",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getSpeed'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_setWeight(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setWeight'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0);
if(!ok)
return 0;
cobj->setWeight(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setWeight",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setWeight'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_getPlayBack(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getPlayBack'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
bool ret = cobj->getPlayBack();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getPlayBack",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getPlayBack'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_setPlayBack(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setPlayBack'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0);
if(!ok)
return 0;
cobj->setPlayBack(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setPlayBack",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setPlayBack'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_setSpeed(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setSpeed'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0);
if(!ok)
return 0;
cobj->setSpeed(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setSpeed",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setSpeed'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_getWeight(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getWeight'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
double ret = cobj->getWeight();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getWeight",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getWeight'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_create(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S)-1;
do
{
if (argc == 3)
{
cocos2d::Animation3D* arg0;
ok &= luaval_to_object<cocos2d::Animation3D>(tolua_S, 2, "cc.Animation3D",&arg0);
if (!ok) { break; }
double arg1;
ok &= luaval_to_number(tolua_S, 3,&arg1);
if (!ok) { break; }
double arg2;
ok &= luaval_to_number(tolua_S, 4,&arg2);
if (!ok) { break; }
cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0, arg1, arg2);
object_to_luaval<cocos2d::Animate3D>(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 1)
{
cocos2d::Animation3D* arg0;
ok &= luaval_to_object<cocos2d::Animation3D>(tolua_S, 2, "cc.Animation3D",&arg0);
if (!ok) { break; }
cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0);
object_to_luaval<cocos2d::Animate3D>(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret);
return 1;
}
} while (0);
ok = true;
CCLOG("%s has wrong number of arguments: %d, was expecting %d", "create",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_create'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_Animate3D_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Animate3D)");
return 0;
}
int lua_register_cocos2dx_Animate3D(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.Animate3D");
tolua_cclass(tolua_S,"Animate3D","cc.Animate3D","cc.ActionInterval",nullptr);
tolua_beginmodule(tolua_S,"Animate3D");
tolua_function(tolua_S,"getSpeed",lua_cocos2dx_Animate3D_getSpeed);
tolua_function(tolua_S,"setWeight",lua_cocos2dx_Animate3D_setWeight);
tolua_function(tolua_S,"getPlayBack",lua_cocos2dx_Animate3D_getPlayBack);
tolua_function(tolua_S,"setPlayBack",lua_cocos2dx_Animate3D_setPlayBack);
tolua_function(tolua_S,"setSpeed",lua_cocos2dx_Animate3D_setSpeed);
tolua_function(tolua_S,"getWeight",lua_cocos2dx_Animate3D_getWeight);
tolua_function(tolua_S,"create", lua_cocos2dx_Animate3D_create);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Animate3D).name();
g_luaType[typeName] = "cc.Animate3D";
g_typeCast["Animate3D"] = "cc.Animate3D";
return 1;
}
TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
{
tolua_open(tolua_S);

View File

@ -1574,7 +1574,6 @@ int register_all_cocos2dx(lua_State* tolua_S);
#endif // __cocos2dx_h__

View File

@ -2604,7 +2604,7 @@ static int tolua_Cocos2d_glLineWidth00(lua_State* tolua_S)
#endif
{
float arg0 = (float)tolua_tonumber(tolua_S, 1, 0);
glLineWidth((GLfloat)arg0 );
glLineWidth(arg0);
}
return 0;
#ifndef TOLUA_RELEASE
@ -2684,9 +2684,9 @@ static int tolua_Cocos2d_glPolygonOffset00(lua_State* tolua_S)
else
#endif
{
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
glPolygonOffset((GLfloat)arg0 , (GLfloat)arg1 );
float arg0 = (float)tolua_tonumber(tolua_S, 1, 0);
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
glPolygonOffset(arg0, arg1);
}
return 0;
#ifndef TOLUA_RELEASE
@ -3165,7 +3165,7 @@ static int tolua_Cocos2d_glTexParameterf00(lua_State* tolua_S)
{
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
unsigned int arg1 = (unsigned int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
glTexParameterf((GLenum)arg0 , (GLenum)arg1 , (GLfloat)arg2 );
}
return 0;
@ -3287,8 +3287,8 @@ static int tolua_Cocos2d_glUniform1f00(lua_State* tolua_S)
#endif
{
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
glUniform1f((GLint)arg0 , (GLfloat)arg1 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
glUniform1f(arg0,arg1);
}
return 0;
#ifndef TOLUA_RELEASE
@ -3426,9 +3426,9 @@ static int tolua_Cocos2d_glUniform2f00(lua_State* tolua_S)
#endif
{
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
glUniform2f((GLint)arg0 , (GLfloat)arg1 , (GLfloat)arg2);
float arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
float arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
glUniform2f(arg0, arg1, arg2);
}
return 0;
#ifndef TOLUA_RELEASE
@ -3569,10 +3569,10 @@ static int tolua_Cocos2d_glUniform3f00(lua_State* tolua_S)
#endif
{
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
int arg3 = (int)tolua_tonumber(tolua_S, 4, 0);
glUniform3f((GLint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 , (GLfloat)arg3 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
float arg3 = (float)tolua_tonumber(tolua_S, 4, 0);
glUniform3f(arg0, arg1, arg2, arg3);
}
return 0;
#ifndef TOLUA_RELEASE
@ -3716,11 +3716,11 @@ static int tolua_Cocos2d_glUniform4f00(lua_State* tolua_S)
#endif
{
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
int arg3 = (int)tolua_tonumber(tolua_S, 4, 0);
int arg4 = (int)tolua_tonumber(tolua_S, 5, 0);
glUniform4f((GLint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 , (GLfloat)arg3 , (GLfloat)arg4 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
float arg3 = (float)tolua_tonumber(tolua_S, 4, 0);
float arg4 = (float)tolua_tonumber(tolua_S, 5, 0);
glUniform4f(arg0 , arg1, arg2, arg3, arg4);
}
return 0;
#ifndef TOLUA_RELEASE
@ -4042,8 +4042,8 @@ static int tolua_Cocos2d_glVertexAttrib1f00(lua_State* tolua_S)
#endif
{
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
glVertexAttrib1f((GLuint)arg0 , (GLfloat)arg1 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
glVertexAttrib1f(arg0 , arg1);
}
return 0;
#ifndef TOLUA_RELEASE
@ -4113,9 +4113,9 @@ static int tolua_Cocos2d_glVertexAttrib2f00(lua_State* tolua_S)
#endif
{
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
glVertexAttrib2f((GLuint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
glVertexAttrib2f(arg0, arg1, arg2);
}
return 0;
#ifndef TOLUA_RELEASE
@ -4186,10 +4186,10 @@ static int tolua_Cocos2d_glVertexAttrib3f00(lua_State* tolua_S)
#endif
{
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
int arg3 = (int)tolua_tonumber(tolua_S, 4, 0);
glVertexAttrib3f((GLuint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 , (GLfloat)arg3 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
float arg3 = (float)tolua_tonumber(tolua_S, 4, 0);
glVertexAttrib3f(arg0 , arg1, arg2, arg3);
}
return 0;
#ifndef TOLUA_RELEASE
@ -4261,11 +4261,11 @@ static int tolua_Cocos2d_glVertexAttrib4f00(lua_State* tolua_S)
#endif
{
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
int arg3 = (int)tolua_tonumber(tolua_S, 4, 0);
int arg4 = (int)tolua_tonumber(tolua_S, 5, 0);
glVertexAttrib4f((GLuint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 , (GLfloat)arg3 , (GLfloat)arg4 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
float arg3 = (float)tolua_tonumber(tolua_S, 4, 0);
float arg4 = (float)tolua_tonumber(tolua_S, 5, 0);
glVertexAttrib4f(arg0, arg1, arg2, arg3, arg4);
}
return 0;
#ifndef TOLUA_RELEASE
@ -5031,10 +5031,10 @@ static int tolua_cocos2d_DrawPrimitives_drawColor4F00(lua_State* tolua_S)
else
#endif
{
unsigned char r = (( unsigned char) tolua_tonumber(tolua_S,1,0));
unsigned char g = (( unsigned char) tolua_tonumber(tolua_S,2,0));
unsigned char b = (( unsigned char) tolua_tonumber(tolua_S,3,0));
unsigned char a = (( unsigned char) tolua_tonumber(tolua_S,4,0));
float r = (float)tolua_tonumber(tolua_S,1,0);
float g = (float)tolua_tonumber(tolua_S,2,0);
float b = (float)tolua_tonumber(tolua_S,3,0);
float a = (float)tolua_tonumber(tolua_S,4,0);
DrawPrimitives::setDrawColor4F(r,g,b,a);
}
return 0;

View File

@ -176,7 +176,7 @@ static int lua_cocos2dx_ArmatureAnimation_setFrameEventCallFunc(lua_State* L)
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)wrapper, handler, ScriptHandlerMgr::HandlerType::ARMATURE_EVENT);
self->setFrameEventCallFunc([=](Bone *bone, const std::string& frameEventName, int originFrameIndex, int currentFrameIndex){
self->setFrameEventCallFunc([=](cocostudio::Bone *bone, const std::string& frameEventName, int originFrameIndex, int currentFrameIndex){
if (0 != handler)
{

View File

@ -2215,6 +2215,66 @@ tolua_lerror:
#endif
}
static int lua_cocos2dx_Node_enumerateChildren(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Node* cobj = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_enumerateChildren'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 2)
{
#if COCOS2D_DEBUG >= 1
if (!tolua_isstring(tolua_S, 2, 0, &tolua_err) ||
!toluafix_isfunction(tolua_S,3,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
std::string name = (std::string)tolua_tocppstring(tolua_S,2,0);
LUA_FUNCTION handler = toluafix_ref_function(tolua_S,3,0);
cobj->enumerateChildren(name, [=](Node* node)->bool{
int id = node ? (int)node->_ID : -1;
int* luaID = node ? &node->_luaID : nullptr;
toluafix_pushusertype_ccobject(tolua_S, id, luaID, (void*)node,"cc.Node");
bool ret = LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 1);
LuaEngine::getInstance()->removeScriptHandler(handler);
return ret;
});
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "enumerateChildren",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_enumerateChildren'.",&tolua_err);
#endif
return 0;
}
static int tolua_cocos2d_Spawn_create(lua_State* tolua_S)
{
if (NULL == tolua_S)
@ -3920,6 +3980,9 @@ static void extendNode(lua_State* tolua_S)
lua_pushstring(tolua_S, "setAnchorPoint");
lua_pushcfunction(tolua_S, tolua_cocos2d_Node_setAnchorPoint);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "enumerateChildren");
lua_pushcfunction(tolua_S, lua_cocos2dx_Node_enumerateChildren);
lua_rawset(tolua_S, -3);
}
lua_pop(tolua_S, 1);
}

View File

@ -561,5 +561,13 @@ end
cc.KeyCode.KEY_BACK = cc.KeyCode.KEY_ESCAPE
cc.EventCode =
{
BEGAN = 0,
MOVED = 1,
ENDED = 2,
CANCELLED = 3,
}

View File

@ -263,9 +263,6 @@ void Button::loadTextureNormal(const std::string& normal,TextureResType texType)
updateFlippedX();
updateFlippedY();
_buttonNormalRenderer->setColor(this->getColor());
_buttonNormalRenderer->setOpacity(this->getOpacity());
updateContentSizeWithTextureSize(_normalTextureSize);
_normalTextureLoaded = true;
_normalTextureAdaptDirty = true;
@ -314,9 +311,6 @@ void Button::loadTexturePressed(const std::string& selected,TextureResType texTy
updateFlippedX();
updateFlippedY();
_buttonDisableRenderer->setColor(this->getColor());
_buttonDisableRenderer->setOpacity(this->getOpacity());
_pressedTextureLoaded = true;
_pressedTextureAdaptDirty = true;
}
@ -363,8 +357,6 @@ void Button::loadTextureDisabled(const std::string& disabled,TextureResType texT
_disabledTextureSize = _buttonDisableRenderer->getContentSize();
updateFlippedX();
updateFlippedY();
_buttonDisableRenderer->setColor(this->getColor());
_buttonDisableRenderer->setOpacity(this->getOpacity());
_disabledTextureLoaded = true;
_disabledTextureAdaptDirty = true;

View File

@ -184,8 +184,6 @@ void CheckBox::loadTextureBackGround(const std::string& backGround,TextureResTyp
}
updateFlippedX();
updateFlippedY();
_backGroundBoxRenderer->setColor(this->getColor());
_backGroundBoxRenderer->setOpacity(this->getOpacity());
updateContentSizeWithTextureSize(_backGroundBoxRenderer->getContentSize());
_backGroundBoxRendererAdaptDirty = true;
@ -212,8 +210,7 @@ void CheckBox::loadTextureBackGroundSelected(const std::string& backGroundSelect
}
updateFlippedX();
updateFlippedY();
_backGroundSelectedBoxRenderer->setColor(this->getColor());
_backGroundSelectedBoxRenderer->setOpacity(this->getOpacity());
_backGroundSelectedBoxRendererAdaptDirty = true;
}
@ -238,8 +235,7 @@ void CheckBox::loadTextureFrontCross(const std::string& cross,TextureResType tex
}
updateFlippedX();
updateFlippedY();
_frontCrossRenderer->setColor(this->getColor());
_frontCrossRenderer->setOpacity(this->getOpacity());
_frontCrossRendererAdaptDirty = true;
}
@ -264,8 +260,6 @@ void CheckBox::loadTextureBackGroundDisabled(const std::string& backGroundDisabl
}
updateFlippedX();
updateFlippedY();
_backGroundBoxDisabledRenderer->setColor(this->getColor());
_backGroundBoxDisabledRenderer->setOpacity(this->getOpacity());
_backGroundBoxDisabledRendererAdaptDirty = true;
}
@ -291,8 +285,6 @@ void CheckBox::loadTextureFrontCrossDisabled(const std::string& frontCrossDisabl
}
updateFlippedX();
updateFlippedY();
_frontCrossDisabledRenderer->setColor(this->getColor());
_frontCrossDisabledRenderer->setOpacity(this->getOpacity());
_frontCrossDisabledRendererAdaptDirty = true;
}

View File

@ -154,8 +154,6 @@ void ImageView::loadTexture(const std::string& fileName, TextureResType texType)
_imageTextureSize = _imageRenderer->getContentSize();
updateFlippedX();
updateFlippedY();
_imageRenderer->setColor(this->getColor());
_imageRenderer->setOpacity(this->getOpacity());
updateContentSizeWithTextureSize(_imageTextureSize);
_imageRendererAdaptDirty = true;

View File

@ -160,8 +160,6 @@ void LoadingBar::loadTexture(const std::string& texture,TextureResType texType)
default:
break;
}
_barRenderer->setColor(this->getColor());
_barRenderer->setOpacity(this->getOpacity());
_barRendererTextureSize = _barRenderer->getContentSize();

View File

@ -148,8 +148,6 @@ void Slider::loadBarTexture(const std::string& fileName, TextureResType texType)
default:
break;
}
_barRenderer->setColor(this->getColor());
_barRenderer->setOpacity(this->getOpacity());
_barRendererAdaptDirty = true;
_progressBarRendererDirty = true;
@ -190,9 +188,6 @@ void Slider::loadProgressBarTexture(const std::string& fileName, TextureResType
break;
}
_progressBarRenderer->setColor(this->getColor());
_progressBarRenderer->setOpacity(this->getOpacity());
_progressBarRenderer->setAnchorPoint(Vec2(0.0f, 0.5f));
_progressBarTextureSize = _progressBarRenderer->getContentSize();
_progressBarRendererDirty = true;
@ -314,8 +309,6 @@ void Slider::loadSlidBallTextureNormal(const std::string& normal,TextureResType
default:
break;
}
_slidBallNormalRenderer->setColor(this->getColor());
_slidBallNormalRenderer->setOpacity(this->getOpacity());
}
void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResType texType)
@ -337,8 +330,6 @@ void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResTyp
default:
break;
}
_slidBallPressedRenderer->setColor(this->getColor());
_slidBallPressedRenderer->setOpacity(this->getOpacity());
}
void Slider::loadSlidBallTextureDisabled(const std::string& disabled,TextureResType texType)
@ -360,8 +351,6 @@ void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResTyp
default:
break;
}
_slidBallDisabledRenderer->setColor(this->getColor());
_slidBallDisabledRenderer->setOpacity(this->getOpacity());
}
void Slider::setPercent(int percent)

View File

@ -88,8 +88,6 @@ void TextBMFont::setFntFile(const std::string& fileName)
_fntFileName = fileName;
_labelBMFontRenderer->setBMFontFilePath(fileName);
_labelBMFontRenderer->setColor(this->getColor());
_labelBMFontRenderer->setOpacity(this->getOpacity());
_fntFileHasInit = true;
setString(_stringValue);
}

View File

@ -79,6 +79,7 @@ class SetEnvVar(object):
MAC_CHECK_FILES = [ '.bash_profile', '.bash_login', '.profile' ]
LINUX_CHECK_FILES = [ '.bashrc' ]
ZSH_CHECK_FILES = ['.zshrc' ]
RE_FORMAT = r'^export[ \t]+%s=(.+)'
def __init__(self):
@ -96,14 +97,24 @@ class SetEnvVar(object):
def _is_mac(self):
return sys.platform == 'darwin'
def _get_filepath_for_setup(self):
def _is_zsh(self):
return os.environ.get('SHELL')[-3:] == "zsh"
def _get_unix_file_list(self):
file_list = None
if self._isLinux():
if self._is_zsh():
file_list = SetEnvVar.ZSH_CHECK_FILES
elif self._isLinux():
file_list = SetEnvVar.LINUX_CHECK_FILES
elif self._is_mac():
file_list = SetEnvVar.MAC_CHECK_FILES
return file_list
def _get_filepath_for_setup(self):
file_list = self._get_unix_file_list();
file_to_write = None
if file_list is None:
return ''
@ -213,11 +224,7 @@ class SetEnvVar(object):
ret = os.environ[var]
except Exception:
if not self._isWindows():
file_list = None
if self._isLinux():
file_list = SetEnvVar.LINUX_CHECK_FILES
elif self._is_mac():
file_list = SetEnvVar.MAC_CHECK_FILES
file_list = self._get_unix_file_list()
if file_list is not None:
home = os.path.expanduser('~')

View File

@ -591,7 +591,7 @@ std::string TestFrameEvent::title() const
{
return "Test Frame Event";
}
void TestFrameEvent::onFrameEvent(Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex)
void TestFrameEvent::onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex)
{
CCLOG("(%s) emit a frame event (%s) at frame index (%d).", bone->getName().c_str(), evt.c_str(), currentFrameIndex);
@ -633,7 +633,7 @@ void TestParticleDisplay::onEnter()
ParticleSystem *p1 = CCParticleSystemQuad::create("Particles/SmallSun.plist");
ParticleSystem *p2 = CCParticleSystemQuad::create("Particles/SmallSun.plist");
Bone *bone = Bone::create("p1");
cocostudio::Bone *bone = cocostudio::Bone::create("p1");
bone->addDisplay(p1, 0);
bone->changeDisplayWithIndex(0, true);
bone->setIgnoreMovementBoneData(true);
@ -641,7 +641,7 @@ void TestParticleDisplay::onEnter()
bone->setScale(1.2f);
armature->addBone(bone, "bady-a3");
bone = Bone::create("p2");
bone = cocostudio::Bone::create("p2");
bone->addDisplay(p2, 0);
bone->changeDisplayWithIndex(0, true);
bone->setIgnoreMovementBoneData(true);
@ -773,7 +773,7 @@ std::string TestColliderDetector::title() const
{
return "Test Collider Detector";
}
void TestColliderDetector::onFrameEvent(Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex)
void TestColliderDetector::onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex)
{
CCLOG("(%s) emit a frame event (%s) at frame index (%d).", bone->getName().c_str(), evt.c_str(), currentFrameIndex);
@ -1025,10 +1025,10 @@ void TestColliderDetector::update(float delta)
// This code is just telling how to get the vertex.
// For a more accurate collider detection, you need to implemente yourself.
const Map<std::string, Bone*>& map = armature2->getBoneDic();
const Map<std::string, cocostudio::Bone*>& map = armature2->getBoneDic();
for(const auto& element : map)
{
Bone *bone = element.second;
cocostudio::Bone *bone = element.second;
ColliderDetector *detector = bone->getColliderDetector();
if (!detector)
@ -1243,7 +1243,7 @@ void Hero::changeMount(Armature *armature)
removeFromParentAndCleanup(false);
//Get the hero bone
Bone *bone = armature->getBone("hero");
cocostudio::Bone *bone = armature->getBone("hero");
//Add hero as a display to this bone
bone->addDisplay(this, 0);
//Change this bone's display

View File

@ -131,6 +131,7 @@ static std::function<Layer*()> createFunctions[] =
CL(AnimationCacheFile),
CL(SpriteCullTest1),
CL(SpriteCullTest2),
CL(Sprite3DRotationTest),
};
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
@ -4995,3 +4996,48 @@ std::string SpriteCullTest2::subtitle() const
{
return "Look at the GL calls";
}
//------------------------------------------------------------------
//
// Sprite 3D rotation test
//
//------------------------------------------------------------------
Sprite3DRotationTest::Sprite3DRotationTest()
{
Size s = Director::getInstance()->getWinSize();
//Create reference sprite that's rotating based on there anchor point
auto s1 = Sprite::create("Images/grossini.png");
s1->setPosition(s.width/4, s.height/4 * 3);
s1->setAnchorPoint(Vec2(0, 0));
s1->runAction(RepeatForever::create(RotateBy::create(6, 360)));
addChild(s1);
auto s2 = Sprite::create("Images/grossini.png");
s2->setPosition(s.width/4 * 3, s.height/4 * 3);
s2->runAction(RepeatForever::create(RotateBy::create(6, 360)));
addChild(s2);
sprite1 = Sprite::create("Images/grossini.png");
sprite1->setPosition(s.width/4, s.height/4);
sprite1->setAnchorPoint(Vec2(0,0));
addChild(sprite1);
sprite2 = Sprite::create("Images/grossini.png");
sprite2->setPosition(s.width/4 * 3, s.height/4);
addChild(sprite2);
scheduleUpdate();
}
void Sprite3DRotationTest::update(float delta)
{
rotation.y += 1;
sprite1->setRotation3D(rotation);
sprite2->setRotation3D(rotation);
}

View File

@ -749,6 +749,22 @@ public:
virtual std::string subtitle() const override;
};
class Sprite3DRotationTest : public SpriteTestDemo
{
public:
CREATE_FUNC(Sprite3DRotationTest);
Sprite3DRotationTest();
virtual std::string title() const override { return "3D Rotation Test"; };
virtual std::string subtitle() const override { return "Rotation should based on the anchor point"; };
virtual void update(float delta) override;
protected:
Sprite* sprite1;
Sprite* sprite2;
Vec3 rotation;
};
class SpriteTestScene : public TestScene
{
public:

View File

@ -43,6 +43,17 @@ bool UIButtonTest::init()
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest::touchEvent, this));
_uiLayer->addChild(button);
// Create the imageview
ImageView* imageView = ImageView::create();
imageView->setPosition(Vec2(widgetSize.width / 2.0f + 50+ button->getContentSize().width/2,
widgetSize.height / 2.0f));
imageView->setTag(12);
_uiLayer->addChild(imageView);
return true;
}
return false;
@ -61,7 +72,15 @@ void UIButtonTest::touchEvent(Ref *pSender, Widget::TouchEventType type)
break;
case Widget::TouchEventType::ENDED:
{
_displayValueLabel->setString(String::createWithFormat("Touch Up")->getCString());
ImageView* imageView = (ImageView*)_uiLayer->getChildByTag(12);
imageView->setVisible(false);
imageView->loadTexture("cocosui/ccicon.png");
imageView->setOpacity(0);
imageView->setVisible(true);
imageView->runAction(Sequence::create(FadeIn::create(0.5),DelayTime::create(1.0),FadeOut::create(0.5), NULL));
}
break;
case Widget::TouchEventType::CANCELED:
@ -111,10 +130,18 @@ bool UIButtonTest_Scale9::init()
button->setScale9Enabled(true);
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
button->setContentSize(Size(150, 70));
// button->addTouchEventListener(this, toucheventselector(UIButtonTest_Scale9::touchEvent));
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Scale9::touchEvent, this));
_uiLayer->addChild(button);
// Create the imageview
Button* button2 = Button::create();
button2->setPosition(Vec2(widgetSize.width / 2.0f + button->getContentSize().width + 20, widgetSize.height / 2.0f));
button2->setName("normal");
_uiLayer->addChild(button2);
Sprite *sprite = Sprite::create("cocosui/animationbuttonnormal.png");
button2->addChild(sprite);
return true;
}
return false;
@ -133,7 +160,13 @@ void UIButtonTest_Scale9::touchEvent(Ref *pSender, Widget::TouchEventType type)
break;
case Widget::TouchEventType::ENDED:
{
_displayValueLabel->setString(String::createWithFormat("Touch Up")->getCString());
Button *btn = (Button*)_uiLayer->getChildByName("normal");
btn->loadTextureNormal("cocosui/animationbuttonnormal.png");
btn->loadTexturePressed("cocosui/animationbuttonpressed.png");
btn->runAction(Sequence::create(FadeIn::create(0.5),DelayTime::create(1.0),FadeOut::create(0.5), NULL));
}
break;
case Widget::TouchEventType::CANCELED:
@ -180,8 +213,10 @@ bool UIButtonTest_PressedAction::init()
Button* button = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png");
button->setPressedActionEnabled(true);
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
// button->addTouchEventListener(this, toucheventselector(UIButtonTest_PressedAction::touchEvent));
button->setColor(Color3B::GREEN);
button->setOpacity(30);
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_PressedAction::touchEvent, this));
button->setName("button");
_uiLayer->addChild(button);
return true;
@ -202,7 +237,11 @@ void UIButtonTest_PressedAction::touchEvent(Ref *pSender, Widget::TouchEventType
break;
case Widget::TouchEventType::ENDED:
{
_displayValueLabel->setString(String::createWithFormat("Touch Up")->getCString());
Button* btn = (Button*)_uiLayer->getChildByName("button");
btn->loadTextureNormal("cocosui/animationbuttonnormal.png");
}
break;
case Widget::TouchEventType::CANCELED:
@ -255,6 +294,16 @@ bool UIButtonTest_Title::init()
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Title::touchEvent, this));
_uiLayer->addChild(button);
TextBMFont *text = TextBMFont::create("BMFont", "cocosui/bitmapFontTest2.fnt");
text->setPosition(button->getPosition() + Vec2(button->getContentSize().width/2 + 50,0));
text->setColor(Color3B::YELLOW);
text->setOpacity(50);
text->setName("text");
_uiLayer->addChild(text);
return true;
}
return false;
@ -274,7 +323,17 @@ void UIButtonTest_Title::touchEvent(Ref *pSender, Widget::TouchEventType type)
break;
case Widget::TouchEventType::ENDED:
{
_displayValueLabel->setString(String::createWithFormat("Touch Up")->getCString());
TextBMFont *text = (TextBMFont*)_uiLayer->getChildByName("text");
text->setFntFile("cocosui/bitmapFontTest2.fnt");
if (text->getString() == "BMFont") {
text->setString("Hello");
}
else{
text->setString("BMFont");
}
}
break;
case Widget::TouchEventType::CANCELED:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

View File

@ -1,162 +0,0 @@
{
"version": "1.2",
"file_type": "c3t",
"mesh_data": [
{
"version": "1.2",
"mesh_vertex_attribute": [
{
"size":3,
"type":"GL_FLOAT",
"vertex_attribute":"VERTEX_ATTRIB_POSITION"
},
{
"size":3,
"type":"GL_FLOAT",
"vertex_attribute":"VERTEX_ATTRIB_NORMAL"
},
{
"size":2,
"type":"GL_FLOAT",
"vertex_attribute":"VERTEX_ATTRIB_TEX_COORD"
},
{
"size":4,
"type":"GL_FLOAT",
"vertex_attribute":"VERTEX_ATTRIB_BLEND_WEIGHT"
},
{
"size":4,
"type":"GL_FLOAT",
"vertex_attribute":"VERTEX_ATTRIB_BLEND_INDEX"
}
],
"body":[
{
"vertices": [
0.000000, -2.259414, -2.259414, 0.000000, 0.000000, -1.000000, 0.582997, 0.456003, 0.500033, 0.499967, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
-5.314565, -2.259414, -2.259414, 0.000000, 0.000000, -1.000000, 0.582997, 0.168971, 0.933581, 0.066419, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000,
0.000000, 2.259414, -2.259414, 0.000000, 0.000000, -1.000000, 0.827052, 0.456003, 0.500111, 0.499889, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
-5.314565, 2.259414, -2.259414, 0.000000, 0.000000, -1.000000, 0.827052, 0.168971, 0.932199, 0.067801, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000,
0.000000, -2.259414, 2.259414, 0.000000, -1.000000, 0.000000, 0.253258, 0.705932, 0.500033, 0.499967, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
-5.314565, -2.259414, 2.259414, 0.000000, -1.000000, 0.000000, 0.253258, 0.418900, 0.933581, 0.066419, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000,
-5.314565, -2.259414, -2.259414, 0.000000, -1.000000, 0.000000, 0.497313, 0.418900, 0.933581, 0.066419, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000,
0.000000, -2.259414, -2.259414, 0.000000, -1.000000, 0.000000, 0.497313, 0.705932, 0.500033, 0.499967, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
-5.314565, 2.259414, 2.259414, -1.000000, 0.000000, 0.000000, 0.753117, 0.748774, 0.932199, 0.067801, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000,
-5.314565, -2.259414, -2.259414, -1.000000, 0.000000, 0.000000, 0.997172, 0.992829, 0.933581, 0.066419, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000,
-5.314565, -2.259414, 2.259414, -1.000000, 0.000000, 0.000000, 0.753117, 0.992829, 0.933581, 0.066419, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000,
-5.314565, 2.259414, -2.259414, -1.000000, 0.000000, 0.000000, 0.997172, 0.748774, 0.932199, 0.067801, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000,
5.314565, -2.259414, -2.259414, 0.000000, 0.000000, -1.000000, 0.582997, 0.743034, 0.932057, 0.067943, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
5.314565, 2.259414, -2.259414, 0.000000, 0.000000, -1.000000, 0.827052, 0.743034, 0.938571, 0.061429, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
5.314565, -2.259414, 2.259414, 0.000000, -1.000000, 0.000000, 0.253258, 0.992964, 0.932057, 0.067943, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
5.314565, -2.259414, -2.259414, 0.000000, -1.000000, 0.000000, 0.497313, 0.992964, 0.932057, 0.067943, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
5.314565, 2.259414, 2.259414, 1.000000, 0.000000, 0.000000, 0.503187, 0.992829, 0.938571, 0.061429, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
5.314565, -2.259414, 2.259414, 1.000000, 0.000000, 0.000000, 0.503187, 0.748774, 0.932057, 0.067943, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
5.314565, -2.259414, -2.259414, 1.000000, 0.000000, 0.000000, 0.747243, 0.748774, 0.932057, 0.067943, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
5.314565, 2.259414, -2.259414, 1.000000, 0.000000, 0.000000, 0.747243, 0.992829, 0.938571, 0.061429, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
0.000000, 2.259414, 2.259414, 0.000000, 1.000000, 0.000000, 0.003328, 0.705932, 0.500111, 0.499889, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
-5.314565, 2.259414, -2.259414, 0.000000, 1.000000, 0.000000, 0.247384, 0.992964, 0.932199, 0.067801, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000,
-5.314565, 2.259414, 2.259414, 0.000000, 1.000000, 0.000000, 0.003328, 0.992964, 0.932199, 0.067801, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000,
0.000000, 2.259414, -2.259414, 0.000000, 1.000000, 0.000000, 0.247384, 0.705932, 0.500111, 0.499889, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
5.314565, 2.259414, 2.259414, 0.000000, 1.000000, 0.000000, 0.003328, 0.418900, 0.938571, 0.061429, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
5.314565, 2.259414, -2.259414, 0.000000, 1.000000, 0.000000, 0.247384, 0.418900, 0.938571, 0.061429, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
0.000000, 2.259414, 2.259414, 0.000000, 0.000000, 1.000000, 0.290226, 0.413161, 0.500111, 0.499889, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
-5.314565, 2.259414, 2.259414, 0.000000, 0.000000, 1.000000, 0.003194, 0.413161, 0.932199, 0.067801, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000,
-5.314565, -2.259414, 2.259414, 0.000000, 0.000000, 1.000000, 0.003194, 0.169105, 0.933581, 0.066419, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000,
0.000000, -2.259414, 2.259414, 0.000000, 0.000000, 1.000000, 0.290226, 0.169105, 0.500033, 0.499967, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
5.314565, 2.259414, 2.259414, 0.000000, 0.000000, 1.000000, 0.577257, 0.413161, 0.938571, 0.061429, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000,
5.314565, -2.259414, 2.259414, 0.000000, 0.000000, 1.000000, 0.577257, 0.169105, 0.932057, 0.067943, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000
],
"vertex_size": 512,
"indices": [
0, 1, 2, 1, 3, 2, 4, 5, 6, 4, 6, 7,
8, 9, 10, 9, 8, 11, 12, 0, 13, 0, 2, 13,
14, 4, 7, 14, 7, 15, 16, 17, 18, 16, 18, 19,
20, 21, 22, 21, 20, 23, 24, 23, 20, 23, 24, 25,
26, 27, 28, 26, 28, 29, 30, 26, 29, 30, 29, 31
],
"index_number": 60
}
]
}
],
"material_data": [
{
"file_name": "Sprite3DTest/checkboard.png"
}
],
"skin_data": [
{
"id": "cubeanim:cube",
"bind_shape": [ 0.393701, 0.000000, 0.000000, 0.000000, 0.000000, 0.393701, 0.000000, 0.000000, 0.000000, -0.000000, 0.393701, 0.000000, 0.100748, 0.000000, -0.457948, 1.000000],
"bones": [
{
"node": "bone1",
"bind_pos": [ 0.999989, 0.004613, 0.000000, 0.000000, -0.004613, 0.999989, 0.000000, 0.000000, -0.000000, -0.000000, 1.000000, 0.000000, -0.036861, 0.049203, 0.000000, 1.000000]
},
{
"node": "bone",
"bind_pos": [ 0.999958, 0.009184, 0.000000, 0.000000, -0.009184, 0.999958, 0.000000, 0.000000, -0.000000, -0.000000, 1.000000, 0.000000, -5.393930, -0.000000, -0.000000, 1.000000]
}
]
},
{
"id": "root",
"children": [
{
"id": "bone",
"children": [
{
"id": "bone1",
"children": [
{
"id": "eff"
}
]
}
]
}
]
}
],
"animation_data": [
{
"id": "Take 001",
"bones": [
{
"id": "bone1",
"keyframes": [
{
"rotation":[
{
"keytime": 0.000000,
"value": [ 0.000000, -0.000000, -0.002285, 0.999997]
},
{
"keytime": 0.333332,
"value": [ 0.000000, -0.000000, -0.002285, 0.999997]
},
{
"keytime": 0.666664,
"value": [ 0.000000, -0.000000, 0.089457, 0.995991]
},
{
"keytime": 0.800000,
"value": [ 0.000000, -0.000000, 0.184131, 0.982902]
},
{
"keytime": 0.933328,
"value": [ 0.000000, -0.000000, 0.274421, 0.961610]
},
{
"keytime": 1.000000,
"value": [ 0.000000, -0.000000, 0.362349, 0.932043]
}
]
}
]
}
]
}
]
}

View File

@ -35,7 +35,7 @@ classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* M
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = Node::[setGLServerState description getUserObject .*UserData getGLServerState .*schedule getPosition$ setContentSize setAnchorPoint],
skip = Node::[setGLServerState description getUserObject .*UserData getGLServerState .*schedule getPosition$ setContentSize setAnchorPoint enumerateChildren],
Sprite::[getQuad getBlendFunc ^setPosition$ setBlendFunc],
SpriteBatchNode::[getBlendFunc setBlendFunc getDescendants],
MotionStreak::[getBlendFunc setBlendFunc draw update],
@ -129,7 +129,8 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
Mesh::[create],
Sprite3D::[getSkin],
Animation3D::[getBoneCurveByName],
Animation3DCache::[*]
Animation3DCache::[*],
Sprite3DMaterialCache::[*]
rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame],
ProgressTimer::[setReverseProgress=setReverseDirection],