📄 game_display.c
字号:
#include <string.h>
#include "api.h"
#include "lcd.h"
#include "common.h"
#include "ap_common.h"
#include "mine.h"
#include "res.h"
#include "res_show.h"
#include "ui_main.h"
xdata GAME_mine mine;
INT8 color_ran=0;
void mine_show_area(char x, char y, char num)
{
switch(num)
{
case MINE_MINE:
bResShowPic(M_MINE,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
case MINE_SMINE:
bResShowPic(M_UNSU,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
case MINE_UNSURE:
bResShowPic(M_UNSU,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y );
break;
case MINE_FULL:
bResShowPic(FULL,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
case MINE_CURSOR:
bResShowPic(M_CUR,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
case MINE_0:
bResShowPic(M_NULL,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
case MINE_1:
bResShowPic(M_1,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
case MINE_2:
bResShowPic(M_2,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
case MINE_3:
bResShowPic(M_3,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
case MINE_4:
bResShowPic(M_4,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
case MINE_5:
bResShowPic(M_5,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
case MINE_6:
bResShowPic(M_6,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
case MINE_7:
bResShowPic(M_7,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
case MINE_8:
bResShowPic(M_8,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
default:
bResShowPic(FULL,MINE_AREA_x + MINE_AREA_SIZE * x, MINE_AREA_y + MINE_AREA_SIZE * y);
break;
}
}
void mine_show_cursor()
{
if(mine.mine_cursor)
{
bResShowPic(M_CUR,MINE_AREA_x + MINE_AREA_SIZE * mine.mine_x, MINE_AREA_y + MINE_AREA_SIZE * mine.mine_y);
mine.mine_cursor = FALSE;
}
else
{
mine_show_area(mine.mine_x, mine.mine_y,mine.area[mine.mine_y][mine.mine_x].play_info);
mine.mine_cursor = TRUE;
}
}
void mine_show_allarea()
{
char x,y;
for (y = 0; y < MINE_HANG; y++)
for (x = 0; x < MINE_LIE; x++)
{
mine_show_area(x, y, mine.area[y][x].init_info);
}
}
void mine_show_all_mine()
{
char x,y;
for(y = 0; y < MINE_HANG; y++)
for(x = 0; x < MINE_LIE; x++)
{
if(mine.area[y][x].play_info != MINE_SMINE && mine.area[y][x].init_info == MINE_MINE)
mine_show_area(x, y, mine.area[y][x].init_info);
if (mine.area[y][x].play_info == MINE_SMINE && mine.area[y][x].init_info != MINE_MINE)
mine_show_area(x, y,MINE_ERROR);
}
}
void mine_show_box(void)
{
bResShowPic(MINE_AREA_x - 2, MINE_AREA_y - 2, M_NULL);
}
void mine_get_xy()
{
mine.mine_x = mine.mine_cur % MINE_LIE;
mine.mine_y = mine.mine_cur / MINE_LIE;
}
void mine_get_cur()
{
mine.mine_cur = mine.mine_y * MINE_LIE + mine.mine_x;
}
void ui_show_data_game(UINT8 *buf, UINT8 x, UINT8 y)
{
while(1)
{
if(*buf!=0)bResShowPic(NO_0+(*buf-0x30), x, y);
else
break;
buf++;
x+=9;
}
}
void mine_show_mine()
{
UINT8 buf1[6];
my_sprintf(buf1, "%02d",num_set);
ui_show_data_game(buf1,102,142);
}
void mine_show_time()
{
UINT8 buf[6];
my_sprintf(buf,"%03d",mine.mine_time/4);
ui_show_data_game(buf,8,142);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -