issue #2404:Add many functions to Deprecated.lua

This commit is contained in:
samuele3hu 2013-07-22 13:42:58 +08:00
parent eed0297c59
commit 510a5912fd
15 changed files with 138 additions and 27 deletions

View File

@ -31,7 +31,7 @@ int LuaBridge::s_newFunctionId = 0;
LuaStack *LuaBridge::getStack(void)
{
return LuaEngine::defaultEngine()->getLuaStack();
return LuaEngine::getInstance()->getLuaStack();
}
int LuaBridge::pushLuaFunctionById(int functionId)

View File

@ -33,7 +33,7 @@ NS_CC_BEGIN
LuaEngine* LuaEngine::_defaultEngine = NULL;
LuaEngine* LuaEngine::defaultEngine(void)
LuaEngine* LuaEngine::getInstance(void)
{
if (!_defaultEngine)
{

View File

@ -44,7 +44,8 @@ NS_CC_BEGIN
class LuaEngine : public ScriptEngineProtocol
{
public:
static LuaEngine* defaultEngine(void);
static LuaEngine* getInstance(void);
CC_DEPRECATED_ATTRIBUTE static LuaEngine* defaultEngine(void) { return LuaEngine::getInstance(); }
virtual ~LuaEngine(void);
virtual ccScriptType getScriptType() {

View File

@ -1 +1 @@
8049a6272800a59fa3ecf062ee7426248ec69d3a
7314b8a835d96e154da442ff16a7325c94edd276

View File

@ -32,7 +32,7 @@ static int SendBinaryMessageToLua(int nHandler,const unsigned char* pTable,int n
return 0;
}
LuaStack *pStack = LuaEngine::defaultEngine()->getLuaStack();
LuaStack *pStack = LuaEngine::getInstance()->getLuaStack();
if (NULL == pStack) {
return 0;
}

View File

@ -337,9 +337,119 @@ local function boundingBox(self)
end
rawset(CCNode,"boundingBox",boundingBox)
local function numberOfRunningActions(self)
deprecatedTip("CCNode:numberOfRunningActions","CCNode:getNumberOfRunningActions")
return self:getNumberOfRunningActions()
end
rawset(CCNode,"numberOfRunningActions",numberOfRunningActions)
local function stringForFormat(self)
deprecatedTip("Texture2D:stringForFormat","Texture2D:getStringForFormat")
return self:getStringForFormat()
end
rawset(CCTexture2D,"stringForFormat",stringForFormat)
local function bitsPerPixelForFormat(self)
deprecatedTip("Texture2D:bitsPerPixelForFormat","Texture2D:getBitsPerPixelForFormat")
return self:getBitsPerPixelForFormat()
end
rawset(CCTexture2D,"bitsPerPixelForFormat",bitsPerPixelForFormat)
local function bitsPerPixelForFormat(self,pixelFormat)
deprecatedTip("Texture2D:bitsPerPixelForFormat","Texture2D:getBitsPerPixelForFormat")
return self:getBitsPerPixelForFormat(pixelFormat)
end
rawset(CCTexture2D,"bitsPerPixelForFormat",bitsPerPixelForFormat)
local function defaultAlphaPixelFormat(self)
deprecatedTip("Texture2D:defaultAlphaPixelFormat","Texture2D:getDefaultAlphaPixelFormat")
return self:getDefaultAlphaPixelFormat()
end
rawset(CCTexture2D,"defaultAlphaPixelFormat",defaultAlphaPixelFormat)
local function spriteFrameByName(self,szName)
deprecatedTip("CCSpriteFrameCache:spriteFrameByName","CCSpriteFrameCache:getSpriteFrameByName")
return self:getSpriteFrameByName(szName)
end
rawset(CCSpriteFrameCache,"spriteFrameByName",spriteFrameByName)
local function timerWithScriptHandler(handler,seconds)
deprecatedTip("CCTimer:timerWithScriptHandler","CCTimer:createWithScriptHandler")
return CCTimer:createWithScriptHandler(handler,seconds)
end
rawset(CCTimer,"timerWithScriptHandler",timerWithScriptHandler)
local function numberOfRunningActionsInTarget(self,target)
deprecatedTip("CCActionManager:numberOfRunningActionsInTarget","CCActionManager:getNumberOfRunningActionsInTarget")
return self:getNumberOfRunningActionsInTarget(target)
end
rawset(CCTimer,"numberOfRunningActionsInTarget",numberOfRunningActionsInTarget)
local function fontSize()
deprecatedTip("CCMenuItemFont:fontSize","CCMenuItemFont:getFontSize")
return CCMenuItemFont:getFontSize()
end
rawset(CCMenuItemFont,"fontSize",fontSize)
local function fontName()
deprecatedTip("CCMenuItemFont:fontName","CCMenuItemFont:getFontName")
return CCMenuItemFont:getFontName()
end
rawset(CCMenuItemFont,"fontName",fontName)
local function fontSizeObj(self)
deprecatedTip("CCMenuItemFont:fontSizeObj","CCMenuItemFont:getFontSizeObj")
return self:getFontSizeObj()
end
rawset(CCMenuItemFont,"fontSizeObj",fontSizeObj)
local function fontNameObj(self)
deprecatedTip("CCMenuItemFont:fontNameObj","CCMenuItemFont:getFontNameObj")
return self:getFontNameObj()
end
rawset(CCMenuItemFont,"fontNameObj",fontNameObj)
local function selectedItem(self)
deprecatedTip("CCMenuItemToggle:selectedItem","CCMenuItemToggle:getSelectedItem")
return self:getSelectedItem()
end
rawset(CCMenuItemToggle,"selectedItem",selectedItem)
local function tileAt(self,pos)
deprecatedTip("CCTileMapAtlas:tileAt","CCTileMapAtlas:getTileAt")
return self:getTileAt(pos)
end
rawset(CCTileMapAtlas,"tileAt",tileAt)
local function tileAt(self,tileCoordinate)
deprecatedTip("CCTMXLayer:tileAt","CCTMXLayer:getTileAt")
return self:getTileAt(tileCoordinate)
end
rawset(CCTMXLayer,"tileAt",tileAt)
local function tileGIDAt(self,tileCoordinate)
deprecatedTip("CCTMXLayer:tileGIDAt","CCTMXLayer:getTileGIDAt")
return self:getTileGIDAt(tileCoordinate)
end
rawset(CCTMXLayer,"tileGIDAt",tileGIDAt)
local function positionAt(self,tileCoordinate)
deprecatedTip("CCTMXLayer:positionAt","CCTMXLayer:getPositionAt")
return self:getPositionAt(tileCoordinate)
end
rawset(CCTMXLayer,"positionAt",positionAt)
local function propertyNamed(self,propertyName)
deprecatedTip("CCTMXLayer:propertyNamed","CCTMXLayer:getPropertyNamed")
return self:getPropertyNamed(propertyName)
end
rawset(CCTMXLayer,"propertyNamed",propertyNamed)
local function sharedEngine()
deprecatedTip("SimpleAudioEngine:sharedEngine","SimpleAudioEngine:getInstance")
return SimpleAudioEngine:getInstance()
end
rawset(SimpleAudioEngine,"sharedEngine",sharedEngine)

View File

@ -13,7 +13,7 @@ class CCActionManager : public CCObject
CCAction* getActionByTag(unsigned int tag, CCObject *pTarget);
unsigned int numberOfRunningActionsInTarget(CCObject *pTarget);
unsigned int getNumberOfRunningActionsInTarget(CCObject *pTarget);
void pauseTarget(CCObject *pTarget);

View File

@ -46,13 +46,13 @@ class CCMenuItemAtlasFont : public CCMenuItemLabel
class CCMenuItemFont : public CCMenuItemLabel
{
static void setFontSize(int s);
static unsigned int fontSize();
static unsigned int getFontSize();
static void setFontName(const char* name);
static const char* fontName();
static const char* getFontName();
void setFontSizeObj(unsigned int s);
unsigned int fontSizeObj();
unsigned int getFontSizeObj();
void setFontNameObj(const char* name);
const char* fontNameObj();
const char* getFontNameObj() const;
static CCMenuItemFont * create(const char* value);
};
@ -116,7 +116,7 @@ class CCMenuItemToggle : public CCMenuItem
CCArray* getSubItems();
void addSubItem(CCMenuItem *item);
CCMenuItem* selectedItem();
CCMenuItem* getSelectedItem();
void activate();
void selected();

View File

@ -97,7 +97,7 @@ class CCNode : public CCObject
const char * description(void) const;
CCNode* getChildByTag(int tag);
unsigned int numberOfRunningActions(void);
unsigned int getNumberOfRunningActions(void) const;
CCAffineTransform nodeToParentTransform(void);
CCAffineTransform parentToNodeTransform(void);

View File

@ -5,7 +5,7 @@ class CCTimer : public CCObject
void setInterval(float fInterval);
void update(float dt);
static CCTimer* timerWithScriptHandler(LUA_FUNCTION funcID, float fSeconds);
static CCTimer* createWithScriptHandler(LUA_FUNCTION funcID, float fSeconds);
};
class CCScheduler : public CCObject

View File

@ -14,7 +14,7 @@ class CCSpriteFrameCache : public CCObject
//void removeSpriteFramesFromDictionary(CCDictionary<std::string, CCSpriteFrame*> *dictionary);
void removeSpriteFramesFromTexture(CCTexture2D* texture);
CCSpriteFrame* spriteFrameByName(const char *pszName);
CCSpriteFrame* getSpriteFrameByName(const char *pszName);
static CCSpriteFrameCache* getInstance();
static void destroyInstance();

View File

@ -21,13 +21,13 @@ class CCTMXLayer : public CCSpriteBatchNode
void releaseMap();
CCSprite* tileAt(CCPoint tileCoordinate);
unsigned int tileGIDAt(const CCPoint& tileCoordinate);
CCSprite* getTileAt(const CCPoint& tileCoordinate);
unsigned int getTileGIDAt(const CCPoint& tileCoordinate);
void setTileGID(unsigned int gid, const CCPoint& tileCoordinate);
void setTileGID(unsigned int gid, const CCPoint& tileCoordinate, ccTMXTileFlags flags);
void removeTileAt(CCPoint tileCoordinate);
CCPoint positionAt(CCPoint tileCoordinate);
CCString *propertyNamed(const char *propertyName);
CCPoint getPositionAt(CCPoint tileCoordinate);
CCString *getPropertyNamed(const char *propertyName) const;
void setupTiles();
void setLayerName(const char *layerName);

View File

@ -505,10 +505,10 @@ class CCTexture2D : public CCObject
void setAliasTexParameters();
void generateMipmap();
const char* stringForFormat() const;
unsigned int bitsPerPixelForFormat() const;
unsigned int bitsPerPixelForFormat(CCTexture2DPixelFormat format) const;
const char* getStringForFormat() const;
unsigned int getBitsPerPixelForFormat() const;
unsigned int getBitsPerPixelForFormat(CCTexture2DPixelFormat format) const;
static void setDefaultAlphaPixelFormat(CCTexture2DPixelFormat format);
static CCTexture2DPixelFormat defaultAlphaPixelFormat();
static CCTexture2DPixelFormat getDefaultAlphaPixelFormat();
};

View File

@ -10,7 +10,7 @@ class CCTileMapAtlas : public CCAtlasNode
void setTile(Color3B tile, CCPoint position);
void releaseMap();
Color3B tileAt(const CCPoint & pos);
Color3B getTileAt(const CCPoint & pos) const;
static CCTileMapAtlas * create(const char *tile, const char *mapFile, int tileWidth, int tileHeight);
};

View File

@ -1,6 +1,6 @@
class SimpleAudioEngine
{
static SimpleAudioEngine* sharedEngine();
static SimpleAudioEngine* getInstance();
void preloadBackgroundMusic(const char* pszFilePath);
void playBackgroundMusic(const char* pszFilePath, bool bLoop = false);
void stopBackgroundMusic(bool bReleaseData = false);