I can't figure this one out:
The grave key ( ^ ) is used to open up the console in my game. Now if the user starts typing, the first letter is the grave, because when you press grave windows waits until you press another key and then puts down the grave symbol (if it can't make the second letter into an exponent, I believe).
So the first letter in the console input is ALWAYS ^. It's really annoying. I tried truncing it somehow, tried clipping it... doesn't seem to allow that.
void consoleDeleteGrave(STRING* activeStr)
{
var length = str_len(activeStr);
while(!inkey_active) wait(1);
while(inkey_active)
{
if(str_len(activeStr) != length)
{
errorNum(str_len(activeStr));
errorNum(length);
if(str_stri(consoleInputString, "^") == 1) str_clip(consoleInputString, 1);
return;
}
wait(1);
}
}
Now I tried inkey. But Inkey is almost worse: When you press the first letter (since it can only read one char) when trying to input a command, it only reads "^" (no second letter) because windows seems to give it the two letters - ^ and the one you've typed - and it only accepts the first one.
Also, I can't get backspace to work correctly with inchar.
Really stupid... if you want to enter a quick command in the heat of battle... none of this is user friendly.
Help?