Merge branch 'newcode' into obb

This commit is contained in:
yangxiao 2014-08-11 13:21:44 +08:00
commit fd314261b7
14 changed files with 928 additions and 45 deletions

View File

@ -10,9 +10,9 @@ cocos2d-x-3.3 ??
[NEW] RotateTo: added 3D rotation support
[NEW] ScrollView: added `setMinScale()` and `setMaxScale()`
[NEW] SpriteFrameCache: load from plist file content data
[NEW] UIText: added getter and setter for TextColor
[NEW] utils: added gettime()
[NEW] TextField: support utf8
[NEW] Text: added getter and setter for TextColor
[FIX] EditBox: font size is not scaled when glview is scaled on Mac OS X
[FIX] EditBox: began/end events not work
@ -21,18 +21,20 @@ cocos2d-x-3.3 ??
[FIX] Label: result of LabelTTF::getBoundingBox() is wrong
[FIX] Label: can not set outline color correctly if using system font on iOS
[FIX] LabelBMFont: result of LabelBMFont::getBoundingBox() is wrong
[FIX] ListView: can not insert an item in specific position, it is added at bottom
[FIX] LoadingBar: position is changed if changing direction
[FIX] ParticleSystem: effect is wrong if scene scaled
[FIX] ParticleSystemQuad: setTotalParticles() can't set a value larger than initialized value
[FIX] PhysicsBody: return wrong bitmask
[FIX] Scale9Sprite: new added sprite will be hidden
[FIX] Slider: if the UISlider is faded, the slide ball won't fade together
[FIX] Sprite: will turn black if opacity is set other than 255 and be added into SpriteBatchNode
[FIX] UIListView: can not insert an item in specific position, it is added at bottom
[FIX] TabelView: can handle touch event though its parents are invisible
[FIX] TextField: can not use backspace to delete a character
[FIX] UISlider: if the UISlider is faded, the slide ball won't fade together
[FIX] UIVideoPlayer: video frame size is not calculated correctly on iOS
[FIX] UIWidget: may crash if remove itself in touch call back function
[FIX] Widget: may crash if remove itself in touch call back function
[FIX] Widget: not support cascaded opacity and cascaded color by default
[FIX] VideoPlayer: memory leak on iOS
[FIX] VideoPlayer: video frame size is not calculated correctly on iOS
[FIX] VideoPlayer: video player not showing on iOS if it's not in FullScreen mode
[FIX] Others: can not import java library shift by engine correctly when using Eclispe on Android

View File

@ -381,9 +381,9 @@ void ProtectedNode::updateDisplayedOpacity(GLubyte parentOpacity)
for(auto child : _children){
child->updateDisplayedOpacity(_displayedOpacity);
}
for(auto child : _protectedChildren){
child->updateDisplayedOpacity(_displayedOpacity);
}
for(auto child : _protectedChildren){
child->setOpacity(_realOpacity);
}
}
@ -399,9 +399,9 @@ void ProtectedNode::updateDisplayedColor(const Color3B& parentColor)
for(const auto &child : _children){
child->updateDisplayedColor(_displayedColor);
}
for(const auto &child : _protectedChildren){
child->updateDisplayedColor(_displayedColor);
}
for(const auto &child : _protectedChildren){
child->setColor(_realColor);
}
}
@ -411,7 +411,7 @@ void ProtectedNode::disableCascadeColor()
child->updateDisplayedColor(Color3B::WHITE);
}
for(auto child : _protectedChildren){
child->updateDisplayedColor(Color3B::WHITE);
child->setColor(Color3B::WHITE);
}
}

View File

@ -153,6 +153,10 @@ bool Scene::initWithPhysics()
{
Director * director;
CC_BREAK_IF( ! (director = Director::getInstance()) );
// add camera
auto camera = Camera::create();
addChild(camera);
this->setContentSize(director->getWinSize());
CC_BREAK_IF(! (_physicsWorld = PhysicsWorld::construct(*this)));

View File

@ -69,10 +69,6 @@ PhysicsBody::PhysicsBody()
, _linearDamping(0.0f)
, _angularDamping(0.0f)
, _tag(0)
, _categoryBitmask(UINT_MAX)
, _collisionBitmask(0)
, _contactTestBitmask(UINT_MAX)
, _group(0)
, _positionResetTag(false)
, _rotationResetTag(false)
, _rotationOffset(0)
@ -422,11 +418,6 @@ PhysicsShape* PhysicsBody::addShape(PhysicsShape* shape, bool addMassAndMoment/*
}
_shapes.pushBack(shape);
if (_group != CP_NO_GROUP && shape->getGroup() == CP_NO_GROUP)
{
shape->setGroup(_group);
}
}
return shape;
@ -829,34 +820,64 @@ void PhysicsBody::update(float delta)
void PhysicsBody::setCategoryBitmask(int bitmask)
{
_categoryBitmask = bitmask;
for (auto& shape : _shapes)
{
shape->setCategoryBitmask(bitmask);
}
}
int PhysicsBody::getCategoryBitmask() const
{
if (!_shapes.empty())
{
return _shapes.front()->getCategoryBitmask();
}
else
{
return UINT_MAX;
}
}
void PhysicsBody::setContactTestBitmask(int bitmask)
{
_contactTestBitmask = bitmask;
for (auto& shape : _shapes)
{
shape->setContactTestBitmask(bitmask);
}
}
int PhysicsBody::getContactTestBitmask() const
{
if (!_shapes.empty())
{
return _shapes.front()->getContactTestBitmask();
}
else
{
return 0x00000000;
}
}
void PhysicsBody::setCollisionBitmask(int bitmask)
{
_collisionBitmask = bitmask;
for (auto& shape : _shapes)
{
shape->setCollisionBitmask(bitmask);
}
}
int PhysicsBody::getCollisionBitmask() const
{
if (!_shapes.empty())
{
return _shapes.front()->getCollisionBitmask();
}
else
{
return UINT_MAX;
}
}
void PhysicsBody::setGroup(int group)
{
for (auto& shape : _shapes)
@ -865,6 +886,18 @@ void PhysicsBody::setGroup(int group)
}
}
int PhysicsBody::getGroup() const
{
if (!_shapes.empty())
{
return _shapes.front()->getGroup();
}
else
{
return 0;
}
}
void PhysicsBody::setPositionOffset(const Vec2& position)
{
if (!_positionOffset.equals(position))

View File

@ -171,12 +171,12 @@ public:
* The default value is 0xFFFFFFFF (all bits set).
*/
void setCollisionBitmask(int bitmask);
/** get the category bit mask */
inline int getCategoryBitmask() const { return _categoryBitmask; }
/** get the contact test bit mask */
inline int getContactTestBitmask() const { return _contactTestBitmask; }
/** get the collision bit mask */
inline int getCollisionBitmask() const { return _collisionBitmask; }
/** Return bitmask of first shape, if there is no shape in body, return default value.(0xFFFFFFFF) */
int getCategoryBitmask() const;
/** Return bitmask of first shape, if there is no shape in body, return default value.(0x00000000) */
int getContactTestBitmask() const;
/** Return bitmask of first shape, if there is no shape in body, return default value.(0xFFFFFFFF) */
int getCollisionBitmask() const;
/**
* set the group of body
@ -184,8 +184,8 @@ public:
* it have high priority than bit masks
*/
void setGroup(int group);
/** get the group of body */
inline int getGroup() const { return _group; }
/** Return group of first shape, if there is no shape in body, return default value.(0) */
int getGroup() const;
/** get the body position. */
Vec2 getPosition() const;
@ -339,11 +339,6 @@ protected:
float _angularDamping;
int _tag;
int _categoryBitmask;
int _collisionBitmask;
int _contactTestBitmask;
int _group;
bool _positionResetTag; /// To avoid reset the body position when body invoke Node::setPosition().
bool _rotationResetTag; /// To avoid reset the body rotation when body invoke Node::setRotation().
Vec2 _positionOffset;

View File

@ -140,6 +140,11 @@ public:
inline void setCollisionBitmask(int bitmask) { _collisionBitmask = bitmask; }
inline int getCollisionBitmask() const { return _collisionBitmask; }
/**
* set the group of body
* Collision groups let you specify an integral group index. You can have all fixtures with the same group index always collide (positive index) or never collide (negative index)
* it have high priority than bit masks
*/
void setGroup(int group);
inline int getGroup() { return _group; }

View File

@ -0,0 +1,83 @@
--------------------------------
-- @module Camera
-- @extend Node
-- @parent_module cc
--------------------------------
-- @function [parent=#Camera] getProjectionMatrix
-- @param self
-- @return mat4_table#mat4_table ret (return value: mat4_table)
--------------------------------
-- @function [parent=#Camera] getViewProjectionMatrix
-- @param self
-- @return mat4_table#mat4_table ret (return value: mat4_table)
--------------------------------
-- @function [parent=#Camera] getViewMatrix
-- @param self
-- @return mat4_table#mat4_table ret (return value: mat4_table)
--------------------------------
-- @function [parent=#Camera] getCameraFlag
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @function [parent=#Camera] getType
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @function [parent=#Camera] lookAt
-- @param self
-- @param #vec3_table vec3
-- @param #vec3_table vec3
--------------------------------
-- @function [parent=#Camera] setCameraFlag
-- @param self
-- @param #int cameraflag
--------------------------------
-- @function [parent=#Camera] unproject
-- @param self
-- @param #size_table size
-- @param #vec3_table vec3
-- @param #vec3_table vec3
--------------------------------
-- @function [parent=#Camera] create
-- @param self
-- @return Camera#Camera ret (return value: cc.Camera)
--------------------------------
-- @function [parent=#Camera] createPerspective
-- @param self
-- @param #float float
-- @param #float float
-- @param #float float
-- @param #float float
-- @return Camera#Camera ret (return value: cc.Camera)
--------------------------------
-- @function [parent=#Camera] createOrthographic
-- @param self
-- @param #float float
-- @param #float float
-- @param #float float
-- @param #float float
-- @return Camera#Camera ret (return value: cc.Camera)
--------------------------------
-- @function [parent=#Camera] getVisitingCamera
-- @param self
-- @return Camera#Camera ret (return value: cc.Camera)
--------------------------------
-- @function [parent=#Camera] setPosition3D
-- @param self
-- @param #vec3_table vec3
return nil

View File

@ -86,6 +86,11 @@
-- @param self
-- @param #unsigned char char
--------------------------------
-- @function [parent=#Node] getCameraMask
-- @param self
-- @return unsigned short#unsigned short ret (return value: unsigned short)
--------------------------------
-- @function [parent=#Node] setRotation
-- @param self
@ -125,6 +130,12 @@
-- @param self
-- @param #int int
--------------------------------
-- @function [parent=#Node] setCameraMask
-- @param self
-- @param #unsigned short short
-- @param #bool bool
--------------------------------
-- @function [parent=#Node] getTag
-- @param self

View File

@ -101,6 +101,11 @@
-- @field [parent=#cc] UserDefault#UserDefault UserDefault preloaded module
--------------------------------------------------------
-- the cc Camera
-- @field [parent=#cc] Camera#Camera Camera preloaded module
--------------------------------------------------------
-- the cc EventListenerTouchOneByOne
-- @field [parent=#cc] EventListenerTouchOneByOne#EventListenerTouchOneByOne EventListenerTouchOneByOne preloaded module

View File

@ -4282,6 +4282,50 @@ int lua_cocos2dx_Node_updateDisplayedOpacity(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Node_getCameraMask(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_getCameraMask'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
unsigned short ret = cobj->getCameraMask();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:getCameraMask",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_getCameraMask'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Node_setRotation(lua_State* tolua_S)
{
int argc = 0;
@ -4651,6 +4695,65 @@ int lua_cocos2dx_Node__setLocalZOrder(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Node_setCameraMask(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_setCameraMask'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
unsigned short arg0;
ok &= luaval_to_ushort(tolua_S, 2, &arg0, "cc.Node:setCameraMask");
if(!ok)
return 0;
cobj->setCameraMask(arg0);
return 0;
}
if (argc == 2)
{
unsigned short arg0;
bool arg1;
ok &= luaval_to_ushort(tolua_S, 2, &arg0, "cc.Node:setCameraMask");
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.Node:setCameraMask");
if(!ok)
return 0;
cobj->setCameraMask(arg0, arg1);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setCameraMask",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_setCameraMask'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Node_getTag(lua_State* tolua_S)
{
int argc = 0;
@ -9731,6 +9834,7 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S)
tolua_function(tolua_S,"isIgnoreAnchorPointForPosition",lua_cocos2dx_Node_isIgnoreAnchorPointForPosition);
tolua_function(tolua_S,"getChildByName",lua_cocos2dx_Node_getChildByName);
tolua_function(tolua_S,"updateDisplayedOpacity",lua_cocos2dx_Node_updateDisplayedOpacity);
tolua_function(tolua_S,"getCameraMask",lua_cocos2dx_Node_getCameraMask);
tolua_function(tolua_S,"setRotation",lua_cocos2dx_Node_setRotation);
tolua_function(tolua_S,"setScaleZ",lua_cocos2dx_Node_setScaleZ);
tolua_function(tolua_S,"setScaleY",lua_cocos2dx_Node_setScaleY);
@ -9739,6 +9843,7 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S)
tolua_function(tolua_S,"setonEnterTransitionDidFinishCallback",lua_cocos2dx_Node_setonEnterTransitionDidFinishCallback);
tolua_function(tolua_S,"removeAllComponents",lua_cocos2dx_Node_removeAllComponents);
tolua_function(tolua_S,"_setLocalZOrder",lua_cocos2dx_Node__setLocalZOrder);
tolua_function(tolua_S,"setCameraMask",lua_cocos2dx_Node_setCameraMask);
tolua_function(tolua_S,"getTag",lua_cocos2dx_Node_getTag);
tolua_function(tolua_S,"getGLProgram",lua_cocos2dx_Node_getGLProgram);
tolua_function(tolua_S,"getNodeToWorldTransform",lua_cocos2dx_Node_getNodeToWorldTransform);
@ -18437,6 +18542,544 @@ int lua_register_cocos2dx_UserDefault(lua_State* tolua_S)
return 1;
}
int lua_cocos2dx_Camera_getProjectionMatrix(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Camera* 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.Camera",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Camera*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Camera_getProjectionMatrix'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
const cocos2d::Mat4& ret = cobj->getProjectionMatrix();
mat4_to_luaval(tolua_S, ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Camera:getProjectionMatrix",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_getProjectionMatrix'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Camera_getViewProjectionMatrix(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Camera* 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.Camera",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Camera*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Camera_getViewProjectionMatrix'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
const cocos2d::Mat4& ret = cobj->getViewProjectionMatrix();
mat4_to_luaval(tolua_S, ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Camera:getViewProjectionMatrix",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_getViewProjectionMatrix'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Camera_getViewMatrix(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Camera* 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.Camera",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Camera*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Camera_getViewMatrix'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
const cocos2d::Mat4& ret = cobj->getViewMatrix();
mat4_to_luaval(tolua_S, ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Camera:getViewMatrix",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_getViewMatrix'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Camera_getCameraFlag(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Camera* 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.Camera",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Camera*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Camera_getCameraFlag'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
int ret = (int)cobj->getCameraFlag();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Camera:getCameraFlag",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_getCameraFlag'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Camera_getType(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Camera* 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.Camera",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Camera*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Camera_getType'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
int ret = (int)cobj->getType();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Camera:getType",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_getType'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Camera_lookAt(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Camera* 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.Camera",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Camera*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Camera_lookAt'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 2)
{
cocos2d::Vec3 arg0;
cocos2d::Vec3 arg1;
ok &= luaval_to_vec3(tolua_S, 2, &arg0, "cc.Camera:lookAt");
ok &= luaval_to_vec3(tolua_S, 3, &arg1, "cc.Camera:lookAt");
if(!ok)
return 0;
cobj->lookAt(arg0, arg1);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Camera:lookAt",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_lookAt'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Camera_setCameraFlag(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Camera* 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.Camera",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Camera*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Camera_setCameraFlag'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::CameraFlag arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Camera:setCameraFlag");
if(!ok)
return 0;
cobj->setCameraFlag(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Camera:setCameraFlag",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_setCameraFlag'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Camera_unproject(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Camera* 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.Camera",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Camera*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Camera_unproject'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 3)
{
cocos2d::Size arg0;
cocos2d::Vec3* arg1;
cocos2d::Vec3* arg2;
ok &= luaval_to_size(tolua_S, 2, &arg0, "cc.Camera:unproject");
ok &= luaval_to_object<cocos2d::Vec3>(tolua_S, 3, "cc.Vec3",&arg1);
ok &= luaval_to_object<cocos2d::Vec3>(tolua_S, 4, "cc.Vec3",&arg2);
if(!ok)
return 0;
cobj->unproject(arg0, arg1, arg2);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Camera:unproject",argc, 3);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_unproject'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Camera_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.Camera",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
if(!ok)
return 0;
cocos2d::Camera* ret = cocos2d::Camera::create();
object_to_luaval<cocos2d::Camera>(tolua_S, "cc.Camera",(cocos2d::Camera*)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Camera:create",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_create'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Camera_createPerspective(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.Camera",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 4)
{
double arg0;
double arg1;
double arg2;
double arg3;
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Camera:createPerspective");
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.Camera:createPerspective");
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.Camera:createPerspective");
ok &= luaval_to_number(tolua_S, 5,&arg3, "cc.Camera:createPerspective");
if(!ok)
return 0;
cocos2d::Camera* ret = cocos2d::Camera::createPerspective(arg0, arg1, arg2, arg3);
object_to_luaval<cocos2d::Camera>(tolua_S, "cc.Camera",(cocos2d::Camera*)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Camera:createPerspective",argc, 4);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_createPerspective'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Camera_createOrthographic(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.Camera",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 4)
{
double arg0;
double arg1;
double arg2;
double arg3;
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Camera:createOrthographic");
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.Camera:createOrthographic");
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.Camera:createOrthographic");
ok &= luaval_to_number(tolua_S, 5,&arg3, "cc.Camera:createOrthographic");
if(!ok)
return 0;
cocos2d::Camera* ret = cocos2d::Camera::createOrthographic(arg0, arg1, arg2, arg3);
object_to_luaval<cocos2d::Camera>(tolua_S, "cc.Camera",(cocos2d::Camera*)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Camera:createOrthographic",argc, 4);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_createOrthographic'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Camera_getVisitingCamera(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.Camera",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
if(!ok)
return 0;
const cocos2d::Camera* ret = cocos2d::Camera::getVisitingCamera();
object_to_luaval<cocos2d::Camera>(tolua_S, "cc.Camera",(cocos2d::Camera*)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Camera:getVisitingCamera",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Camera_getVisitingCamera'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_Camera_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Camera)");
return 0;
}
int lua_register_cocos2dx_Camera(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.Camera");
tolua_cclass(tolua_S,"Camera","cc.Camera","cc.Node",nullptr);
tolua_beginmodule(tolua_S,"Camera");
tolua_function(tolua_S,"getProjectionMatrix",lua_cocos2dx_Camera_getProjectionMatrix);
tolua_function(tolua_S,"getViewProjectionMatrix",lua_cocos2dx_Camera_getViewProjectionMatrix);
tolua_function(tolua_S,"getViewMatrix",lua_cocos2dx_Camera_getViewMatrix);
tolua_function(tolua_S,"getCameraFlag",lua_cocos2dx_Camera_getCameraFlag);
tolua_function(tolua_S,"getType",lua_cocos2dx_Camera_getType);
tolua_function(tolua_S,"lookAt",lua_cocos2dx_Camera_lookAt);
tolua_function(tolua_S,"setCameraFlag",lua_cocos2dx_Camera_setCameraFlag);
tolua_function(tolua_S,"unproject",lua_cocos2dx_Camera_unproject);
tolua_function(tolua_S,"create", lua_cocos2dx_Camera_create);
tolua_function(tolua_S,"createPerspective", lua_cocos2dx_Camera_createPerspective);
tolua_function(tolua_S,"createOrthographic", lua_cocos2dx_Camera_createOrthographic);
tolua_function(tolua_S,"getVisitingCamera", lua_cocos2dx_Camera_getVisitingCamera);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Camera).name();
g_luaType[typeName] = "cc.Camera";
g_typeCast["Camera"] = "cc.Camera";
return 1;
}
int lua_cocos2dx_EventListenerTouchOneByOne_isSwallowTouches(lua_State* tolua_S)
{
int argc = 0;
@ -65159,7 +65802,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
lua_register_cocos2dx_SpriteBatchNode(tolua_S);
lua_register_cocos2dx_Label(tolua_S);
lua_register_cocos2dx_Application(tolua_S);
lua_register_cocos2dx_DelayTime(tolua_S);
lua_register_cocos2dx_Camera(tolua_S);
lua_register_cocos2dx_LabelAtlas(tolua_S);
lua_register_cocos2dx_AttachNode(tolua_S);
lua_register_cocos2dx_ParticleSnow(tolua_S);
@ -65247,6 +65890,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
lua_register_cocos2dx_TransitionCrossFade(tolua_S);
lua_register_cocos2dx_Ripple3D(tolua_S);
lua_register_cocos2dx_Lens3D(tolua_S);
lua_register_cocos2dx_Animation(tolua_S);
lua_register_cocos2dx_ScaleTo(tolua_S);
lua_register_cocos2dx_Spawn(tolua_S);
lua_register_cocos2dx_EaseQuarticActionInOut(tolua_S);
@ -65260,6 +65904,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
lua_register_cocos2dx_EaseCircleActionOut(tolua_S);
lua_register_cocos2dx_TransitionProgressInOut(tolua_S);
lua_register_cocos2dx_EaseCubicActionInOut(tolua_S);
lua_register_cocos2dx_DelayTime(tolua_S);
lua_register_cocos2dx_EaseBackIn(tolua_S);
lua_register_cocos2dx_SplitRows(tolua_S);
lua_register_cocos2dx_Follow(tolua_S);
@ -65272,7 +65917,6 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
lua_register_cocos2dx_TransitionZoomFlipY(tolua_S);
lua_register_cocos2dx_ScaleBy(tolua_S);
lua_register_cocos2dx_EventTouch(tolua_S);
lua_register_cocos2dx_Animation(tolua_S);
lua_register_cocos2dx_TMXMapInfo(tolua_S);
lua_register_cocos2dx_EaseExponentialIn(tolua_S);
lua_register_cocos2dx_ReuseGrid(tolua_S);

View File

@ -1559,6 +1559,21 @@ int register_all_cocos2dx(lua_State* tolua_S);

View File

@ -209,9 +209,6 @@ bool Widget::init()
ignoreContentAdaptWithSize(true);
this->setCascadeColorEnabled(true);
this->setCascadeOpacityEnabled(true);
return true;
}
return false;

View File

@ -3630,6 +3630,7 @@
"cocos/scripting/lua-bindings/auto/api/CCBAnimationManager.lua",
"cocos/scripting/lua-bindings/auto/api/CCBReader.lua",
"cocos/scripting/lua-bindings/auto/api/CallFunc.lua",
"cocos/scripting/lua-bindings/auto/api/Camera.lua",
"cocos/scripting/lua-bindings/auto/api/CardinalSplineBy.lua",
"cocos/scripting/lua-bindings/auto/api/CardinalSplineTo.lua",
"cocos/scripting/lua-bindings/auto/api/CatmullRomBy.lua",

View File

@ -0,0 +1,88 @@
import os
import MySQLdb
import datetime
def connect_db():
db_host = os.environ['db_host']
db_user = os.environ['db_user']
db_pw = os.environ['db_pw']
db_name=os.environ['db_name']
db = MySQLdb.connect(db_host, db_user, db_pw, db_name)
return db
def close_db(db):
db.close()
def list_lib_names(db):
tables=[]
cursor = db.cursor()
#sql = "SELECT TABLE_NAME,TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='dailybuild'"
sql = 'show tables'
cursor.execute(sql)
results = cursor.fetchall()
for row in results:
tables.append(row[0])
return tables
def today():
now = datetime.datetime.now()
return now.strftime("%Y-%m-%d")
def prev_day(aDay, gap):
t = datetime.datetime.strptime(aDay, "%Y-%m-%d")
days = datetime.timedelta(hours=24*gap)
t = t - days
return t.strftime("%Y-%m-%d")
def next_day(aDay, gap):
t = datetime.datetime.strptime(aDay, "%Y-%m-%d")
days = datetime.timedelta(hours=24*gap)
t = t + days
return t.strftime("%Y-%m-%d")
def query_lib_size(db, libname, date):
cursor = db.cursor()
t1 = date + ' 00:00:00'
t2 = next_day(date,1) + ' 00:00:00'
sql = "SELECT size FROM %s WHERE createdTime > '%s' AND createdTime < '%s'" % (libname, t1, t2)
cursor.execute(sql)
result = cursor.fetchone()
#print libname + ":" + str(result[0])+'kB'
data = {}
data[libname] = result[0]
return data
def query_all_libs(db, date):
tables = list_lib_names(db)
result = {}
for t in tables:
data = query_lib_size(db, t, date)
result.update(data)
return result
db = connect_db()
#print tables
today = today()
Monday = prev_day(today, 4)
csv = "cocos2d-libsize-tracking-"+today+".csv"
with open(csv, "w") as stats_file:
title = 'date,'
libs = list_lib_names(db)
for name in libs:
title += name
title += ','
stats_file.write(title)
stats_file.write('\n')
for i in range(0,5):
d = next_day(Monday, i)
stats_file.write(d)
stats_file.write(',')
stats = query_all_libs(db, d)
for name in libs:
size = str(stats[name])
stats_file.write(size)
stats_file.write(',')
stats_file.write('\n')
close_db(db)
#print yesterday