我正在为C上的3D引擎工作,我(我相信)成为一切。除了键盘输入之外,我可以使用scanf()函数,但我认为这有问题(例如多键输入)。我不想使用像SDL2这样的库,我只想一个输入的标题文件,或者更优选地仅获取代码以扫描键并将其添加到数组或其他内容中。请不要建议一些更好的东西,也不要为我做所有事情的图书馆,我想从头开始构建这个。谢谢。
I'm working on a 3D Engine for C, and I have (what I believe) to be everything. Except keyboard input, I could use the scanf() function but I imagine that has its problems (like multi-key inputs). I dont want to use a library like SDL2, I just want a header file for inputs or more preferably just getting code to scan for keys and add it to an array or something. Please do not suggest something better or a library that would do everything for me, I want to build this from scratch. Thank you.
发布评论
评论(1)
您可能需要在消息循环:
wm_keydown
wm_keyup
参见href =“ https://learn.microsoft.com/en-us/windows/windows/win32/inputdev/keyboard-input“ rel =”键盘输入上的Microsoft文档以获取更多信息。
You will probably want to process the following two window messages in your message loop:
WM_KEYDOWN
WM_KEYUP
See the Microsoft documentation on Keyboard Input for further information.