多分、動くと思う・・・動くんじゃないかな・・・まぁ、ちょっとは(動かない)覚悟はしておけw
class IInputBase
{
public:
virtual bool IsOnOff (int code) = 0;
virtual bool IsPress (int code) = 0;
virtual bool IsRelease (int code) = 0;
virtual int GetCount (int code) = 0;
virtual bool Refresh (void) = 0;
};
#pragma once
#include
#include "DxLib.h"
class CKeyboard : public IInputBase
{
public:
static const int Size = 256;
private:
std::vector m_bOnOff;
std::vector m_bRelease;
std::vector m_nCount;
private:
CKeyboard (void)
{
m_bOnOff.resize(CKeyboard::Size, false);
m_bRelease.resize(CKeyboard::Size, false);
m_nCount.resize(CKeyboard::Size, 0);
}
public:
static CKeyboard& GetInstance (void)
{
static CKeyboard key;
return key;
}
bool IsOnOff (int code)
{
return m_bOnOff[code];
}
bool IsPress (int code)
{
return (m_nCount[code] == 1);
}
bool IsRelease (int code)
{
return m_bRelease[code];
}
int GetCount (int code)
{
return m_nCount[code];
}
bool Refresh (void)
{
char buf[CKeyboard::Size] = {0, };
if (::GetHitKeyStateAll(buf) != 0)
{
return false;
}
for (int i = 0; i 0);
m_nCount[i] = 0;
}
}
return true;
}
};