大致思路,在NBoot或EBoot加开机进度条,由于WINCE启动主要时间都花在读取NK,因此每读取一定的页,就在屏上画一条固定高度的线,并记录画线的位置,下次接着画,直到读取完NK,这样就产生的进度条的效果。
参考Mini2440 Nboot。
先定义进度条颜色、位置及长宽,关键代码如下:
1 #define PROGRESS_BAR_R 0x00
2 #define PROGRESS_BAR_G 0xFF
3 #define PROGRESS_BAR_B 0x00
4
5 //设置启动条的位置和长宽
6 #define PROGRESS_BAR_TOP 225
7 #define PROGRESS_BAR_LEFT 145
8 #define PROGRESS_BAR_WIDTH 512
9 #define PROGRESS_BAR_HEIGHT 20
10 #define PROGRESS_BAR_COLOR ( ( (PROGRESS_BAR_R >> 3) << 11) | ((PROGRESS_BAR_G >> 2) << 5) | (PROGRESS_BAR_B >> 3) )
11
2 #define PROGRESS_BAR_G 0xFF
3 #define PROGRESS_BAR_B 0x00
4
5 //设置启动条的位置和长宽
6 #define PROGRESS_BAR_TOP 225
7 #define PROGRESS_BAR_LEFT 145
8 #define PROGRESS_BAR_WIDTH 512
9 #define PROGRESS_BAR_HEIGHT 20
10 #define PROGRESS_BAR_COLOR ( ( (PROGRESS_BAR_R >> 3) << 11) | ((PROGRESS_BAR_G >> 2) << 5) | (PROGRESS_BAR_B >> 3) )
11
在读取NK前计算出读取开始画线的位置
1 unsigned char *LCDCurrentAddr;
2
3 LCDCurrentAddr = (unsigned char *)LCD_ADDR + PROGRESS_BAR_TOP * LCD_WIDTH * 2 + PROGRESS_BAR_LEFT * 2;// LCD_ADDR为屏地址
4
2
3 LCDCurrentAddr = (unsigned char *)LCD_ADDR + PROGRESS_BAR_TOP * LCD_WIDTH * 2 + PROGRESS_BAR_LEFT * 2;// LCD_ADDR为屏地址
4
根据NK长度及进条度长度,计算出每读取多少页就画一条线,画线关键代码
1 unsigned short *p = (unsigned short *)LCDCurrentAddr;
2 for (y = 0; y < PROGRESS_BAR_HEIGHT; y++)
3 {
4 *p = PROGRESS_BAR_COLOR;
5 p += LCD_WIDTH;
6 }
7 LCDCurrentAddr += 2;
8
2 for (y = 0; y < PROGRESS_BAR_HEIGHT; y++)
3 {
4 *p = PROGRESS_BAR_COLOR;
5 p += LCD_WIDTH;
6 }
7 LCDCurrentAddr += 2;
8
转载自http://www.cnblogs.com/feishanm