mirror of https://github.com/axmolengine/axmol.git
* merge CCLuaSupport to CCLuaEngine
This commit is contained in:
parent
4ba170d82f
commit
f1351610d8
|
@ -1,47 +0,0 @@
|
|||
|
||||
#include "CCLuaSupport.h"
|
||||
#include "CCArray.h"
|
||||
#include "CCTimer.h"
|
||||
#include "LuaEngine.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
CCSchedulerFuncEntry* CCSchedulerFuncEntry::entryWithRefID(int refID, ccTime fInterval, bool bPaused)
|
||||
{
|
||||
CCSchedulerFuncEntry* entry = new CCSchedulerFuncEntry();
|
||||
entry->initWithRefID(refID, fInterval, bPaused);
|
||||
entry->autorelease();
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
||||
bool CCSchedulerFuncEntry::initWithRefID(int refID, ccTime fInterval, bool bPaused)
|
||||
{
|
||||
LuaEngine::sharedEngine()->retainRefID(refID);
|
||||
m_timer = new CCTimer();
|
||||
m_timer->initWithScriptFunc(refID, fInterval);
|
||||
m_timer->autorelease();
|
||||
m_timer->retain();
|
||||
m_refID = refID;
|
||||
m_paused = bPaused;
|
||||
return true;
|
||||
}
|
||||
|
||||
CCSchedulerFuncEntry::CCSchedulerFuncEntry(void)
|
||||
: m_timer(NULL)
|
||||
, m_refID(0)
|
||||
, m_paused(true)
|
||||
, m_isMarkDeleted(false)
|
||||
{
|
||||
static int handleCount = 0;
|
||||
++handleCount;
|
||||
m_handle = handleCount;
|
||||
}
|
||||
|
||||
CCSchedulerFuncEntry::~CCSchedulerFuncEntry(void)
|
||||
{
|
||||
m_timer->release();
|
||||
LuaEngine::sharedEngine()->releaseRefID(m_refID);
|
||||
// CCLOG("CCSchedulerFuncEntry::~CCSchedulerFuncEntry() - remove script entry, handle: %d, refid: %d",
|
||||
// m_handle, m_refID);
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
#ifndef __CC_LUA_SUPPORT_
|
||||
#define __CC_LUA_SUPPORT_
|
||||
|
||||
#include "CCObject.h"
|
||||
#include "ccTypes.h"
|
||||
|
||||
namespace cocos2d
|
||||
{
|
||||
class CCTimer;
|
||||
|
||||
class CCSchedulerFuncEntry : public CCObject
|
||||
{
|
||||
public:
|
||||
static CCSchedulerFuncEntry* entryWithRefID(int refID, ccTime fInterval, bool bPaused);
|
||||
~CCSchedulerFuncEntry(void);
|
||||
|
||||
inline CCTimer* getTimer(void) {
|
||||
return m_timer;
|
||||
}
|
||||
|
||||
inline bool isPaused(void) {
|
||||
return m_paused;
|
||||
}
|
||||
|
||||
inline int getRefID(void) {
|
||||
return m_refID;
|
||||
}
|
||||
|
||||
inline int getHandle(void) {
|
||||
return m_handle;
|
||||
}
|
||||
|
||||
void markDeleted(void) {
|
||||
m_isMarkDeleted = true;
|
||||
}
|
||||
|
||||
bool isMarkDeleted(void) {
|
||||
return m_isMarkDeleted;
|
||||
}
|
||||
|
||||
private:
|
||||
CCSchedulerFuncEntry(void);
|
||||
bool initWithRefID(int refID, ccTime fInterval, bool bPaused);
|
||||
|
||||
CCTimer* m_timer;
|
||||
bool m_paused;
|
||||
int m_refID;
|
||||
int m_handle;
|
||||
bool m_isMarkDeleted;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __CC_LUA_SUPPORT_
|
Loading…
Reference in New Issue