0 。准备 (a) 建立如下目录: minigui |--build_x86 /建立PC上运行的MiniGUI |--build_arm /建立ARM上运行的MiniGUI |--tarball /所有的包资源存放点 (b) download MiniGUI: 从www.minigui.com下载libminigui-1.3.3.tar.gz 和minigui-res-1.3.3.tar.gz并且放 tarball目录 (起始目录:minigui) #cd build_x86 #tar zxvf ../tarball/libminigui-1.3.3.tar.gz #tar zxvf ../tarball/minigui-res-1.3.3.tar.gz #cd ../build_arm #tar zxvf ../tarball/libminigui-1.3.3.tar.gz #cd .. (c) download and install qvfb: 从www.minigui.com下载qvfb-1.0.tar.gz,放入tarball目录 #cd build_x86 #tar zxvf ../tarball/qvfb-1.0.tar.gz #cd qvfb-1.0 #./configure #make #make install #cd .. (d) 建立范例程序: test.c --------------------------------------------------------------------------test.c begin #include <minigui/common.h> #include <minigui/minigui.h> #include <minigui/gdi.h> #include <minigui/window.h> #include <minigui/control.h>#define MWINDOW_LX 10#define MWINDOW_TY 50#define MWINDOW_RX 230#define MWINDOW_BY 180static char * hello_str = "HelloMiniGUI!";HWND hMainWnd;static int WinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam){HDC hdc;RECT rc;
switch (message){case MSG_PAINT : hdc = BeginPaint(hWnd); GetClientRect(hWnd, &rc); DrawText(hdc, hello_str, -1, &rc, DT_LEFT); EndPaint(hWnd, hdc); break;case MSG_CLOSE : DestroyMainWindow(hWnd); PostQuitMessage(hWnd); break;default : return(DefaultMainWinProc(hWnd, message, wParam, lParam));}return(0);}
int InitMainWindow(void){MAINWINCREATE window_info;
window_info.dwStyle = WS_VISIBLE | WS_BORDER | WS_CAPTION;window_info.dwExStyle = WS_EX_NONE;window_info.spCaption = "MiniGUI";window_info.hMenu = 0;window_info.hCursor = GetSystemCursor(0);window_info.hIcon = 0;window_info.MainWindowProc = WinProc;window_info.lx = MWINDOW_LX;window_info.ty = MWINDOW_TY;window_info.rx = MWINDOW_RX;window_info.by = MWINDOW_BY;window_info.iBkColor = COLOR_lightwhite;window_info.dwAddData = 0;window_info.hHosting = HWND_DESKTOP;hMainWnd = CreateMainWindow(&window_info);if (hMainWnd == HWND_INVALID)return(0);elsereturn(1);}
int MiniGUIMain (int argc, const char ** argv){MSG Msg;
#ifdef _LITE_VERSIONSetDesktopRect(0, 0, 800, 600);#endif
InitMainWindow();ShowWindow(hMainWnd, SW_SHOWNORMAL);
while (GetMessage(&Msg, hMainWnd)){TranslateMessage(&Msg);DispatchMessage(&Msg);}MainWindowThreadCleanup(hMainWnd);return(0);}
#ifndef _LITE_VERSION#include <minigui/dti.c>#endif--------------------------------------------------------------------------test.c end
1. Build MiniGUI for PC:(a) build lib#Cd build_x86#Cd libminigui-1.3.3#./configure#make#make install#cd ..(b) install resource #cd minigui-res-1.3.3 #make install #cd .. (资源被安装到/usr/local/lib/minigui/中)(c) build and run test #gcc –o test test.c –lpthread –lminigui –ljpeg –lpng –lz –lttf 把/usr/local/etc/MiniGUI.cfg中[system]组的gal_engine和ial_engine的值都改成qvfb #qvfb –width 640 –height 480 –depth 16 & #./test #cd ..2. Build MiniGUI for ARM:(a) build lib#cd build_arm#cd libminigui-1.3.3#make menuconfig在默认的设置下将“GAL engine options”中的“NEWGAL”改成“OLDGAL”;将“Font options”中的最后三项保留,其余全部不选;将“Image options”中对JPG和PNG的support去掉;将“Development environment options”中“Compiler”设置成“arm-linux-gcc”,“Path prefix”设置成“/usr/local/arm/2.95.3/arm-linux”(假设交叉编译环境安装在/usr/local/arm)。其余选项全部取默认值。保存修改并退出menuconfig#make#make install#cd ..(b) build test.c#arm-linux-gcc –o test test.c –lpthread –lminigui这样就会产生一个名为test的文件。(c) 设置root file system假设已经有一个可以用的root file system把先前安装在/usr/local/arm/2.95.3/arm-linux/lib下的库文件复制到目标文件系统的/lib目录下。如果分不清楚那个目录下哪些是需要复制的库文件,可以重复一次2.(a)的过程,并且把其中“Path prefix”的值改成你事先建立的一个空的目录的路径。比如,我建立了一个新的目录/root/need,并且把“Path prefix”的值改成了“/root/need”, 那么在执行完2.(a)后,/root/need/lib目录下的所有文件就是我们所需要复制的MiniGUI库文件。(这个办法很冗余-_-)把/usr/local/etc/MiniGUI.cfg文件复制到目标文件系统的/usr/local/etc/目录下,并且修改该文件,将[system]组中的gal_engine的值改成“fbcon” ial_engine的值改成“console” mdev的值改成“/dev/mouse” mtype的值改成“PS2”,将[fbcon]组中的defaultmode改成“640x480-16bpp”(根据实际情况而定)。把/usr/local/lib/minigui/res整个目录复制到目标文件系统的/usr/local/lib/minigui中。最后把刚才编译好的test文件复制到目标文件系统的/bin下面。(d) 设置鼠标我的LCD没有带触摸屏,所以要设置鼠标,我的鼠标是USB口的。修改文件系统的/etc/init.d/rcS,添加一行:“ln /dev/input/mice /dev/mouse”(e) run给板子上电,通过minicom执行:#test &就能在LCD上看到运行结果了。