全部博文(395)
分类: 虚拟化
2011-05-13 18:13:51
(注:今天上实验课,老师让做一个实验,是ucgui的vc界面下的图形显示,挺傻瓜的,不过有关ucgui的源码我也不知道在哪能够获得,还有如何把源代码加载上去,即建立一个工程(这也算是一种移植吧),仍不会弄,也不知道老师怎么弄出来的,方正这些东西来时已经给我们做了,我们只是拿着他给我们弄好的压缩包进行解压后在main函数中进行修改就行,呵呵,傻瓜吧,不过还好,做好了,以下是MainTask()中的代码,还是实现了一定的功能。。。,以后有机会就好好研究研究这个源码吧)
关于ucgui的源码(vc的),你可以从网上下,如果下不到的话,联系我,我给你传一份,呵呵
/*
*********************************************************************************************************
* 礐/GUI
* Universal graphic software for embedded applications
*
* (c) Copyright 2002, Micrium Inc., Weston, FL
* (c) Copyright 2000, SEGGER Microcontroller Systeme GmbH
*
* 礐/GUI is protected by international copyright laws. Knowledge of the
* source code may not be used to write a similar product. This file may
* only be used in accordance with a license and should not be redistributed
* in any way. We appreciate your understanding and fairness.
*
* File : MainTask.c
* Purpose : Application program in windows simulator
*********************************************************************************************************
*/
#include "GUI.h"
#include "GUI_Protected.h"
#include
#include
#include
extern const GUI_BITMAP bmMicriumLogo;
extern const GUI_BITMAP bmMicriumLogo_1bpp;
/*
*******************************************************************
*
* main()
*
*******************************************************************
*/
void MainTask(void) {
GUI_Init();
GUI_CURSOR_Show();
GUI_CURSOR_Select(&GUI_CursorCrossL);
GUI_SetBkColor(GUI_WHITE);
// GUI_SetBkColor(GUI_YELLOW); //
GUI_SetColor(GUI_BLACK);
// GUI_SetColor(GUI_WHITE);
GUI_Clear();
//LCD_L0_FillRect(240, 90, 320, 130);
LCD_L0_FillRect(120, 90, 240, 130);
GUI_SetColor(GUI_GRAY);
LCD_L0_FillRect(40, 190, 100, 230);
LCD_L0_FillRect(120, 190, 180, 230);
LCD_L0_FillRect(200, 190, 260, 230);
GUI_SetFont(&GUI_Font24_ASCII);
//GUI_SetColor(GUI_WHITE);
GUI_SetBkColor(GUI_BLUE);
GUI_DispStringHCenterAt("blue", 70, 200);
GUI_SetBkColor(GUI_RED);
GUI_DispStringHCenterAt("red", 150, 200);
GUI_SetBkColor(GUI_GREEN);
GUI_DispStringHCenterAt("green", 230, 200);
while (1)
{
GUI_PID_STATE TouchState;
GUI_TOUCH_GetState(&TouchState); // Get the touch position in pixel
if((TouchState.x>40)&&(TouchState.x<100)&&(TouchState.y>190)&&(TouchState.y<230))
{
GUI_SetColor(GUI_BLUE);
// GUI_SetColor(GUI_WHITE);
//GUI_Clear();
LCD_L0_FillRect(120, 90, 240, 130);
}
if((TouchState.x>120)&&(TouchState.x<180)&&(TouchState.y>190)&&(TouchState.y<230))
{
GUI_SetColor(GUI_RED);
// GUI_SetColor(GUI_WHITE);
//GUI_Clear();
LCD_L0_FillRect(120, 90, 240, 130);
}
if((TouchState.x>200)&&(TouchState.x<260)&&(TouchState.y>190)&&(TouchState.y<230))
{
GUI_SetColor(GUI_GREEN);
// GUI_SetColor(GUI_WHITE);
//GUI_Clear();
LCD_L0_FillRect(120, 90, 240, 130);
}
}
}