home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C++ Games Programming
/
CPPGAMES.ISO
/
thx
/
source
/
utils
/
mice.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-21
|
4KB
|
227 lines
#include <iostream.h>
// ---- utility to build mouse mask source code from character strings
char *cn =
"\x7\x7"
" "
" "
" xxxxxxxxxxxx "
" xx xx "
" x x x x "
" x x x x "
" x x x x "
" x xx x "
" x xx x "
" x x x x "
" x x x x "
" x x x x "
" xx xx "
" xxxxxxxxxxxx "
" "
" ";
char *ul =
"\0\0"
"xxxxxxxxxxxxx "
"x x "
"x x "
"x x "
"x x "
"x x "
"x x "
"x x "
"x x "
"x x x"
"x x x x "
"xx x x "
"x x x "
" x x "
" x x "
" x ";
char *ll =
"\0\xf"
" x "
" x x "
" x x "
"x x x "
"xx x x "
"x x x x "
"x x x"
"x x "
"x x "
"x x "
"x x "
"x x "
"x x "
"x x "
"x x "
"xxxxxxxxxxxxx ";
char *lr =
"\xf\xf"
" x "
" x x "
" x x "
" x x x"
" x x xx"
" x x x x"
"x x x"
" x x"
" x x"
" x x"
" x x"
" x x"
" x x"
" x x"
" x x"
" xxxxxxxxxxxxx";
char *ur =
"\xf\0"
" xxxxxxxxxxxxx"
" x x"
" x x"
" x x"
" x x"
" x x"
" x x"
" x x"
" x x"
"x x x"
" x x x x"
" x x xx"
" x x x"
" x x "
" x x "
" x ";
char *lf =
"\0\x7"
" xx "
" x x "
" x x "
" x xxxxxxxx"
" x x"
" x x"
" x x"
"x x"
"x x"
" x x"
" x x"
" x x"
" x xxxxxxxx"
" x x "
" x x "
" xx ";
char *rt =
"\xf\x7"
" xx "
" x x "
" x x "
"xxxxxxxx x "
"x x "
"x x "
"x x "
"x x"
"x x"
"x x "
"x x "
"x x "
"xxxxxxxx x "
" x x "
" x x "
" xx ";
char *up =
"\x7\0"
" xx "
" x x "
" x x "
" x x "
" x x "
" x x "
" x x "
"xxxx xxxx"
" x x "
" x x "
" x x "
" x x "
" x x "
" x x "
" x x "
" xxxxxxxxxx ";
char *dn =
"\x7\xf"
" xxxxxxxxxx "
" x x "
" x x "
" x x "
" x x "
" x x "
" x x "
" x x "
"xxxx xxxx"
" x x "
" x x "
" x x "
" x x "
" x x "
" x x "
" xx " ;
static short int mask[16];
static short int cvt(char *cp)
{
short int rtn = 0;
short int msk = 0x8000;
for (int i = 0; i < 16; i++) {
if (*(cp+i) != ' ')
rtn |= msk;
msk = (msk >> 1) & 0x7fff;
}
return rtn;
}
static void opint(int i, int msk)
{
if ((i % 4) == 0)
cout << "\n\t";
cout << "0x";
cout.width(4);
cout.fill('0');
cout << hex << (msk & 0xffff);
if (i < 15)
cout << ',';
}
static void op(char *cp, char *arname)
{
for (int i = 0; i < 16; i++)
mask[i] = cvt(cp+2+i*16);
cout << "\nshort int " << arname << "[] = {";
cout << "\n\t" << dec << (int)*cp << ',' << (int)*(cp+1) << ',';
for (i = 0; i < 16; i++)
opint(i, ~mask[i]);
cout << ',';
for (i = 0; i < 16; i++)
opint(i, mask[i]);
cout << "\n};";
}
int main()
{
op(cn, "CENTERCURSOR");
op(ul, "UPPERLEFTARROWCURSOR");
op(ur, "UPPERRIGHTARROWCURSOR");
op(ll, "LOWERLEFTARROWCURSOR");
op(lr, "LOWERRIGHTARROWCURSOR");
op(lf, "LEFTARROWCURSOR");
op(rt, "RIGHTARROWCURSOR");
op(up, "UPARROWCURSOR");
op(dn, "DOWNARROWCURSOR");
return 0;
}