Quick question...
What do you all use to detect keyboard input? getc() is slow. can someone tell me a fast way?
I windows i use direct input, takes some getting use to but its quite powerfull. Other then that i would suggest you use SDL. I don''t recommend writing your own keyboard layer unless you are crazy..
Later, Ben
Later, Ben
quote:
I don''t recommend writing your own keyboard layer unless you are crazy
Can you explain why not? I use opengl and dont want to use directX if i can help it. It would be nice to have my own keyboard input library. Is it too difficult, or not cross platform, or what?
I use SDL for my stuff. I like it because I don't have to worry about window creation and it makes it really easy to port to other platforms. While I doubt that SDL input is as powerful as directx input (I really have no information to base that on, just a guess), it works great for me.
[edit]I use opengl and SDL works fine with it.[/edit]
[edited by - Mr Grinch on November 16, 2003 10:23:58 PM]
[edit]I use opengl and SDL works fine with it.[/edit]
[edited by - Mr Grinch on November 16, 2003 10:23:58 PM]
When creating small demos/applications I use the Windows API function GetAsyncKeyState() for my keyboard input, and it is very fast as far as I know.
Nobody uses getc(), it''s for console apps.
Just catch the keypressed event if you want to catch eg. the esc key for quitting. Or keydown/keyup to track movement.
But it''s probably better to use directinput when playing.
Just catch the keypressed event if you want to catch eg. the esc key for quitting. Or keydown/keyup to track movement.
But it''s probably better to use directinput when playing.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement