inaczej nie jestem w stanie tego opisać, tutaj jest kod z main:
Window window;
while (!keyboard[esc])
{
//
cout << keyboard[esc] << endl;
}
return 0;
tu definicja konstruktora Window:
Window::Window()
{
//
}
i struktura keyboard+metody:
struct Keyboard
{
bool operator [] (char key);
bool operator [] (int key);
}keyboard;
bool Keyboard::operator[] (char key)
{
return GetAsyncKeyState(key);
}
bool Keyboard::operator[] (int key)
{
return GetAsyncKeyState((char)key);
}
po wciśnięciu klawisza esc program crashuje