mirror of https://github.com/axmolengine/axmol.git
issue #2344: ScriptEngineManager::sharedManager --> ScriptEngineManager::getInstance, ScriptEngineManager::purgeSharedManager --> ScriptEngineManager::destroyInstance
This commit is contained in:
parent
0164946779
commit
1db847ad7c
|
@ -164,7 +164,7 @@ void Timer::update(float dt)
|
||||||
{
|
{
|
||||||
SchedulerScriptData data(_scriptHandler,_elapsed);
|
SchedulerScriptData data(_scriptHandler,_elapsed);
|
||||||
ScriptEvent event(kScheduleEvent,&data);
|
ScriptEvent event(kScheduleEvent,&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
_elapsed = 0;
|
_elapsed = 0;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ void Timer::update(float dt)
|
||||||
{
|
{
|
||||||
SchedulerScriptData data(_scriptHandler,_elapsed);
|
SchedulerScriptData data(_scriptHandler,_elapsed);
|
||||||
ScriptEvent event(kScheduleEvent,&data);
|
ScriptEvent event(kScheduleEvent,&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
_elapsed = _elapsed - _delay;
|
_elapsed = _elapsed - _delay;
|
||||||
|
@ -206,7 +206,7 @@ void Timer::update(float dt)
|
||||||
{
|
{
|
||||||
SchedulerScriptData data(_scriptHandler,_elapsed);
|
SchedulerScriptData data(_scriptHandler,_elapsed);
|
||||||
ScriptEvent event(kScheduleEvent,&data);
|
ScriptEvent event(kScheduleEvent,&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
_elapsed = 0;
|
_elapsed = 0;
|
||||||
|
|
|
@ -97,7 +97,7 @@ Node::Node(void)
|
||||||
_scheduler = director->getScheduler();
|
_scheduler = director->getScheduler();
|
||||||
_scheduler->retain();
|
_scheduler->retain();
|
||||||
|
|
||||||
ScriptEngineProtocol* pEngine = ScriptEngineManager::sharedManager()->getScriptEngine();
|
ScriptEngineProtocol* pEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
_scriptType = pEngine != NULL ? pEngine->getScriptType() : kScriptTypeNone;
|
_scriptType = pEngine != NULL ? pEngine->getScriptType() : kScriptTypeNone;
|
||||||
_componentContainer = new ComponentContainer(this);
|
_componentContainer = new ComponentContainer(this);
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ Node::~Node()
|
||||||
|
|
||||||
if (_updateScriptHandler)
|
if (_updateScriptHandler)
|
||||||
{
|
{
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->removeScriptHandler(_updateScriptHandler);
|
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_updateScriptHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_RELEASE(_actionManager);
|
CC_SAFE_RELEASE(_actionManager);
|
||||||
|
@ -511,7 +511,7 @@ void Node::cleanup()
|
||||||
int action = kNodeOnCleanup;
|
int action = kNodeOnCleanup;
|
||||||
BasicScriptData data(this,(void*)&action);
|
BasicScriptData data(this,(void*)&action);
|
||||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// timers
|
// timers
|
||||||
|
@ -876,7 +876,7 @@ void Node::onEnter()
|
||||||
int action = kNodeOnEnter;
|
int action = kNodeOnEnter;
|
||||||
BasicScriptData data(this,(void*)&action);
|
BasicScriptData data(this,(void*)&action);
|
||||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -891,7 +891,7 @@ void Node::onEnterTransitionDidFinish()
|
||||||
int action = kNodeOnEnterTransitionDidFinish;
|
int action = kNodeOnEnterTransitionDidFinish;
|
||||||
BasicScriptData data(this,(void*)&action);
|
BasicScriptData data(this,(void*)&action);
|
||||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,7 +903,7 @@ void Node::onExitTransitionDidStart()
|
||||||
int action = kNodeOnExitTransitionDidStart;
|
int action = kNodeOnExitTransitionDidStart;
|
||||||
BasicScriptData data(this,(void*)&action);
|
BasicScriptData data(this,(void*)&action);
|
||||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,7 +917,7 @@ void Node::onExit()
|
||||||
int action = kNodeOnExit;
|
int action = kNodeOnExit;
|
||||||
BasicScriptData data(this,(void*)&action);
|
BasicScriptData data(this,(void*)&action);
|
||||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayMakeObjectsPerformSelector(_children, onExit, Node*);
|
arrayMakeObjectsPerformSelector(_children, onExit, Node*);
|
||||||
|
@ -1006,7 +1006,7 @@ void Node::unscheduleUpdate()
|
||||||
_scheduler->unscheduleUpdateForTarget(this);
|
_scheduler->unscheduleUpdateForTarget(this);
|
||||||
if (_updateScriptHandler)
|
if (_updateScriptHandler)
|
||||||
{
|
{
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->removeScriptHandler(_updateScriptHandler);
|
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_updateScriptHandler);
|
||||||
_updateScriptHandler = 0;
|
_updateScriptHandler = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1068,7 +1068,7 @@ void Node::update(float fDelta)
|
||||||
//only lua use
|
//only lua use
|
||||||
SchedulerScriptData data(_updateScriptHandler,fDelta);
|
SchedulerScriptData data(_updateScriptHandler,fDelta);
|
||||||
ScriptEvent event(kScheduleEvent,&data);
|
ScriptEvent event(kScheduleEvent,&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_componentContainer && !_componentContainer->isEmpty())
|
if (_componentContainer && !_componentContainer->isEmpty())
|
||||||
|
|
|
@ -52,11 +52,11 @@ Object::~Object(void)
|
||||||
// if the object is referenced by Lua engine, remove it
|
// if the object is referenced by Lua engine, remove it
|
||||||
if (_luaID)
|
if (_luaID)
|
||||||
{
|
{
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->removeScriptObjectByObject(this);
|
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptObjectByObject(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScriptEngineProtocol* pEngine = ScriptEngineManager::sharedManager()->getScriptEngine();
|
ScriptEngineProtocol* pEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (pEngine != NULL && pEngine->getScriptType() == kScriptTypeJavascript)
|
if (pEngine != NULL && pEngine->getScriptType() == kScriptTypeJavascript)
|
||||||
{
|
{
|
||||||
pEngine->removeScriptObjectByObject(this);
|
pEngine->removeScriptObjectByObject(this);
|
||||||
|
|
|
@ -109,7 +109,7 @@ int Layer::executeScriptTouchHandler(int eventType, Touch* touch)
|
||||||
{
|
{
|
||||||
TouchScriptData data(eventType, this, touch);
|
TouchScriptData data(eventType, this, touch);
|
||||||
ScriptEvent event(kTouchEvent, &data);
|
ScriptEvent event(kTouchEvent, &data);
|
||||||
return ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
return ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//can not reach it
|
//can not reach it
|
||||||
|
@ -122,7 +122,7 @@ int Layer::executeScriptTouchesHandler(int eventType, Set* touches)
|
||||||
{
|
{
|
||||||
TouchesScriptData data(eventType, this, touches);
|
TouchesScriptData data(eventType, this, touches);
|
||||||
ScriptEvent event(kTouchesEvent, &data);
|
ScriptEvent event(kTouchesEvent, &data);
|
||||||
return ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
return ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -241,7 +241,7 @@ void Layer::didAccelerate(Acceleration* pAccelerationValue)
|
||||||
{
|
{
|
||||||
BasicScriptData data(this,(void*)pAccelerationValue);
|
BasicScriptData data(this,(void*)pAccelerationValue);
|
||||||
ScriptEvent event(kAccelerometerEvent,&data);
|
ScriptEvent event(kAccelerometerEvent,&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ void Layer::keyBackClicked(void)
|
||||||
{
|
{
|
||||||
KeypadScriptData data(kTypeBackClicked, this);
|
KeypadScriptData data(kTypeBackClicked, this);
|
||||||
ScriptEvent event(kKeypadEvent,(void*)&data);
|
ScriptEvent event(kKeypadEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ void Layer::keyMenuClicked(void)
|
||||||
{
|
{
|
||||||
KeypadScriptData data(kTypeMenuClicked, this);
|
KeypadScriptData data(kTypeMenuClicked, this);
|
||||||
ScriptEvent event(kKeypadEvent,(void*)&data);
|
ScriptEvent event(kKeypadEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ void MenuItem::activate()
|
||||||
{
|
{
|
||||||
BasicScriptData data(this);
|
BasicScriptData data(this);
|
||||||
ScriptEvent scriptEvent(kMenuClickedEvent,&data);
|
ScriptEvent scriptEvent(kMenuClickedEvent,&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
bool CC_DLL cc_assert_script_compatible(const char *msg)
|
bool CC_DLL cc_assert_script_compatible(const char *msg)
|
||||||
{
|
{
|
||||||
cocos2d::ScriptEngineProtocol* pEngine = cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine();
|
cocos2d::ScriptEngineProtocol* pEngine = cocos2d::ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (pEngine && pEngine->handleAssert(msg))
|
if (pEngine && pEngine->handleAssert(msg))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -49,7 +49,7 @@ ScriptHandlerEntry* ScriptHandlerEntry::create(int nHandler)
|
||||||
|
|
||||||
ScriptHandlerEntry::~ScriptHandlerEntry(void)
|
ScriptHandlerEntry::~ScriptHandlerEntry(void)
|
||||||
{
|
{
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->removeScriptHandler(_handler);
|
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
@ -97,7 +97,7 @@ TouchScriptHandlerEntry* TouchScriptHandlerEntry::create(int nHandler,
|
||||||
|
|
||||||
TouchScriptHandlerEntry::~TouchScriptHandlerEntry(void)
|
TouchScriptHandlerEntry::~TouchScriptHandlerEntry(void)
|
||||||
{
|
{
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->removeScriptHandler(_handler);
|
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_handler);
|
||||||
LUALOG("[LUA] Remove touch event handler: %d", _handler);
|
LUALOG("[LUA] Remove touch event handler: %d", _handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ void NotificationCenter::postNotification(const char *name, Object *object)
|
||||||
{
|
{
|
||||||
BasicScriptData data(this, (void*)name);
|
BasicScriptData data(this, (void*)name);
|
||||||
ScriptEvent scriptEvent(kNotificationEvent,(void*)&data);
|
ScriptEvent scriptEvent(kNotificationEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,7 +130,7 @@ void Control::sendActionsForControlEvents(ControlEvent controlEvents)
|
||||||
{
|
{
|
||||||
cocos2d::BasicScriptData data(this,(void*)&controlEvents);
|
cocos2d::BasicScriptData data(this,(void*)&controlEvents);
|
||||||
cocos2d::ScriptEvent event(cocos2d::kControlEvent,(void*)&data);
|
cocos2d::ScriptEvent event(cocos2d::kControlEvent,(void*)&data);
|
||||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,7 @@ void EditBox::unregisterScriptEditBoxHandler(void)
|
||||||
{
|
{
|
||||||
if (0 != _scriptEditBoxHandler)
|
if (0 != _scriptEditBoxHandler)
|
||||||
{
|
{
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->removeScriptHandler(_scriptEditBoxHandler);
|
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_scriptEditBoxHandler);
|
||||||
_scriptEditBoxHandler = 0;
|
_scriptEditBoxHandler = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,15 +261,15 @@ static void editBoxCallbackFunc(const char* pText, void* ctx)
|
||||||
{
|
{
|
||||||
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
memset(data.eventName,0,64*sizeof(char));
|
memset(data.eventName,0,64*sizeof(char));
|
||||||
strncpy(data.eventName,"ended",64);
|
strncpy(data.eventName,"ended",64);
|
||||||
event.data = (void*)&data;
|
event.data = (void*)&data;
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
memset(data.eventName,0,64*sizeof(char));
|
memset(data.eventName,0,64*sizeof(char));
|
||||||
strncpy(data.eventName,"return",64);
|
strncpy(data.eventName,"return",64);
|
||||||
event.data = (void*)&data;
|
event.data = (void*)&data;
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ void EditBoxImplAndroid::openKeyboard()
|
||||||
{
|
{
|
||||||
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||||
ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
showEditTextDialogJNI( _placeHolder.c_str(),
|
showEditTextDialogJNI( _placeHolder.c_str(),
|
||||||
|
|
|
@ -161,7 +161,7 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
||||||
{
|
{
|
||||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||||
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
||||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -184,11 +184,11 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
||||||
{
|
{
|
||||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
|
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
|
||||||
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
||||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
memset(data.eventName,0,64*sizeof(char));
|
memset(data.eventName,0,64*sizeof(char));
|
||||||
strncpy(data.eventName,"return",64);
|
strncpy(data.eventName,"return",64);
|
||||||
event.data = (void*)&data;
|
event.data = (void*)&data;
|
||||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(editBox_ != nil)
|
if(editBox_ != nil)
|
||||||
|
@ -238,7 +238,7 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
||||||
{
|
{
|
||||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||||
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
||||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@
|
||||||
{
|
{
|
||||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||||
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
||||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -172,11 +172,11 @@
|
||||||
{
|
{
|
||||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
|
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
|
||||||
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
||||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
memset(data.eventName,0,64*sizeof(char));
|
memset(data.eventName,0,64*sizeof(char));
|
||||||
strncpy(data.eventName,"return",64);
|
strncpy(data.eventName,"return",64);
|
||||||
event.data = (void*)&data;
|
event.data = (void*)&data;
|
||||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@
|
||||||
{
|
{
|
||||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||||
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
||||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -253,15 +253,15 @@ static void editBoxCallbackFunc(const char* pText, void* ctx)
|
||||||
{
|
{
|
||||||
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
memset(data.eventName,0,64*sizeof(char));
|
memset(data.eventName,0,64*sizeof(char));
|
||||||
strncpy(data.eventName,"ended",64);
|
strncpy(data.eventName,"ended",64);
|
||||||
event.data = (void*)&data;
|
event.data = (void*)&data;
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
memset(data.eventName,0,64*sizeof(char));
|
memset(data.eventName,0,64*sizeof(char));
|
||||||
strncpy(data.eventName,"return",64);
|
strncpy(data.eventName,"return",64);
|
||||||
event.data = (void*)&data;
|
event.data = (void*)&data;
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ void EditBoxImplTizen::openKeyboard()
|
||||||
{
|
{
|
||||||
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
KeypadStyle keypadStyle = KEYPAD_STYLE_NORMAL;
|
KeypadStyle keypadStyle = KEYPAD_STYLE_NORMAL;
|
||||||
|
|
|
@ -240,15 +240,15 @@ static void editBoxCallbackFunc(const char* pText, void* ctx)
|
||||||
{
|
{
|
||||||
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
memset(data.eventName,0,64*sizeof(char));
|
memset(data.eventName,0,64*sizeof(char));
|
||||||
strncpy(data.eventName,"ended",64);
|
strncpy(data.eventName,"ended",64);
|
||||||
event.data = (void*)&data;
|
event.data = (void*)&data;
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
memset(data.eventName,0,64*sizeof(char));
|
memset(data.eventName,0,64*sizeof(char));
|
||||||
strncpy(data.eventName,"return",64);
|
strncpy(data.eventName,"return",64);
|
||||||
event.data = (void*)&data;
|
event.data = (void*)&data;
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ void EditBoxImplWin::openKeyboard()
|
||||||
{
|
{
|
||||||
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string placeHolder = _labelPlaceHolder->getString();
|
std::string placeHolder = _labelPlaceHolder->getString();
|
||||||
|
|
|
@ -51,7 +51,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
sc->start();
|
sc->start();
|
||||||
CCLOG("applicationDidFinishLaunching 02");
|
CCLOG("applicationDidFinishLaunching 02");
|
||||||
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
ScriptingCore::getInstance()->runScript("main.js");
|
ScriptingCore::getInstance()->runScript("main.js");
|
||||||
CCLOG("applicationDidFinishLaunching 03");
|
CCLOG("applicationDidFinishLaunching 03");
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -53,7 +53,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
sc->start();
|
sc->start();
|
||||||
|
|
||||||
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
ScriptingCore::getInstance()->runScript("main.js");
|
ScriptingCore::getInstance()->runScript("main.js");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -133,7 +133,7 @@ void UpdateLayer::enter(cocos2d::Object *pSender)
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
ScriptingCore::getInstance()->runScript("main.js");
|
ScriptingCore::getInstance()->runScript("main.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
||||||
js_log("RUNNING Main");
|
js_log("RUNNING Main");
|
||||||
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
ScriptingCore::getInstance()->runScript("main.js");
|
ScriptingCore::getInstance()->runScript("main.js");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -113,7 +113,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
||||||
js_log("RUNNING Main");
|
js_log("RUNNING Main");
|
||||||
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
ScriptingCore::getInstance()->runScript("main.js");
|
ScriptingCore::getInstance()->runScript("main.js");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -53,7 +53,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
sc->start();
|
sc->start();
|
||||||
|
|
||||||
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
#if JSB_ENABLE_DEBUGGER
|
#if JSB_ENABLE_DEBUGGER
|
||||||
ScriptingCore::getInstance()->runScript("main.debug.js");
|
ScriptingCore::getInstance()->runScript("main.debug.js");
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -54,7 +54,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
sc->start();
|
sc->start();
|
||||||
|
|
||||||
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
#ifdef JS_OBFUSCATED
|
#ifdef JS_OBFUSCATED
|
||||||
ScriptingCore::getInstance()->runScript("game.js");
|
ScriptingCore::getInstance()->runScript("game.js");
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -51,7 +51,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
sc->start();
|
sc->start();
|
||||||
|
|
||||||
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
ScriptingCore::getInstance()->runScript("boot-jsb.js");
|
ScriptingCore::getInstance()->runScript("boot-jsb.js");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -17,7 +17,7 @@ AppDelegate::~AppDelegate()
|
||||||
{
|
{
|
||||||
// end simple audio engine here, or it may crashed on win32
|
// end simple audio engine here, or it may crashed on win32
|
||||||
SimpleAudioEngine::getInstance()->end();
|
SimpleAudioEngine::getInstance()->end();
|
||||||
//CCScriptEngineManager::purgeSharedManager();
|
//CCScriptEngineManager::destroyInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppDelegate::applicationDidFinishLaunching()
|
bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
@ -36,7 +36,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
||||||
// register lua engine
|
// register lua engine
|
||||||
LuaEngine* pEngine = LuaEngine::defaultEngine();
|
LuaEngine* pEngine = LuaEngine::defaultEngine();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
|
|
||||||
std::string path = FileUtils::getInstance()->fullPathForFilename("hello.lua");
|
std::string path = FileUtils::getInstance()->fullPathForFilename("hello.lua");
|
||||||
pEngine->executeScriptFile(path.c_str());
|
pEngine->executeScriptFile(path.c_str());
|
||||||
|
|
|
@ -48,7 +48,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
||||||
// register lua engine
|
// register lua engine
|
||||||
LuaEngine* pEngine = LuaEngine::defaultEngine();
|
LuaEngine* pEngine = LuaEngine::defaultEngine();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
|
|
||||||
std::vector<std::string> searchPaths = pFileUtils->getSearchPaths();
|
std::vector<std::string> searchPaths = pFileUtils->getSearchPaths();
|
||||||
searchPaths.push_back("cocosbuilderRes");
|
searchPaths.push_back("cocosbuilderRes");
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
31f6e535b10b0e282216d54533c9cae806c34d8e
|
1e099e4c734f57f72adc2c665a8ab9e941b10417
|
|
@ -73,7 +73,7 @@ void LuaCallFunc::execute()
|
||||||
|
|
||||||
BasicScriptData data((void*)this,(void*)_target);
|
BasicScriptData data((void*)this,(void*)_target);
|
||||||
ScriptEvent event(kCallFuncEvent,(void*)&data);
|
ScriptEvent event(kCallFuncEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
LuaCallFunc* LuaCallFunc::clone() const
|
LuaCallFunc* LuaCallFunc::clone() const
|
||||||
|
@ -85,7 +85,7 @@ LuaCallFunc* LuaCallFunc::clone() const
|
||||||
|
|
||||||
auto ret = new LuaCallFunc();
|
auto ret = new LuaCallFunc();
|
||||||
|
|
||||||
int newscriptHandler = cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->reallocateScriptHandler(handler);
|
int newscriptHandler = cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->reallocateScriptHandler(handler);
|
||||||
|
|
||||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)ret, newscriptHandler, ScriptHandlerMgr::kCallFuncHandler);
|
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)ret, newscriptHandler, ScriptHandlerMgr::kCallFuncHandler);
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ void LuaScrollView::scrollViewDidScroll(ScrollView* view)
|
||||||
{
|
{
|
||||||
CommonScriptData data(handler,"");
|
CommonScriptData data(handler,"");
|
||||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ void LuaScrollView::scrollViewDidZoom(ScrollView* view)
|
||||||
{
|
{
|
||||||
CommonScriptData data(handler,"");
|
CommonScriptData data(handler,"");
|
||||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ static int SendBinaryMessageToLua(int nHandler,const unsigned char* pTable,int n
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == ScriptEngineManager::sharedManager()->getScriptEngine()) {
|
if (NULL == ScriptEngineManager::getInstance()->getScriptEngine()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ void LuaWebSocket::onOpen(WebSocket* ws)
|
||||||
if (0 != nHandler) {
|
if (0 != nHandler) {
|
||||||
CommonScriptData data(nHandler,"");
|
CommonScriptData data(nHandler,"");
|
||||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ void LuaWebSocket::onMessage(WebSocket* ws, const WebSocket::Data& data)
|
||||||
if (0 != nHandler) {
|
if (0 != nHandler) {
|
||||||
CommonScriptData commonData(nHandler,data.bytes);
|
CommonScriptData commonData(nHandler,data.bytes);
|
||||||
ScriptEvent event(kCommonEvent,(void*)&commonData);
|
ScriptEvent event(kCommonEvent,(void*)&commonData);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ void LuaWebSocket::onClose(WebSocket* ws)
|
||||||
{
|
{
|
||||||
CommonScriptData data(nHandler,"");
|
CommonScriptData data(nHandler,"");
|
||||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ void LuaWebSocket::onError(WebSocket* ws, const WebSocket::ErrorCode& error)
|
||||||
{
|
{
|
||||||
CommonScriptData data(nHandler,"");
|
CommonScriptData data(nHandler,"");
|
||||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
sc->start();
|
sc->start();
|
||||||
|
|
||||||
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
ScriptingCore::getInstance()->runScript("main.js");
|
ScriptingCore::getInstance()->runScript("main.js");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -35,7 +35,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
||||||
// register lua engine
|
// register lua engine
|
||||||
LuaEngine* pEngine = LuaEngine::defaultEngine();
|
LuaEngine* pEngine = LuaEngine::defaultEngine();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
|
|
||||||
LuaStack *pStack = pEngine->getLuaStack();
|
LuaStack *pStack = pEngine->getLuaStack();
|
||||||
lua_State *tolua_s = pStack->getLuaState();
|
lua_State *tolua_s = pStack->getLuaState();
|
||||||
|
|
|
@ -51,7 +51,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
sc->start();
|
sc->start();
|
||||||
|
|
||||||
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
ScriptingCore::getInstance()->runScript("hello.js");
|
ScriptingCore::getInstance()->runScript("hello.js");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -17,7 +17,7 @@ AppDelegate::~AppDelegate()
|
||||||
{
|
{
|
||||||
// end simple audio engine here, or it may crashed on win32
|
// end simple audio engine here, or it may crashed on win32
|
||||||
SimpleAudioEngine::sharedEngine()->end();
|
SimpleAudioEngine::sharedEngine()->end();
|
||||||
//CCScriptEngineManager::purgeSharedManager();
|
//CCScriptEngineManager::destroyInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppDelegate::applicationDidFinishLaunching()
|
bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
@ -34,7 +34,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
||||||
// register lua engine
|
// register lua engine
|
||||||
LuaEngine* pEngine = LuaEngine::defaultEngine();
|
LuaEngine* pEngine = LuaEngine::defaultEngine();
|
||||||
ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||||
|
|
||||||
std::string path = FileUtils::getInstance()->fullPathForFilename("hello.lua");
|
std::string path = FileUtils::getInstance()->fullPathForFilename("hello.lua");
|
||||||
pEngine->executeScriptFile(path.c_str());
|
pEngine->executeScriptFile(path.c_str());
|
||||||
|
|
Loading…
Reference in New Issue