#include <ScriptingCore.h>
Public Member Functions | |
| ~ScriptingCore () | |
| virtual cocos2d::ccScriptType | getScriptType () |
| Get script type. More... | |
| local | getScriptType () |
| Get script type. More... | |
| virtual void | removeScriptObjectByObject (cocos2d::Object *pObj) |
| Remove Object from lua state. More... | |
| local | removeScriptObjectByObject ( local pObj) |
| Remove Object from lua state. More... | |
| virtual int | executeString (const char *codes) |
| Execute script code contained in the given string. More... | |
| void | pauseSchedulesAndActions (js_proxy_t *p) |
| void | resumeSchedulesAndActions (js_proxy_t *p) |
| void | cleanupSchedulesAndActions (js_proxy_t *p) |
| virtual int | executeScriptFile (const char *filename) |
| Execute a script file. More... | |
| local | executeScriptFile ( local filename) |
| Execute a script file. More... | |
| virtual int | executeGlobalFunction (const char *functionName) |
| Execute a scripted global function. More... | |
| virtual int | sendEvent (cocos2d::ScriptEvent *message) override |
| when trigger a script event ,call this func,add params needed into ScriptEvent object.nativeObject is object triggering the event, can be nullptr in lua More... | |
| virtual bool | parseConfig (ConfigType type, const std::string &str) override |
| Parse configuration file. More... | |
| local | parseConfig ( local type, local str) |
| Parse configuration file. More... | |
| virtual bool | handleAssert (const char *msg) |
| called by CCAssert to allow scripting engine to handle failed assertions More... | |
| var | handleAssert ( var msg) |
| called by CCAssert to allow scripting engine to handle failed assertions More... | |
| local | handleAssert ( local msg) |
| called by CCAssert to allow scripting engine to handle failed assertions More... | |
| bool | executeFunctionWithObjectData (cocos2d::Node *self, const char *name, JSObject *obj) |
| JSBool | executeFunctionWithOwner (jsval owner, const char *name, uint32_t argc=0, jsval *vp=NULL, jsval *retVal=NULL) |
| local | executeFunctionWithOwner ( local owner, local name, local 0, local NULL, local NULL) |
| void | executeJSFunctionWithThisObj (jsval thisObj, jsval callback, uint32_t argc=0, jsval *vp=NULL, jsval *retVal=NULL) |
| JSBool | evalString (const char *string, jsval *outVal, const char *filename=NULL, JSContext *cx=NULL, JSObject *global=NULL) |
| will eval the specified string More... | |
| JSBool | runScript (const char *path, JSObject *global=NULL, JSContext *cx=NULL) |
| will run the specified string More... | |
| void | start () |
| initialize everything More... | |
| void | cleanup () |
| cleanup everything More... | |
| void | reset () |
| cleanup everything then initialize everything More... | |
| void | addRegisterCallback (sc_register_sth callback) |
| will add the register_sth callback to the list of functions that need to be called after the creation of the context More... | |
| void | createGlobalContext () |
| Will create a new context. More... | |
| int | executeCustomTouchEvent (cocos2d::EventTouch::EventCode eventType, cocos2d::Touch *pTouch, JSObject *obj, jsval &retval) |
| int | executeCustomTouchEvent (cocos2d::EventTouch::EventCode eventType, cocos2d::Touch *pTouch, JSObject *obj) |
| var | executeCustomTouchEvent ( var eventType, var pTouch, var obj) |
| local | executeCustomTouchEvent ( local eventType, local pTouch, local obj) |
| int | executeCustomTouchesEvent (cocos2d::EventTouch::EventCode eventType, const std::vector< cocos2d::Touch * > &touches, JSObject *obj) |
| JSContext * | getGlobalContext () |
| JSBool | setReservedSpot (uint32_t i, JSObject *obj, jsval value) |
| void | debugProcessInput (const std::string &str) |
| enable the debug environment More... | |
| void | enableDebugger () |
| JSObject * | getDebugGlobal () |
| local | getDebugGlobal () |
| JSObject * | getGlobalObject () |
| local | getGlobalObject () |
Public Member Functions inherited from ScriptEngineProtocol | |
| virtual | ~ScriptEngineProtocol () |
| virtual void | removeScriptHandler (int handler) |
| Remove script function handler, only LuaEngine class need to implement this function. More... | |
| virtual int | reallocateScriptHandler (int handler) |
| Reallocate script function handler, only LuaEngine class need to implement this function. More... | |
Static Public Member Functions | |
| static ScriptingCore * | getInstance () |
| static void | removeAllRoots (JSContext *cx) |
| local | removeAllRoots ( local cx) |
| static void | reportError (JSContext *cx, const char *message, JSErrorReport *report) |
| static JSBool | log (JSContext *cx, uint32_t argc, jsval *vp) |
| Log something using CCLog. More... | |
| local | log ( local cx, local argc, local vp) |
| Log something using CCLog. More... | |
| static JSBool | executeScript (JSContext *cx, uint32_t argc, jsval *vp) |
| run a script from script :) More... | |
| local | executeScript ( local cx, local argc, local vp) |
| run a script from script :) More... | |
| static JSBool | forceGC (JSContext *cx, uint32_t argc, jsval *vp) |
| Force a cycle of GC. More... | |
| local | forceGC ( local cx, local argc, local vp) |
| Force a cycle of GC. More... | |
| static JSBool | dumpRoot (JSContext *cx, uint32_t argc, jsval *vp) |
| static JSBool | addRootJS (JSContext *cx, uint32_t argc, jsval *vp) |
| local | addRootJS ( local cx, local argc, local vp) |
| static JSBool | removeRootJS (JSContext *cx, uint32_t argc, jsval *vp) |
| local | removeRootJS ( local cx, local argc, local vp) |
Additional Inherited Members | |
Public Types inherited from ScriptEngineProtocol | |
| enum | ConfigType { NONE, COCOSTUDIO } |
| ~ScriptingCore | ( | ) |
| var ~ScriptingCore | ( | ) |
| local ~ScriptingCore | ( | ) |
| void addRegisterCallback | ( | sc_register_sth | callback) |
will add the register_sth callback to the list of functions that need to be called after the creation of the context
| var addRegisterCallback | ( | var | callback) |
will add the register_sth callback to the list of functions that need to be called after the creation of the context
| local addRegisterCallback | ( | local | callback) |
will add the register_sth callback to the list of functions that need to be called after the creation of the context
|
static |
|
static |
|
static |
| void cleanup | ( | ) |
cleanup everything
| var cleanup | ( | ) |
cleanup everything
| local cleanup | ( | ) |
cleanup everything
| void cleanupSchedulesAndActions | ( | js_proxy_t * | p) |
| var cleanupSchedulesAndActions | ( | var | p) |
| local cleanupSchedulesAndActions | ( | local | p) |
| void createGlobalContext | ( | ) |
Will create a new context.
If one is already there, it will destroy the old context and create a new one.
| var createGlobalContext | ( | ) |
Will create a new context.
If one is already there, it will destroy the old context and create a new one.
| local createGlobalContext | ( | ) |
Will create a new context.
If one is already there, it will destroy the old context and create a new one.
| void debugProcessInput | ( | const std::string & | str) |
enable the debug environment
| var debugProcessInput | ( | var | str) |
enable the debug environment
| local debugProcessInput | ( | local | str) |
enable the debug environment
|
static |
|
static |
|
static |
| void enableDebugger | ( | ) |
| var enableDebugger | ( | ) |
| local enableDebugger | ( | ) |
| JSBool evalString | ( | const char * | string, |
| jsval * | outVal, | ||
| const char * | filename = NULL, |
||
| JSContext * | cx = NULL, |
||
| JSObject * | global = NULL |
||
| ) |
will eval the specified string
| string | The string with the javascript code to be evaluated |
| outVal | The jsval that will hold the return value of the evaluation. Can be NULL. |
will eval the specified string
| string | The string with the javascript code to be evaluated |
| outVal | The jsval that will hold the return value of the evaluation. Can be NULL. |
| local evalString | ( | local | string, |
| local | outVal, | ||
| local | filename = NULL, |
||
| local | cx = NULL, |
||
| local | global = NULL |
||
| ) |
will eval the specified string
| string | The string with the javascript code to be evaluated |
| outVal | The jsval that will hold the return value of the evaluation. Can be NULL. |
| int executeCustomTouchesEvent | ( | cocos2d::EventTouch::EventCode | eventType, |
| const std::vector< cocos2d::Touch * > & | touches, | ||
| JSObject * | obj | ||
| ) |
| var executeCustomTouchesEvent | ( | var | eventType, |
| var | touches, | ||
| var | obj | ||
| ) |
| local executeCustomTouchesEvent | ( | local | eventType, |
| local | touches, | ||
| local | obj | ||
| ) |
| int executeCustomTouchEvent | ( | cocos2d::EventTouch::EventCode | eventType, |
| cocos2d::Touch * | pTouch, | ||
| JSObject * | obj, | ||
| jsval & | retval | ||
| ) |
| var executeCustomTouchEvent | ( | var | eventType, |
| var | pTouch, | ||
| var | obj, | ||
| var | retval | ||
| ) |
| local executeCustomTouchEvent | ( | local | eventType, |
| local | pTouch, | ||
| local | obj, | ||
| local | retval | ||
| ) |
| int executeCustomTouchEvent | ( | cocos2d::EventTouch::EventCode | eventType, |
| cocos2d::Touch * | pTouch, | ||
| JSObject * | obj | ||
| ) |
| var executeCustomTouchEvent | ( | var | eventType, |
| var | pTouch, | ||
| var | obj | ||
| ) |
| local executeCustomTouchEvent | ( | local | eventType, |
| local | pTouch, | ||
| local | obj | ||
| ) |
| bool executeFunctionWithObjectData | ( | cocos2d::Node * | self, |
| const char * | name, | ||
| JSObject * | obj | ||
| ) |
| var executeFunctionWithObjectData | ( | var | self, |
| var | name, | ||
| var | obj | ||
| ) |
| local executeFunctionWithObjectData | ( | local | self, |
| local | name, | ||
| local | obj | ||
| ) |
| JSBool executeFunctionWithOwner | ( | jsval | owner, |
| const char * | name, | ||
| uint32_t | argc = 0, |
||
| jsval * | vp = NULL, |
||
| jsval * | retVal = NULL |
||
| ) |
| var executeFunctionWithOwner | ( | var | owner, |
| var | name, | ||
| var | argc = 0, |
||
| var | vp = NULL, |
||
| var | retVal = NULL |
||
| ) |
| local executeFunctionWithOwner | ( | local | owner, |
| local | name, | ||
| local | argc = 0, |
||
| local | vp = NULL, |
||
| local | retVal = NULL |
||
| ) |
|
inlinevirtual |
Execute a scripted global function.
The function should not take any parameters and should return an integer.
| functionName | String object holding the name of the function, in the global script environment, that is to be executed. |
Implements ScriptEngineProtocol.
|
inlinevirtual |
Execute a scripted global function.
The function should not take any parameters and should return an integer.
| functionName | String object holding the name of the function, in the global script environment, that is to be executed. |
Implements ScriptEngineProtocol.
|
inlinevirtual |
Execute a scripted global function.
The function should not take any parameters and should return an integer.
| functionName | String object holding the name of the function, in the global script environment, that is to be executed. |
Implements ScriptEngineProtocol.
| void executeJSFunctionWithThisObj | ( | jsval | thisObj, |
| jsval | callback, | ||
| uint32_t | argc = 0, |
||
| jsval * | vp = NULL, |
||
| jsval * | retVal = NULL |
||
| ) |
| var executeJSFunctionWithThisObj | ( | var | thisObj, |
| var | callback, | ||
| var | argc = 0, |
||
| var | vp = NULL, |
||
| var | retVal = NULL |
||
| ) |
| local executeJSFunctionWithThisObj | ( | local | thisObj, |
| local | callback, | ||
| local | argc = 0, |
||
| local | vp = NULL, |
||
| local | retVal = NULL |
||
| ) |
|
static |
run a script from script :)
|
static |
run a script from script :)
|
static |
run a script from script :)
|
inlinevirtual |
Execute a script file.
| filename | String object holding the filename of the script file that is to be executed |
Implements ScriptEngineProtocol.
|
inlinevirtual |
Execute a script file.
| filename | String object holding the filename of the script file that is to be executed |
Implements ScriptEngineProtocol.
|
inlinevirtual |
Execute a script file.
| filename | String object holding the filename of the script file that is to be executed |
Implements ScriptEngineProtocol.
|
inlinevirtual |
Execute script code contained in the given string.
| codes | holding the valid script code that should be executed. |
Implements ScriptEngineProtocol.
|
inlinevirtual |
Execute script code contained in the given string.
| codes | holding the valid script code that should be executed. |
Implements ScriptEngineProtocol.
|
inlinevirtual |
Execute script code contained in the given string.
| codes | holding the valid script code that should be executed. |
Implements ScriptEngineProtocol.
|
static |
Force a cycle of GC.
| cx | |
| argc | |
| vp |
|
static |
Force a cycle of GC.
| cx | |
| argc | |
| vp |
|
static |
Force a cycle of GC.
| cx | |
| argc | |
| vp |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinevirtual |
Get script type.
Reimplemented from ScriptEngineProtocol.
|
inlinevirtual |
Get script type.
Reimplemented from ScriptEngineProtocol.
|
inlinevirtual |
Get script type.
Reimplemented from ScriptEngineProtocol.
|
inlinevirtual |
called by CCAssert to allow scripting engine to handle failed assertions
Implements ScriptEngineProtocol.
|
inlinevirtual |
called by CCAssert to allow scripting engine to handle failed assertions
Implements ScriptEngineProtocol.
|
inlinevirtual |
called by CCAssert to allow scripting engine to handle failed assertions
Implements ScriptEngineProtocol.
|
static |
Log something using CCLog.
| cx | |
| argc | |
| vp |
|
static |
Log something using CCLog.
| cx | |
| argc | |
| vp |
|
static |
Log something using CCLog.
| cx | |
| argc | |
| vp |
|
overridevirtual |
Parse configuration file.
Implements ScriptEngineProtocol.
|
overridevirtual |
Parse configuration file.
Implements ScriptEngineProtocol.
|
overridevirtual |
Parse configuration file.
Implements ScriptEngineProtocol.
| void pauseSchedulesAndActions | ( | js_proxy_t * | p) |
| var pauseSchedulesAndActions | ( | var | p) |
| local pauseSchedulesAndActions | ( | local | p) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
virtual |
|
virtual |
|
virtual |
|
static |
| cx | |
| message | |
| report |
|
static |
| cx | |
| message | |
| report |
|
static |
| cx | |
| message | |
| report |
| void reset | ( | ) |
cleanup everything then initialize everything
| var reset | ( | ) |
cleanup everything then initialize everything
| local reset | ( | ) |
cleanup everything then initialize everything
| void resumeSchedulesAndActions | ( | js_proxy_t * | p) |
| var resumeSchedulesAndActions | ( | var | p) |
| local resumeSchedulesAndActions | ( | local | p) |
will run the specified string
| string | The path of the script to be run |
will run the specified string
| string | The path of the script to be run |
will run the specified string
| string | The path of the script to be run |
|
overridevirtual |
when trigger a script event ,call this func,add params needed into ScriptEvent object.nativeObject is object triggering the event, can be nullptr in lua
Implements ScriptEngineProtocol.
|
overridevirtual |
when trigger a script event ,call this func,add params needed into ScriptEvent object.nativeObject is object triggering the event, can be nullptr in lua
Implements ScriptEngineProtocol.
|
overridevirtual |
when trigger a script event ,call this func,add params needed into ScriptEvent object.nativeObject is object triggering the event, can be nullptr in lua
Implements ScriptEngineProtocol.
| JSBool setReservedSpot | ( | uint32_t | i, |
| JSObject * | obj, | ||
| jsval | value | ||
| ) |
| var setReservedSpot | ( | var | i, |
| var | obj, | ||
| var | value | ||
| ) |
| local setReservedSpot | ( | local | i, |
| local | obj, | ||
| local | value | ||
| ) |
| void start | ( | ) |
initialize everything
| var start | ( | ) |
initialize everything
| local start | ( | ) |
initialize everything