no in header file

This commit is contained in:
minggo 2014-01-02 20:14:01 +08:00
parent d8186a1d3c
commit 674b38beef
5 changed files with 34 additions and 33 deletions

View File

@ -54,6 +54,8 @@
#define BYTE_CODE_FILE_EXT ".jsc"
using namespace cocos2d;
static std::string inData;
static std::string outData;
static std::vector<std::string> g_queue;

View File

@ -21,20 +21,18 @@
void js_log(const char *format, ...);
using namespace cocos2d;
typedef void (*sc_register_sth)(JSContext* cx, JSObject* global);
void registerDefaultClasses(JSContext* cx, JSObject* global);
class SimpleRunLoop : public Object
class SimpleRunLoop : public cocos2d::Object
{
public:
void update(float d);
};
class ScriptingCore : public ScriptEngineProtocol
class ScriptingCore : public cocos2d::ScriptEngineProtocol
{
JSRuntime *_rt;
JSContext *_cx;
@ -54,13 +52,13 @@ public:
return pInstance;
};
virtual ccScriptType getScriptType() { return kScriptTypeJavascript; };
virtual cocos2d::ccScriptType getScriptType() { return cocos2d::kScriptTypeJavascript; };
/**
@brief Remove Object from lua state
@param object to remove
*/
virtual void removeScriptObjectByObject(Object* pObj);
virtual void removeScriptObjectByObject(cocos2d::Object* pObj);
/**
@brief Execute script code contained in the given string.
@ -87,13 +85,13 @@ public:
*/
virtual int executeGlobalFunction(const char* functionName) { return 0; }
virtual int sendEvent(ScriptEvent* message) override;
virtual int sendEvent(cocos2d::ScriptEvent* message) override;
virtual bool parseConfig(ConfigType type, const std::string& str) override;
virtual bool handleAssert(const char *msg) { return false; }
bool executeFunctionWithObjectData(Node *self, const char *name, JSObject *obj);
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);
void executeJSFunctionWithThisObj(jsval thisObj, jsval callback, uint32_t argc = 0, jsval* vp = NULL, jsval* retVal = NULL);
@ -142,12 +140,12 @@ public:
static void removeAllRoots(JSContext *cx);
int executeCustomTouchEvent(EventTouch::EventCode eventType,
Touch *pTouch, JSObject *obj, jsval &retval);
int executeCustomTouchEvent(EventTouch::EventCode eventType,
Touch *pTouch, JSObject *obj);
int executeCustomTouchesEvent(EventTouch::EventCode eventType,
const std::vector<Touch*>& touches, JSObject *obj);
int executeCustomTouchEvent(cocos2d::EventTouch::EventCode eventType,
cocos2d::Touch *pTouch, JSObject *obj, jsval &retval);
int executeCustomTouchEvent(cocos2d::EventTouch::EventCode eventType,
cocos2d::Touch *pTouch, JSObject *obj);
int executeCustomTouchesEvent(cocos2d::EventTouch::EventCode eventType,
const std::vector<cocos2d::Touch*>& touches, JSObject *obj);
/**
* @return the global context
*/

View File

@ -1 +1 @@
887e2d3869dfa674b390e1373c94937ae965ea6f
0690676c834cdda681e69a387225425f186a0cc6

View File

@ -11,20 +11,20 @@ class JSScheduleWrapper;
// It will prove that i'm right. :)
typedef struct jsScheduleFunc_proxy {
JSObject* jsfuncObj;
Array* targets;
cocos2d::Array* targets;
UT_hash_handle hh;
} schedFunc_proxy_t;
typedef struct jsScheduleTarget_proxy {
JSObject* jsTargetObj;
Array* targets;
cocos2d::Array* targets;
UT_hash_handle hh;
} schedTarget_proxy_t;
typedef struct jsCallFuncTarget_proxy {
void * ptr;
Array *obj;
cocos2d::Array *obj;
UT_hash_handle hh;
} callfuncTarget_proxy_t;
@ -93,7 +93,7 @@ jsval anonEvaluate(JSContext *cx, JSObject *thisObj, const char* string);
void register_cocos2dx_js_extensions(JSContext* cx, JSObject* obj);
class JSCallbackWrapper: public Object {
class JSCallbackWrapper: public cocos2d::Object {
public:
JSCallbackWrapper();
virtual ~JSCallbackWrapper();
@ -118,9 +118,9 @@ public:
virtual ~JSScheduleWrapper();
static void setTargetForSchedule(jsval sched, JSScheduleWrapper *target);
static Array * getTargetForSchedule(jsval sched);
static cocos2d::Array * getTargetForSchedule(jsval sched);
static void setTargetForJSObject(JSObject* jsTargetObj, JSScheduleWrapper *target);
static Array * getTargetForJSObject(JSObject* jsTargetObj);
static cocos2d::Array * getTargetForJSObject(JSObject* jsTargetObj);
// Remove all targets.
static void removeAllTargets();
@ -157,7 +157,7 @@ protected:
};
class JSTouchDelegate: public Object
class JSTouchDelegate: public cocos2d::Object
{
public:
JSTouchDelegate();
@ -178,16 +178,16 @@ public:
// So this function need to be binded.
void unregisterTouchDelegate();
bool onTouchBegan(Touch *touch, Event *event);
void onTouchMoved(Touch *touch, Event *event);
void onTouchEnded(Touch *touch, Event *event);
void onTouchCancelled(Touch *touch, Event *event);
bool onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event);
void onTouchMoved(cocos2d::Touch *touch, cocos2d::Event *event);
void onTouchEnded(cocos2d::Touch *touch, cocos2d::Event *event);
void onTouchCancelled(cocos2d::Touch *touch, cocos2d::Event *event);
// optional
void onTouchesBegan(const std::vector<Touch*>& touches, Event *event);
void onTouchesMoved(const std::vector<Touch*>& touches, Event *event);
void onTouchesEnded(const std::vector<Touch*>& touches, Event *event);
void onTouchesCancelled(const std::vector<Touch*>& touches, Event *event);
void onTouchesBegan(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void onTouchesCancelled(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
private:
JSObject* _obj;
@ -195,8 +195,8 @@ private:
typedef std::pair<JSObject*, JSTouchDelegate*> TouchDelegatePair;
static TouchDelegateMap sTouchDelegateMap;
bool _needUnroot;
EventListenerTouchOneByOne* _touchListenerOneByOne;
EventListenerTouchAllAtOnce* _touchListenerAllAtOnce;
cocos2d::EventListenerTouchOneByOne* _touchListenerOneByOne;
cocos2d::EventListenerTouchAllAtOnce* _touchListenerAllAtOnce;
};

View File

@ -9,7 +9,8 @@
#include "cocos2d_specifics.hpp"
#include "gui/CocosGUI.h"
using namespace gui;
using namespace cocos2d;
using namespace cocos2d::gui;
class JSStudioEventListenerWrapper: public JSCallbackWrapper {
public: