diff --git a/CHANGELOG b/CHANGELOG index 814fecd67e..ad5c3e1d42 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ cocos2d-x-3.2 ?? [FIX] Animate3D: setSpeed() accept negtive value, which means play reverse, getPlayback and setPlayBack are deprecated [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] Lua-binding: support UIVideoPlayer [FIX] Node: setRotation3D not work based on anchor point [FIX] Node: modify regular of enumerateChildren, now it just searchs its children [FIX] Setup.py: not work if using zsh diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index 537d485dcd..da1a96a15f 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -58,6 +58,13 @@ 1503FAC418DA8B6C00F6518C /* tp.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB118DA8B6C00F6518C /* tp.lua */; }; 1503FAC518DA8B6C00F6518C /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; }; 1503FAC618DA8B6C00F6518C /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; }; + 15AECE0B195C0F8A00907DB0 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; }; + 15AECE0F195C1FDD00907DB0 /* cocosvideo.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */; }; + 15AECE1F195D0EC500907DB0 /* experimentalConstants.lua in Resources */ = {isa = PBXBuildFile; fileRef = 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */; }; + 15AECE22195D122400907DB0 /* experimentalConstants.lua in Resources */ = {isa = PBXBuildFile; fileRef = 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */; }; + 15AECE23195D122600907DB0 /* experimentalConstants.lua in Resources */ = {isa = PBXBuildFile; fileRef = 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */; }; + 15AECE24195D122700907DB0 /* experimentalConstants.lua in Resources */ = {isa = PBXBuildFile; fileRef = 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */; }; + 15AECE25195D467D00907DB0 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; }; 15B0870D195AD52000D6F62B /* ActionTimeline in Resources */ = {isa = PBXBuildFile; fileRef = 38FA2E75194AECF800FF2BE4 /* ActionTimeline */; }; 15C64825165F3934007D4F18 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64824165F3934007D4F18 /* OpenGL.framework */; }; 15C64827165F394E007D4F18 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64826165F394E007D4F18 /* QuartzCore.framework */; }; @@ -1315,6 +1322,7 @@ 1503FAB018DA8B6C00F6518C /* socket.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = socket.lua; path = ../external/lua/luasocket/socket.lua; sourceTree = ""; }; 1503FAB118DA8B6C00F6518C /* tp.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = tp.lua; path = ../external/lua/luasocket/tp.lua; sourceTree = ""; }; 1503FAB218DA8B6C00F6518C /* url.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = url.lua; path = ../external/lua/luasocket/url.lua; sourceTree = ""; }; + 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = experimentalConstants.lua; path = "../cocos/scripting/lua-bindings/script/experimentalConstants.lua"; sourceTree = ""; }; 15C64822165F391E007D4F18 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; 15C64824165F3934007D4F18 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework; sourceTree = DEVELOPER_DIR; }; 15C64826165F394E007D4F18 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; @@ -2049,6 +2057,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 15AECE25195D467D00907DB0 /* MediaPlayer.framework in Frameworks */, 1A0EE42C18CDF799004CD58F /* libz.dylib in Frameworks */, 1A0EE42D18CDF799004CD58F /* CoreMotion.framework in Frameworks */, 1A0EE42E18CDF799004CD58F /* AudioToolbox.framework in Frameworks */, @@ -2093,6 +2102,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 15AECE0B195C0F8A00907DB0 /* MediaPlayer.framework in Frameworks */, 1ABCA3B018CDA06D0087CE3A /* libz.dylib in Frameworks */, 1ABCA3AA18CD9F1A0087CE3A /* CoreMotion.framework in Frameworks */, 1ABCA3A918CD9F130087CE3A /* AudioToolbox.framework in Frameworks */, @@ -2218,6 +2228,7 @@ 1ABCA36418CD9E060087CE3A /* Lua Common */ = { isa = PBXGroup; children = ( + 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */, 1503FAA918DA8B6C00F6518C /* ftp.lua */, 1503FAAA18DA8B6C00F6518C /* headers.lua */, 1503FAAB18DA8B6C00F6518C /* http.lua */, @@ -4389,6 +4400,7 @@ 1AC35D5D18CEDE9E00F37B72 /* MainMenu.xib in Resources */, 1503FABD18DA8B6C00F6518C /* mime.lua in Resources */, 1A0EE56F18CDFBBE004CD58F /* CCBReaderLoad.lua in Resources */, + 15AECE23195D122600907DB0 /* experimentalConstants.lua in Resources */, 1A0EE57018CDFBBE004CD58F /* Cocos2d.lua in Resources */, 1A0EE57B18CDFBBE004CD58F /* luaj.lua in Resources */, 1A0EE57918CDFBBE004CD58F /* GuiConstants.lua in Resources */, @@ -4458,6 +4470,7 @@ 1A0EE56018CDFBBD004CD58F /* CocoStudio.lua in Resources */, 1A0EE56318CDFBBD004CD58F /* DeprecatedEnum.lua in Resources */, 1503FAB818DA8B6C00F6518C /* http.lua in Resources */, + 15AECE22195D122400907DB0 /* experimentalConstants.lua in Resources */, 1AC35D4B18CEDE9400F37B72 /* Icon-144.png in Resources */, 1503FAC618DA8B6C00F6518C /* url.lua in Resources */, 1AC35D4618CEDE9400F37B72 /* Default-568h@2x.png in Resources */, @@ -4502,6 +4515,7 @@ 1AC35DBB18CEE65100F37B72 /* components in Resources */, 1AC35DE218CEE65900F37B72 /* effect2.ogg in Resources */, 1ABCA39A18CD9E180087CE3A /* StudioConstants.lua in Resources */, + 15AECE24195D122700907DB0 /* experimentalConstants.lua in Resources */, 15C90B4318E66C1700D69802 /* mime.lua in Resources */, 1AC35DB118CEE5DA00F37B72 /* InfoPlist.strings in Resources */, 1AC35DDD18CEE65900F37B72 /* CocosBuilderExample.ccbproj in Resources */, @@ -4564,6 +4578,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 15AECE0F195C1FDD00907DB0 /* cocosvideo.mp4 in Resources */, 15B0870D195AD52000D6F62B /* ActionTimeline in Resources */, 15E66FC8192D957100C20A52 /* Sprite3DTest in Resources */, 15C90B4418E66C1800D69802 /* mime.lua in Resources */, @@ -4580,6 +4595,7 @@ 1AC35DD718CEE65200F37B72 /* Particles in Resources */, 1AC35D9D18CEE5D100F37B72 /* Icon-120.png in Resources */, 15C90B3E18E66BF200D69802 /* http.lua in Resources */, + 15AECE1F195D0EC500907DB0 /* experimentalConstants.lua in Resources */, 1AC35DA018CEE5D100F37B72 /* Icon-57.png in Resources */, 1ABCA37F18CD9E180087CE3A /* Cocos2dConstants.lua in Resources */, 1AC35DF118CEE65B00F37B72 /* fileLookup.plist in Resources */, diff --git a/cocos/3d/CCAnimate3D.h b/cocos/3d/CCAnimate3D.h index b8011e3946..ba8ccee7ae 100644 --- a/cocos/3d/CCAnimate3D.h +++ b/cocos/3d/CCAnimate3D.h @@ -38,7 +38,7 @@ NS_CC_BEGIN class Animation3D; -class Bone; +class Bone3D; /** * Animate3D, Animates a Sprite3D given with an Animation3D */ @@ -92,7 +92,7 @@ protected: float _start; //start time 0 - 1, used to generate sub Animate3D float _last; //last time 0 - 1, used to generate sub Animate3D bool _playReverse; // is playing reverse - std::map _boneCurves; //weak ref + std::map _boneCurves; //weak ref }; NS_CC_END diff --git a/cocos/3d/CCMeshSkin.cpp b/cocos/3d/CCMeshSkin.cpp index 64add14d67..3e8d563888 100644 --- a/cocos/3d/CCMeshSkin.cpp +++ b/cocos/3d/CCMeshSkin.cpp @@ -36,22 +36,22 @@ NS_CC_BEGIN * * @param m C3DMatrix representing the inverse bind pose for this Bone. */ -void Bone::setInverseBindPose(const Mat4& m) +void Bone3D::setInverseBindPose(const Mat4& m) { _invBindPose = m; } -const Mat4& Bone::getInverseBindPose() +const Mat4& Bone3D::getInverseBindPose() { return _invBindPose; } -void Bone::setOriPose(const Mat4& m) +void Bone3D::setOriPose(const Mat4& m) { _oriPose = m; } -void Bone::resetPose() +void Bone3D::resetPose() { _local =_oriPose; @@ -60,7 +60,7 @@ void Bone::resetPose() } } -void Bone::setWorldMatDirty(bool dirty) +void Bone3D::setWorldMatDirty(bool dirty) { _worldDirty = dirty; for (auto it : _children) { @@ -69,7 +69,7 @@ void Bone::setWorldMatDirty(bool dirty) } //update own world matrix and children's -void Bone::updateWorldMat() +void Bone3D::updateWorldMat() { getWorldMat(); for (auto itor : _children) { @@ -77,7 +77,7 @@ void Bone::updateWorldMat() } } -const Mat4& Bone::getWorldMat() +const Mat4& Bone3D::getWorldMat() { if (_worldDirty) { @@ -95,7 +95,7 @@ const Mat4& Bone::getWorldMat() return _world; } -void Bone::setAnimationValue(float* trans, float* rot, float* scale, void* tag, float weight) +void Bone3D::setAnimationValue(float* trans, float* rot, float* scale, void* tag, float weight) { for (auto& it : _blendStates) { if (it.tag == tag) @@ -124,7 +124,7 @@ void Bone::setAnimationValue(float* trans, float* rot, float* scale, void* tag, _blendStates.push_back(state); } -void Bone::clearBoneBlendState() +void Bone3D::clearBoneBlendState() { _blendStates.clear(); for (auto it : _children) { @@ -135,14 +135,14 @@ void Bone::clearBoneBlendState() /** * Creates C3DBone. */ -Bone* Bone::create(const std::string& id) +Bone3D* Bone3D::create(const std::string& id) { - auto bone = new Bone(id); + auto bone = new Bone3D(id); bone->autorelease(); return bone; } -void Bone::updateJointMatrix(Vec4* matrixPalette) +void Bone3D::updateJointMatrix(Vec4* matrixPalette) { { static Mat4 t; @@ -154,37 +154,37 @@ void Bone::updateJointMatrix(Vec4* matrixPalette) } } -Bone* Bone::getParentBone() +Bone3D* Bone3D::getParentBone() { return _parent; } -ssize_t Bone::getChildBoneCount() const +ssize_t Bone3D::getChildBoneCount() const { return _children.size(); } -Bone* Bone::getChildBoneByIndex(int index) +Bone3D* Bone3D::getChildBoneByIndex(int index) { return _children.at(index); } -void Bone::addChildBone(Bone* bone) +void Bone3D::addChildBone(Bone3D* bone) { if (_children.find(bone) == _children.end()) _children.pushBack(bone); } -void Bone::removeChildBoneByIndex(int index) +void Bone3D::removeChildBoneByIndex(int index) { _children.erase(index); } -void Bone::removeChildBone(Bone* bone) +void Bone3D::removeChildBone(Bone3D* bone) { _children.eraseObject(bone); } -void Bone::removeAllChildBone() +void Bone3D::removeAllChildBone() { _children.clear(); } -Bone::Bone(const std::string& id) +Bone3D::Bone3D(const std::string& id) : _name(id) , _parent(nullptr) , _worldDirty(true) @@ -192,12 +192,12 @@ Bone::Bone(const std::string& id) } -Bone::~Bone() +Bone3D::~Bone3D() { removeAllChildBone(); } -void Bone::updateLocalMat() +void Bone3D::updateLocalMat() { if (_blendStates.size()) { @@ -299,13 +299,13 @@ bool MeshSkin::initFromSkinData(const SkinData& skindata) { ssize_t i = 0; for (; i < skindata.skinBoneNames.size(); i++) { - auto bone = Bone::create(skindata.skinBoneNames[i]); + auto bone = Bone3D::create(skindata.skinBoneNames[i]); bone->_invBindPose = skindata.inverseBindPoseMatrices[i]; bone->setOriPose(skindata.skinBoneOriginMatrices[i]); addSkinBone(bone); } for (i = 0; i < skindata.nodeBoneNames.size(); i++) { - auto bone = Bone::create(skindata.nodeBoneNames[i]); + auto bone = Bone3D::create(skindata.nodeBoneNames[i]); bone->setOriPose(skindata.nodeBoneOriginMatrices[i]); addNodeBone(bone); } @@ -330,7 +330,7 @@ ssize_t MeshSkin::getBoneCount() const } //get bone -Bone* MeshSkin::getBoneByIndex(unsigned int index) const +Bone3D* MeshSkin::getBoneByIndex(unsigned int index) const { if (index < _skinBones.size()) return _skinBones.at(index); @@ -340,7 +340,7 @@ Bone* MeshSkin::getBoneByIndex(unsigned int index) const return nullptr; } -Bone* MeshSkin::getBoneByName(const std::string& id) const +Bone3D* MeshSkin::getBoneByName(const std::string& id) const { //search from skin bones for (auto it : _skinBones) { @@ -355,18 +355,18 @@ Bone* MeshSkin::getBoneByName(const std::string& id) const return nullptr; } -Bone* MeshSkin::getRootBone() const +Bone3D* MeshSkin::getRootBone() const { return _rootBone; } -void MeshSkin::setRootBone(Bone* joint) +void MeshSkin::setRootBone(Bone3D* joint) { CC_SAFE_RETAIN(joint); CC_SAFE_RELEASE(_rootBone); _rootBone = joint; } -int MeshSkin::getBoneIndex(Bone* bone) const +int MeshSkin::getBoneIndex(Bone3D* bone) const { int i = 0; for (; i < _skinBones.size(); i++) { @@ -419,12 +419,12 @@ void MeshSkin::removeAllBones() CC_SAFE_RELEASE(_rootBone); } -void MeshSkin::addSkinBone(Bone* bone) +void MeshSkin::addSkinBone(Bone3D* bone) { _skinBones.pushBack(bone); } -void MeshSkin::addNodeBone(Bone* bone) +void MeshSkin::addNodeBone(Bone3D* bone) { _nodeBones.pushBack(bone); } diff --git a/cocos/3d/CCMeshSkin.h b/cocos/3d/CCMeshSkin.h index eaeaa03467..b031afeefb 100644 --- a/cocos/3d/CCMeshSkin.h +++ b/cocos/3d/CCMeshSkin.h @@ -40,7 +40,7 @@ NS_CC_BEGIN /** * Defines a basic hierachial structure of transformation spaces. */ -class Bone : public Ref +class Bone3D : public Ref { friend class MeshSkin; public: @@ -76,7 +76,7 @@ public: /** * Creates C3DBone. */ - static Bone* create(const std::string& id); + static Bone3D* create(const std::string& id); /** * Sets the inverse bind pose matrix. @@ -105,17 +105,17 @@ public: void updateJointMatrix(Vec4* matrixPalette); /**bone tree, we do not inherit from Node, Node has too many properties that we do not need. A clean Node is needed.*/ - Bone* getParentBone(); + Bone3D* getParentBone(); /**get child bone count*/ ssize_t getChildBoneCount() const; /**get child bone by index*/ - Bone* getChildBoneByIndex(int index); + Bone3D* getChildBoneByIndex(int index); /**add child bone*/ - void addChildBone(Bone* bone); + void addChildBone(Bone3D* bone); /**remove child bone by index*/ void removeChildBoneByIndex(int index); /**remove child bone*/ - void removeChildBone(Bone* bone); + void removeChildBone(Bone3D* bone); /**remove all child bone*/ void removeAllChildBone(); @@ -143,12 +143,12 @@ protected: /** * Constructor. */ - Bone(const std::string& id); + Bone3D(const std::string& id); /** * Destructor. */ - virtual ~Bone(); + virtual ~Bone3D(); /** * Update local matrix @@ -166,9 +166,9 @@ protected: Mat4 _oriPose; //original bone pose - Bone* _parent; //parent bone + Bone3D* _parent; //parent bone - Vector _children; + Vector _children; bool _worldDirty; Mat4 _world; @@ -193,15 +193,15 @@ public: ssize_t getBoneCount() const; /**get bone*/ - Bone* getBoneByIndex(unsigned int index) const; - Bone* getBoneByName(const std::string& id) const; + Bone3D* getBoneByIndex(unsigned int index) const; + Bone3D* getBoneByName(const std::string& id) const; /**get & set root bone*/ - Bone* getRootBone() const; - void setRootBone(Bone* bone); + Bone3D* getRootBone() const; + void setRootBone(Bone3D* bone); /**get bone index*/ - int getBoneIndex(Bone* bone) const; + int getBoneIndex(Bone3D* bone) const; /**compute matrix palette used by gpu skin*/ Vec4* getMatrixPalette(); @@ -225,17 +225,17 @@ CC_CONSTRUCTOR_ACCESS: void removeAllBones(); /**add skin bone*/ - void addSkinBone(Bone* bone); + void addSkinBone(Bone3D* bone); /**add Node bone*/ - void addNodeBone(Bone* bone); + void addNodeBone(Bone3D* bone); protected: - Vector _skinBones; // bones with skin - Vector _nodeBones; //bones without skin, only used to compute transform of children + Vector _skinBones; // bones with skin + Vector _nodeBones; //bones without skin, only used to compute transform of children - Bone* _rootBone; + Bone3D* _rootBone; // Pointer to the array of palette matrices. // This array is passed to the vertex shader as a uniform. diff --git a/cocos/base/CCController.h b/cocos/base/CCController.h index 46aabbc283..0c596f3cfe 100644 --- a/cocos/base/CCController.h +++ b/cocos/base/CCController.h @@ -41,6 +41,9 @@ class EventDispatcher; class Controller { public: + /** Controllers' standard key + * Controller receives only standard key which contained within enum Key by default. + */ enum Key { JOYSTICK_LEFT_X = 1000, @@ -87,9 +90,17 @@ public: static const int TAG_UNSET = -1; static const std::vector& getAllController(){ return s_allController;} + /** Gets a controller with its tag + * @param tag An identifier to find the controller. + */ static Controller* getControllerByTag(int tag); - + /** To start discovering new controllers + * @warning The API only work on the IOS platform.Empty implementation on Android + */ static void startDiscoveryController(); + /** End the discovery process + * @warning The API only work on the IOS platform.Empty implementation on Android + */ static void stopDiscoveryController(); const std::string& getDeviceName() const { return _deviceName;} @@ -108,7 +119,15 @@ public: */ void receiveExternalKeyEvent(int externalKeyCode,bool receive); + /** Changes the tag that is used to identify the controller easily. + * @param tag A integer that identifies the controller. + */ void setTag(int tag) { _controllerTag = tag;} + /** + * Returns a tag that is used to identify the controller easily. + * + * @return An integer that identifies the controller. + */ int getTag() const { return _controllerTag;} private: diff --git a/cocos/base/CCUserDefault.h b/cocos/base/CCUserDefault.h index 6d98743da2..8ba6bcf7d8 100644 --- a/cocos/base/CCUserDefault.h +++ b/cocos/base/CCUserDefault.h @@ -173,7 +173,7 @@ public: /** * @js NA */ - const static std::string& getXMLFilePath(); + static const std::string& getXMLFilePath(); /** * @js NA */ diff --git a/cocos/base/ccTypes.h b/cocos/base/ccTypes.h index 7911e37f22..0aa38f29bc 100644 --- a/cocos/base/ccTypes.h +++ b/cocos/base/ccTypes.h @@ -66,15 +66,15 @@ struct Color3B GLubyte g; GLubyte b; - const static Color3B WHITE; - const static Color3B YELLOW; - const static Color3B BLUE; - const static Color3B GREEN; - const static Color3B RED; - const static Color3B MAGENTA; - const static Color3B BLACK; - const static Color3B ORANGE; - const static Color3B GRAY; + static const Color3B WHITE; + static const Color3B YELLOW; + static const Color3B BLUE; + static const Color3B GREEN; + static const Color3B RED; + static const Color3B MAGENTA; + static const Color3B BLACK; + static const Color3B ORANGE; + static const Color3B GRAY; }; /** RGBA color composed of 4 bytes @@ -99,15 +99,15 @@ struct Color4B GLubyte b; GLubyte a; - const static Color4B WHITE; - const static Color4B YELLOW; - const static Color4B BLUE; - const static Color4B GREEN; - const static Color4B RED; - const static Color4B MAGENTA; - const static Color4B BLACK; - const static Color4B ORANGE; - const static Color4B GRAY; + static const Color4B WHITE; + static const Color4B YELLOW; + static const Color4B BLUE; + static const Color4B GREEN; + static const Color4B RED; + static const Color4B MAGENTA; + static const Color4B BLACK; + static const Color4B ORANGE; + static const Color4B GRAY; }; @@ -138,15 +138,15 @@ struct Color4F GLfloat b; GLfloat a; - const static Color4F WHITE; - const static Color4F YELLOW; - const static Color4F BLUE; - const static Color4F GREEN; - const static Color4F RED; - const static Color4F MAGENTA; - const static Color4F BLACK; - const static Color4F ORANGE; - const static Color4F GRAY; + static const Color4F WHITE; + static const Color4F YELLOW; + static const Color4F BLUE; + static const Color4F GREEN; + static const Color4F RED; + static const Color4F MAGENTA; + static const Color4F BLACK; + static const Color4F ORANGE; + static const Color4F GRAY; }; /** A vertex composed of 2 floats: x, y @@ -335,13 +335,13 @@ struct BlendFunc GLenum dst; //! Blending disabled. Uses {GL_ONE, GL_ZERO} - const static BlendFunc DISABLE; + static const BlendFunc DISABLE; //! Blending enabled for textures with Alpha premultiplied. Uses {GL_ONE, GL_ONE_MINUS_SRC_ALPHA} - const static BlendFunc ALPHA_PREMULTIPLIED; + static const BlendFunc ALPHA_PREMULTIPLIED; //! Blending enabled for textures with Alpha NON premultiplied. Uses {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA} - const static BlendFunc ALPHA_NON_PREMULTIPLIED; + static const BlendFunc ALPHA_NON_PREMULTIPLIED; //! Enables Additive blending. Uses {GL_SRC_ALPHA, GL_ONE} - const static BlendFunc ADDITIVE; + static const BlendFunc ADDITIVE; bool operator==(const BlendFunc &a) const { diff --git a/cocos/editor-support/cocostudio/CCBone.cpp b/cocos/editor-support/cocostudio/CCBone.cpp index 5c0daf2e79..7a446d1521 100644 --- a/cocos/editor-support/cocostudio/CCBone.cpp +++ b/cocos/editor-support/cocostudio/CCBone.cpp @@ -201,8 +201,8 @@ void Bone::update(float delta) _worldInfo->y = _tweenData->y + _position.y; _worldInfo->scaleX = _tweenData->scaleX * _scaleX; _worldInfo->scaleY = _tweenData->scaleY * _scaleY; - _worldInfo->skewX = _tweenData->skewX + _skewX + _rotationX; - _worldInfo->skewY = _tweenData->skewY + _skewY - _rotationY; + _worldInfo->skewX = _tweenData->skewX + _skewX + _rotationZ_X; + _worldInfo->skewY = _tweenData->skewY + _skewY - _rotationZ_Y; if(_parentBone) { diff --git a/cocos/editor-support/cocostudio/CocoLoader.cpp b/cocos/editor-support/cocostudio/CocoLoader.cpp index 38e0fb1d2f..334858fe0c 100644 --- a/cocos/editor-support/cocostudio/CocoLoader.cpp +++ b/cocos/editor-support/cocostudio/CocoLoader.cpp @@ -130,10 +130,19 @@ char* stExpCocoNode::GetName(CocoLoader* pCoco) } -char* stExpCocoNode::GetValue(CocoLoader* pCoco) -{ - return ( pCoco->GetMemoryAddr_String() + m_szValue ); -} + char* stExpCocoNode::GetValue(CocoLoader* pCoco) + { + char* szValue = ( pCoco->GetMemoryAddr_String() + m_szValue ); + if(GetType(pCoco) == kStringType ) + { + if(szValue && 0==strcmp(szValue,"null")) + { + strcpy(szValue,""); + } + } + return szValue; + } + int stExpCocoNode::GetChildNum() { diff --git a/cocos/scripting/lua-bindings/Android.mk b/cocos/scripting/lua-bindings/Android.mk index 6d0b337577..c926b1d11c 100644 --- a/cocos/scripting/lua-bindings/Android.mk +++ b/cocos/scripting/lua-bindings/Android.mk @@ -23,6 +23,7 @@ LOCAL_SRC_FILES := manual/CCLuaBridge.cpp \ manual/lua_cocos2dx_ui_manual.cpp \ manual/lua_cocos2dx_spine_manual.cpp \ manual/lua_cocos2dx_physics_manual.cpp \ + manual/lua_cocos2dx_experimental_video_manual.cpp \ manual/lua_cocos2dx_deprecated.cpp \ manual/lua_xml_http_request.cpp \ manual/platform/android/CCLuaJavaBridge.cpp \ @@ -35,6 +36,7 @@ LOCAL_SRC_FILES := manual/CCLuaBridge.cpp \ auto/lua_cocos2dx_ui_auto.cpp \ auto/lua_cocos2dx_spine_auto.cpp \ auto/lua_cocos2dx_physics_auto.cpp \ + auto/lua_cocos2dx_experimental_video_auto.cpp \ ../../../external/lua/tolua/tolua_event.c \ ../../../external/lua/tolua/tolua_is.c \ ../../../external/lua/tolua/tolua_map.c \ diff --git a/cocos/scripting/lua-bindings/auto/api/VideoPlayer.lua b/cocos/scripting/lua-bindings/auto/api/VideoPlayer.lua new file mode 100644 index 0000000000..81ca7db206 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/VideoPlayer.lua @@ -0,0 +1,95 @@ + +-------------------------------- +-- @module VideoPlayer +-- @extend Widget +-- @parent_module ccexprimental + +-------------------------------- +-- @function [parent=#VideoPlayer] getFileName +-- @param self +-- @return string#string ret (return value: string) + +-------------------------------- +-- @function [parent=#VideoPlayer] getURL +-- @param self +-- @return string#string ret (return value: string) + +-------------------------------- +-- @function [parent=#VideoPlayer] play +-- @param self + +-------------------------------- +-- @function [parent=#VideoPlayer] pause +-- @param self + +-------------------------------- +-- @function [parent=#VideoPlayer] setKeepAspectRatioEnabled +-- @param self +-- @param #bool bool + +-------------------------------- +-- @function [parent=#VideoPlayer] resume +-- @param self + +-------------------------------- +-- @function [parent=#VideoPlayer] stop +-- @param self + +-------------------------------- +-- @function [parent=#VideoPlayer] setFullScreenEnabled +-- @param self +-- @param #bool bool + +-------------------------------- +-- @function [parent=#VideoPlayer] setFileName +-- @param self +-- @param #string str + +-------------------------------- +-- @function [parent=#VideoPlayer] setURL +-- @param self +-- @param #string str + +-------------------------------- +-- @function [parent=#VideoPlayer] isKeepAspectRatioEnabled +-- @param self +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- @function [parent=#VideoPlayer] onPlayEvent +-- @param self +-- @param #cc.experimental::ui::VideoPlayer::EventType eventtype + +-------------------------------- +-- @function [parent=#VideoPlayer] isFullScreenEnabled +-- @param self +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- @function [parent=#VideoPlayer] isPlaying +-- @param self +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- @function [parent=#VideoPlayer] seekTo +-- @param self +-- @param #float float + +-------------------------------- +-- @function [parent=#VideoPlayer] create +-- @param self +-- @return experimental::ui::VideoPlayer#experimental::ui::VideoPlayer ret (return value: cc.experimental::ui::VideoPlayer) + +-------------------------------- +-- @function [parent=#VideoPlayer] draw +-- @param self +-- @param #cc.Renderer renderer +-- @param #mat4_table mat4 +-- @param #unsigned int int + +-------------------------------- +-- @function [parent=#VideoPlayer] setVisible +-- @param self +-- @param #bool bool + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_experimental_video_auto_api.lua b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_experimental_video_auto_api.lua new file mode 100644 index 0000000000..515fad0841 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_experimental_video_auto_api.lua @@ -0,0 +1,9 @@ +-------------------------------- +-- @module ccexprimental + +-------------------------------------------------------- +-- the ccexprimental VideoPlayer +-- @field [parent=#ccexprimental] VideoPlayer#VideoPlayer VideoPlayer preloaded module + + +return nil diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index a2d480bf97..0cff4e3b27 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1,3 +1,4 @@ +#include "base/ccConfig.h" #ifndef __cocos2dx_h__ #define __cocos2dx_h__ @@ -1572,6 +1573,7 @@ int register_all_cocos2dx(lua_State* tolua_S); + #endif // __cocos2dx_h__ diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp new file mode 100644 index 0000000000..408da55ffc --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp @@ -0,0 +1,755 @@ +#include "lua_cocos2dx_experimental_video_auto.hpp" +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) +#include "UIVideoPlayer.h" +#include "tolua_fix.h" +#include "LuaBasicConversions.h" + + + +int lua_cocos2dx_experimental_video_VideoPlayer_getFileName(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_getFileName'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + const std::string& ret = cobj->getFileName(); + tolua_pushcppstring(tolua_S,ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getFileName",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_getFileName'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_getURL(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_getURL'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + const std::string& ret = cobj->getURL(); + tolua_pushcppstring(tolua_S,ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getURL",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_getURL'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_play(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_play'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cobj->play(); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "play",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_play'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_pause(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_pause'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cobj->pause(); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "pause",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_pause'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_setKeepAspectRatioEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_setKeepAspectRatioEnabled'", 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->setKeepAspectRatioEnabled(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setKeepAspectRatioEnabled",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_setKeepAspectRatioEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_resume(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_resume'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cobj->resume(); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "resume",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_resume'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_stop(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_stop'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cobj->stop(); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "stop",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_stop'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_setFullScreenEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_setFullScreenEnabled'", 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->setFullScreenEnabled(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setFullScreenEnabled",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_setFullScreenEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_setFileName(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_setFileName'", nullptr); + return 0; + } +#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; + cobj->setFileName(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setFileName",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_setFileName'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_setURL(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_setURL'", nullptr); + return 0; + } +#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; + cobj->setURL(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setURL",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_setURL'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_isKeepAspectRatioEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_isKeepAspectRatioEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + bool ret = cobj->isKeepAspectRatioEnabled(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "isKeepAspectRatioEnabled",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_isKeepAspectRatioEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_onPlayEvent(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_onPlayEvent'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::experimental::ui::VideoPlayer::EventType arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); + if(!ok) + return 0; + cobj->onPlayEvent(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "onPlayEvent",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_onPlayEvent'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_isFullScreenEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_isFullScreenEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + bool ret = cobj->isFullScreenEnabled(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "isFullScreenEnabled",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_isFullScreenEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_isPlaying(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_isPlaying'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + bool ret = cobj->isPlaying(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "isPlaying",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_isPlaying'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_seekTo(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_seekTo'", 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->seekTo(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "seekTo",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_seekTo'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_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,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 0) + { + if(!ok) + return 0; + cocos2d::experimental::ui::VideoPlayer* ret = cocos2d::experimental::ui::VideoPlayer::create(); + object_to_luaval(tolua_S, "ccexp.VideoPlayer",(cocos2d::experimental::ui::VideoPlayer*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "create",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_create'.",&tolua_err); +#endif + return 0; +} +static int lua_cocos2dx_experimental_video_VideoPlayer_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (VideoPlayer)"); + return 0; +} + +int lua_register_cocos2dx_experimental_video_VideoPlayer(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"ccexp.VideoPlayer"); + tolua_cclass(tolua_S,"VideoPlayer","ccexp.VideoPlayer","ccui.Widget",nullptr); + + tolua_beginmodule(tolua_S,"VideoPlayer"); + tolua_function(tolua_S,"getFileName",lua_cocos2dx_experimental_video_VideoPlayer_getFileName); + tolua_function(tolua_S,"getURL",lua_cocos2dx_experimental_video_VideoPlayer_getURL); + tolua_function(tolua_S,"play",lua_cocos2dx_experimental_video_VideoPlayer_play); + tolua_function(tolua_S,"pause",lua_cocos2dx_experimental_video_VideoPlayer_pause); + tolua_function(tolua_S,"setKeepAspectRatioEnabled",lua_cocos2dx_experimental_video_VideoPlayer_setKeepAspectRatioEnabled); + tolua_function(tolua_S,"resume",lua_cocos2dx_experimental_video_VideoPlayer_resume); + tolua_function(tolua_S,"stop",lua_cocos2dx_experimental_video_VideoPlayer_stop); + tolua_function(tolua_S,"setFullScreenEnabled",lua_cocos2dx_experimental_video_VideoPlayer_setFullScreenEnabled); + tolua_function(tolua_S,"setFileName",lua_cocos2dx_experimental_video_VideoPlayer_setFileName); + tolua_function(tolua_S,"setURL",lua_cocos2dx_experimental_video_VideoPlayer_setURL); + tolua_function(tolua_S,"isKeepAspectRatioEnabled",lua_cocos2dx_experimental_video_VideoPlayer_isKeepAspectRatioEnabled); + tolua_function(tolua_S,"onPlayEvent",lua_cocos2dx_experimental_video_VideoPlayer_onPlayEvent); + tolua_function(tolua_S,"isFullScreenEnabled",lua_cocos2dx_experimental_video_VideoPlayer_isFullScreenEnabled); + tolua_function(tolua_S,"isPlaying",lua_cocos2dx_experimental_video_VideoPlayer_isPlaying); + tolua_function(tolua_S,"seekTo",lua_cocos2dx_experimental_video_VideoPlayer_seekTo); + tolua_function(tolua_S,"create", lua_cocos2dx_experimental_video_VideoPlayer_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::experimental::ui::VideoPlayer).name(); + g_luaType[typeName] = "ccexp.VideoPlayer"; + g_typeCast["VideoPlayer"] = "ccexp.VideoPlayer"; + return 1; +} +TOLUA_API int register_all_cocos2dx_experimental_video(lua_State* tolua_S) +{ + tolua_open(tolua_S); + + tolua_module(tolua_S,"ccexprimental",0); + tolua_beginmodule(tolua_S,"ccexprimental"); + + lua_register_cocos2dx_experimental_video_VideoPlayer(tolua_S); + + tolua_endmodule(tolua_S); + return 1; +} + +#endif diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.hpp new file mode 100644 index 0000000000..ca7986e43f --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.hpp @@ -0,0 +1,34 @@ +#include "base/ccConfig.h" +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) +#ifndef __cocos2dx_experimental_video_h__ +#define __cocos2dx_experimental_video_h__ + +#ifdef __cplusplus +extern "C" { +#endif +#include "tolua++.h" +#ifdef __cplusplus +} +#endif + +int register_all_cocos2dx_experimental_video(lua_State* tolua_S); + + + + + + + + + + + + + + + + + + +#endif // __cocos2dx_experimental_video_h__ +#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp index 9a70c65430..4aeaa3a638 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp @@ -1,3 +1,4 @@ +#include "base/ccConfig.h" #ifndef __cocos2dx_extension_h__ #define __cocos2dx_extension_h__ @@ -364,6 +365,7 @@ int register_all_cocos2dx_extension(lua_State* tolua_S); + #endif // __cocos2dx_extension_h__ diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp index 799661839b..e6a4da2f3c 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp @@ -1,4 +1,5 @@ #include "lua_cocos2dx_physics_auto.hpp" +#if CC_USE_PHYSICS #include "cocos2d.h" #include "tolua_fix.h" #include "LuaBasicConversions.h" @@ -10943,3 +10944,4 @@ TOLUA_API int register_all_cocos2dx_physics(lua_State* tolua_S) return 1; } +#endif diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp index ac13735604..6ef0ca4ab5 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp @@ -1,3 +1,5 @@ +#include "base/ccConfig.h" +#if CC_USE_PHYSICS #ifndef __cocos2dx_physics_h__ #define __cocos2dx_physics_h__ @@ -258,6 +260,8 @@ int register_all_cocos2dx_physics(lua_State* tolua_S); + #endif // __cocos2dx_physics_h__ +#endif //#if CC_USE_PHYSICS diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp index 8601fbf0f5..82266a8afb 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp @@ -1,3 +1,4 @@ +#include "base/ccConfig.h" #ifndef __cocos2dx_spine_h__ #define __cocos2dx_spine_h__ @@ -23,4 +24,5 @@ int register_all_cocos2dx_spine(lua_State* tolua_S); + #endif // __cocos2dx_spine_h__ diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp index 82c1e824ea..a97498c0c3 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp @@ -1,3 +1,4 @@ +#include "base/ccConfig.h" #ifndef __cocos2dx_studio_h__ #define __cocos2dx_studio_h__ @@ -490,6 +491,7 @@ int register_all_cocos2dx_studio(lua_State* tolua_S); + #endif // __cocos2dx_studio_h__ diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp index abb0672abd..a894093755 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp @@ -1,3 +1,4 @@ +#include "base/ccConfig.h" #ifndef __cocos2dx_ui_h__ #define __cocos2dx_ui_h__ @@ -394,6 +395,7 @@ int register_all_cocos2dx_ui(lua_State* tolua_S); + #endif // __cocos2dx_ui_h__ diff --git a/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp b/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp index e9c0598539..f695bb8ae6 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp +++ b/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp @@ -66,6 +66,8 @@ extern "C" { #include "lua_cocos2dx_physics_manual.hpp" #include "lua_cocos2dx_ui_auto.hpp" #include "lua_cocos2dx_ui_manual.hpp" +#include "lua_cocos2dx_experimental_video_auto.hpp" +#include "lua_cocos2dx_experimental_video_manual.hpp" namespace { int lua_print(lua_State * luastate) @@ -175,6 +177,11 @@ bool LuaStack::init(void) LuaObjcBridge::luaopen_luaoc(_state); #endif +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + register_all_cocos2dx_experimental_video(_state); + register_all_cocos2dx_experimental_video_manual(_state); +#endif + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) LuaJavaBridge::luaopen_luaj(_state); #endif diff --git a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.cpp b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.cpp new file mode 100644 index 0000000000..9b144fa828 --- /dev/null +++ b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.cpp @@ -0,0 +1,87 @@ +#include "lua_cocos2dx_experimental_video_manual.hpp" + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + +#include "UIVideoPlayer.h" +#include "tolua_fix.h" +#include "LuaBasicConversions.h" +#include "CCLuaValue.h" +#include "CCLuaEngine.h" + + + +static int lua_cocos2dx_experimental_video_VideoPlayer_addEventListener(lua_State* L) +{ + + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* self = nullptr; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; + if (!tolua_isusertype(L,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + self = static_cast(tolua_tousertype(L,1,0)); + +#if COCOS2D_DEBUG >= 1 + if (nullptr == self) { + tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_Widget_addTouchEventListener'\n", nullptr); + return 0; + } +#endif + + argc = lua_gettop(L) - 1; + + if (argc == 1) + { +#if COCOS2D_DEBUG >= 1 + if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err)) + { + goto tolua_lerror; + } +#endif + + LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0)); + + self->addEventListener([=](cocos2d::Ref* ref, cocos2d::experimental::ui::VideoPlayer::EventType eventType){ + LuaStack* stack = LuaEngine::getInstance()->getLuaStack(); + + stack->pushObject(ref, "cc.Ref"); + stack->pushInt((int)eventType); + + stack->executeFunctionByHandler(handler, 2); + }); + + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "addEventListener",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(L, "#ferror in function 'lua_cocos2dx_experimental_VideoPlayer_addEventListener'.", &tolua_err); +#endif + return 0; +} + +static void extendVideoPlayer(lua_State* L) +{ + lua_pushstring(L, "ccexp.VideoPlayer"); + lua_rawget(L, LUA_REGISTRYINDEX); + if (lua_istable(L,-1)) + { + tolua_function(L, "addEventListener", lua_cocos2dx_experimental_video_VideoPlayer_addEventListener); + } + lua_pop(L, 1); +} + +int register_all_cocos2dx_experimental_video_manual(lua_State* L) +{ + if (nullptr == L) + return 0; + + extendVideoPlayer(L); + + return 0; +} + +#endif diff --git a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.hpp b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.hpp new file mode 100644 index 0000000000..fa4072a24e --- /dev/null +++ b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.hpp @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ +#include "base/ccConfig.h" +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + +#ifndef COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_EXPERIMENTAL_VIDEO_MANUAL_H +#define COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_EXPERIMENTAL_VIDEO_MANUAL_H + +#ifdef __cplusplus +extern "C" { +#endif +#include "tolua++.h" +#ifdef __cplusplus +} +#endif + +TOLUA_API int register_all_cocos2dx_experimental_video_manual(lua_State* L); + +#endif // COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_EXPERIMENTAL_VIDEO_MANUAL_H +#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) diff --git a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj index afa4c1df66..8306a270c4 100644 --- a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj +++ b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj @@ -19,6 +19,10 @@ 1540AF58193EC30500717D8E /* xxtea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1540AF55193EC30500717D8E /* xxtea.cpp */; }; 1540AF59193EC30500717D8E /* xxtea.h in Headers */ = {isa = PBXBuildFile; fileRef = 1540AF56193EC30500717D8E /* xxtea.h */; }; 1540AF5A193EC30500717D8E /* xxtea.h in Headers */ = {isa = PBXBuildFile; fileRef = 1540AF56193EC30500717D8E /* xxtea.h */; }; + 15AECE12195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15AECE10195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.cpp */; }; + 15AECE13195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15AECE11195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.hpp */; }; + 15AECE16195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15AECE14195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.cpp */; }; + 15AECE17195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15AECE15195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.hpp */; }; 1A262AB818BEEF5900D2DB92 /* tolua_fix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A262AB718BEEF5900D2DB92 /* tolua_fix.cpp */; }; 1A262AB918BEEF5900D2DB92 /* tolua_fix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A262AB718BEEF5900D2DB92 /* tolua_fix.cpp */; }; 1AACE7B518BC45C200215002 /* lua_cocos2dx_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AACE74918BC45C200215002 /* lua_cocos2dx_auto.cpp */; }; @@ -220,6 +224,10 @@ 1503FAA018DA8A1C00F6518C /* io.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = io.h; sourceTree = ""; }; 1540AF55193EC30500717D8E /* xxtea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xxtea.cpp; sourceTree = ""; }; 1540AF56193EC30500717D8E /* xxtea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xxtea.h; sourceTree = ""; }; + 15AECE10195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_experimental_video_auto.cpp; sourceTree = ""; }; + 15AECE11195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_experimental_video_auto.hpp; sourceTree = ""; }; + 15AECE14195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_experimental_video_manual.cpp; sourceTree = ""; }; + 15AECE15195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_experimental_video_manual.hpp; sourceTree = ""; }; 1A262AB718BEEF5900D2DB92 /* tolua_fix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tolua_fix.cpp; sourceTree = ""; }; 1AACE74618BC45A000215002 /* libluabindings Mac.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libluabindings Mac.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 1AACE74718BC45A000215002 /* libluabindings iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libluabindings iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -365,6 +373,8 @@ 1AACE74818BC45C200215002 /* auto */ = { isa = PBXGroup; children = ( + 15AECE10195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.cpp */, + 15AECE11195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.hpp */, 2905FACE18CF12E600240AA3 /* lua_cocos2dx_ui_auto.cpp */, 2905FACF18CF12E600240AA3 /* lua_cocos2dx_ui_auto.hpp */, 1AACE74918BC45C200215002 /* lua_cocos2dx_auto.cpp */, @@ -385,6 +395,8 @@ 1AACE75B18BC45C200215002 /* manual */ = { isa = PBXGroup; children = ( + 15AECE14195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.cpp */, + 15AECE15195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.hpp */, 2905FAD418CF143800240AA3 /* lua_cocos2dx_ui_manual.cpp */, 2905FAD518CF143800240AA3 /* lua_cocos2dx_ui_manual.hpp */, 1AACE75E18BC45C200215002 /* CCBProxy.cpp */, @@ -611,8 +623,10 @@ 1ABCA1ED18CD8F470087CE3A /* lua.h in Headers */, 1AACE7F418BC45C200215002 /* lua_cocos2dx_coco_studio_manual.hpp in Headers */, 1ABCA26818CD8F7D0087CE3A /* udp.h in Headers */, + 15AECE17195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.hpp in Headers */, 1ABCA25418CD8F7D0087CE3A /* select.h in Headers */, 1AACE7D618BC45C200215002 /* lua_cocos2dx_studio_auto.hpp in Headers */, + 15AECE13195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.hpp in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -752,9 +766,11 @@ 1AACE81E18BC45C200215002 /* LuaOpengl.cpp in Sources */, 1AACE7CE18BC45C200215002 /* lua_cocos2dx_spine_auto.cpp in Sources */, 1AACE80218BC45C200215002 /* lua_cocos2dx_manual.cpp in Sources */, + 15AECE16195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.cpp in Sources */, 1ABCA23E18CD8F7D0087CE3A /* luasocket.c in Sources */, 1ABCA25218CD8F7D0087CE3A /* select.c in Sources */, 1ABCA24A18CD8F7D0087CE3A /* mime.c in Sources */, + 15AECE12195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.cpp in Sources */, 1540AF58193EC30500717D8E /* xxtea.cpp in Sources */, 1ABCA26218CD8F7D0087CE3A /* timeout.c in Sources */, 1503FAA618DA8A1C00F6518C /* io.c in Sources */, diff --git a/cocos/scripting/lua-bindings/script/experimentalConstants.lua b/cocos/scripting/lua-bindings/script/experimentalConstants.lua new file mode 100644 index 0000000000..9fea50ca3b --- /dev/null +++ b/cocos/scripting/lua-bindings/script/experimentalConstants.lua @@ -0,0 +1,9 @@ +ccexprimental = ccexprimental or {} + + +ccexprimental.VideoPlayerEvent = { + PLAYING = 0, + PAUSED = 1, + STOPPED= 2, + COMPLETED =3, +} diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 7665651405..9729fc1397 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -3930,6 +3930,7 @@ "cocos/scripting/lua-bindings/auto/api/Twirl.lua", "cocos/scripting/lua-bindings/auto/api/UserDefault.lua", "cocos/scripting/lua-bindings/auto/api/VBox.lua", + "cocos/scripting/lua-bindings/auto/api/VideoPlayer.lua", "cocos/scripting/lua-bindings/auto/api/VisibleFrame.lua", "cocos/scripting/lua-bindings/auto/api/Waves.lua", "cocos/scripting/lua-bindings/auto/api/Waves3D.lua", @@ -3937,6 +3938,7 @@ "cocos/scripting/lua-bindings/auto/api/Widget.lua", "cocos/scripting/lua-bindings/auto/api/ZOrderFrame.lua", "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua", + "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_experimental_video_auto_api.lua", "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_extension_auto_api.lua", "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_physics_auto_api.lua", "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_spine_auto_api.lua", @@ -3944,6 +3946,8 @@ "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_ui_auto_api.lua", "cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp", "cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp", + "cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp", + "cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.hpp", "cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp", "cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp", "cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp", @@ -3980,6 +3984,8 @@ "cocos/scripting/lua-bindings/manual/lua_cocos2dx_coco_studio_manual.hpp", "cocos/scripting/lua-bindings/manual/lua_cocos2dx_deprecated.cpp", "cocos/scripting/lua-bindings/manual/lua_cocos2dx_deprecated.h", + "cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.cpp", + "cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.hpp", "cocos/scripting/lua-bindings/manual/lua_cocos2dx_extension_manual.cpp", "cocos/scripting/lua-bindings/manual/lua_cocos2dx_extension_manual.h", "cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp", @@ -4022,6 +4028,7 @@ "cocos/scripting/lua-bindings/script/Opengl.lua", "cocos/scripting/lua-bindings/script/OpenglConstants.lua", "cocos/scripting/lua-bindings/script/StudioConstants.lua", + "cocos/scripting/lua-bindings/script/experimentalConstants.lua", "cocos/scripting/lua-bindings/script/extern.lua", "cocos/scripting/lua-bindings/script/json.lua", "cocos/scripting/lua-bindings/script/luaj.lua", @@ -4406,6 +4413,7 @@ "tools/bindings-generator/tools/win32/cygwin1.dll", "tools/tolua/README.mdown", "tools/tolua/cocos2dx.ini", + "tools/tolua/cocos2dx_experimental_video.ini", "tools/tolua/cocos2dx_extension.ini", "tools/tolua/cocos2dx_physics.ini", "tools/tolua/cocos2dx_spine.ini", diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj index 067c0a1743..bdde18eec0 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj +++ b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 15A8A4841834C73500142BE0 /* libcocos2dx-extensions Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15A8A4191834BDA200142BE0 /* libcocos2dx-extensions Mac.a */; }; 15A8A4851834C73500142BE0 /* libCocosDenshion Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15A8A41F1834BDA200142BE0 /* libCocosDenshion Mac.a */; }; 15A8A4881834C90F00142BE0 /* libcurl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15A8A4871834C90E00142BE0 /* libcurl.dylib */; }; + 15AECE29195D482800907DB0 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15AECE28195D482800907DB0 /* MediaPlayer.framework */; }; 1AF4C403178663F200122817 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AF4C402178663F200122817 /* libz.dylib */; }; 5023811817EBBCAC00990C9B /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5023810817EBBCAC00990C9B /* AppController.mm */; }; 5023811917EBBCAC00990C9B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023810917EBBCAC00990C9B /* Default-568h@2x.png */; }; @@ -277,6 +278,7 @@ /* Begin PBXFileReference section */ 15A8A4031834BDA200142BE0 /* cocos2d_libs.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2d_libs.xcodeproj; path = "../../cocos2d-x/build/cocos2d_libs.xcodeproj"; sourceTree = ""; }; 15A8A4871834C90E00142BE0 /* libcurl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcurl.dylib; path = usr/lib/libcurl.dylib; sourceTree = SDKROOT; }; + 15AECE28195D482800907DB0 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; }; 15C1568D1683131500D239F2 /* libcurl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcurl.a; path = "../../cocos2d-x/cocos2dx/platform/third_party/ios/libraries/libcurl.a"; sourceTree = ""; }; 1AF4C402178663F200122817 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 5023810717EBBCAC00990C9B /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; @@ -375,6 +377,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 15AECE29195D482800907DB0 /* MediaPlayer.framework in Frameworks */, C03781F618BF65B100FE4F13 /* libluabindings iOS.a in Frameworks */, 15A8A4441834C43700142BE0 /* libchipmunk iOS.a in Frameworks */, 15A8A4451834C43700142BE0 /* libcocos2dx iOS.a in Frameworks */, @@ -523,6 +526,7 @@ F293B3CB15EB7BE500256477 /* Frameworks */ = { isa = PBXGroup; children = ( + 15AECE28195D482800907DB0 /* MediaPlayer.framework */, 15A8A4871834C90E00142BE0 /* libcurl.dylib */, D6B061341803AC000077942B /* CoreMotion.framework */, 50D7C96F17EBBEEC005D0B91 /* IOKit.framework */, diff --git a/tests/cpp-tests/Resources/ccs-res b/tests/cpp-tests/Resources/ccs-res index 0f11440a03..c307f62357 160000 --- a/tests/cpp-tests/Resources/ccs-res +++ b/tests/cpp-tests/Resources/ccs-res @@ -1 +1 @@ -Subproject commit 0f11440a037f594ee1bc0cfb5253610a640a984c +Subproject commit c307f62357e42d2e7e671f4741f855dc8a5fde3a diff --git a/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua b/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua new file mode 100644 index 0000000000..022745d079 --- /dev/null +++ b/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua @@ -0,0 +1,148 @@ +require("experimentalConstants") + + +local visibleRect = cc.Director:getInstance():getOpenGLView():getVisibleRect() +local centerPos = cc.p(visibleRect.x + visibleRect.width / 2,visibleRect.y + visibleRect.height /2) + +local function VideoPlayerTest() + local layer = cc.Layer:create() --createTestLayer("VideoPlayerTest", "") + titleLabel = cc.Label:createWithTTF("VideoPlayerTest", s_arialPath, 28) + titleLabel:setAnchorPoint(cc.p(0.5, 0.5)) + layer:addChild(titleLabel, 1) + + cc.MenuItemFont:setFontSize(16) + + widget = ccs.GUIReader:getInstance():widgetFromJsonFile("cocosui/UITest/UITest.json") + layer:addChild(widget) + + local videoStateLabel = cc.Label:createWithSystemFont("IDLE","Arial",16) + videoStateLabel:setAnchorPoint(cc.p(1, 0.5)) + videoStateLabel:setPosition(cc.p(visibleRect.x + visibleRect.width - 10,visibleRect.y + 200)) + layer:addChild(videoStateLabel) + + local function onVideoEventCallback(sener, eventType) + if eventType == ccexprimental.VideoPlayerEvent.PLAYING then + videoStateLabel:setString("PLAYING") + elseif eventType == ccexprimental.VideoPlayerEvent.PAUSED then + videoStateLabel:setString("PAUSED") + elseif eventType == ccexprimental.VideoPlayerEvent.STOPPED then + videoStateLabel:setString("STOPPED") + elseif eventType == ccexprimental.VideoPlayerEvent.COMPLETED then + videoStateLabel:setString("COMPLETED") + end + end + local widgetSize = widget:getContentSize() + local videoPlayer = ccexprimental.VideoPlayer:create() + videoPlayer:setPosition(centerPos) + videoPlayer:setAnchorPoint(cc.p(0.5, 0.5)) + videoPlayer:setContentSize(cc.size(widgetSize.width * 0.4,widgetSize.height * 0.4)) + videoPlayer:addEventListener(onVideoEventCallback) + layer:addChild(videoPlayer) + + local screenSize = cc.Director:getInstance():getWinSize() + local rootSize = widget:getContentSize() + layer:setPosition(cc.p((screenSize.width - rootSize.width) / 2,(screenSize.height - rootSize.height) / 2)) + + local function menuFullScreenCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:setFullScreenEnabled(not videoPlayer:isFullScreenEnabled()) + end + end + local fullSwitch = cc.MenuItemFont:create("FullScreenSwitch") + fullSwitch:setAnchorPoint(cc.p(0.0, 0.0)) + fullSwitch:setPosition(cc.p(visibleRect.x + 10,visibleRect.y + 50)) + fullSwitch:registerScriptTapHandler(menuFullScreenCallback) + + local function menuPauseCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:pause() + end + end + local pauseItem = cc.MenuItemFont:create("Pause") + pauseItem:setAnchorPoint(cc.p(0.0, 0.0)) + pauseItem:setPosition(cc.p(visibleRect.x + 10,visibleRect.y + 100)) + pauseItem:registerScriptTapHandler(menuPauseCallback) + + local function menuResumeCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:resume() + end + end + local resumeItem = cc.MenuItemFont:create("Resume") + resumeItem:setAnchorPoint(cc.p(0.0, 0.0)) + resumeItem:setPosition(cc.p(visibleRect.x + 10,visibleRect.y + 150)) + resumeItem:registerScriptTapHandler(menuResumeCallback) + + local function menuStopCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:stop() + end + end + local stopItem = cc.MenuItemFont:create("Stop") + stopItem:setAnchorPoint(cc.p(0.0, 0.0)) + stopItem:setPosition(cc.p(visibleRect.x + 10,visibleRect.y + 200)) + stopItem:registerScriptTapHandler(menuStopCallback) + + local function menuHintCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:setVisible(not videoPlayer:isVisible()) + end + end + local hintItem = cc.MenuItemFont:create("Hint") + hintItem:setAnchorPoint(cc.p(0.0, 0.0)) + hintItem:setPosition(cc.p(visibleRect.x + 10,visibleRect.y + 250)) + hintItem:registerScriptTapHandler(menuHintCallback) + + ------------------------------------------------------------ + local function menuResourceVideoCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:setFileName("res/cocosvideo.mp4") + videoPlayer:play() + end + end + + local resourceVideo = cc.MenuItemFont:create("Play resource video") + resourceVideo:setAnchorPoint(cc.p(1, 0.5)) + resourceVideo:setPosition(cc.p(visibleRect.x + visibleRect.width - 10,visibleRect.y + 50)) + resourceVideo:registerScriptTapHandler(menuResourceVideoCallback) + + local function menuOnlineVideoCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:setURL("http://video001.smgbb.cn/gslb/program/FDN/FDN1190949/HLSVodService.m3u8?_mdCode=6065719&_cdnCode=B2B_XL_TEST&_type=0&_rCode=TerOut_18865&_userId=020341000456068&_categoryCode=SMG_HUAYU&_categoryPath=SMG_1002,SMG_HUAYU,&_adPositionId=01001000&_adCategorySource=0&_flag=.m3u8&_enCode=m3u8&taskID=ysh_ps_002-ott_1397459105893_020341000456068&_client=103&_cms=ctv&_CDNToken=76C043FD4969501754DC19E54EC8DC2C") + videoPlayer:play() + end + end + local onlineVideo = cc.MenuItemFont:create("Play online video") + onlineVideo:setAnchorPoint(cc.p(1, 0.5)) + onlineVideo:setPosition(cc.p(visibleRect.x + visibleRect.width - 10,visibleRect.y + 100)) + onlineVideo:registerScriptTapHandler(menuOnlineVideoCallback) + + local function menuRatioCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:setKeepAspectRatioEnabled(not videoPlayer:isKeepAspectRatioEnabled()) + end + end + local ratioSwitch = cc.MenuItemFont:create("KeepRatioSwitch") + ratioSwitch:setAnchorPoint(cc.p(1, 0.5)) + ratioSwitch:setPosition(cc.p(visibleRect.x + visibleRect.width - 10,visibleRect.y + 150)) + ratioSwitch:registerScriptTapHandler(menuRatioCallback) + + local menu = cc.Menu:create(fullSwitch, pauseItem, resumeItem, stopItem, hintItem, resourceVideo, onlineVideo, ratioSwitch) + menu:setPosition(cc.p(0.0, 0.0)) + layer:addChild(menu) + + return layer +end + + + +function VideoPlayerTestMain() + Helper.index = 1 + local scene = cc.Scene:create() + Helper.createFunctionTable = { + VideoPlayerTest + } + scene:addChild(VideoPlayerTest()) + scene:addChild(CreateBackMenuItem()) + return scene +end \ No newline at end of file diff --git a/tests/lua-tests/src/mainMenu.lua b/tests/lua-tests/src/mainMenu.lua index 436b473cca..e52de85e36 100644 --- a/tests/lua-tests/src/mainMenu.lua +++ b/tests/lua-tests/src/mainMenu.lua @@ -54,6 +54,7 @@ require "src/LuaBridgeTest/LuaBridgeTest" require "src/XMLHttpRequestTest/XMLHttpRequestTest" require "src/PhysicsTest/PhysicsTest" require "src/CaptureScreenTest/CaptureScreenTest" +require "src/VideoPlayerTest/VideoPlayerTest" local LINE_SPACE = 40 @@ -116,6 +117,7 @@ local _allTests = { { isSupported = true, name = "TouchesTest" , create_func = TouchesTest }, { isSupported = true, name = "TransitionsTest" , create_func = TransitionsTest }, { isSupported = true, name = "UserDefaultTest" , create_func= UserDefaultTestMain }, + { isSupported = true, name = "VideoPlayerTest" , create_func= VideoPlayerTestMain }, { isSupported = true, name = "XMLHttpRequestTest" , create_func = XMLHttpRequestTestMain }, { isSupported = true, name = "ZwoptexTest" , create_func = ZwoptexTestMain } } @@ -171,6 +173,13 @@ function CreateTestMenu() if not obj.isSupported then testMenuItem:setEnabled(false) end + + if obj.name == "VideoPlayerTest" then + if cc.PLATFORM_OS_IPHONE ~= targetPlatform and cc.PLATFORM_OS_ANDROID ~= targetPlatform then + testMenuItem:setEnabled(false) + end + end + testMenuItem:registerScriptTapHandler(menuCallback) testMenuItem:setPosition(cc.p(s.width / 2, (s.height - (index) * LINE_SPACE))) MainMenu:addChild(testMenuItem, index + 10000, index + 10000) diff --git a/tools/bindings-generator b/tools/bindings-generator index 0c16c3107b..132282d67a 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 0c16c3107b5c8b54e7414d7e984e21c3f242f33c +Subproject commit 132282d67aff8da7113f4a00596aac75e7b4528d diff --git a/tools/tolua/cocos2dx_experimental_video.ini b/tools/tolua/cocos2dx_experimental_video.ini new file mode 100644 index 0000000000..80bf9a254a --- /dev/null +++ b/tools/tolua/cocos2dx_experimental_video.ini @@ -0,0 +1,62 @@ +[cocos2dx_experimental_video] +# the prefix to be added to the generated functions. You might or might not use this in your own +# templates +prefix = cocos2dx_experimental_video + +# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`) +# all classes will be embedded in that namespace +target_namespace = ccexprimental + +macro_judgement = #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + +android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include +android_flags = -D_SIZE_T_DEFINED_ + +clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include +clang_flags = -nostdinc -x c++ -std=c++11 + +cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/editor-support -I%(cocosdir)s/cocos/platform/android + +cocos_flags = -DANDROID + +cxxgenerator_headers = + +# extra arguments for clang +extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s + +# what headers to parse +headers = %(cocosdir)s/cocos/ui/UIVideoPlayer.h + +# what classes to produce code for. You can use regular expressions here. When testing the regular +# expression, it will be enclosed in "^$", like this: "^Menu*$". +classes = VideoPlayer + +# what should we skip? in the format ClassName::[function function] +# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also +# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just +# add a single "*" as functions. See bellow for several examples. A special class name is "*", which +# will apply to all class names. This is a convenience wildcard to be able to skip similar named +# functions from all classes. + +skip = VideoPlayer::[addEventListener] + +rename_functions = + +rename_classes = + +# for all class names, should we remove something when registering in the target VM? +remove_prefix = + +# classes for which there will be no "parent" lookup +classes_have_no_parents = + +# base classes which will be skipped when their sub-classes found them. +base_classes_to_skip = + +# classes that create no constructor +# Set is special and we will use a hand-written constructor +abstract_classes = + +# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'. +script_control_cpp = no + diff --git a/tools/tolua/cocos2dx_physics.ini b/tools/tolua/cocos2dx_physics.ini index 6911e254cb..dca3e11f6f 100644 --- a/tools/tolua/cocos2dx_physics.ini +++ b/tools/tolua/cocos2dx_physics.ini @@ -7,6 +7,8 @@ prefix = cocos2dx_physics # all classes will be embedded in that namespace target_namespace = cc +macro_judgement = #if CC_USE_PHYSICS + android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include android_flags = -D_SIZE_T_DEFINED_ diff --git a/tools/tolua/genbindings.py b/tools/tolua/genbindings.py index 6e8b59c35d..1fc2d34868 100755 --- a/tools/tolua/genbindings.py +++ b/tools/tolua/genbindings.py @@ -132,6 +132,7 @@ def main(): 'cocos2dx_studio.ini' : ('cocos2dx_studio', 'lua_cocos2dx_studio_auto'), \ 'cocos2dx_spine.ini' : ('cocos2dx_spine', 'lua_cocos2dx_spine_auto'), \ 'cocos2dx_physics.ini' : ('cocos2dx_physics', 'lua_cocos2dx_physics_auto'), \ + 'cocos2dx_experimental_video.ini' : ('cocos2dx_experimental_video', 'lua_cocos2dx_experimental_video_auto'), \ } target = 'lua' generator_py = '%s/generator.py' % cxx_generator_root