issue #2404:Add more deprecated function and Modify template vs11 solution

This commit is contained in:
samuele3hu 2013-07-28 00:16:16 +08:00
parent 3d60019eb1
commit 3c953a934e
5 changed files with 42 additions and 46 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

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

View File

@ -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;
}