void fncModifyString ( STRING *str )
{
char key[2];
key[0] = NULL;
key[1] = NULL;
while ( 1 )
{
var nKey = inchar ( NULL );
if ( nKey == 8 )
{
if ( !key[0] )
{
str_cpy ( str, "" );
txtCursor->pos_x = panHscores->pos_x + MC_HIGHSCORE_BORDER_SIZE_X;
}
else
{
str_trunc ( str, 1 );
txtCursor->pos_x = panHscores->pos_x + MC_HIGHSCORE_BORDER_SIZE_X + str_width ( str, fntHscores );
int count = str_len ( str );
while ( str_getchr ( str, count ) == 32 )
{
count -= 1;
txtCursor->pos_x += str_width ( "t", fntHscores );
}
}
}
else if ( nKey == 13 )
{
if ( str_len ( str ) == 0 )
str_cpy ( str, MC_HIGHSCORE_NAME );
break;
}
else if ( nKey == 27 )
{
str_cpy ( str, MC_HIGHSCORE_NAME );
break;
}
else if ( str_len ( str ) > MC_HIGHSCORE_MAX_CHARS )
{
continue;
}
else if ( nKey < 32 )
{
continue;
}
else
{
if ( !key[0] )
{
str_cpy ( str, "" );
txtCursor->pos_x = panHscores->pos_x + MC_HIGHSCORE_BORDER_SIZE_X;
}
key[0] = nKey;
str_cat ( str, key );
if ( nKey == 32 )
txtCursor->pos_x += str_width ( "t", fntHscores );
else
txtCursor->pos_x += str_width ( key, fntHscores );
}
}
}