Limit edit boxes input till numbers only (fine as this is for Rocket only but shouldn't be in regular emgui (needs flag))

This commit is contained in:
Daniel Collin 2013-01-07 17:47:38 +01:00
parent a51a821fde
commit 9e355122a5

View File

@ -1024,9 +1024,15 @@ void Emgui_editBoxXY(int x, int y, int width, int height, int bufferLength, char
default :
{
// Rocket hack:
// Currenty for rocket we only need 0-9 as input (for the edit field
// so we only update here if those are the keys
int offset = emini(bufferLength - 2, len);
buffer[offset + 0] = (char)keyCode;
buffer[offset + 1] = 0;
if (keyCode >= '0' && keyCode <= '9')
{
buffer[offset + 0] = (char)keyCode;
buffer[offset + 1] = 0;
}
break;
}
}