📄 graph.c
字号:
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_MAGENTA,
MAP_COLOR_WHITE,
24,
'C',
"1", },
{ PHONE_BOX_X + (PHONE_BOX_W + PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R) * PHONE_ROW_H + PHONE_FRAME * 2,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_MAGENTA,
MAP_COLOR_WHITE,
24,
'C',
"2", },
{ PHONE_BOX_X + (PHONE_BOX_W + PHONE_FRAME) * 2 / PHONE_ZONE_2_C,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R) * PHONE_ROW_H + PHONE_FRAME * 2,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_MAGENTA,
MAP_COLOR_WHITE,
24,
'C',
"3", },
{ PHONE_BOX_X + (PHONE_BOX_W + PHONE_FRAME) * 3 / PHONE_ZONE_2_C,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R) * PHONE_ROW_H + PHONE_FRAME * 2,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_CYAN,
MAP_COLOR_BLACK,
24,
'C',
"清空", },
{ PHONE_BOX_X,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R + PHONE_ZONE_2_R) * PHONE_ROW_H + PHONE_FRAME * 3,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_MAGENTA,
MAP_COLOR_WHITE,
24,
'C',
"4", },
{ PHONE_BOX_X + (PHONE_BOX_W + PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R + PHONE_ZONE_2_R) * PHONE_ROW_H + PHONE_FRAME * 3,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_MAGENTA,
MAP_COLOR_WHITE,
24,
'C',
"5", },
{ PHONE_BOX_X + (PHONE_BOX_W + PHONE_FRAME) * 2 / PHONE_ZONE_2_C,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R + PHONE_ZONE_2_R) * PHONE_ROW_H + PHONE_FRAME * 3,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_MAGENTA,
MAP_COLOR_WHITE,
24,
'C',
"6", },
{ PHONE_BOX_X + (PHONE_BOX_W + PHONE_FRAME) * 3 / PHONE_ZONE_2_C,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R + PHONE_ZONE_2_R) * PHONE_ROW_H + PHONE_FRAME * 3,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_CYAN,
MAP_COLOR_BLACK,
24,
'C',
"拨出", },
{ PHONE_BOX_X,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R + PHONE_ZONE_2_R + PHONE_ZONE_3_R) * PHONE_ROW_H + PHONE_FRAME * 4,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_MAGENTA,
MAP_COLOR_WHITE,
24,
'C',
"7", },
{ PHONE_BOX_X + (PHONE_BOX_W + PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R + PHONE_ZONE_2_R + PHONE_ZONE_3_R) * PHONE_ROW_H + PHONE_FRAME * 4,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_MAGENTA,
MAP_COLOR_WHITE,
24,
'C',
"8", },
{ PHONE_BOX_X + (PHONE_BOX_W + PHONE_FRAME) * 2 / PHONE_ZONE_2_C,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R + PHONE_ZONE_2_R + PHONE_ZONE_3_R) * PHONE_ROW_H + PHONE_FRAME * 4,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_MAGENTA,
MAP_COLOR_WHITE,
24,
'C',
"9", },
{ PHONE_BOX_X + (PHONE_BOX_W + PHONE_FRAME) * 3 / PHONE_ZONE_2_C,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R + PHONE_ZONE_2_R + PHONE_ZONE_3_R) * PHONE_ROW_H + PHONE_FRAME * 4,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_CYAN,
MAP_COLOR_BLACK,
24,
'C',
"重拨", },
{ PHONE_BOX_X,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R + PHONE_ZONE_2_R + PHONE_ZONE_3_R + PHONE_ZONE_4_R) * PHONE_ROW_H + PHONE_FRAME * 5,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_MAGENTA,
MAP_COLOR_WHITE,
24,
'C',
"*", },
{ PHONE_BOX_X + (PHONE_BOX_W + PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R + PHONE_ZONE_2_R + PHONE_ZONE_3_R + PHONE_ZONE_4_R) * PHONE_ROW_H + PHONE_FRAME * 5,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_MAGENTA,
MAP_COLOR_WHITE,
24,
'C',
"0", },
{ PHONE_BOX_X + (PHONE_BOX_W + PHONE_FRAME) * 2 / PHONE_ZONE_2_C,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R + PHONE_ZONE_2_R + PHONE_ZONE_3_R + PHONE_ZONE_4_R) * PHONE_ROW_H + PHONE_FRAME * 5,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_MAGENTA,
MAP_COLOR_WHITE,
24,
'C',
"#", },
{ PHONE_BOX_X + (PHONE_BOX_W + PHONE_FRAME) * 3 / PHONE_ZONE_2_C,
PHONE_BOX_Y + (PHONE_ZONE_0_R + PHONE_ZONE_1_R + PHONE_ZONE_2_R + PHONE_ZONE_3_R + PHONE_ZONE_4_R) * PHONE_ROW_H + PHONE_FRAME * 5,
(PHONE_BOX_W - (PHONE_ZONE_2_C - 1) * PHONE_FRAME) / PHONE_ZONE_2_C,
PHONE_ZONE_2_R * PHONE_ROW_H,
MAP_COLOR_CYAN,
MAP_COLOR_BLACK,
24,
'C',
"返回", },
};
void MapDrawPhone()
{
BYTE i;
MapSaveWindow(PHONE_BOX_Y - PHONE_FRAME, PHONE_BOX_H + PHONE_FRAME * 2);
MapSetColor(MAP_COLOR_GRAY);
MapFillRectangle(PHONE_BOX_X - PHONE_FRAME,
PHONE_BOX_Y - PHONE_FRAME,
PHONE_BOX_X + PHONE_BOX_W + PHONE_FRAME,
PHONE_BOX_Y + PHONE_BOX_H + PHONE_FRAME);
for (i = 0; i < PHONE_ZONE_ALL; i++) {
MapSetColor(PhoneMenuZone[i].BackColor);
MapFillCircleRect(PhoneMenuZone[i].x, PhoneMenuZone[i].y,
PhoneMenuZone[i].w, PhoneMenuZone[i].h, 4);
MapDrawPhoneZone((BYTE *)PhoneMenuZone[i].Text, i);
}
}
void MapHidePhone()
{
MapLoadWindow(PHONE_BOX_Y - PHONE_FRAME, PHONE_BOX_H + PHONE_FRAME * 2);
}
void MapDrawPhoneZone(BYTE *Str, BYTE Zone)
{
BYTE i;
MapSaveFontSize();
MapSetFontSize(24);
MapSetColor(PhoneMenuZone[Zone].FontColor);
MapSetBackColor(PhoneMenuZone[Zone].BackColor);
if (Zone == 1) {
strcpy(LineBuffer, Str);
for (i = strlen(LineBuffer); i < PHONE_SHOW_MAX; i++) {
LineBuffer[i] = ' ';
}
LineBuffer[i] = 0;
MapFillString(PhoneMenuZone[Zone].x + PHONE_FRAME,
PhoneMenuZone[Zone].y + (PhoneMenuZone[Zone].h - 24) / 2, LineBuffer);
}
else {
MapFillString(PhoneMenuZone[Zone].x + (PhoneMenuZone[Zone].w - (strlen(Str) * 12)) / 2,
PhoneMenuZone[Zone].y + (PhoneMenuZone[Zone].h - 24) / 2, Str);
}
MapRestoreFontSize();
}
#define NOTE_BOX_X (96)
#define NOTE_BOX_Y (240)
#define NOTE_BOX_C (32)
#define NOTE_BOX_R (1)
#define NOTE_BOX_W (NOTE_BOX_C * NOTE_COL_W)
#define NOTE_BOX_H (NOTE_BOX_R * NOTE_ROW_H)
#define NOTE_COL_W (16)
#define NOTE_ROW_H (32)
#define NOTE_STEP (16)
#define NOTE_CHAR (32)
#define NOTE_FRAME (8)
#define NOTE_FONT_COLOR MAP_COLOR_BLACK
#define NOTE_BACK_COLOR MAP_COLOR_CYAN
void MapNoteEnter()
{
if (MapNoteEnterOK) MapNoteExit();
if (MapBillEnterOK) MapBillExit();
MapSaveFrame(NOTE_BOX_X - NOTE_FRAME * 1, NOTE_BOX_Y - NOTE_FRAME * 2,
NOTE_BOX_W + NOTE_FRAME * 2, NOTE_BOX_H + NOTE_FRAME * 4);
MapSetColor(NOTE_BACK_COLOR);
MapFillCircleRect(NOTE_BOX_X - NOTE_FRAME * 1, NOTE_BOX_Y - NOTE_FRAME * 2,
NOTE_BOX_W + NOTE_FRAME * 2, NOTE_BOX_H + NOTE_FRAME * 4, 4);
MapNoteEnterOK = TRUE;
}
void MapNoteExit()
{
if (MapNoteEnterOK) {
MapLoadFrame(NOTE_BOX_X - NOTE_FRAME * 1, NOTE_BOX_Y - NOTE_FRAME * 2,
NOTE_BOX_W + NOTE_FRAME * 2, NOTE_BOX_H + NOTE_FRAME * 4);
MapNoteFlag = FALSE;
MapNoteEnterOK = FALSE;
}
}
BYTE MapNoteState()
{
return MapNoteEnterOK;
}
void MapNoteShowText(BYTE *Text)
{
BYTE i;
BYTE Len;
if ((Len = strlen(Text)) < NOTE_BOX_C) {
for (i = 0; i < NOTE_BOX_C; i++) MapNoteText[i] = ' '; MapNoteText[i] = 0;
strcpy(MapNoteText + ((NOTE_BOX_C - Len) >> 1), Text);
Len = NOTE_BOX_C;
MapSetColor(NOTE_FONT_COLOR);
MapSetBackColor(NOTE_BACK_COLOR);
MapSetFontSize(32);
MapFillString(NOTE_BOX_X, NOTE_BOX_Y, MapNoteText);
MapNoteFlag = FALSE;
}
else {
strcpy(MapNoteText, Text);
MapNoteSize = Len;
MapNoteAddr = 0;
MapNoteStep = 0;
MapNoteFlag = TRUE;
}
}
void PollingMapNote()
{
if (!MapNoteFlag) return;
MapMoveWindowLeft(NOTE_BOX_X, NOTE_BOX_Y, NOTE_BOX_W, NOTE_BOX_H, NOTE_STEP);
if (MapNoteAddr >= MapNoteSize + NOTE_BOX_C / 2) {
MapNoteAddr = 0;
}
else if (MapNoteAddr >= MapNoteSize) {
MapSaveColor();
MapSetColor(NOTE_BACK_COLOR);
MapFillRectangle(NOTE_BOX_X + NOTE_BOX_W - NOTE_STEP, NOTE_BOX_Y,
NOTE_BOX_X + NOTE_BOX_W, NOTE_BOX_Y + NOTE_BOX_H);
MapRestoreColor();
MapNoteStep += NOTE_STEP;
if (MapNoteStep >= NOTE_CHAR / 2) {
MapNoteAddr++;
MapNoteStep = 0;
}
}
else {
MapSaveColor();
MapSetColor(NOTE_BACK_COLOR);
MapFillRectangle(NOTE_BOX_X + NOTE_BOX_W - NOTE_STEP, NOTE_BOX_Y,
NOTE_BOX_X + NOTE_BOX_W, NOTE_BOX_Y + NOTE_BOX_H);
MapSaveFontSize();
MapSetFontSize(NOTE_CHAR);
MapSetColor(NOTE_FONT_COLOR);
MapDrawFontPart(NOTE_BOX_X + NOTE_BOX_W - NOTE_STEP, NOTE_BOX_Y,
MapNoteText + MapNoteAddr, MapNoteStep, NOTE_STEP);
MapRestoreColor();
MapRestoreFontSize();
MapNoteStep += NOTE_STEP;
if (MapNoteText[MapNoteAddr] < 161 || MapNoteText[MapNoteAddr + 1] < 161) {
if (MapNoteStep >= NOTE_CHAR / 2) {
MapNoteStep = 0;
MapNoteAddr++;
}
}
else {
if (MapNoteStep >= NOTE_CHAR) {
MapNoteStep = 0;
MapNoteAddr += 2;
}
}
}
}
#define BILL_BOX_X (96)
#define BILL_BOX_Y (124)
#define BILL_BOX_C (32)
#define BILL_BOX_R (BILL_ZONE_0_R + BILL_ZONE_1_R)
#define BILL_BOX_W (BILL_BOX_C * BILL_COL_W)
#define BILL_BOX_H (BILL_BOX_R * BILL_ROW_H + BILL_FRAME * (BILL_ZONE_V - 1))
#define BILL_COL_W (16)
#define BILL_ROW_H (32 + BILL_FRAME * 2)
#define BILL_FRAME (8)
#define BILL_ZONE_V (2)
#define BILL_ZONE_0_R (1)
#define BILL_ZONE_1_R (4)
#define BILL_ZONE_ALL (BILL_ZONE_V)
const MENU_BASE BillMenuZone[BILL_ZONE_ALL] = {
{ BILL_BOX_X,
BILL_BOX_Y,
BILL_BOX_W,
BILL_ZONE_0_R * BILL_ROW_H,
MAP_COLOR_BLUE,
MAP_COLOR_WHITE,
32,
'C',
"", },
{ BILL_BOX_X,
BILL_BOX_Y + BILL_ZONE_0_R * BILL_ROW_H + BILL_FRAME,
BILL_BOX_W,
BILL_ZONE_1_R * BILL_ROW_H,
0xB08080,
MAP_COLOR_BLACK,
32,
'C',
"", },
};
void MapBillEnter()
{
BYTE i;
if (MapNoteEnterOK) MapNoteExit();
if (MapBillEnterOK) MapBillExit();
MapSaveFrame(BILL_BOX_X - BILL_FRAME * 1, BILL_BOX_Y - BILL_FRAME * 1,
BILL_BOX_W + BILL_FRAME * 2, BILL_BOX_H + BILL_FRAME * 2);
MapSetColor(MAP_COLOR_GRAY);
MapFillCircleRect(BILL_BOX_X - BILL_FRAME * 1, BILL_BOX_Y - BILL_FRAME * 1,
BILL_BOX_W + BILL_FRAME * 2, BILL_BOX_H + BILL_FRAME * 2, 2);
for (i = 0; i < BILL_ZONE_ALL; i++) {
MapSetColor(BillMenuZone[i].BackColor);
MapFillCircleRect(BillMenuZone[i].x, BillMenuZone[i].y,
BillMenuZone[i].w, BillMenuZone[i].h, 4);
// MapDrawBillZone((BYTE *)BillMenuZone[i].Text, i);
}
MapBillEnterOK = TRUE;
}
void MapBillExit()
{
if (MapBillEnterOK) {
MapLoadFrame(BILL_BOX_X - BILL_FRAME * 1, BILL_BOX_Y - BILL_FRAME * 1,
BILL_BOX_W + BILL_FRAME * 2, BILL_BOX_H + BILL_FRAME * 2);
MapBillEnterOK = FALSE;
}
}
BYTE MapBillState()
{
return MapBillEnterOK;
}
void MapBillShowHead(BYTE *Str)
{
MapSetFontSize(32);
MapSetColor(BillMenuZone[0].FontColor);
MapDrawString(BillMenuZone[0].x + (BillMenuZone[0].w - (strlen(Str) * 16)) / 2,
BillMenuZone[0].y + (BillMenuZone[0].h - 32) / 2, Str);
}
void MapBillShowText(BYTE *Str, BYTE Row, BYTE Col)
{
MapSetFontSize(32);
MapSetColor(BillMenuZone[1].FontColor);
MapDrawString(BillMenuZone[1].x + BILL_COL_W + Col * BILL_COL_W,
BillMenuZone[1].y + (BILL_ROW_H - 32) / 2 + Row * BILL_ROW_H, Str);
}
#endif
#define MSG_HELLO_SIZE 6
#define MSG_HELLO_LEN_X ((MSG_HELLO_SIZE + 2) * 24)
#define MSG_HELLO_LEN_Y 50
#define MSG_HELLO_POS_X ((MAP_SIZE_X - MSG_HELLO_LEN_X) / 2)
#define MSG_HELLO_POS_Y 180
void MapShowInit()
{
UINT16 x, y;
x = MSG_HELLO_POS_X + (MSG_HELLO_LEN_X - MSG_HELLO_SIZE * 24) / 2;
y = MSG_HELLO_POS_Y + (MSG_HELLO_LEN_Y - 24) / 2;
MapSetColor(MAP_COLOR_YELLOW);
MapFillCircleRect(MSG_HELLO_POS_X, MSG_HELLO_POS_Y,
MSG_HELLO_LEN_X, MSG_HELLO_LEN_Y, 4);
MapSetColor(MAP_COLOR_BLACK);
MapDrawFontMap(x, y, (BYTE *)SystemInit24, MSG_HELLO_SIZE);
}
#define MSG_ERROR_SIZE 10
#define MSG_ERROR_LEN_X ((MSG_ERROR_SIZE + 2) * 24)
#define MSG_ERROR_LEN_Y 50
#define MSG_ERROR_POS_X ((MAP_SIZE_X - MSG_ERROR_LEN_X) / 2)
#define MSG_ERROR_POS_Y 180
void MapShowError(BYTE Code)
{
UINT16 x, y;
// UINT16 h, l;
BYTE i, j;
x = MSG_ERROR_POS_X + (MSG_ERROR_LEN_X - MSG_ERROR_SIZE * 24) / 2;
y = MSG_ERROR_POS_Y + (MSG_ERROR_LEN_Y - 24) / 2;
MapSaveFontSize();
MapSetFontSize(24);
#if 0
MapSetColor(MAP_COLOR_RED);
MapFillCircleRect(MSG_ERROR_POS_X, MSG_ERROR_POS_Y,
MSG_ERROR_LEN_X, MSG_ERROR_LEN_Y, 4);
MapSetColor(MAP_COLOR_WHITE);
MapDrawFontMap(x, y, (BYTE *)SystemError24, MSG_ERROR_SIZE);
h = (Code / 10) * 48;
l = (Code % 10) * 48;
for (i = 0; i < 48; i += 2) {
j = (i >> 1) * 3;
LineBuffer[j++] = SystemDigit24[h + i ];
LineBuffer[j++] = SystemDigit24[h + i + 1] |
SystemDigit24[l + i ] >> 4;
LineBuffer[j++] = SystemDigit24[l + i ] << 4 |
SystemDigit24[l + i + 1] >> 4;
}
MapDrawFontMap(x + 24 * (MSG_ERROR_SIZE - 1), y, LineBuffer, 1);
#else
for (i = 0, j = 0; i < 5; i++) {
if (Code & (1 << i)) {
MapSetColor(MAP_COLOR_RED);
MapFillCircleRect(MSG_ERROR_POS_X, MSG_ERROR_POS_Y + j * 64,
MSG_ERROR_LEN_X, MSG_ERROR_LEN_Y, 4);
MapSetColor(MAP_COLOR_WHITE);
MapDrawFontMap(x, y, (BYTE *)SystemError24, MSG_ERROR_SIZE - 3);
MapDrawFontMap(x + 24 * (MSG_ERROR_SIZE - 3), y,
(BYTE *)SystemErrorCode24 + i * (3 * 24 * 24 / 8), 3);
y += 64;
j++;
}
}
#endif
MapRestoreFontSize();
}
void MapShowErrorText(BYTE *Text)
{
UINT16 x, y;
x = MSG_ERROR_POS_X + (MSG_ERROR_LEN_X - MSG_ERROR_SIZE * 24) / 2 - 8;
y = MSG_ERROR_POS_Y + (MSG_ERROR_LEN_Y - 24) / 2 - 4;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -