🔒 Locked
Message Box
Advertisement
Original Post
Im doing an online RPG and i would like to do a message box that recognizes the letters that the player types like if the player types "A" it appears "A" in the box like a chat in-game. I know how to do that with Windows, but outside the game, not in the game. Im very noob at Directx sorry for my question.
What version of DirectX? ID3DXFont is usually a good way of handling this, and using standard window messages for the input (WM_CHAR).
Quote:
Original post by Evil Steve
using standard window messages for the input (WM_CHAR).
Yea, WM_CHAR rocks for things like this. Here is an article explaining why (and how to use it).
thank you!!
this is not working :/
But when i render it to the display it says that App.Keytext is null.
KeyText is public
Thank you for your help
long FAR PASCAL AppWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ cApplication App; switch(uMsg) { case WM_DESTROY: PostQuitMessage(0); return 0; case WM_CHAR: App.KeyText += (char)wParam; //string KeyText break; default: return g_pApplication->MsgProc(hWnd, uMsg, wParam, lParam); }}But when i render it to the display it says that App.Keytext is null.
KeyText is public
cApplication::RenderScene() {...sprintf(Stats, "Text %s", KeyText);m_Stats.Render(Stats);...}Thank you for your help
If KeyText is a std::string, then you should use sprintf(Stats, "Text %s", KeyText.c_str());
Actually, if you're using std::string, you should avoid sprintf completely, and use std::stringstream.
Note: I'm a hypocrite - I use sprintf() all the time [smile]
Actually, if you're using std::string, you should avoid sprintf completely, and use std::stringstream.
Note: I'm a hypocrite - I use sprintf() all the time [smile]
haha :D thanks
ok, now we making some progress, instead of showing null, it shows anything. :(
Shouldn't it be:
g_pApplication->KeyText+=(char)wParam;
Otherwise the local variable string App.KeyText will keep resetting itself each time the function is entered.
Good Luck
g_pApplication->KeyText+=(char)wParam;
Otherwise the local variable string App.KeyText will keep resetting itself each time the function is entered.
Good Luck
ah sure! sorry! thank you!!
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement