2010-07-26 17:12:06 +08:00
|
|
|
|
// Application application cpp file.
|
|
|
|
|
|
|
|
|
|
// Original file name: test_uphoneApp.cpp
|
|
|
|
|
// Generated by TOPS Builder:Project wizard,Date:2010-7-26
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "test_uphoneApp.h"
|
|
|
|
|
#include "test_uphoneMainForm.h"
|
2010-08-03 11:23:12 +08:00
|
|
|
|
|
|
|
|
|
#include "CCDirector.h"
|
2010-08-06 17:50:20 +08:00
|
|
|
|
#include "CCScene.h"
|
|
|
|
|
#include "tests/controller.h"
|
2010-08-03 11:23:12 +08:00
|
|
|
|
|
2010-08-05 10:29:29 +08:00
|
|
|
|
using namespace cocos2d;
|
|
|
|
|
|
2010-07-26 17:12:06 +08:00
|
|
|
|
Ttest_uphoneApp::Ttest_uphoneApp()
|
2010-08-03 11:23:12 +08:00
|
|
|
|
: m_pMainWnd(NULL)
|
2010-07-26 17:12:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ttest_uphoneApp::~Ttest_uphoneApp()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-06 17:50:20 +08:00
|
|
|
|
bool Ttest_uphoneApp::initCocos2d()
|
2010-08-03 11:23:12 +08:00
|
|
|
|
{
|
|
|
|
|
CCDirector::getSharedDirector()->setOpenGLView(m_pMainWnd);
|
2010-08-11 15:19:47 +08:00
|
|
|
|
CCDirector::getSharedDirector()->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
|
2010-08-06 17:50:20 +08:00
|
|
|
|
|
|
|
|
|
CCScene * pScene = CCScene::node();
|
|
|
|
|
CCLayer * pLayer = new TestController();
|
|
|
|
|
pLayer->autorelease();
|
|
|
|
|
|
|
|
|
|
pScene->addChild(pLayer);
|
|
|
|
|
CCDirector::getSharedDirector()->runWithScene(pScene);
|
|
|
|
|
|
|
|
|
|
return true;
|
2010-08-03 11:23:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
2010-07-26 17:12:06 +08:00
|
|
|
|
Boolean Ttest_uphoneApp::EventHandler(EventType* pEvent)
|
|
|
|
|
{
|
|
|
|
|
Boolean bHandled = FALSE;
|
|
|
|
|
|
|
|
|
|
switch(pEvent->eType)
|
|
|
|
|
{
|
|
|
|
|
case EVENT_AppLoad:
|
|
|
|
|
{
|
2010-08-03 11:23:12 +08:00
|
|
|
|
m_pMainWnd = new TMainForm(this);
|
|
|
|
|
if (m_pMainWnd)
|
2010-07-26 17:12:06 +08:00
|
|
|
|
{
|
2010-08-03 11:23:12 +08:00
|
|
|
|
SetActiveWindow(m_pMainWnd);
|
2010-07-26 17:12:06 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{ // <20><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3>˳<EFBFBD>Ӧ<EFBFBD>á<EFBFBD>
|
|
|
|
|
SendStopEvent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_AppStopNotify:
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
bHandled = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (FALSE == bHandled)
|
|
|
|
|
{
|
2010-08-03 11:23:12 +08:00
|
|
|
|
return CCXApplication::EventHandler(pEvent);
|
2010-07-26 17:12:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return bHandled;
|
|
|
|
|
}
|