Best way to get text input with DirectX
I am trying to add communication to my game (RPG)
user pushes enter.... program records text typed.... enter again talking over :-)
And, I was just wondering what the best way to do text input is, with directX
The few ideas I have thought about.
Please if there are better please tell me!
1: Use directXinput:
long case statement DIK_A.... DIK_Z :-/
use DirectX font to display
also worried about speed here... wouldn't be difficult though
2: Use directX GUI
DXut? I belive?
I would love to do this but it seems really complicated and I may have to redu a huge portion of my game??? not really sure
I think this is my best option but i have no idea how to start using it. Or if its even a good idea.
3: standard windows pop up with edit controls
wow ugly(standard windows pop up over game is ugly)... but easy
good idea to do now and change later? maybe..... I don't like it though
Have a string that holds the input, then a switch with a case for every character you want to want to allow, and then add that character to the string. Also check for backspace so they can fix bad input.
---EDIT---
Never mind, I didnt notice that you were already considering using the DX GUI. My apologies
Yours Truly
K
Never mind, I didnt notice that you were already considering using the DX GUI. My apologies
Yours Truly
K
Is Vampyre_Dark's suggetsion and #1 really the best solution.
I certainly can do that... it would be very easy. Just seems like bad programming or something....along those lines
I certainly can do that... it would be very easy. Just seems like bad programming or something....along those lines
If you want to use DirectInput you can use buffered mode [NB] never tried switching from buffered state to immediate, can someone comment.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/Buffered_Keyboard_Data.asp
Seeing as DInput is just a wrapper for the message system you could use that, which many people will recommend.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/Buffered_Keyboard_Data.asp
Seeing as DInput is just a wrapper for the message system you could use that, which many people will recommend.
Quote:
If you want to use DirectInput you can use buffered mode [NB] never tried switching from buffered state to immediate, can someone comment.
I tried this once and it worked as far as I could see.
I use example number, with my wrapper class that keeps it's own buffer of the text inputed. But I haven't really explored any other ways.
if you are looking for other solutions, besides using the DX GUI, you can, as you said, use the Windows Popup with an edit control.
Just make sure you owner draw them to match your game look.
Most people forget that its really not that hard to make window's display any kind of look and feel.
If you arent into Win32 very quickly:
Register a new class from the Edit (optional)
declare your own message proc if you registered your class or replace the original with your own
Forward all messages except WM_PAINT to original proc (im not sure if WM_PAINT is enough, you might need WM_NCPAINT (spelling) and a few others).
Process your paint message by drawing yourself into the DC
(if you want to make it easy just stick an image into it)
This is a very quick and simple example.
Yours Truly
K
Just make sure you owner draw them to match your game look.
Most people forget that its really not that hard to make window's display any kind of look and feel.
If you arent into Win32 very quickly:
Register a new class from the Edit (optional)
declare your own message proc if you registered your class or replace the original with your own
Forward all messages except WM_PAINT to original proc (im not sure if WM_PAINT is enough, you might need WM_NCPAINT (spelling) and a few others).
Process your paint message by drawing yourself into the DC
(if you want to make it easy just stick an image into it)
This is a very quick and simple example.
Yours Truly
K
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement