#include "menu.h" #include "display.h" #include "delay.h" #include "draw.h" #include Menu M_STARTUP; Menu M_MAINMENU;//主菜单 Menu M_PLAYMODE1; //俄罗斯方块 Menu* NOW; //当前菜单指针 Menu* LAST=NULL;//上一个状态的菜单 //初始菜单 void m_startup(struct _menu* this, enum OPR opr) { if(LAST != &M_STARTUP) { LAST = &M_STARTUP; drawNAME(); //绘制名字 delay(1000); drawNUMBER(); //绘制学号 } if(opr == confirm) { opr = idle; NOW = this->n; //转向下一菜单 clear(); } } void m_mainmenu(struct _menu* this, enum OPR opr) { if(LAST != &M_MAINMENU) { LAST = &M_MAINMENU; drawMAINMENU(); } if(opr == left) { opr = idle; NOW = &M_STARTUP; clear(); } } void menuInit() { M_STARTUP.n = &M_MAINMENU; M_STARTUP.f = m_startup; M_MAINMENU.f = m_mainmenu; NOW = &M_STARTUP; }