From ae320b5f9ccc4c68992620d0ae7f19cd2d8350c2 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 10 Sep 2012 18:38:18 +0800 Subject: [PATCH] stage sth. --- cocos2dx/script_support/CCScriptSupport.cpp | 20 ++++---- cocos2dx/script_support/CCScriptSupport.h | 53 +++++++-------------- 2 files changed, 26 insertions(+), 47 deletions(-) diff --git a/cocos2dx/script_support/CCScriptSupport.cpp b/cocos2dx/script_support/CCScriptSupport.cpp index 9c456d3674..4e99165548 100644 --- a/cocos2dx/script_support/CCScriptSupport.cpp +++ b/cocos2dx/script_support/CCScriptSupport.cpp @@ -27,8 +27,8 @@ NS_CC_BEGIN -#pragma mark - -#pragma mark CCScriptHandlerEntry +// #pragma mark - +// #pragma mark CCScriptHandlerEntry CCScriptHandlerEntry* CCScriptHandlerEntry::create(int nHandler) { @@ -42,8 +42,8 @@ CCScriptHandlerEntry::~CCScriptHandlerEntry(void) CCScriptEngineManager::sharedManager()->getScriptEngine()->removeLuaHandler(m_nHandler); } -#pragma mark - -#pragma mark CCSchedulerScriptHandlerEntry +// #pragma mark - +// #pragma mark CCSchedulerScriptHandlerEntry CCSchedulerScriptHandlerEntry* CCSchedulerScriptHandlerEntry::create(int nHandler, float fInterval, bool bPaused) { @@ -71,8 +71,8 @@ CCSchedulerScriptHandlerEntry::~CCSchedulerScriptHandlerEntry(void) } -#pragma mark - -#pragma mark CCTouchScriptHandlerEntry +// #pragma mark - +// #pragma mark CCTouchScriptHandlerEntry CCTouchScriptHandlerEntry* CCTouchScriptHandlerEntry::create(int nHandler, bool bIsMultiTouches, @@ -101,8 +101,8 @@ bool CCTouchScriptHandlerEntry::init(bool bIsMultiTouches, int nPriority, bool b } -#pragma mark - -#pragma mark CCScriptValue +// #pragma mark - +// #pragma mark CCScriptValue const CCScriptValue CCScriptValue::intValue(const int intValue) { @@ -232,8 +232,8 @@ void CCScriptValue::copy(const CCScriptValue& rhs) } -#pragma mark - -#pragma mark CCScriptEngineManager +// #pragma mark - +// #pragma mark CCScriptEngineManager static CCScriptEngineManager* s_pSharedScriptEngineManager = NULL; diff --git a/cocos2dx/script_support/CCScriptSupport.h b/cocos2dx/script_support/CCScriptSupport.h index a1b4857594..99a20e5a72 100644 --- a/cocos2dx/script_support/CCScriptSupport.h +++ b/cocos2dx/script_support/CCScriptSupport.h @@ -46,8 +46,8 @@ typedef int LUA_FUNCTION; typedef int LUA_TABLE; typedef int LUA_STRING; -#pragma mark - -#pragma mark CCScriptHandlerEntry +// #pragma mark - +// #pragma mark CCScriptHandlerEntry class CCScriptHandlerEntry : public CCObject { @@ -81,8 +81,8 @@ protected: * @{ */ -#pragma mark - -#pragma mark CCSchedulerScriptHandlerEntry +// #pragma mark - +// #pragma mark CCSchedulerScriptHandlerEntry class CCTimer; @@ -125,8 +125,8 @@ private: }; -#pragma mark - -#pragma mark CCTouchScriptHandlerEntry +// #pragma mark - +// #pragma mark CCTouchScriptHandlerEntry class CCTouchScriptHandlerEntry : public CCScriptHandlerEntry { @@ -161,8 +161,8 @@ private: bool m_bSwallowsTouches; }; -#pragma mark - -#pragma mark CCScriptValue +// #pragma mark - +// #pragma mark CCScriptValue class CCScriptValue; @@ -259,8 +259,8 @@ private: }; -#pragma mark - -#pragma mark CCScriptEngineProtocol +// #pragma mark - +// #pragma mark CCScriptEngineProtocol // Don't make CCScriptEngineProtocol inherits from CCObject since setScriptEngine is invoked only once in AppDelegate.cpp, // It will affect the lifecycle of ScriptCore instance, the autorelease pool will be destroyed before destructing ScriptCore. @@ -271,31 +271,20 @@ public: virtual ~CCScriptEngineProtocol() {}; virtual ccScriptType getScriptType() { return kScriptTypeNone; }; + /** - @brief Method used to get a pointer to the lua_State that the script module is attached to. - @return A pointer to the lua_State that the script module is attached to. + @brief Remove scripte object. + @param object to remove, + in LuaBinding, it's m_nLuaID in CCObject, + in JSBinding it means current CCObject pointer. */ - virtual lua_State* getLuaState(void) = 0; - - /** - @brief Remove CCObject from lua state - @param object to remove - */ - virtual void removeCCObjectByID(int nLuaID) = 0; - virtual void removeJSObjectByCCObject(void * cobj) = 0; - + virtual void removeScriptObjectByID(int nId) = 0; /** @brief Remove Lua function handler */ virtual void removeLuaHandler(int nHandler) = 0; - /** - @brief Add a path to find lua files in - @param path to be added to the Lua path - */ - virtual void addSearchPath(const char* path) = 0; - /** @brief Execute script code contained in the given string. @param codes holding the valid script code that should be executed. @@ -331,16 +320,6 @@ public: virtual int executeFunctionWithCCObject(int nHandler, CCObject* pObject, const char* typeName) = 0; virtual int executeFunctionWithStringData(int nHandler, const char* data) = 0; - virtual int pushIntegerData(int data) = 0; - virtual int pushFloatData(float data) = 0; - virtual int pushBooleanData(bool data) = 0; - virtual int pushStringData(const char* data) = 0; - virtual int pushCCObject(CCObject* pObject, const char* typeName) = 0; - virtual int pushCCScriptValue(const CCScriptValue& value) = 0; - virtual int pushCCScriptValueDict(const CCScriptValueDict& dict) = 0; - virtual int pushCCScriptValueArray(const CCScriptValueArray& array) = 0; - virtual void cleanStack(void) = 0; - // execute a schedule function virtual int executeSchedule(int nHandler, float dt, CCNode *self = NULL) = 0;