郑州轻工业学院 ucgui点菜系统.docx
《郑州轻工业学院 ucgui点菜系统.docx》由会员分享,可在线阅读,更多相关《郑州轻工业学院 ucgui点菜系统.docx(13页珍藏版)》请在冰豆网上搜索。
郑州轻工业学院ucgui点菜系统
郑州轻工业学院
嵌入式课程设计
题目基于ucgui的点菜系统
班级___信息工程12-01_______
学号541207070111
姓名何骞
指导老师张涛
1.课程说明
随着信息化技术的不断发展,电子菜单开始出现在一些高档餐厅,与传统菜单相比,电子菜单可以节省制作成本和人力成本,并能实现无线下单。
可以随需变更菜品信息,灵活进行菜品促销,帮助饭店有效提升品牌形象和服务水平,增加菜品销量,提高营业收益。
其强大的后台管理功能,让饭店管理者运筹帷幄,省心省力。
本次课程设计利用GUI函数制作一个简单的电子菜单,实现基本的查阅、点菜、菜价计算、付账等功能,旨在熟悉掌握C语言和对系统函数的灵活运用。
2.程序及其注释
#include"GUI.h"
#include"GUI_Protected.h"
#include"GUI.h"
#include"LCD_ConfDefaults.h"
#include"WM.h"
#include"DIALOG.h"
#include
#include
#include
intx1=0,x2=0,x3=0,x4=0;
intx5=0;
ints=0;
intj=0,k=0;
inta[16];
GUI_BITMAPbmMicriumLogo1;
GUI_BITMAPbmMicriumLogo2;
GUI_BITMAPbmMicriumLogo3;
GUI_BITMAPbmMicriumLogo4;
/*
*******************************************************************
*
*main()
*
*******************************************************************
*/
typedefstruct{
intnum;//编号
intprice;//价格
charname[10];//菜名
}dish;
dishc[16]={{1,16,"麻婆豆腐"},{2,21,"辣子鸡丁"},{3,30,"东坡肘子"},{4,35,"豆瓣鲫鱼"}
{5,18,"口袋豆腐"},{6,32,"酸菜鱼"},{7,20,"夫妻肺片"},{8,18,"蚂蚁上树"}
{9,32,"叫化鸡"},{10,22,"茄汁鱼卷"},{11,18,"鱼香肉丝"},{12,22,"干煸冬笋"}
{13,32,"魔芋烧鸭"},{14,32,"锅贴鱼片"},{15,23,"麻辣肉丁"},{16,15,"鱼香茄饼"}};
voidMainTask(void)
{
intCnt=0;
inti=0,j=0,p=0;
intx,y,flag_x=1,flag_y=1;
intLCDXSize=LCD_GET_XSIZE();
intLCDYSize=LCD_GET_YSIZE();
constGUI_BITMAP*pBitmap;
GUI_Init();
GUI_SetFont(&GUI_FontHZ24);
GUI_SetColor(GUI_LIGHTCYAN);
GUI_DispStringHCenterAt("有间客栈",160,100);
GUI_Delay(2000);//显示一个2秒钟的欢迎界面。
GUI_SetColor(GUI_WHITE);
GUI_SetBkColor(GUI_BLUE);
GUI_Clear();
GUI_SetColor(GUI_LIGHTCYAN);
GUI_FillRect(40,180,100,220);
GUI_FillRect(140,180,200,220);
GUI_FillRect(240,180,300,220);
GUI_SetBkColor(GUI_LIGHTCYAN);
GUI_SetColor(GUI_LIGHTBLUE);
GUI_DispStringHCenterAt("上页",70,190);
GUI_DispStringHCenterAt("下页",170,190);
GUI_DispStringHCenterAt("确认",270,190);
GUI_SetColor(GUI_WHITE);
GUI_SetBkColor(GUI_BLUE);
while
(1)
{
GUI_PID_STATETouchState;
if(x5<=0)
{
for(i=0;i<4;i++)
{
GUI_DispStringHCenterAt(c[p+i].name,80,20+i*35);
GUI_DispDecAt(c[p+i].price,140,20+i*35,2);
GUI_DispStringAt("+",200,20+i*35);
GUI_DispStringAt("-",250,20+i*35);
GUI_SetColor(GUI_LIGHTRED);
GUI_DispDecAt(x1,280,20,2);
GUI_DispDecAt(x2,280,55,2);
GUI_DispDecAt(x3,280,90,2);
GUI_DispDecAt(x4,280,125,2);
GUI_SetColor(GUI_WHITE);
a[0]=x1;a[1]=x2;a[2]=x3;a[3]=x4;
GUI_Delay(15);
}
}
elseif(x5==1)
{
for(i=4;i<8;i++)
{
GUI_DispStringHCenterAt(c[p+i].name,80,20+(i-4)*35);
GUI_DispDecAt(c[p+i].price,140,20+(i-4)*35,2);
GUI_DispStringAt("+",200,20+(i-4)*35);
GUI_DispStringAt("-",250,20+(i-4)*35);
GUI_SetColor(GUI_LIGHTRED);
GUI_DispDecAt(x1,280,20,2);
GUI_DispDecAt(x2,280,55,2);
GUI_DispDecAt(x3,280,90,2);
GUI_DispDecAt(x4,280,125,2);
GUI_SetColor(GUI_WHITE);
a[4]=x1;a[5]=x2;a[6]=x3;a[7]=x4;
GUI_Delay(15);
}
}
elseif(x5==2)
{
for(i=8;i<12;i++)
{
GUI_DispStringHCenterAt(c[p+i].name,80,20+(i-8)*35);
GUI_DispDecAt(c[p+i].price,140,20+(i-8)*35,2);
GUI_DispStringAt("+",200,20+(i-8)*35);
GUI_DispStringAt("-",250,20+(i-8)*35);
GUI_SetColor(GUI_LIGHTRED);
GUI_DispDecAt(x1,280,20,2);
GUI_DispDecAt(x2,280,55,2);
GUI_DispDecAt(x3,280,90,2);
GUI_DispDecAt(x4,280,125,2);
GUI_SetColor(GUI_WHITE);
a[8]=x1;a[9]=x2;a[10]=x3;a[11]=x4;
GUI_Delay(15);
}
}
elseif(x5>=3&&x5<99)
{
for(i=12;i<16;i++)
{
GUI_DispStringHCenterAt(c[p+i].name,80,20+(i-12)*35);
GUI_DispDecAt(c[p+i].price,140,20+(i-12)*35,2);
GUI_DispStringAt("+",200,20+(i-12)*35);
GUI_DispStringAt("-",250,20+(i-12)*35);
GUI_SetColor(GUI_LIGHTRED);
GUI_DispDecAt(x1,280,20,2);
GUI_DispDecAt(x2,280,55,2);
GUI_DispDecAt(x3,280,90,2);
GUI_DispDecAt(x4,280,125,2);
GUI_SetColor(GUI_WHITE);
a[12]=x1;a[13]=x2;a[14]=x3;a[15]=x4;
GUI_Delay(15);
}
}
elseif(x5==100)
{x5=101;
for(i=0;i<16;i++)
{
if(a[i]!
=0)
{
GUI_SetFont(&GUI_FontHZ12);
k++;
if(k<11)
{
GUI_DispStringHCenterAt(c[p+i].name,40,20+(k-1)*15);
GUI_DispDecAt(c[p+i].price,80,20+(k-1)*15,2);
GUI_DispDecAt(a[i],120,20+(k-1)*15,2);
GUI_Delay(20);
a[i]=0;
}
else
{
GUI_DispStringHCenterAt(c[p+i].name,200,20+(k-11)*15);
GUI_DispDecAt(c[p+i].price,240,20+(k-11)*15,2);
GUI_DispDecAt(a[i],280,20+(k-11)*15,2);
GUI_Delay(20);
a[i]=0;
}
}
}
}
if(GUI_TOUCH_GetState(&TouchState))
{
if((TouchState.x>30)&&(TouchState.x<110)&&(TouchState.y>170)&&(TouchState.y<230)&&x5!
=100&&x5!
=101)
{
x5=x5-1;
GUI_Delay(300);
GUI_SetColor(GUI_BLUE);
GUI_FillRect(0,0,300,160);
GUI_SetColor(GUI_WHITE);
if(x5<=0)
{x1=a[0];x2=a[1];x3=a[2];x4=a[3];}
elseif(x5==1)
{x1=a[4];x2=a[5];x3=a