From 3c953a934e4297c24d718938821d341c7e9b6cda Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Sun, 28 Jul 2013 00:16:16 +0800 Subject: [PATCH] issue #2404:Add more deprecated function and Modify template vs11 solution --- scripting/lua/script/Deprecated.lua | 9 +++++++ .../Classes/AppDelegate.cpp | 14 +++++----- .../Classes/HelloWorldScene.cpp | 26 +++++++++--------- .../multi-platform-js/Classes/AppDelegate.cpp | 12 ++++----- .../Classes/AppDelegate.cpp | 27 +++++-------------- 5 files changed, 42 insertions(+), 46 deletions(-) diff --git a/scripting/lua/script/Deprecated.lua b/scripting/lua/script/Deprecated.lua index 893951d109..cd0ccf6cde 100644 --- a/scripting/lua/script/Deprecated.lua +++ b/scripting/lua/script/Deprecated.lua @@ -881,3 +881,12 @@ rawset(_G, "ccPointSize", CCDrawPrimitivesDeprecated.ccPointSize) _G["kParticleStartSizeEqualToEndSize"] = _G["kCCParticleStartSizeEqualToEndSize"] _G["kParticleDurationInfinity"] = _G["kCCParticleDurationInfinity"] --enums of CCParticleSystem will be deprecated end + +--enums of CCRenderTexture will be deprecated begin +local CCRenderTextureDeprecated = { } +function CCRenderTextureDeprecated.newCCImage(self) + deprecatedTip("CCRenderTexture:newCCImage","CCRenderTexture:newImage") + return self:newImage() +end +rawset(CCRenderTexture, "newCCImage", CCRenderTextureDeprecated.newCCImage) +--enums of CCRenderTexture will be deprecated end diff --git a/template/multi-platform-cpp/Classes/AppDelegate.cpp b/template/multi-platform-cpp/Classes/AppDelegate.cpp index 1c065df82b..27677ac1ad 100644 --- a/template/multi-platform-cpp/Classes/AppDelegate.cpp +++ b/template/multi-platform-cpp/Classes/AppDelegate.cpp @@ -13,22 +13,22 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director - Director* pDirector = Director::getInstance(); - EGLView* pEGLView = EGLView::getInstance(); + Director* director = Director::getInstance(); + EGLView* eglView = EGLView::getInstance(); - pDirector->setOpenGLView(pEGLView); + director->setOpenGLView(eglView); // turn on display FPS - pDirector->setDisplayStats(true); + director->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this - pDirector->setAnimationInterval(1.0 / 60); + director->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object - Scene *pScene = HelloWorld::scene(); + Scene *scene = HelloWorld::scene(); // run - pDirector->runWithScene(pScene); + director->runWithScene(scene); return true; } diff --git a/template/multi-platform-cpp/Classes/HelloWorldScene.cpp b/template/multi-platform-cpp/Classes/HelloWorldScene.cpp index b635359243..c2f4896258 100644 --- a/template/multi-platform-cpp/Classes/HelloWorldScene.cpp +++ b/template/multi-platform-cpp/Classes/HelloWorldScene.cpp @@ -35,18 +35,18 @@ bool HelloWorld::init() // you may modify it. // add a "close" icon to exit the progress. it's an autorelease object - MenuItemImage *pCloseItem = MenuItemImage::create( + MenuItemImage *closeItem = MenuItemImage::create( "CloseNormal.png", "CloseSelected.png", CC_CALLBACK_1(HelloWorld::menuCloseCallback, this)); - pCloseItem->setPosition(Point(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 , - origin.y + pCloseItem->getContentSize().height/2)); + closeItem->setPosition(Point(origin.x + visibleSize.width - closeItem->getContentSize().width/2 , + origin.y + closeItem->getContentSize().height/2)); // create menu, it's an autorelease object - Menu* pMenu = Menu::create(pCloseItem, NULL); - pMenu->setPosition(Point::ZERO); - this->addChild(pMenu, 1); + Menu* menu = Menu::create(closeItem, NULL); + menu->setPosition(Point::ZERO); + this->addChild(menu, 1); ///////////////////////////// // 3. add your codes below... @@ -54,23 +54,23 @@ bool HelloWorld::init() // add a label shows "Hello World" // create and initialize a label - LabelTTF* pLabel = LabelTTF::create("Hello World", "Arial", 24); + LabelTTF* label = LabelTTF::create("Hello World", "Arial", 24); // position the label on the center of the screen - pLabel->setPosition(Point(origin.x + visibleSize.width/2, - origin.y + visibleSize.height - pLabel->getContentSize().height)); + label->setPosition(Point(origin.x + visibleSize.width/2, + origin.y + visibleSize.height - label->getContentSize().height)); // add the label as a child to this layer - this->addChild(pLabel, 1); + this->addChild(label, 1); // add "HelloWorld" splash screen" - Sprite* pSprite = Sprite::create("HelloWorld.png"); + Sprite* sprite = Sprite::create("HelloWorld.png"); // position the sprite on the center of the screen - pSprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); + sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); // add the sprite as a child to this layer - this->addChild(pSprite, 0); + this->addChild(sprite, 0); return true; } diff --git a/template/multi-platform-js/Classes/AppDelegate.cpp b/template/multi-platform-js/Classes/AppDelegate.cpp index ae91b478d4..f086f7b889 100644 --- a/template/multi-platform-js/Classes/AppDelegate.cpp +++ b/template/multi-platform-js/Classes/AppDelegate.cpp @@ -29,14 +29,14 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director - Director *pDirector = Director::getInstance(); - pDirector->setOpenGLView(EGLView::getInstance()); + Director *director = Director::getInstance(); + director->setOpenGLView(EGLView::getInstance()); // turn on display FPS - pDirector->setDisplayStats(true); + director->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this - pDirector->setAnimationInterval(1.0 / 60); + director->setAnimationInterval(1.0 / 60); ScriptingCore* sc = ScriptingCore::getInstance(); sc->addRegisterCallback(register_all_cocos2dx); @@ -52,8 +52,8 @@ bool AppDelegate::applicationDidFinishLaunching() sc->start(); - ScriptEngineProtocol *pEngine = ScriptingCore::getInstance(); - ScriptEngineManager::getInstance()->setScriptEngine(pEngine); + ScriptEngineProtocol *engine = ScriptingCore::getInstance(); + ScriptEngineManager::getInstance()->setScriptEngine(engine); ScriptingCore::getInstance()->runScript("main.js"); return true; diff --git a/template/multi-platform-lua/Classes/AppDelegate.cpp b/template/multi-platform-lua/Classes/AppDelegate.cpp index 05fb3205e1..8f8b0f5a3f 100644 --- a/template/multi-platform-lua/Classes/AppDelegate.cpp +++ b/template/multi-platform-lua/Classes/AppDelegate.cpp @@ -3,10 +3,6 @@ #include "AppDelegate.h" #include "CCLuaEngine.h" #include "SimpleAudioEngine.h" -#include "Lua_extensions_CCB.h" -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) -#include "Lua_web_socket.h" -#endif using namespace CocosDenshion; @@ -24,30 +20,21 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director - Director *pDirector = Director::getInstance(); - pDirector->setOpenGLView(EGLView::getInstance()); + Director *director = Director::getInstance(); + director->setOpenGLView(EGLView::getInstance()); // turn on display FPS - pDirector->setDisplayStats(true); + director->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this - pDirector->setAnimationInterval(1.0 / 60); + director->setAnimationInterval(1.0 / 60); // register lua engine - LuaEngine* pEngine = LuaEngine::getInstance(); - ScriptEngineManager::getInstance()->setScriptEngine(pEngine); - - LuaStack *pStack = pEngine->getLuaStack(); - lua_State *tolua_s = pStack->getLuaState(); - tolua_extensions_ccb_open(tolua_s); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) - pStack = pEngine->getLuaStack(); - tolua_s = pStack->getLuaState(); - tolua_web_socket_open(tolua_s); -#endif + LuaEngine* engine = LuaEngine::getInstance(); + ScriptEngineManager::getInstance()->setScriptEngine(engine); std::string path = FileUtils::getInstance()->fullPathForFilename("hello.lua"); - pEngine->executeScriptFile(path.c_str()); + engine->executeScriptFile(path.c_str()); return true; }