?? graph.c
字號:
void MapDrawString(INT16 xStart, INT16 yStart, BYTE *str)
{
BYTE *pFont;
BYTE FontIndex;
UINT32 FontCount;
UINT16 FontHigh, FontWidth;
UINT32 BitMap;
UINT32 FontMap;
INT16 xPoint, yPoint;
UINT16 i, j;
BYTE c, d;
FontIndex = 0;
if (MapFontSize == 24)
FontHigh = 24;
else
FontHigh = 16;
while ((c = ((BYTE *) str)[FontIndex]) != '\0') {
if (c < 0x80) { // ASCII char
if (MapFontSize == 24) {
if (c < ' ') c = ' ';
FontWidth = 12;
FontCount = c - ' ';
pFont = (BYTE *)(ASC24 + FontCount * FontHigh * (FontWidth + 4) / 8);
}
else {
FontWidth = 8;
FontCount = c;
pFont = (BYTE *)(ASC16 + FontCount * FontHigh * FontWidth / 8);
}
}
else {
d = ((BYTE *) str)[FontIndex + 1];
if (MapFontSize == 24) {
FontWidth = 24;
FontCount = (c - 160 - 16) * 94 + (d -160 - 1);
pFont = (BYTE *)(HZK24 + 72 * FontCount);
}
else {
FontWidth = 16;
FontCount = (c - 160 - 1) * 94 + (d -160 - 1);
pFont = (BYTE *)(HZK16 + 32 * FontCount);
}
}
for (i = 0; i < FontHigh; i++) {
if (c < 0x80) { // ASCII char
if (MapFontSize == 24) {
FontMap = (pFont[i * 2] << 8) | pFont[i * 2 + 1];
BitMap = 0x8000;
}
else {
FontMap = pFont[i];
BitMap = 0x80;
}
}
else {
if (MapFontSize == 24) {
FontMap = (pFont[i * 3] << 16) | (pFont[i * 3 + 1] << 8) |
(pFont[i * 3 + 2]);
BitMap = 0x800000;
}
else {
FontMap = (pFont[i * 2] << 8) | pFont[i * 2 + 1];
BitMap = 0x8000;
}
}
for (j = 0; j < FontWidth; j++) {
if (MapFontSize == 24)
xPoint = xStart + j + FontIndex * 12;
else if (MapFontSize == 32)
xPoint = xStart + (j + FontIndex * 8) * 2;
else
xPoint = xStart + j + FontIndex * 8;
if (MapFontSize == 32)
yPoint = yStart + i * 2;
else
yPoint = yStart + i;
if (FontMap & BitMap) {
__plotXY(xPoint, yPoint);
if (MapFontSize == 32) {
__plotXY(xPoint, yPoint + 1);
__plotXY(xPoint + 1, yPoint );
__plotXY(xPoint + 1, yPoint + 1);
}
}
BitMap >>= 1;
}
}
if (c < 0x80) // ASCII char
FontIndex++;
else
FontIndex += 2;
}
}
void MapDrawFontMap(INT16 xStart, INT16 yStart, BYTE *pFont, BYTE Len)
{
BYTE FontIndex;
UINT16 FontHigh, FontWidth;
UINT32 BitMap;
UINT32 FontMap;
INT16 xPoint, yPoint;
UINT16 i, j;
FontIndex = 0;
FontHigh = 24;
FontWidth = 24;
for (FontIndex = 0; FontIndex < Len; FontIndex++) {
for (i = 0; i < FontHigh; i++) {
j = FontIndex * 72 + i * 3;
FontMap = (pFont[j] << 16) | (pFont[j + 1] << 8) | (pFont[j + 2]);
BitMap = 0x800000;
for (j = 0; j < FontWidth; j++) {
xPoint = xStart + j + FontIndex * 24;
yPoint = yStart + i;
if (FontMap & BitMap) {
__plotXY(xPoint, yPoint);
}
BitMap >>= 1;
}
}
}
}
void MapDrawFontPart(INT16 xStart, INT16 yStart, BYTE *pChar, BYTE bStart, BYTE bLen)
{
BYTE *pFont;
UINT16 FontHigh, FontWidth;
UINT32 BitMap;
UINT32 FontMap;
INT16 xPoint, yPoint;
UINT16 i, j;
BYTE c, d;
if (MapFontSize == 24)
FontHigh = 24;
else
FontHigh = 16;
c = *pChar;
if (c < 0x80) { // ASCII char
if (MapFontSize == 24) {
if (c < ' ') c = ' ';
FontWidth = 12;
pFont = (BYTE *)(ASC24 + (c - ' ') * FontHigh * (FontWidth + 4) / 8);
}
else {
FontWidth = 8;
pFont = (BYTE *)(ASC16 + c * FontHigh * FontWidth / 8);
}
}
else {
d = *(pChar + 1);
if (MapFontSize == 24) {
FontWidth = 24;
pFont = (BYTE *)(HZK24 + 72 * ((c - 160 - 16) * 94 + (d -160 - 1)));
}
else {
FontWidth = 16;
pFont = (BYTE *)(HZK16 + 32 * ((c - 160 - 1) * 94 + (d -160 - 1)));
}
}
for (i = 0; i < FontHigh; i++) {
if (c < 0x80) { // ASCII char
if (MapFontSize == 24) {
FontMap = (pFont[i * 2] << 8) | pFont[i * 2 + 1];
BitMap = 0x8000;
}
else {
FontMap = pFont[i];
BitMap = 0x80;
}
}
else {
if (MapFontSize == 24) {
FontMap = (pFont[i * 3] << 16) | (pFont[i * 3 + 1] << 8) |
(pFont[i * 3 + 2]);
BitMap = 0x800000;
}
else {
FontMap = (pFont[i * 2] << 8) | pFont[i * 2 + 1];
BitMap = 0x8000;
}
}
if (MapFontSize == 32) {
bLen <<= 1;
bStart <<= 1;
}
for (j = 0; j < bStart; j++) {
BitMap >>= 1;
}
for (j = 0; j < bLen; j++) {
if (MapFontSize == 32) {
xPoint = xStart + (j << 1);
yPoint = yStart + (i << 1);
}
else {
xPoint = xStart + j;
yPoint = yStart + i;
}
if (FontMap & BitMap) {
__plotXY(xPoint, yPoint);
if (MapFontSize == 32) {
__plotXY(xPoint, yPoint + 1);
__plotXY(xPoint + 1, yPoint );
__plotXY(xPoint + 1, yPoint + 1);
}
}
BitMap >>= 1;
}
}
}
void ShowDebugHex(UINT32 Data, BYTE Pos)
{
UINT16 x, y;
#ifdef SUPPORT_LINEAR_PLAYBACK
if (CheckSystemState(SYSTEM_LINEAR)) return;
#endif
PublicBuffer[0] = Hex2Asc[(Data >> 28) & 0x0f];
PublicBuffer[1] = Hex2Asc[(Data >> 24) & 0x0f];
PublicBuffer[2] = Hex2Asc[(Data >> 20) & 0x0f];
PublicBuffer[3] = Hex2Asc[(Data >> 16) & 0x0f];
PublicBuffer[4] = Hex2Asc[(Data >> 12) & 0x0f];
PublicBuffer[5] = Hex2Asc[(Data >> 8) & 0x0f];
PublicBuffer[6] = Hex2Asc[(Data >> 4) & 0x0f];
PublicBuffer[7] = Hex2Asc[(Data >> 0) & 0x0f];
PublicBuffer[8] = '\0';
x = (Pos / 8) * 124 + 64;
y = (Pos % 8) * 50 + 100;
MapSaveColor();
MapSaveFontSize();
MapSetFontSize(24);
MapSetColor(MAP_COLOR_BLACK);
MapFillRectangle(x - 8, y - 8, x + 24 / 2 * 8 + 8, y + 24 + 8);
MapSetColor(MAP_COLOR_WHITE);
MapDrawString(x, y, PublicBuffer);
MapRestoreFontSize();
MapRestoreColor();
}
void ShowDebugDec(UINT32 Data, BYTE Pos)
{
UINT16 x, y;
#ifdef SUPPORT_LINEAR_PLAYBACK
if (CheckSystemState(SYSTEM_LINEAR)) return;
#endif
PublicBuffer[0] = (Data / 10000000) % 10 + '0';
PublicBuffer[1] = (Data / 1000000) % 10 + '0';
PublicBuffer[2] = (Data / 100000) % 10 + '0';
PublicBuffer[3] = (Data / 10000) % 10 + '0';
PublicBuffer[4] = (Data / 1000) % 10 + '0';
PublicBuffer[5] = (Data / 100) % 10 + '0';
PublicBuffer[6] = (Data / 10) % 10 + '0';
PublicBuffer[7] = (Data) % 10 + '0';
PublicBuffer[8] = '\0';
x = (Pos / 8) * 124 + 64;
y = (Pos % 8) * 50 + 100;
MapSaveColor();
MapSaveFontSize();
MapSetFontSize(24);
MapSetColor(MAP_COLOR_BLACK);
MapFillRectangle(x - 8, y - 8, x + 24 / 2 * 8 + 8, y + 24 + 8);
MapSetColor(MAP_COLOR_WHITE);
MapDrawString(x, y, PublicBuffer);
MapRestoreFontSize();
MapRestoreColor();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -