暗域天堂
#include
#include
#include
#include
#include
using namespace std;
int get_character(unsigned char* pc1, unsigned char* pc2)
{
unsigned char buf[100];
cin >> buf;
*pc1 = buf[0];
*pc2 = buf[1];
if (*pc1
{
return -2;
}
if (*pc2
{
return -2;
}
return 0;
}
void load_font(unsigned char* buf, unsigned char c1, unsigned char c2)
{
int n = (c1 - 0xa1) * 94 + (c2 - 0xa1);
FILE* fp = fopen("hzk16f", "rb");
if (fp == NULL)
{
cout <
exit(1);
}
fseek(fp, n * 32L, SEEK_SET);
for (int i = 0; i
{
buf[i] = (unsigned char)fgetc(fp);
}
fclose(fp);
}
void show_character(unsigned char* buf)
{
for (int i = 0; i
{
for (int j = 0; j
{
for (int k = 0; k
{
if (((buf[i * 2 + j] >> (7 - k)) & 0x1) != NULL)
{
cout <
}
else
{
cout <
}
}
}
cout <
}
}
int main()
{
unsigned char character[32];
unsigned char c1;
unsigned char c2;
if (get_character(&c1, &c2) != 0)
{
cout <
return 0;
}
printf("%d %d\n", c1, c2);
load_font(character, c1, c2);
show_character(character);
system("pause");
return 0;
}