mirror of https://github.com/axmolengine/axmol.git
72 lines
1.3 KiB
C++
72 lines
1.3 KiB
C++
// 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
|
|
{ // 窗口创建失败,退出应用。
|
|
SendStopEvent();
|
|
}
|
|
}
|
|
break;
|
|
|
|
case EVENT_AppStopNotify:
|
|
{
|
|
|
|
}
|
|
bHandled = FALSE;
|
|
break;
|
|
}
|
|
if (FALSE == bHandled)
|
|
{
|
|
return CCXApplication::EventHandler(pEvent);
|
|
}
|
|
|
|
return bHandled;
|
|
}
|