⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menu_app.c

📁 this puzzle game using BREW this puzzle game using BREW this puzzle game using BREW this puzzle g
💻 C
字号:
//======================================================
//颇老:menu_app.c
//
//林力:览侩橇肺弊伐阑 困茄 荤侩磊 捞亥飘 备泅 颇老  
//
//汲疙:
//   备炼眉 冯(Room) 扁过捞 利侩等 览侩橇肺弊伐 备炼眉甫 
//   扁馆栏肺 荤侩磊 裹困狼 捞亥飘 贸府 窃荐 备泅 
//
//累己磊:
//   2006.02. 冠蛮刮(eacs@paran.com)
//======================================================

#include "std.h"
#include "menu_app.h"

#define M_ITEM_1 0x01
#define M_ITEM_2 0x02
#define M_ITEM_3 0x03
#define M_EXIT M_ITEM_3


static void DistroyMenu(IMenuCtl * pMenu)
{
	if(pMenu != NULL)
	{
		IMENUCTL_Release(pMenu);
		pMenu = NULL;
	}
}

static void DisplayMenu(menu_app * pMe)
{
	AEERect rect;
	AECHAR * pCaption[7];
	int i;

	DistroyMenu(pMe->pMenu);

	pCaption[0] = L"Menu";
	pCaption[1] = L"Start";
	pCaption[3] = L"Exit";

	ISHELL_CreateInstance(GetActiveShell(pMe), AEECLSID_MENUCTL, (void **)&pMe->pMenu);
	IMENUCTL_SetTitle(pMe->pMenu, NULL, 0, pCaption[0]);
	IMENUCTL_AddItem(pMe->pMenu, NULL, 0, M_ITEM_1, pCaption[1], 1);
	IMENUCTL_AddItem(pMe->pMenu, NULL, 0, M_EXIT, pCaption[3], 0);

	SETAEERECT(&rect, 0, 0, pMe->DeviceInfo.cxScreen, pMe->DeviceInfo.cyScreen);
	IMENUCTL_SetRect(pMe->pMenu, &rect);
	IMENUCTL_SetActive(pMe->pMenu, TRUE);
}

//览侩橇肺弊伐 捞亥飘 勤甸矾
static boolean menu_app_OnStart(menu_app *pMe, uint16 wParam, AEEAppStart * pStart)
{	
	int ret;

	_D("OnStart");

	DisplayMenu(pMe);
	
	return(TRUE);
}

static boolean menu_app_OnStop(menu_app *pMe, uint16 wParam, boolean * pCloseFlag)
{

	_D("OnStop");

	return(TRUE);
}

static boolean menu_app_OnSuspend(menu_app *pMe, AEESuspendReason reason, AEESuspendInfo * pInfo)
{

	_D("OnSuspend");

	return(TRUE);
}

static boolean menu_app_OnResume(menu_app *pMe, uint16 wParam, AEEAppStart * pStart)
{

	_D("OnResume");
	
	DisplayMenu(pMe);

	return(TRUE);
}

static boolean menu_app_OnMessage(menu_app *pMe, uint16 smsEncoding, void * pszMsg)
{

	_D("OnMessage");
	
	return(TRUE);
}

static boolean menu_app_OnCommand(menu_app *pMe, uint16 nID, uint32 data)
{
	_D("OnCommand");

	if(nID == M_EXIT)
	{	
		char arg[20];
		SNPRINTF(arg, sizeof(arg), "Item2: %d", nID);
		ISHELL_StartAppletArgs(GetActiveShell(pMe), 0x11110006/*menu_exit*/, arg);

		//ISHELL_CloseApplet(GetActiveShell(pMe), TRUE);
	}else if(nID == M_ITEM_1)
	{
		char arg[20];
		SNPRINTF(arg, sizeof(arg), "Item1: %d", nID);
		ISHELL_StartAppletArgs(GetActiveShell(pMe), 0x11110009/*menu_sub*/, arg);
	}

	return(TRUE);
}

//虐 菩靛 捞亥飘 勤甸矾
static boolean menu_app_OnKey0(menu_app * pMe)
{
	_D("OnKey 0");

	return(FALSE);
}

static boolean menu_app_OnKey1(menu_app * pMe)
{
	_D("OnKey 1");

	return(FALSE);
}

static boolean menu_app_OnKey2(menu_app * pMe)
{
	_D("OnKey 2");

	return(FALSE);
}

static boolean menu_app_OnKey3(menu_app * pMe)
{
	_D("OnKey 3");

	return(FALSE);
}

static boolean menu_app_OnKey4(menu_app * pMe)
{
	_D("OnKey 4");

	return(FALSE);
}

static boolean menu_app_OnKey5(menu_app * pMe)
{
	_D("OnKey 5");

	return(FALSE);
}

static boolean menu_app_OnKey6(menu_app * pMe)
{
	_D("OnKey 6");

	return(FALSE);
}

static boolean menu_app_OnKey7(menu_app * pMe)
{
	_D("OnKey 7");

	return(FALSE);
}

static boolean menu_app_OnKey8(menu_app * pMe)
{
	_D("OnKey 8");

	return(FALSE);
}

static boolean menu_app_OnKey9(menu_app * pMe)
{
	_D("OnKey 9");

	return(FALSE);
}

static boolean menu_app_OnKeyStar(menu_app * pMe)
{
	_D("OnKey Star");

	return(FALSE);
}

static boolean menu_app_OnKeyPound(menu_app * pMe)
{
	_D("OnKey Pound");

	return(FALSE);
}

static boolean menu_app_OnKeyUP(menu_app * pMe)
{
	_D("OnKey Up");

	return(FALSE);
}

static boolean menu_app_OnKeyDown(menu_app * pMe)
{
	_D("OnKey Down");

	return(FALSE);
}

static boolean menu_app_OnKeyLeft(menu_app * pMe)
{
	_D("OnKey Left");

	return(FALSE);
}

static boolean menu_app_OnKeyRight(menu_app * pMe)
{
	_D("OnKey Right");

	return(FALSE);
}

static boolean menu_app_OnKeySelect(menu_app * pMe)
{
	_D("OnKey Select");

	return(FALSE);
}

//虐 菩靛 捞亥飘 勤甸矾甫 角青窍扁 傈俊 鞘夸茄 傈贸府 荐青
int menu_app_PreTranslateKey(uint16 * pVkey, uint32 * pBitFlags)
{
	menu_app * pMe = (menu_app *)GETAPPINSTANCE();

	_D("OnKey PreTranslate");
	
	if(pMe->pMenu)
	{
		IMENUCTL_HandleEvent(pMe->pMenu, EVT_KEY, *pVkey, *pBitFlags);
		return(TRUE);
	}

	return(-1); //-1阑 馆券窍搁 秦寸 虐 勤甸矾档 眠啊 角青(-1, FALSE TRUE)
}


//檬扁拳 棺 秦力
boolean menu_app_Init(menu_app *pMe)
{
    _D("Call: menu_app_Init");

    pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);
    ISHELL_GetDeviceInfo(GetActiveShell(pMe),&pMe->DeviceInfo);

	//览侩橇肺弊伐 捞亥飘 勤甸矾 殿废
	BEGIN_EVENT(6)
		SET_EVENT(EVT_APP_START, menu_app_OnStart)
		SET_EVENT(EVT_APP_STOP, menu_app_OnStop)
		SET_EVENT(EVT_APP_SUSPEND, menu_app_OnSuspend)
		SET_EVENT(EVT_APP_RESUME, menu_app_OnResume)
		SET_EVENT(EVT_APP_MESSAGE, menu_app_OnMessage)
		SET_EVENT(EVT_COMMAND, menu_app_OnCommand)
	END_EVENT()

	//虐 菩靛 捞亥飘 勤甸矾 殿废
	BEGIN_KEY_EVENT(17)
		SET_KEY_EVENT(AVK_0, menu_app_OnKey0)
		SET_KEY_EVENT(AVK_1, menu_app_OnKey1)
		SET_KEY_EVENT(AVK_2, menu_app_OnKey2)
		SET_KEY_EVENT(AVK_3, menu_app_OnKey3)
		SET_KEY_EVENT(AVK_4, menu_app_OnKey4)
		SET_KEY_EVENT(AVK_5, menu_app_OnKey5)
		SET_KEY_EVENT(AVK_6, menu_app_OnKey6)
		SET_KEY_EVENT(AVK_7, menu_app_OnKey7)
		SET_KEY_EVENT(AVK_8, menu_app_OnKey8)
		SET_KEY_EVENT(AVK_9, menu_app_OnKey9)
		SET_KEY_EVENT(AVK_STAR, menu_app_OnKeyStar)
		SET_KEY_EVENT(AVK_POUND, menu_app_OnKeyPound)
		SET_KEY_EVENT(AVK_UP, menu_app_OnKeyUP)
		SET_KEY_EVENT(AVK_DOWN, menu_app_OnKeyDown)
		SET_KEY_EVENT(AVK_LEFT, menu_app_OnKeyLeft)
		SET_KEY_EVENT(AVK_RIGHT, menu_app_OnKeyRight)
		SET_KEY_EVENT(AVK_SELECT, menu_app_OnKeySelect)
	END_KEY_EVENT()

	//捞 镑俊 檬扁拳 棺 磊盔且寸 内靛甫 火涝茄促.
	pMe->pMenu = NULL;
	pMe->depth = 0; //Main menu

    return TRUE;
}

void menu_app_Free(menu_app *pMe)
{
    _D("Call: menu_app_Free");

	EVENT_FREE();
	KEY_EVENT_FREE();

	//捞 镑俊 且寸等 磊盔阑 秦力窍绰 内靛甫 火涝茄促.
	DistroyMenu(pMe->pMenu);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -