Browse Source

engine: client: add barebones gamepad controls to input fields

pull/2/head
fgsfds 3 years ago committed by Alibek Omarov
parent
commit
d944301a60
  1. 12
      engine/client/console.c

12
engine/client/console.c

@ -1230,7 +1230,7 @@ void Field_KeyDownEvent( field_t *edit, int key )
return; return;
} }
if( key == K_BACKSPACE ) if( key == K_BACKSPACE || key == K_B_BUTTON )
{ {
if( edit->cursor > 0 ) if( edit->cursor > 0 )
{ {
@ -1242,7 +1242,7 @@ void Field_KeyDownEvent( field_t *edit, int key )
return; return;
} }
if( key == K_RIGHTARROW ) if( key == K_RIGHTARROW || key == K_DPAD_RIGHT )
{ {
if( edit->cursor < len ) edit->cursor = Con_UtfMoveRight( edit->buffer, edit->cursor, edit->widthInChars ); if( edit->cursor < len ) edit->cursor = Con_UtfMoveRight( edit->buffer, edit->cursor, edit->widthInChars );
if( edit->cursor >= edit->scroll + edit->widthInChars && edit->cursor <= len ) if( edit->cursor >= edit->scroll + edit->widthInChars && edit->cursor <= len )
@ -1250,7 +1250,7 @@ void Field_KeyDownEvent( field_t *edit, int key )
return; return;
} }
if( key == K_LEFTARROW ) if( key == K_LEFTARROW || key == K_DPAD_LEFT )
{ {
if( edit->cursor > 0 ) edit->cursor = Con_UtfMoveLeft( edit->buffer, edit->cursor ); if( edit->cursor > 0 ) edit->cursor = Con_UtfMoveLeft( edit->buffer, edit->cursor );
if( edit->cursor < edit->scroll ) edit->scroll--; if( edit->cursor < edit->scroll ) edit->scroll--;
@ -1547,8 +1547,8 @@ void Key_Console( int key )
return; return;
} }
// enter finishes the line // enter or A finish the line
if( key == K_ENTER || key == K_KP_ENTER ) if( key == K_ENTER || key == K_KP_ENTER || key == K_A_BUTTON )
{ {
// backslash text are commands, else chat // backslash text are commands, else chat
if( con.input.buffer[0] == '\\' || con.input.buffer[0] == '/' ) if( con.input.buffer[0] == '\\' || con.input.buffer[0] == '/' )
@ -1575,7 +1575,7 @@ void Key_Console( int key )
} }
// command completion // command completion
if( key == K_TAB ) if( key == K_TAB || key == K_X_BUTTON )
{ {
Con_CompleteCommand( &con.input ); Con_CompleteCommand( &con.input );
Con_Bottom(); Con_Bottom();

Loading…
Cancel
Save