axmol/HelloWorld/HelloWorldApp.cpp

72 lines
1.3 KiB
C++
Raw Normal View History

// Application application cpp file.
// Original file name: HelloWorldApp.cpp
// Generated by TOPS Builder:Project wizard,Date:2010-8-3
#include "HelloWorldApp.h"
#include "HelloWorldMainForm.h"
#include "CCDirector.h"
#include "CCScene.h"
#include "HelloWorld/HelloWorld.h"
THelloWorldApp::THelloWorldApp()
: m_pMainWnd(NULL)
{
}
THelloWorldApp::~THelloWorldApp()
{
}
Boolean THelloWorldApp::initCocos2d()
{
CCDirector::getSharedDirector()->setOpenGLView(m_pMainWnd);
CCScene * pScene = CCScene::node();
CCLayer * pLayer = new HelloWorld();
pLayer->autorelease();
pScene->addChild(pLayer);
CCDirector::getSharedDirector()->runWithScene(pScene);
return TRUE;
}
Boolean THelloWorldApp::EventHandler(EventType* pEvent)
{
Boolean bHandled = FALSE;
switch(pEvent->eType)
{
case EVENT_AppLoad:
{
m_pMainWnd = new TMainForm(this);
if (m_pMainWnd)
{
SetActiveWindow(m_pMainWnd);
}
else
{ // <20><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3>˳<EFBFBD>Ӧ<EFBFBD>á<EFBFBD>
SendStopEvent();
}
}
break;
case EVENT_AppStopNotify:
{
}
bHandled = FALSE;
break;
}
if (FALSE == bHandled)
{
return CCXApplication::EventHandler(pEvent);
}
return bHandled;
}