📄 pfly.c
字号:
#include "pfly.h"
#include "AEEStdLib.h"
#include "pfly.bid"
#include "commondef.h"
static boolean Pfly_HandleEvent(PflyApp * pme, AEEEvent eCode,uint16 wParam, uint32 dwParam);
static boolean Pfly_Init(PflyApp *pMe);
static void Pfly_Free(PflyApp *pMe);
boolean Pfly_SetActiveWnd(PflyApp *pMe, int wnd)
{
switch(pMe->activeView) {
case IDW_GAME:
GameWnd_Close(&pMe->game);
break;
case IDW_GAMEEND:
GameEndWnd_Close(&pMe->end);
break;
case IDW_MAINMENU:
MainMenuWnd_Close(&pMe->mainMenu);
break;
case IDW_SCORELIST:
ScoreListWnd_Close(&pMe->score);
break;
default:
break;
}
pMe->activeView = wnd;
switch(pMe->activeView) {
case IDW_GAME:
return GameWnd_Open(&pMe->game);
case IDW_GAMEEND:
return GameEndWnd_Open(&pMe->end);
case IDW_MAINMENU:
return MainMenuWnd_Open(&pMe->mainMenu);
case IDW_SCORELIST:
return ScoreListWnd_Open(&pMe->score);
default:
return FALSE;
}
}
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * pMod,void ** ppObj)
{
*ppObj = NULL;
if (!AEEApplet_New(sizeof(PflyApp), // Size of our private class
ClsId, // Our class ID
pIShell, // Shell interface
pMod, // Module instance
(IApplet**)ppObj, // Return object
(AEEHANDLER)Pfly_HandleEvent, // Our event handler
(PFNFREEAPPDATA)Pfly_Free))
return EFAILED;
return SUCCESS;
}
static boolean Pfly_HandleEvent(PflyApp * pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
switch (eCode) {
case EVT_APP_START:
if (Pfly_Init(pMe) != TRUE) {
return FALSE;
}
return Pfly_SetActiveWnd(pMe, IDW_MAINMENU);
case EVT_APP_STOP:
return TRUE;
default:
switch(pMe->activeView) {
case IDW_GAME:
return GameWnd_HandleEvent(&pMe->game, eCode, wParam, dwParam);
case IDW_MAINMENU:
return MainMenuWnd_HandleEvent(&pMe->mainMenu, eCode, wParam, dwParam);
case IDW_GAMEEND:
return GameEndWnd_HandleEvent(&pMe->end, eCode, wParam, dwParam);
case IDW_SCORELIST:
return ScoreListWnd_HandleEvent(&pMe->score, eCode, wParam, dwParam);
default:
break;
}
}
return FALSE;
}
static boolean Pfly_Init(PflyApp *pMe)
{
pMe->activeView = IDW_NOWND;
if (GameWnd_New(&pMe->game, pMe) != TRUE) {
return FALSE;
}
if (MainMenuWnd_New(&pMe->mainMenu, pMe) != TRUE) {
return FALSE;
}
if (GameEndWnd_New(&pMe->end, pMe) != TRUE) {
return FALSE;
}
if (ScoreListWnd_New(&pMe->score, pMe) != TRUE) {
return FALSE;
}
return TRUE;
}
static void Pfly_Free(PflyApp *pMe)
{
GameWnd_Free(&pMe->game);
MainMenuWnd_Free(&pMe->mainMenu);
GameEndWnd_Free(&pMe->end);
ScoreListWnd_Free(&pMe->score);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -