16 lines
347 B
C++

#pragma once
#include <array>
template <size_t width, size_t height>
class KeyboardState {
std::array<char, width*height> _state = {};
public:
typedef char state_t;
// Todo: Bounds check
state_t state(size_t x, size_t y) const { return _state[y * width + x]; }
state_t &state(size_t x, size_t y) { return _state[y * width + x]; }
};