📄 fruit.c
字号:
#include "fruit.h"
#include "AEEStdLib.h"
#include "fruit.bid"
#include "commondef.h"
static boolean pfruit_HandleEvent(pfruitApp * pme, AEEEvent eCode,uint16 wParam, uint32 dwParam);
static boolean pfruit_Init(pfruitApp *pMe);
static void pfruit_Free(pfruitApp *pMe);
boolean Pfruit_SetActiveWnd(pfruitApp *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;
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);
default:
return FALSE;
}
}
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * pMod,void ** ppObj)
{
*ppObj = NULL;
if (!AEEApplet_New(sizeof(pfruitApp), // Size of our private class
ClsId, // Our class ID
pIShell, // Shell interface
pMod, // Module instance
(IApplet**)ppObj, // Return object
(AEEHANDLER)pfruit_HandleEvent, // Our event handler
(PFNFREEAPPDATA)pfruit_Free))
return EFAILED;
return SUCCESS;
}
static boolean pfruit_HandleEvent(pfruitApp * pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
switch (eCode) {
case EVT_APP_START:
if (pfruit_Init(pMe) != TRUE) {
return FALSE;
}
return Pfruit_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);
default:
break;
}
}
return FALSE;
}
static boolean pfruit_Init(pfruitApp *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;
}
return TRUE;
}
static void pfruit_Free(pfruitApp *pMe)
{
GameWnd_Free(&pMe->game);
MainMenuWnd_Free(&pMe->mainMenu);
GameEndWnd_Free(&pMe->end);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -