Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Need help with keyboard!!

Author
Message
Digital Scribe
19
Years of Service
User Offline
Joined: 16th Sep 2005
Location:
Posted: 19th Dec 2005 03:22
When I was making my first game I needed to get the player's initials for the high score board. But when I went to code that part of the program I had trouble figuring out how to get only 3 characters. Eventially I ended up coding a rather messy function that used keyboard scancodes to get a max of 3 characters from the keyboard. Is there a an easier way to get text input with length limitations?
Dark Lord
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location: Australia
Posted: 21st Dec 2005 06:40
This piece of code I made copies the first 3 characters of the string ‘a’ into the string ‘b’ using the strncpy() function found in the string header file which you can include like this: #include <string>.

Digital Scribe
19
Years of Service
User Offline
Joined: 16th Sep 2005
Location:
Posted: 4th Jan 2006 19:54
That looks good, but the trouble wasn't keeping the amount of characters in memory down. I need to be able to keep the amount of characters seen on the screen to a certain amount for graphical reasons.

Login to post a reply

Server time is: 2024-11-19 03:43:53
Your offset time is: 2024-11-19 03:43:53