Merge pull request #3198 from samuele3hu/deprecatedfunc

issue #2404:Move deprecated functions in Lua
This commit is contained in:
minggo 2013-07-22 00:27:06 -07:00
commit 8660543d77
36 changed files with 542 additions and 105 deletions

View File

@ -1 +1 @@
62276b5bbca4f4c7b09fa6f3eab9d01aaa7a8372
f7781fbb67fc947c54f987d419593d211f6a4020

View File

@ -31,9 +31,9 @@ local function main()
-- create dog animate
local textureDog = CCTextureCache:getInstance():addImage("dog.png")
local rect = Rect(0, 0, frameWidth, frameHeight)
local rect = CCRectMake(0, 0, frameWidth, frameHeight)
local frame0 = CCSpriteFrame:createWithTexture(textureDog, rect)
rect = Rect(frameWidth, 0, frameWidth, frameHeight)
rect = CCRectMake(frameWidth, 0, frameWidth, frameHeight)
local frame1 = CCSpriteFrame:createWithTexture(textureDog, rect)
local spriteDog = CCSprite:createWithSpriteFrame(frame0)
@ -86,7 +86,7 @@ local function main()
end
-- add crop
local frameCrop = CCSpriteFrame:create("crop.png", Rect(0, 0, 105, 95))
local frameCrop = CCSpriteFrame:create("crop.png", CCRectMake(0, 0, 105, 95))
for i = 0, 3 do
for j = 0, 1 do
local spriteCrop = CCSprite:createWithSpriteFrame(frameCrop);

View File

@ -4,7 +4,7 @@
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="9"/>
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9"/>
<uses-feature android:glEsVersion="0x00020000" />
<application android:label="@string/app_name"

View File

@ -79,6 +79,18 @@ if [ -f "$file" ]; then
fi
done
#copy comment script
for file in "$APP_ROOT"/../../../scripting/lua/script/*
do
if [ -d "$file" ]; then
cp -rf "$file" "$APP_ANDROID_ROOT"/assets
fi
if [ -f "$file" ]; then
cp "$file" "$APP_ANDROID_ROOT"/assets
fi
done
if [[ "$buildexternalsfromsource" ]]; then
echo "Building external dependencies from source"
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \

View File

@ -16,6 +16,7 @@ include $(COCOS_ROOT)/cocos2dx/proj.emscripten/cocos2dx.mk
$(TARGET): $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
cp -r ../../../../scripting/lua/script/ ../../../../samples/Lua/HelloLua/Resources
$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS) $(LIBS)
$(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST)

View File

@ -16,6 +16,7 @@ include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mk
$(TARGET): $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
cp -n ../../../../scripting/lua/script/* ../../../../samples/Lua/HelloLua/Resources
$(LOG_LINK)$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS) $(LIBS)
$(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST)

View File

@ -55,4 +55,4 @@ files
AppDelegate.cpp
}
postbuild "cccopy.py -s ../../../../scripting/lua/script/ -d ../../../../samples/Lua/HelloLua/Resources/"

View File

@ -95,12 +95,15 @@
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>libcocos2d.lib;libCocosDenshion.lib;liblua.lib;lua51.lib;libExtensions.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>libcocos2d.lib;libCocosDenshion.lib;liblua.lib;lua51.lib;libExtensions.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>xcopy "$(ProjectDir)..\..\..\..\scripting\lua\script" "$(ProjectDir)..\..\HelloLua\Resources" /e /Y</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl>

View File

@ -1 +1 @@
4a829fc84c7a38d95e536c8a26b4822bff188701
32e637c6b271e1eea27e207c13116f43c310c0d4

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)
{
@ -54,6 +54,7 @@ bool LuaEngine::init(void)
_stack = LuaStack::create();
_stack->retain();
extendLuaObject();
executeScriptFile("Deprecated.lua");
return true;
}

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 @@
ecb6191757f5eb70142d6767d49edf46074a2db4
7314b8a835d96e154da442ff16a7325c94edd276

View File

@ -320,7 +320,7 @@ int tolua_Cocos2d_registerScriptTouchHandler00(lua_State* tolua_S)
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
bool isMultiTouches = ((bool) tolua_toboolean(tolua_S,3,false));
int priority = ((int) tolua_tonumber(tolua_S,4,0));
bool swallowsTouches = ((bool) tolua_toboolean(tolua_S,5,false));
//the fifth arg(swallowsTouches) is not set in Layer,default true,
ccTouchesMode touchesMode = kTouchesAllAtOnce;
if (!isMultiTouches)
touchesMode = kTouchesOneByOne;

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

@ -0,0 +1,458 @@
local function deprecatedTip(old_name,new_name)
print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
end
local function addHandleOfControlEvent(self,func,controlEvent)
deprecatedTip("addHandleOfControlEvent","registerControlEventHandler")
self:registerControlEventHandler(func,controlEvent)
end
rawset(CCControl,"addHandleOfControlEvent",addHandleOfControlEvent)
local function ccpLineIntersect(a,b,c,d,s,t)
deprecatedTip("ccpLineIntersect","CCPoint:isLineIntersect")
return CCPoint:isLineIntersect(a,b,c,d,s,t)
end
rawset(_G,"ccpLineIntersect",ccpLineIntersect)
local function CCPointMake(x,y)
deprecatedTip("CCPointMake","CCPoint:__call")
return CCPoint:__call(x,y)
end
rawset(_G,"CCPointMake",CCPointMake)
local function ccp(x,y)
deprecatedTip("ccp","CCPoint:__call")
return CCPoint:__call(x,y)
end
rawset(_G,"ccp",ccp)
local function CCSizeMake(width,height)
deprecatedTip("CCSizeMake","CCSize:__call")
return CCSize:__call(width,height)
end
rawset(_G,"CCSizeMake",CCSizeMake)
local function CCRectMake(x,y,width,height)
deprecatedTip("CCRectMake","CCRect:__call")
return CCRect:__call(x,y,width,height)
end
rawset(_G,"CCRectMake",CCRectMake)
local function ccpNeg(pt)
deprecatedTip("ccpNeg","CCPoint.__sub")
return CCPoint.__sub(CCPoint:new_local(0,0),pt)
end
rawset(_G,"ccpNeg",ccpNeg)
local function ccpAdd(pt1,pt2)
deprecatedTip("ccpAdd","CCPoint.__add")
return CCPoint.__add(pt1,pt2)
end
rawset(_G,"ccpAdd",ccpAdd)
local function ccpSub(pt1,pt2)
deprecatedTip("ccpSub","CCPoint.__sub")
return CCPoint.__sub(pt1,pt2)
end
rawset(_G,"ccpSub",ccpSub)
local function ccpMult(pt,factor)
deprecatedTip("ccpMult","CCPoint.__mul")
return CCPoint.__mul(pt,factor)
end
rawset(_G,"ccpMult",ccpMult)
local function ccpMidpoint(pt1,pt2)
deprecatedTip("ccpMidpoint","CCPoint:getMidpoint")
return pt1:getMidpoint(pt2)
end
rawset(_G,"ccpMidpoint",ccpMidpoint)
local function ccpDot(pt1,pt2)
deprecatedTip("ccpDot","CCPoint:dot")
return pt1:dot(pt2)
end
rawset(_G,"ccpDot",ccpDot)
local function ccpCross(pt1,pt2)
deprecatedTip("ccpCross","CCPoint:cross")
return pt1:cross(pt2)
end
rawset(_G,"ccpCross",ccpCross)
local function ccpPerp(pt)
deprecatedTip("ccpPerp","CCPoint:getPerp")
return pt:getPerp()
end
rawset(_G,"ccpPerp",ccpPerp)
local function ccpRPerp(pt)
deprecatedTip("ccpRPerp","CCPoint:getRPerp")
return pt:getRPerp()
end
rawset(_G,"ccpRPerp",ccpRPerp)
--no test
local function ccpProject(pt1,pt2)
deprecatedTip("ccpProject","CCPoint:project")
return pt1:project(pt2)
end
rawset(_G,"ccpProject",ccpProject)
local function ccpRotate(pt1,pt2)
deprecatedTip("ccpRotate","CCPoint:rotate")
return pt1:rotate(pt2)
end
rawset(_G,"ccpRotate",ccpRotate)
local function ccpUnrotate(pt1,pt2)
deprecatedTip("ccpUnrotate","CCPoint:unrotate")
return pt1:unrotate(pt2)
end
rawset(_G,"ccpUnrotate",ccpUnrotate)
local function ccpLengthSQ(pt)
deprecatedTip("ccpLengthSQ","CCPoint:getLengthSq")
return pt:getLengthSq(pt)
end
rawset(_G,"ccpLengthSQ",ccpLengthSQ)
local function ccpDistanceSQ(pt1,pt2)
deprecatedTip("ccpDistanceSQ","CCPoint:__sub(pt1,pt2):getLengthSq")
return (CCPoint.__sub(pt1,pt2)):getLengthSq()
end
rawset(_G,"ccpDistanceSQ",ccpDistanceSQ)
local function ccpLength(pt)
deprecatedTip("ccpLength","CCPoint:getLength")
return pt:getLength()
end
rawset(_G,"ccpLength",ccpLength)
local function ccpDistance(pt1,pt2)
deprecatedTip("ccpDistance","CCPoint:getDistance")
return pt1:getDistance(pt2)
end
rawset(_G,"ccpDistance",ccpDistance)
local function ccpNormalize(pt)
deprecatedTip("ccpNormalize","CCPoint:getDistance")
return pt:getDistance()
end
rawset(_G,"ccpNormalize",ccpNormalize)
local function ccpForAngle(angle)
deprecatedTip("ccpForAngle","CCPoint:forAngle")
return CCPoint:forAngle(angle)
end
rawset(_G,"ccpForAngle",ccpForAngle)
local function ccpToAngle(pt)
deprecatedTip("ccpToAngle","CCPoint:getAngle")
return pt:getAngle()
end
rawset(_G,"ccpToAngle",ccpToAngle)
local function ccpClamp(pt1,pt2,pt3)
deprecatedTip("ccpClamp","CCPoint:getClampPoint")
return pt1:getClampPoint(pt2, pt3)
end
rawset(_G,"ccpClamp",ccpClamp)
local function ccpFromSize(sz)
deprecatedTip("ccpFromSize","CCPoint:__call")
return CCPoint:__call(sz)
end
rawset(_G,"ccpFromSize",ccpFromSize)
local function ccpLerp(pt1,pt2,alpha)
deprecatedTip("ccpLerp","CCPoint:lerp")
return pt1:lerp(pt2,alpha)
end
rawset(_G,"ccpLerp",ccpLerp)
local function ccpFuzzyEqual(pt1,pt2,variance)
deprecatedTip("ccpFuzzyEqual","CCPoint:fuzzyEquals")
return pt1:fuzzyEquals(pt2,variance)
end
rawset(_G,"ccpFuzzyEqual",ccpFuzzyEqual)
local function ccpCompMult(pt1,pt2)
deprecatedTip("ccpCompMult","CCPoint:__call")
return CCPoint:__call(pt1.x * pt2.x , pt1.y * pt2.y)
end
rawset(_G,"ccpCompMult",ccpCompMult)
local function ccpAngleSigned(pt1,pt2)
deprecatedTip("ccpAngleSigned","CCPoint:getAngle")
return pt1:getAngle(pt2)
end
rawset(_G,"ccpAngleSigned",ccpAngleSigned)
local function ccpAngle(pt1,pt2)
deprecatedTip("ccpAngle","CCPoint:getAngle")
return pt1:getAngle(pt2)
end
rawset(_G,"ccpAngle",ccpAngle)
local function ccpRotateByAngle(pt1,pt2,angle)
deprecatedTip("ccpRotateByAngle","CCPoint:rotateByAngle")
return pt1:rotateByAngle(pt2, angle)
end
rawset(_G,"ccpRotateByAngle",ccpRotateByAngle)
local function ccpSegmentIntersect(pt1,pt2,pt3,pt4)
deprecatedTip("ccpSegmentIntersect","CCPoint:isSegmentIntersect")
return CCPoint:isSegmentIntersect(pt1,pt2,pt3,pt4)
end
rawset(_G,"ccpSegmentIntersect",ccpSegmentIntersect)
local function ccpIntersectPoint(pt1,pt2,pt3,pt4)
deprecatedTip("ccpIntersectPoint","CCPoint:getIntersectPoint")
return CCPoint:getIntersectPoint(pt1,pt2,pt3,pt4)
end
rawset(_G,"ccpIntersectPoint",ccpIntersectPoint)
local function sharedOpenGLView()
deprecatedTip("CCEGLView:sharedOpenGLView","CCEGLView:getInstance")
return CCEGLView:getInstance()
end
rawset(CCEGLView,"sharedOpenGLView",sharedOpenGLView)
local function sharedFileUtils()
deprecatedTip("CCFileUtils:sharedFileUtils","CCFileUtils:getInstance")
return CCFileUtils:getInstance()
end
rawset(CCFileUtils,"sharedFileUtils",sharedFileUtils)
local function purgeFileUtils()
deprecatedTip("CCFileUtils:purgeFileUtils","CCFileUtils:destroyInstance")
return CCFileUtils:destroyInstance()
end
rawset(CCFileUtils,"purgeFileUtils",purgeFileUtils)
local function sharedApplication()
deprecatedTip("CCApplication:sharedApplication","CCApplication:getInstance")
return CCApplication:getInstance()
end
rawset(CCApplication,"sharedApplication",sharedApplication)
local function sharedDirector()
deprecatedTip("CCDirector:sharedDirector","CCDirector:getInstance")
return CCDirector:getInstance()
end
rawset(CCDirector,"sharedDirector",sharedDirector)
local function sharedUserDefault()
deprecatedTip("CCUserDefault:sharedUserDefault","CCUserDefault:getInstance")
return CCUserDefault:getInstance()
end
rawset(CCUserDefault,"sharedUserDefault",sharedUserDefault)
local function purgeSharedUserDefault()
deprecatedTip("CCUserDefault:purgeSharedUserDefault","CCUserDefault:destroyInstance")
return CCUserDefault:destroyInstance()
end
rawset(CCUserDefault,"purgeSharedUserDefault",purgeSharedUserDefault)
local function sharedNotificationCenter()
deprecatedTip("CCNotificationCenter:sharedNotificationCenter","CCNotificationCenter:getInstance")
return CCNotificationCenter:getInstance()
end
rawset(CCNotificationCenter,"sharedNotificationCenter",sharedNotificationCenter)
local function purgeNotificationCenter()
deprecatedTip("CCNotificationCenter:purgeNotificationCenter","CCNotificationCenter:destroyInstance")
return CCNotificationCenter:destroyInstance()
end
rawset(CCNotificationCenter,"purgeNotificationCenter",purgeNotificationCenter)
local function sharedTextureCache()
deprecatedTip("CCTextureCache:sharedTextureCache","CCTextureCache:getInstance")
return CCTextureCache:getInstance()
end
rawset(CCTextureCache,"sharedTextureCache",sharedTextureCache)
local function purgeSharedTextureCache()
deprecatedTip("CCTextureCache:purgeSharedTextureCache","CCTextureCache:destroyInstance")
return CCTextureCache:destroyInstance()
end
rawset(CCTextureCache,"purgeSharedTextureCache",purgeSharedTextureCache)
local function sharedSpriteFrameCache()
deprecatedTip("CCSpriteFrameCache:sharedSpriteFrameCache","CCSpriteFrameCache:getInstance")
return CCSpriteFrameCache:getInstance()
end
rawset(CCSpriteFrameCache,"sharedSpriteFrameCache",sharedSpriteFrameCache)
local function purgeSharedSpriteFrameCache()
deprecatedTip("CCSpriteFrameCache:purgeSharedSpriteFrameCache","CCSpriteFrameCache:destroyInstance")
return CCSpriteFrameCache:destroyInstance()
end
rawset(CCSpriteFrameCache,"purgeSharedSpriteFrameCache",purgeSharedSpriteFrameCache)
local function vertex(self,pt)
deprecatedTip("vertex","CCGrid3DAction:getVertex")
return self:getVertex(pt)
end
rawset(CCGrid3DAction,"vertex",vertex)
local function originalVertex(self,pt)
deprecatedTip("originalVertex","CCGrid3DAction:getOriginalVertex")
return self:getOriginalVertex(pt)
end
rawset(CCGrid3DAction,"originalVertex",originalVertex)
local function tile(self,pt)
deprecatedTip("tile","CCTiledGrid3DAction:getTile")
return self:getTile(pt)
end
rawset(CCTiledGrid3DAction,"tile",tile)
local function originalTile(self,pt)
deprecatedTip("originalTile","CCTiledGrid3DAction:getOriginalTile")
return self:getOriginalTile(pt)
end
rawset(CCTiledGrid3DAction,"originalTile",originalTile)
local function sharedAnimationCache()
deprecatedTip("CCAnimationCache:sharedAnimationCache","CCAnimationCache:getInstance")
return CCAnimationCache:getInstance()
end
rawset(CCAnimationCache,"sharedAnimationCache",sharedAnimationCache)
local function purgeSharedAnimationCache()
deprecatedTip("CCAnimationCache:purgeSharedAnimationCache","CCAnimationCache:destroyInstance")
return CCAnimationCache:destroyInstance()
end
rawset(CCAnimationCache,"purgeSharedAnimationCache",purgeSharedAnimationCache)
local function boundingBox(self)
deprecatedTip("CCNode:boundingBox","CCNode:getBoundingBox")
return self:getBoundingBox()
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

@ -19,17 +19,17 @@ class CCAccelDeccelAmplitude : public CCActionInterval
class CCGrid3DAction : public CCGridAction
{
virtual CCGridBase* getGrid(void);
Vertex3F vertex(const CCPoint& pos);
Vertex3F originalVertex(const CCPoint& pos);
void setVertex(const CCPoint& pos, const Vertex3F& vertex);
Vertex3F getVertex(const CCPoint& position);
Vertex3F getOriginalVertex(const CCPoint& position);
};
class CCTiledGrid3DAction : public CCGridAction
{
Quad3 tile(CCPoint pos);
Quad3 originalTile(CCPoint pos);
void setTile(CCPoint pos, Quad3 coords);
CCGridBase* getGrid(void);
Quad3 getTile(const CCPoint& position);
Quad3 getOriginalTile(const CCPoint& position);
//static CCTiledGrid3DAction* create(float duration, const CCSize& gridSize);
};

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

@ -5,11 +5,6 @@ class CCAnimationCache : public CCObject
void removeAnimationByName(const char* name);
CCAnimation* animationByName(const char* name);
// XXX deprecated, use getInstance instead
static CCAnimationCache* sharedAnimationCache(void);
// XXX deprecated, use destroyInstance instead
static void purgeSharedAnimationCache(void);
static CCAnimationCache* getInstance();
static void destroyInstance();

View File

@ -28,8 +28,6 @@ enum TargetPlatform
class CCApplication
{
~CCApplication();
// XXX: deprecated
static CCApplication* sharedApplication();
static CCApplication* getInstance();
ccLanguageType getCurrentLanguage();

View File

@ -57,7 +57,5 @@ class CCDirector : public CCObject
CCSize getVisibleSize();
CCPoint getVisibleOrigin();
/** @deprecated Use getInstance() instead */
static CCDirector* sharedDirector(void);
static CCDirector* getInstance();
};

View File

@ -86,8 +86,6 @@ class CCEGLViewProtocol
class CCEGLView : public CCEGLViewProtocol
{
/** @deprecated Use getInstance() instead */
static CCEGLView* sharedOpenGLView(void);
static CCEGLView* getInstance();
};

View File

@ -1,11 +1,6 @@
class CCFileUtils
{
/** @deprecated Use getInstance() instead */
static CCFileUtils* sharedFileUtils();
/** @deprecated Use destroyInstance() instead */
static void purgeFileUtils();
static CCFileUtils* getInstance();
static void destroyInstance();

View File

@ -5,8 +5,33 @@ class CCPoint
float y;
CCPoint();
CCPoint(float x, float y);
CCPoint(const CCSize& size);
CCPoint operator-(const CCPoint& right) const;
CCPoint operator+(const CCPoint& right) const;
CCPoint operator*(float a) const;
CCPoint getMidpoint(const CCPoint& other) const;
float dot(const CCPoint& other) const;
float cross(const CCPoint& other) const;
CCPoint getPerp() const;
CCPoint getRPerp() const;
CCPoint project(const CCPoint& other) const;
CCPoint rotate(const CCPoint& other) const;
CCPoint unrotate(const CCPoint& other) const;
float getLengthSq() const;
float getLength() const;
float getDistance(const CCPoint& other) const;
CCPoint normalize() const;
float getAngle() const;
CCPoint getClampPoint(const CCPoint& min_inclusive, const CCPoint& max_inclusive) const;
CCPoint lerp(const CCPoint& other, float alpha) const;
bool fuzzyEquals(const CCPoint& target, float variance) const;
CCPoint rotateByAngle(const CCPoint& pivot, float angle) const;
bool equals(const CCPoint & target) const ;
static bool isLineIntersect(const CCPoint& A, const CCPoint& B,const CCPoint& C, const CCPoint& D,float* S, float* T);
static bool isSegmentIntersect(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D);
static CCPoint getIntersectPoint(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D);
static CCPoint forAngle(const float a);
};
class CCSize
@ -36,8 +61,3 @@ class CCRect
bool containsPoint(const CCPoint & point) const;
bool intersectsRect(const CCRect & rect) const;
};
CCPoint CCPointMake(float x, float y);
CCPoint CCPointMake @ ccp (float x, float y);
CCSize CCSizeMake(float width, float height);
CCRect CCRectMake(float x, float y, float width,float height);

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

@ -86,7 +86,7 @@ class CCNode : public CCObject
void visit(void);
void transform(void);
void transformAncestors(void);
CCRect boundingBox(void);
CCRect getBoundingBox(void) const;
CCAction* runAction(CCAction* action);
void stopAllActions(void);
@ -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,10 +5,6 @@ class CCNotificationCenter : public CCObject
~CCNotificationCenter();
// XXX deprecated
static CCNotificationCenter *sharedNotificationCenter(void);
static void purgeNotificationCenter(void);
static CCNotificationCenter* getInstance();
static void destroyInstance();

View File

@ -1,32 +1 @@
static CCPoint ccpNeg(const CCPoint& v);
static CCPoint ccpAdd(const CCPoint& v1, const CCPoint& v2);
static CCPoint ccpSub(const CCPoint& v1, const CCPoint& v2);
static CCPoint ccpMult(const CCPoint& v, const float s);
static CCPoint ccpMidpoint(const CCPoint& v1, const CCPoint& v2);
static float ccpDot(const CCPoint& v1, const CCPoint& v2);
static float ccpCross(const CCPoint& v1, const CCPoint& v2);
static CCPoint ccpPerp(const CCPoint& v);
static CCPoint ccpRPerp(const CCPoint& v);
static CCPoint ccpProject(const CCPoint& v1, const CCPoint& v2);
static CCPoint ccpRotate(const CCPoint& v1, const CCPoint& v2);
static CCPoint ccpUnrotate(const CCPoint& v1, const CCPoint& v2);
static float ccpLengthSQ(const CCPoint& v);
static float ccpDistanceSQ(const CCPoint p1, const CCPoint p2);
float ccpLength(const CCPoint& v);
float ccpDistance(const CCPoint& v1, const CCPoint& v2);
CCPoint ccpNormalize(const CCPoint& v);
CCPoint ccpForAngle(const float a);
float ccpToAngle(const CCPoint& v);
float clampf(float value, float min_inclusive, float max_inclusive);
CCPoint ccpClamp(const CCPoint& p, const CCPoint& from, const CCPoint& to);
CCPoint ccpFromSize(const CCSize& s);
CCPoint ccpLerp(const CCPoint& a, const CCPoint& b, float alpha);
bool ccpFuzzyEqual(const CCPoint& a, const CCPoint& b, float variance);
CCPoint ccpCompMult(const CCPoint& a, const CCPoint& b);
float ccpAngleSigned(const CCPoint& a, const CCPoint& b);
float ccpAngle(const CCPoint& a, const CCPoint& b);
CCPoint ccpRotateByAngle(const CCPoint& v, const CCPoint& pivot, float angle);
bool ccpLineIntersect(const CCPoint& p1, const CCPoint& p2, const CCPoint& p3, const CCPoint& p4, float *s, float *t);
bool ccpSegmentIntersect(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D);
CCPoint ccpIntersectPoint(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D);

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,11 +14,7 @@ class CCSpriteFrameCache : public CCObject
//void removeSpriteFramesFromDictionary(CCDictionary<std::string, CCSpriteFrame*> *dictionary);
void removeSpriteFramesFromTexture(CCTexture2D* texture);
CCSpriteFrame* spriteFrameByName(const char *pszName);
// XXX deprecated
static CCSpriteFrameCache* sharedSpriteFrameCache(void);
static void purgeSharedSpriteFrameCache(void);
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

@ -389,7 +389,8 @@
//comment nextline since it wasn't defined in glew.h of windows
// #define GL_RGB565 0x8D62
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_STENCIL_INDEX 0x1901
//comment nextline since it wasn't defined in gl.h of IOS7 sdk
//#define GL_STENCIL_INDEX 0x1901
#define GL_STENCIL_INDEX8 0x8D48
#define GL_RENDERBUFFER_WIDTH 0x8D42
@ -504,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

@ -13,10 +13,7 @@ class CCTextureCache : public CCObject
void removeTextureForKey(const char *textureKeyName);
void dumpCachedTextureInfo();
// XXX: deprecated
static CCTextureCache * sharedTextureCache();
static void reloadAllTextures();
static void purgeSharedTextureCache();
static CCTextureCache * getInstance();
static void destroyInstance();

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

@ -17,9 +17,6 @@ class CCUserDefault
void flush();
static CCUserDefault* sharedUserDefault();
static void purgeSharedUserDefault();
static CCUserDefault* getInstance();
static void destroyInstance();

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);