Am I on the wrong path? DirectX and input

Started by
2 comments, last by Chad Seibert 16 years, 9 months ago
So I have been trying to learn game programming comming from my mainly C++ background. I started using: C++ DirectX 9 DirectX Input So far I have written a program with: 2d iso map (3 layers) characters than can walk around creatures with basically no AI I got stuck when trying to do inventory and names, because I can't find a simple way to switch from current input (no buffer). To a input that basically resembles a text box. Because of this simple text problem I seem to be questioning everything I have done. Should I have used C++, what about DirectX. Should I start over with XNA? If I continue with direct X should I used DirectX input, or change everything over to windows input? I was off to a great start learning game programming before this happened and I want to continue, but this one problem caused me to quit for about 6 months. Because everytime I come back I get completely stuck I have no idea what to try.
Advertisement
Quote:
Original post by Thors1982
I can't find a simple way to switch from current input (no buffer). To a input that basically resembles a text box.


I don't understand your problem. You're asking how to draw a text box that you can type text into? If so, there are many free GUI libraries for DirectX, and the SDK even includes a GUI sample.

If that's not what you meant, can you give an example?

Regarding what to use for input, most people say that DirectInput should only be used to get input from joysticks and the like. For keyboard and mouse input you should use Windows messages or GetAsyncKeyState() because it's more efficient.
Sure, sorry for the confusion

I really wanted to use the DirectX SDK option that sounded awesome. However it uses all kinds of includes I have no idea where to begin getting that to work with my game.
I think that problem stems from DXut and a unicode build?? Whatever that is.

I also tried this...which seems more complicated than what I need.
http://www.gamedev.net/reference/articles/article994.asp

All I really want is for input to be handled like it is when someone uses WSAD, if they push enter to switch to an input state where someone can type in anything they want. Push enter. Then I can use this string anyway I want, and of course switches the input back.

If it would be easier to use a text box… then I need to know that or if it would be easier to do something else that is fine. Or if its easier to use DXut that sounds/looks great it just confuses the heck out of me. And is rather annoying i got this far and text is what is ruining me :-p

I hope that clears everything up, and thanks for the help
If you have anymore questions feel free.
Quote:
I think that problem stems from DXut and a unicode build?? Whatever that is.


Unicode.

Quote:
All I really want is for input to be handled like it is when someone uses WSAD, if they push enter to switch to an input state where someone can type in anything they want. Push enter. Then I can use this string anyway I want, and of course switches the input back.

If it would be easier to use a text box… then I need to know that or if it would be easier to do something else that is fine. Or if its easier to use DXut that sounds/looks great it just confuses the heck out of me. And is rather annoying i got this far and text is what is ruining me :-p


Depending on how your engine is written, it may be more or less difficult to just capture key inputs, store them into a string, and echo it back using ID3DXFont, or what ever font engine your using. I'm assuming that your using Direct3D. You could set a variable when the user hits enter, then append your string with whatever character are being sent via WM_CHAR. Then when they hit enter again, unset the variable.

Hope this helps,
Chad Seibert

This topic is closed to new replies.

Advertisement