www.pudn.com > emGUI.rar > emGUI-test.c


#include "emGUI.h" 
#include "lcd.h" 
 
void start() 
{ 
	clrbss(); 
	boot_card(); 
} 
 
static unsigned32 appCount; 
 
static unsigned32 mywndproc( 
	WndID 		wId, 
	unsigned16 	msg, 
	unsigned16  nParam, 
	unsigned32	lParam 
); 
 
static struct GC mygc; 
 
static POINT mypoints[4] = { 
	{30, 20}, 
	{60, 120}, 
	{70, 200}, 
	{30, 20} 
}; 
 
static void WinMain( 
	AppID	appID 
) 
{ 
	WndID	winid; 
	if (appCount >= 2){ 
		appCount--; 
		goto terminate; 
	} 
 
	/*  create some window */ 
	winid = CreateWindow( 
		appID, 
		NULL, 
		MAINWND, 
		mywndproc, 
		0, 
		0, 
		200, 
		240 
	); 
 
	/* example startx */ 
	GrGCSetForeColor( 
		&mygc, 
		0x0f 
	); 
 
	GrFillRect(winid, &mygc, 0, 0, 239, 319); 
	 
	GrGCSetForeColor( 
		&mygc, 
		0x00 
	); 
 
	GrLine(winid, &mygc, 0, 0, 239, 319, TRUE);	 
 
	GrRect(winid, &mygc, 20, 20, 100, 100); 
 
	GrPoly(winid, &mygc, 4, &mypoints[0]); 
	 
	while(SysGetAppMessage(appID)){ 
		AppHandleEvent(appID); 
	} 
	 
terminate:	 
	SysApplicationTermination(); 
} 
 
 
static unsigned32 mywndproc( 
	WndID 		wId, 
	unsigned16 	msg, 
	unsigned16  nParam, 
	unsigned32	lParam 
) 
{ 
	return DefaultWndProc(wId, msg, nParam, lParam); 
} 
 
 
static unsigned32 myappproc( 
	AppID 		app, 
	unsigned16 	msg, 
	unsigned16  nParam, 
	unsigned32	lParam 
) 
{ 
	return DefaultAppProc(app, msg, nParam, lParam); 
} 
 
void myapplication() 
{ 
	appCount++; 
	 
	CreateApplication( 
		WinMain, 
		myappproc, 
		&appCount 
	); 
} 
 
void hehe() 
{ 
	emGUIInitialization(); 
 
	myapplication(); 
	myapplication(); 
} 
_SysEvent _evSys_Snapshot;