📄 main.cpp
字号:
#include "main.h"
#include "cppdemo.bid"
#include "Demo.h"
void* operator new(size_t r0)
{
return (MALLOC(r0));
}
void* operator new[](size_t r0)
{
return (MALLOC(r0));
}
void operator delete(void *a0)
{
if (a0)
{
FREE(a0);
}
}
void operator delete[](void* a0)
{
if(a0)
{
FREE(a0);
}
}
extern "C"
{
int AEEClsCreateInstance(AEECLSID CIsId, IShell *pIShell, IModule* po, void** ppObj)
{
*ppObj = NULL;
if (CIsId == AEECLSID_CPPDEMO)
{
if (AEEApplet_New(sizeof(BMainApp), CIsId, pIShell, po, (IApplet** )ppObj,
(AEEHANDLER)BMainApp::HandleEvent, (PFNFREEAPPDATA)BMainApp::FreeAppData))
{
BMainApp::InitAppData((BMainApp*)(*ppObj));
return SUCCESS;
}
}
return (EFAILED);
}
};
boolean BMainApp::HandleEvent(BMainApp* pApp, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
return pApp->handleEvent(eCode, wParam,dwParam);
}
boolean BMainApp::InitAppData(BMainApp* pApp)
{
return pApp->initAppData();
}
boolean BMainApp::FreeAppData(BMainApp* pApp)
{
pApp->freeAppData();
return TRUE;
}
void BMainApp::Loop(BMainApp* pApp)
{
pApp->loop();
}
boolean BMainApp::handleEvent(AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
switch(eCode)
{
case EVT_APP_START:
{
// BDemo *demo = new BDemo(this);
BDemo2 *demo2 = new BDemo2(this);
// demo->Draw();
demo2->Draw();
SetMainTimer();
// delete demo;
delete demo2;
}
return TRUE;
break;
case EVT_APP_STOP:
return TRUE;
case EVT_APP_SUSPEND:
suspend();
return TRUE;
case EVT_APP_RESUME:
resume();
return TRUE;
case EVT_APP_NO_SLEEP:
return TRUE;
default:
return HandleSelfEvent(eCode,wParam, dwParam);
}
}
boolean BMainApp::initAppData()
{
m_DevInfo.wStructSize = sizeof(m_DevInfo);
ISHELL_GetDeviceInfo(m_pIShell, &m_DevInfo);
int nAscent;
int nDescent;
m_nFontHeight = IDISPLAY_GetFontMetrics(m_pIDisplay, AEE_FONT_NORMAL, &nAscent, &nDescent);
CALLBACK_Init(&m_cbMainTimer, BMainApp::Loop, this);
return TRUE;
}
void BMainApp::freeAppData()
{
}
void BMainApp::SetMainTimer(int32 mSecs /* = 0 */)
{
ISHELL_SetTimerEx(m_pIShell, mSecs, &m_cbMainTimer);
}
void BMainApp::CancelMainTimer()
{
CALLBACK_Cancel(&m_cbMainTimer);
}
void BMainApp::loop()
{
SetMainTimer(80);
Action();
Update();
}
boolean BMainApp::HandleSelfEvent(AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
return FALSE;
}
void BMainApp::Update()
{
IDISPLAY_Update(m_pIDisplay);
}
void BMainApp::Action()
{
}
void BMainApp::suspend()
{
}
void BMainApp::resume()
{
}
void BMainApp::Suspend()
{
}
void BMainApp::Resume()
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -