05/12/03 20:45:23 kCJHfA11
おらよ。
<ヘッダ>
#define KEY_UP 0x0001
#define KEY_DOWN 0x0002
#define KEY_RIGHT 0x0004
#define KEY_LEFT 0x0008
#define KEY_1 0x0010
#define KEY_2 0x0020
void GetKeyLoop(); short GetKey(); short GetKeyOn();
<ライブラリ>
short g_wKey = 0,g_wKeyBk = 0;
void GetKeyLoop()
{
g_wKeyBk = g_wKey; g_wKey = 0;
if(上キーが押されている)g_wKey |= KEY_UP;
if(下キーが押されている)g_wKey |= KEY_DOWN;
if(右キーが押されている)g_wKey |= KEY_RIGHT;
if(左キーが押されている)g_wKey |= KEY_LEFT;
if(Zキーが押されている)g_wKey |= KEY_1;
if(Xキーが押されている)g_wKey |= KEY_2;
}
short GetKey(){ return g_wKey; }
short GetKeyOn(){ return g_wKey ^ g_wKeyBk & g_wKey; }