feat(MCU课设): 增加旋转状态提示

This commit is contained in:
iridiumR 2022-06-09 13:04:45 +08:00
parent 438dfeea08
commit 6d1deaf6ca
4 changed files with 77 additions and 12 deletions

View file

@ -283,4 +283,69 @@ void drawVOID8(unsigned char x, unsigned char y, unsigned char len)
P1 = 0x00; P1 = 0x00;
write(); write();
} }
}
void placeIMG_ROTATE(unsigned char x, unsigned char y)
{
unsigned int j;
if(x < 0 || x > 127)
return;
else if(x < 64)
{
CSA = 1;
CSB = 0;
}
else
{
x = x - 63;
CSA = 0;
CSB = 1;
}
for(j = 0; j < 8; j++)
{
RS = 0;
RW = 0;
P1 = 0xb8 + y;
write();
P1 = 0X40 + x + j;
write(); //Ò³yÁÐx+j
RS = 1;
RW = 0;
P1 = IMG_ROTATE[j];
write();
}
}
void placeRIMG_BLOCK(unsigned char x, unsigned char y)
{
unsigned int j;
if(x < 0 || x > 127)
return;
else if(x < 64)
{
CSA = 1;
CSB = 0;
}
else
{
x = x - 63;
CSA = 0;
CSB = 1;
}
for(j = 0; j < 8; j++)
{
RS = 0;
RW = 0;
P1 = 0xb8 + y;
write();
P1 = 0X40 + x + j;
write(); //Ò³yÁÐx+j
RS = 1;
RW = 0;
P1 = IMG_BLOCK[j];
write();
}
} }

View file

@ -17,7 +17,8 @@ void drawGOOD(unsigned char x, unsigned char y);
void drawGAME(unsigned char x, unsigned char y); void drawGAME(unsigned char x, unsigned char y);
void drawOVER(unsigned char x, unsigned char y); void drawOVER(unsigned char x, unsigned char y);
void drawBLOCKSCORE(); void drawBLOCKSCORE();
void placeIMG_ROTATE(unsigned char x, unsigned char y);
void placeRIMG_BLOCK(unsigned char x, unsigned char y);
////=================== ¼Ç¼ ================== ////=================== ¼Ç¼ ==================
void drawBEST(unsigned char x, unsigned char y); void drawBEST(unsigned char x, unsigned char y);

View file

@ -3,7 +3,7 @@
//#define WIPE_BEST //#define WIPE_BEST
#define RELOAD (65535-7535) //定时器填充值(1ms) #define RELOAD (65535-6535) //定时器填充值(1ms)
unsigned char TH, TL; unsigned char TH, TL;
extern Menu *NOW; //꽉데寧濾 extern Menu *NOW; //꽉데寧濾
@ -36,15 +36,14 @@ void time() interrupt 1 //
EA = 0; EA = 0;
TH0 = TH; TH0 = TH;
TL0 = TL0 + TL; TL0 = TL0 + TL;
TL0 = TL0 + 23;
if(PIN_4 == 0) if(PIN_4 == 0)
{ {
delayms(9); delayms(6);
if(PIN_4 == 0) if(PIN_4 == 0)
{ {
opr = confirm; opr = confirm;
delayms(20); delayms(25);
} }
} }

View file

@ -164,17 +164,17 @@ void m_block(struct _menu* this)
drawVOID8(70, 4, 40); drawVOID8(70, 4, 40);
drawVOID8(70, 6, 32); drawVOID8(70, 6, 32);
} }
drawVerticalDottedLine(64); drawVerticalDottedLine(64); //绘制线
drawBLOCKSCORE(); drawBLOCKSCORE(); //绘制字
drawSUPNUM(70, 2, score / 10000); //绘制分数 drawSUPNUM(70, 2, score / 10000); //绘制分数
drawSUPNUM(79, 2, (score % 10000) / 1000); drawSUPNUM(79, 2, (score % 10000) / 1000);
drawSUPNUM(88, 2, (score % 1000) / 100); drawSUPNUM(88, 2, (score % 1000) / 100);
drawSUPNUM(97, 2, (score % 100) / 10); drawSUPNUM(97, 2, (score % 100) / 10);
drawSUPNUM(106, 2, score % 10); drawSUPNUM(106, 2, score % 10);
// if(local[2]) if(local[2])
// placeIMG_ROTATE(115, 6); placeIMG_ROTATE(115, 2); //绘制提示符
// else else
// placeRIMG_BLOCK(115, 6); placeRIMG_BLOCK(115, 2);
blockGameOver(); //检查是否游戏结束 blockGameOver(); //检查是否游戏结束