Advertisement

Console..

Started by May 22, 2000 12:13 PM
6 comments, last by Fresh 24 years, 6 months ago
Hi - I''m quickly developing a simple command line interpreter for my game engine, and all the internal string manipulation and rendering are working fine. However, I need somehow to read the keyboard for whenever a key is pressed and then strcat this to the console''s input buffer. How would I do this quickly with DirectInput? I.E. wait for user input and then quickly retrieve the char from it? Thanx r.
Come on....surely somebody must know the answer??
Advertisement
What you want to do is while you''re using your command line thingie, switch DirectInput to buffered mode. That way you don''t have to store the buffer on your own, and don''t have to check each key to see if it''s down.

Unfortunately, I can''t recall how to do it at the moment, but it''s pretty simple.

Jonathan
If you''re interested, I have a buffered input sample on my web site (well, it''s a program that uses buffered input). It''s at www.crosswinds.net/~uselessknowledge. It''s the "Keybaord Monitor" on the other page.
you could also just use the win32 input stuff, you really don''t need high performance input for typing in text and you''ll be able to take advantage of things like repeating characters when a key is held down.

+AA_970+
Yeh thanx - that''s got that working. Now for a really stupid question; how do I convert ascii codes into chars and vice versa in MSVC?
I''ve looked but haven''t found.
Advertisement
chars are just ascii values. if you have an int with an ascii code, just do c = (char) i; or whatever. Don''t you mean direct input''s keyboard constants though? like DIK_1 etc?
Frank
No - I am using the ascii values after all.
Thanx for that all.

This topic is closed to new replies.

Advertisement