Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

input

This topic is 5582 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hy! how can i get whole text-lines from the user and print it the same time to the screen and put the whole "line" in a string/... thx for help! i know one possibility to do that. by printing every key a bit more right and using strcat/... but i don´t think that source would be nice to read. anyone got better ideas? thx -------- ts0

Share this post


Link to post
Share on other sites
Advertisement
i would put this in WndProc, under WM_KEYDOWN.
you have wParam that is the key being pressed.
you can distinguish two cases:
1) you want to put in some cheats (i.e. non-terminated char sequence)
you should declare a char vector, shift every character to the left, and put at the end of the vector the pressed character, and then compare to whatever you want, starting from the end of the vector
2) you want a chat system (return key terminated string)
declare the char vector, and a counter.
each key pressed, store it in char[counter], increment the counter, until return is hit; then null-terminate the string, assign counter=0, and send the string to whatever function you want

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!