Win32 API Game Framework in C++ (Ep.4 Keyboard Input Handling)

preview_player
Показать описание

How to make a game framework in C++ using only Win32 API. Episode 4 Keyboard Input Handling. Input Polling.

Github: danielblagy
IG: @danielblagy
Рекомендации по теме
Комментарии
Автор

Thank you, I was having a difficult time understanding the process of input handling from messages. I know this video was 9 months ago but maybe look into using std::bitset for knowing if a key isDown or wasDown (using bools). Less memory being used if I'm not mistaken :)

Ex.
enum e_input {FWD = 0, BACK = 1, LEFT = 2, RIGHT = 3, ..., COUNT}; // instead of having a defining count, we can use it as the last item in an enum so the value represents use keys count!

std::array<e_input, 256> map;
map['w'] = e_input::FWD // set by init, config file, inside a menu at run time, etc.
map['VK_UP'] = e_input::FWD // set by init, config file, inside a menu at run time, etc.

// then instead of needing to set bools you can turn on the bit
input_state[map[wParam]] = true;


I am still learning more about handling window messages but this was something from my lecture the other day that I thought was cool :)

ZeroTubeTV
join shbcf.ru