you want to poll:
void UpdateVehicleFromInput() { if (InputSystem()->IsKeyDown(key)) DoSomething(); }
And that, of course, is "somewhere in your update cycle, where it suits you." If you want to call this private place “part of your input system” or “part of your game logic” or something else, knock yourself.
That way, you know why you are doing something (no reason is given), you can set the conditions trivially, you know that you do something once and exactly once (and you can change it without branching, especially if the transport the remedy does not exist), and you know when you are doing something (before or after you say, react to damage, or position your particle effects, or who knows what else).
An abstract input system can be valid if you are really doing cross-platform development. for random development, this is very unnecessary (but a fun technical distraction when you run out of game design ideas for implementation).
Contrary to the irrational popular belief, there are no barriers to questioning. The processors do> 1B things per second, one IF if the frame does not matter (basically the only relevant cpu operations are N ^ 2, where N> 100, and purge your cache l2 and, of course, busy waiting for access to the disk). The input for polling is O (1).
source share