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

📄 vacation.h

📁 brew中开发的个人小游戏
💻 H
字号:
#ifndef	__VACATION_H__
#define	__VACATION_H__

//#define	 DEBUG_

#include "AEEModGen.h"          // Module interface definitions
#include "AEEAppGen.h"          // Applet interface definitions
#include "AEEShell.h"           // Shell interface definitions
#include "AEEFile.h"			// File interface definitions
#include "AEEDB.h"				// Database interface definitions
#include "AEENet.h"				// Socket interface definitions
#include "AEESound.h"			// Sound Interface definitions
#include "AEETapi.h"			// TAPI Interface definitions
#include "AEEStdLib.h"
#include "AEEMenu.h"			//Menu Control Interface definitions
#include "AEELicense.h"
#include "AEETapi.h"
#include "AEEGraphics.h"
#include "vacation_res.h"
#include "vacation.bid"

//#define INIT_FILE	"vacation.ini"	//for configurate
#define ISDIGIT(c)  ( (unsigned) ((c) - '0') < 10)
#define ISALPHA(c)  ( (unsigned) ( ((c)|32) - 'a') < 26 )
#define ISALNUM(c)  ( ISDIGIT(c) || ISALPHA(c) )
//#define MIN(a,b)  ((a) < (b) ? (a) : (b))
#define	DIM(x)	(sizeof(x)/sizeof(x[0]))

#define USEREVT_SOCKET_OK	1000
#define USEREVT_SOCKET_FAILED 1001
#define USEREVT_MEMORY_FAILED 1002

//////////////////////////////////////////////////
//#define HANDSETTYPE	"SAMSUNGX359"
//#define HANDSETTYPE "SAMSUNGX609"
//#define HANDSETTYPE "SAMSUNGX799"
//#define HANDSETTYPE "SAMSUNGW109"
//#define HANDSETTYPE "SAMSUNGX699"
//#define HANDSETTYPE "SAMSUNGX339"
//#define HANDSETTYPE "SAMSUNGX559"
//#define HANDSETTYPE "SAMSUNGX809"
//#define HANDSETTYPE "SAMSUNGX619"
//#define HANDSETTYPE "SAMSUNGX839"
//#define HANDSETTYPE "LGCU8188"
//#define HANDSETTYPE "LGCU6260"
#define HANDSETTYPE "LGC610"
//#define HANDSETTYPE "LGC620"
//#define HANDSETTYPE "LGC650"
//#define HANDSETTYPE "LGCU8380"
//#define URL "http://211.96.97.178:8080/elfgf/vacation/index.jsp?"
//#define IPADDR "211.96.97.178"
//#define URL "http://10.199.124.7:8080/elfgf/vacation/index.jsp?"
//#define IPADDR "10.199.124.7"

#define URL "http://127.0.0.1:8080/index1.jsp?"
#define IPADDR "127.0.0.1"
/*
 *	选取:C800A6  TXET:FFF3AF
    :D933D9       :000000 

 */
#define ITEMBACKCOLOR MAKE_RGB(0xd9,0x33,0xd9);
#define ITEMTEXTCOLOR MAKE_RGB(0x00,0x00,0x00);

#define ITEMSELTEXTCOLOR MAKE_RGB(0xff,0xf3,0xaf);
#define ITEMSELBAKCOLOR MAKE_RGB(0xC8,0x00,0xA6);

#define TEXTCOLOR MAKE_RGB(0x00,0x00,0x00)
#define BACKCOLOR MAKE_RGB(0xff,0x74,0xf4)

#define MENULEFTSPACE 6
#define MENURIGHTSPACE 12
#define MENUADJUST 12
//6 for 128*146 176*205: 4 for 128*114
//120*146:lg8188,lgcu6260
#define ENDSPACE 3
/*
 选取状态:
色块:0DC3CB   文字:000000
未选取状态:
色块:A228E4   文字:FCFF01
背景色:FF74F4 0
 */


#define PORT	8080
//////////////////////////////////////////////////
typedef enum	//视的类型
{
	INIT_VIEW,MAINMENU_VIEW,INTRO_VIEW,SUBMENU_VIEW,CONTENT_VIEW,FAVSUBMENU_VIEW,FAVCONTENT_VIEW
}ViewType;

typedef enum
{
	ERR_OK,ERR_SPACE_NOT_ENOUGH,ERR_CONNECT_FAILED,ERR_MEMORY_ALLOCATE_FAILED
}ErrorCode;

typedef struct _CTheApp
{
	AEEApplet	a;
	uint16 cxScreen;	//save physical screen size
	uint16 cyScreen;
	uint16 nNormalFontHeight;//save font height
	uint16 nBoldFontHeight;
	int nTxtLength;
	
	ErrorCode err;
	boolean bIsConnecting;
	int     nPageEnd;

	ViewType	vtCurrent;
	IMenuCtl*	pIMenuCtl;
	IMenuCtl*	pIMenuCtl1;
	struct _MenuItem*	pMainMenuItem;
	struct _MenuItem*	pSubMenuItem;
	//struct _MenuItem*	pPrevMenuItem;
	struct _MenuItem*	pMenuItem;//保持的指向item指针
	boolean bIsFromNextPage;//是不是从"下一篇"来的
	//boolean bIsFavorite;
	//struct _CView* pView;
	
	//IBitmap* pIBitmap;
	//IDIB*	pIDIB;
	INetMgr*	pINetMgr;
	ISocket*	pISocket;
	IImage*     pIImage;
	ILicense* pILicense;
	ITAPI* pITapi;
	IDBMgr*	pIDBMgr;
	IDatabase* pIDatabase;

	ISoundPlayer*	pISoundPlayer;

	char	pszSendData[200];//写socket时发送的数据
	char*	pszReceiveData;//读socket时接收的数据
	uint32  nGrowMem;		//接收数据时的增长值
	char*   pszKeepReceiveData;//短信中断下一篇连接时,用来保存pszReceiveData中的数据(图片数据);
	char	pszLinkAddr[200];//收藏时用

	char	chKeepMenuItem[200];//从数据库里读出时用保存

	AECHAR* pContent;		//文本内容
	int pPos;			//
	int nHeaderHeight;
	int idKeep;
	int idKeep1;
	uint16 nCityId;
	uint16	uMainMenuItemSel;
	uint16  uSubMenuItemSel;
	char chPhoneNumber[20];
	AECHAR unicCityName[6];
	AECHAR unicHeadline[20];
}CTheApp;
/*
typedef struct _CView
{
	ViewType  nViewID;//什么类型的视图
	//IMenuCtl* pIMenuCtl;
	//void (*pfCreateMenu)(CTheApp);
	boolean (*pfOnKey)(CTheApp*,AEEEvent,uint16,uint32);
	struct _CView *pNext;
}CView;
*/
typedef struct _EVTMSG_ENTRY	//event map
{
	AEEEvent	nEvent;//uint16
	boolean	(*pfn)(CTheApp*,AEEEvent,uint16,uint32);//point to event handle function
}EVTMSG_ENTRY;

typedef struct _KEYMSG_ENTRY	//key map
{
	AVKType nKey;
	boolean (*pfn)(CTheApp*,AEEEvent,uint16,uint32);
}KEYMSG_ENTRY;

//菜单项list
typedef struct _MenuItem
{
	char idView[5];
	char idMenuItem[10];
	char idContext[20];
	struct _MenuItem* link;
	AECHAR* content;
}MenuItem;

static boolean vacation_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam);
static boolean vacation_InitAppData(CTheApp* pi);
static  void vacation_FreeAppData(CTheApp* pi);
void FreeAppData(CTheApp* pApp);


boolean OnAppStart(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnAppStop(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);

boolean OnCtlTab(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnAppSuspend(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnAppResume(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnAppMessage(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnCommand(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnKey(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnUser(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);

uint32 CheckFreeSpace(CTheApp* pApp);
void ShowMSG(CTheApp* pApp,int x,int y,int16 nResId);
void DispBootAnim(CTheApp* pApp);
void DispLoadAnim(CTheApp* pApp);
void DispHeader(CTheApp* pApp);
//void DispMenuBack(CTheApp* pApp);
//void DispContBack(CTheApp* pApp);
void DispBackground(CTheApp* pApp);
int DispImage(CTheApp* pApp,char* pBuf,int yPos);

INAddr xConvertToINAddr(char *psz);
void StartSocket(CTheApp* pApp);
static void ConnectSocketCB(CTheApp* pApp,int errCode);
static void WriteSocketCB(CTheApp* pApp);
static void ReadSocketCB(CTheApp* pApp);
void CleanSocket(CTheApp* pApp);

void GetMainMenuItem(CTheApp* pApp);
void GetSubMenuItem(CTheApp* pApp);
void CleanMainMenuItemList(CTheApp* pApp);
void CleanSubMenuItemList(CTheApp* pApp);
void ConvertAECHAR(char* pV,uint16 l,AECHAR* pMI);
int Str2Int(char* pCh);
void Int2Str(char a[],uint16 x);

//void ConstructView(CTheApp* pApp,ViewType vid);
void CreateMainMenu(CTheApp* pApp);
void CreateSubMenu(CTheApp* pApp);

boolean OnKey_MainMenuView(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnKey_SubMenuView(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnKey_IntroView(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnKey_InitView(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnKey_ContentView(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnKey_FavSubMenuView(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);
boolean OnKey_FavContentView(CTheApp* pApp,AEEEvent eCode,uint16 wParam,uint32 dwParam);

void GetContent(CTheApp* pApp);
void DispContent(CTheApp* pApp,AECHAR* pText,int y);
void DispContent1(CTheApp* pApp,AECHAR* pText,int y);
void RequestImageData(CTheApp* pApp);
void RequestFavImageData(CTheApp* pApp);
//void ShowBitmap(CTheApp* pApp);
//void StartTimer(CTheApp* pApp);
//void ShowPic(void* pData);
//void ShowPicture(CTheApp* pApp);
//void TransactLicense(CTheApp* pApp);
void GetPhoneNumber(CTheApp* pApp);
void ReStart(CTheApp* pApp);
void DispHeadline(CTheApp* pApp,AECHAR* punicoStr);
//void DispTriangle(CTheApp* pApp,int n);
void ManipulatePageEnd(CTheApp* pApp,uint16 nDelt);
void OpenDatabase(CTheApp* pApp);
//boolean SaveFavoriteFile(CTheApp* pApp);
boolean SaveFavorite(CTheApp* pApp);
void TimeAsChar(char a[],uint32 time);
boolean AddDBRecoder(CTheApp* pApp);
void PopFavoriteMenu(CTheApp* pApp);
void GetFavoriteLink(CTheApp* pApp,uint16 wParam);
void GetNextPage(CTheApp* pApp);
void ShowMSG1(CTheApp* pApp,int x,int y,int16 nResId);
void EmptyFavorite(CTheApp* pApp);
void PlayMusic(CTheApp* pApp);
void StopMusic(CTheApp* pApp);
void DispScollBar(CTheApp* pApp,int y);
#ifdef DEBUG_
void log(CTheApp* pApp,char* info);
#endif
#endif

⌨️ 快捷键说明

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