I've been testing a chat system, just trying to get it to where I can enter something, use backspace if I need to, so on.
if (bsdebounce != 0)
{
bsdebounce--;
}
if (chatting)
{
if (dbEntry() != chat)
chat = dbEntry();
if (dbKeyTap(14) && bsdebounce == 0)
{
bsdebounce = 10;
char *temp = chat;
temp[(sizeof(temp)/4)] = '\0';
chat = temp;
}
dbText(0, dbScreenHeight() - 20, chat);
}
This is dbKeyTap()
bool dbKeyTap(int iScancode)
{
static bool bKeyDown[256];
if (!dbKeyState(iScancode))
bKeyDown[iScancode] = false;
if (dbKeyState(iScancode) && !bKeyDown[iScancode])
bKeyDown[iScancode] = true;
else
return false;
return true;
}