more modern C++ code, but I don't know how to design it properly. I'm trying to make make a structure containg the current state of an XBOX controller. However, I don't know how to store the states, as there are 2 different types of input sensors. What I've got so far is:
class InputState {
bool m_Pressed;
bool m_Changed;
public:
void Update(bool State) noexcept;
bool Changed() const noexcept;
float State() const noexcept;
};
class DynamicInputState {
float m_Threshold;
float m_Value;
bool m_Changed;
public:
void Update(float State) noexcept;
bool Changed() const noexcept;
bool State() const noexcept;
};
Is there a way to merge those two classes?
Is it even a good idea to design it like that?
How would a C++ pro do that? 🙈
bitmask? or a state machine
Обсуждают сегодня