Text input in Allegro. (FIXED, NOW LOOKING FOR TESTERS)
I used Allegro pthreads and Winsock to create a little multi-player tank game.
In this game I want the players to be able to chat with each other, and this means that they must be able to type things in a little box (like a console) and press the enter key to send it.
I was setting it up so it would wait for a key press. If it is backspace it will remove a character from the buffer, if it is enter it will send the buffer to a function that will assemble and send the message to the server, and if it is anything else it will add it to the buffer. This doesnt work though, when i try to enter the letter "h" it says on the line "h-d=^^f", its just the letter followed by some symbols.
I was just wondering if there is something that I could use to accept text input.
Also I was also wondering, should I use charactor arrays to hold strings (char mystring[100];), or string(string mystring)? I have seen this done both ways.
[Edited by - TheBunny on October 28, 2004 6:03:54 PM]
I'm not familar with Allegro specifically, but that looks like you're not clearing the string when you initialize it.
Like there's just random garbage in there.
Like there's just random garbage in there.
Sounds like the buffer isn't null terminated. Add a 0 (not a '0') to the position after the new character. That should fix it.
I always clear the string after i initialize it.
Ill try to add the 0, that might work.
Ill try to add the 0, that might work.
I knew alot of people would want to do that, just couldn't find a tutorial.
I actually did almost EXACTLY what they did in the tutorial, but I also made sure that the keypress was not an arrow key for movement.
The game is done now. You can download it at : http://www.rotbgame.com/downloads/tanks_0.9.1_.exe
I want to see if i can get a few people to test this. If you want to join in the test post here and I will send you the IP address of the server.
I actually did almost EXACTLY what they did in the tutorial, but I also made sure that the keypress was not an arrow key for movement.
The game is done now. You can download it at : http://www.rotbgame.com/downloads/tanks_0.9.1_.exe
I want to see if i can get a few people to test this. If you want to join in the test post here and I will send you the IP address of the server.
I have done a bit of testing with some other people.
Dont bother downloading yet, I just found some bugs and im going to get a patch ready.
If you want you can still download and check it out (i have the server in the installer too).
Dont bother downloading yet, I just found some bugs and im going to get a patch ready.
If you want you can still download and check it out (i have the server in the installer too).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement