2010-10-12 17:15:44 +08:00
|
|
|
#include "TestApplication.h"
|
|
|
|
#include "winmain.h"
|
|
|
|
#include "tests/controller.h"
|
|
|
|
|
|
|
|
using namespace cocos2d;
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// implement TestApplication
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
bool TestApplication::InitInstance()
|
|
|
|
{
|
2010-10-15 16:06:05 +08:00
|
|
|
return m_MainForm.Create(L"Cocos2dx-Win32", 320, 480);
|
2010-10-12 17:15:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool TestApplication::initCocos2d()
|
|
|
|
{
|
|
|
|
// init director
|
|
|
|
CCDirector * pDirector = CCDirector::getSharedDirector();
|
|
|
|
pDirector->setOpenGLView(&m_MainForm);
|
2010-10-15 16:06:05 +08:00
|
|
|
pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
|
2010-10-12 17:15:44 +08:00
|
|
|
|
|
|
|
pDirector->setDisplayFPS(true);
|
|
|
|
|
|
|
|
CCScene * pScene = CCScene::node();
|
2010-10-13 14:46:06 +08:00
|
|
|
CCLayer * pLayer = new TestController();
|
2010-10-12 17:15:44 +08:00
|
|
|
pLayer->autorelease();
|
|
|
|
|
|
|
|
pScene->addChild(pLayer);
|
2010-10-13 13:09:39 +08:00
|
|
|
pDirector->runWithScene(pScene);
|
2010-10-12 17:15:44 +08:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestApplication::applicationDidEnterBackground()
|
|
|
|
{
|
|
|
|
CCDirector::getSharedDirector()->stopAnimation();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestApplication::applicationWillEnterForeground()
|
|
|
|
{
|
|
|
|
CCDirector::getSharedDirector()->startAnimation();
|
2010-10-13 13:09:39 +08:00
|
|
|
}
|