diff --git a/cocos/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id b/cocos/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id index a33c70d7bd..c47aa3ee8c 100644 --- a/cocos/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id +++ b/cocos/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id @@ -1 +1 @@ -16af4ad046f4db00af7a229d89c406054d8616c3 \ No newline at end of file +4d5ce0b03be411b27323ef9800c2a292e03499f9 \ No newline at end of file diff --git a/cocos/scripting/javascript/bindings/cocos2d_specifics.hpp b/cocos/scripting/javascript/bindings/cocos2d_specifics.hpp index e43b3804dd..4e4b4c7217 100644 --- a/cocos/scripting/javascript/bindings/cocos2d_specifics.hpp +++ b/cocos/scripting/javascript/bindings/cocos2d_specifics.hpp @@ -3,6 +3,7 @@ #include "jsapi.h" #include "ScriptingCore.h" +#include "platform/CCSAXParser.h" class JSScheduleWrapper; @@ -200,5 +201,44 @@ private: }; +class CC_DLL __JSSAXDelegator: public cocos2d::SAXDelegator +{ +public: + static __JSSAXDelegator* getInstance() { + static __JSSAXDelegator* pInstance = NULL; + if (pInstance == NULL) { + pInstance = new __JSSAXDelegator(); + } + return pInstance; + }; + + ~__JSSAXDelegator(); + + cocos2d::SAXParser* getParser(); + + std::string parse(std::string path); + + bool preloadPlist(std::string path) { + return true; + } + + std::string getList(std::string path) { + return path; + } + + // implement pure virtual methods of SAXDelegator + void startElement(void *ctx, const char *name, const char **atts); + void endElement(void *ctx, const char *name); + void textHandler(void *ctx, const char *ch, int len); + +private: + cocos2d::SAXParser _parser; + JSObject* _obj; + std::string _result; + bool _isStoringCharacters; + std::string _currentValue; +}; + + #endif diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index 99f57b9e8e..63c3187997 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos/2d/cocos2d.h %(cocosdir)s/cocos/audio/include/Simpl # 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 = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak TextFieldTTF EGLViewProtocol EGLView Component __NodeRGBA __LayerRGBA +classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak TextFieldTTF EGLViewProtocol EGLView Component __NodeRGBA __LayerRGBA SAXParser classes_need_extend = Node Layer.* Sprite MenuItemFont Scene DrawNode @@ -60,11 +60,11 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat Texture2D::[initWithPVRTCData addPVRTCImage releaseData setTexParameters initWithData keepData getPixelFormatInfoMap], Set::[begin end acceptVisitor], IMEDispatcher::[*], - SAXParser::[*], Thread::[*], Profiler::[*], ProfilingTimer::[*], CallFunc::[create initWithFunction], + SAXParser::[(?!(init))], SAXDelegator::[*], Color3bObject::[*], TouchDispatcher::[*], @@ -136,14 +136,14 @@ rename_classes = ParticleSystemQuad::ParticleSystem, remove_prefix = # classes for which there will be no "parent" lookup -classes_have_no_parents = Node Director SimpleAudioEngine FileUtils TMXMapInfo Application EGLViewProtocol +classes_have_no_parents = Node Director SimpleAudioEngine FileUtils TMXMapInfo Application EGLViewProtocol SAXParser # base classes which will be skipped when their sub-classes found them. base_classes_to_skip = Object Clonable # classes that create no constructor # Set is special and we will use a hand-written constructor -abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application ClippingNode Label EGLViewProtocol EGLView Component +abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application ClippingNode Label EGLViewProtocol EGLView Component SAXParser # 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