Jump to content
  • Advertisement


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



This topic is 5765 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
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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!