Register
Handmade Hero»Forums»Code»Rebinding keys question
Israel Fernández Angullo
16 posts
Rebinding keys question
5 months, 2 weeks ago Edited by Israel Fernández Angullo on Dec. 11, 2019, 6:04 p.m.
Hi,

Casey comments in a post somewhere that if I want to make an engine capable of rebinding keys I should send all key states from the platform layer to the game and the game should take care of the rebinding.

My question is: Is the overhead of sending all the keys each frame (most of them without any use) something I should be concerned about?


*edited for clarity
Simon Anciaux
791 posts
Rebinding keys question
5 months, 2 weeks ago
No.

You can use 1 byte per key (storing the current state in 1 bit, the previous state in 1 bit and the repetition count in 6 bits if you need it). If you want to support every Virtual Key Windows presents you can use a 256 bytes array. 256 octets is nothing to worry about.
Israel Fernández Angullo
16 posts
Rebinding keys question
5 months, 2 weeks ago
Clear enough!

Thank you!