Browse Source

game: disable text on buttons by default

pull/112/head
SanyaSho 2 years ago
parent
commit
c41148b9dd
  1. 10
      game/client/touch.cpp

10
game/client/touch.cpp

@ -41,6 +41,8 @@ ConVar touch_grid_count( "touch_grid_count", "50", FCVAR_ARCHIVE, "touch grid co
ConVar touch_grid_enable( "touch_grid_enable", "1", FCVAR_ARCHIVE, "enable touch grid" ); ConVar touch_grid_enable( "touch_grid_enable", "1", FCVAR_ARCHIVE, "enable touch grid" );
ConVar touch_precise_amount( "touch_precise_amount", "0.5", FCVAR_ARCHIVE, "sensitivity multiplier for precise-look" ); ConVar touch_precise_amount( "touch_precise_amount", "0.5", FCVAR_ARCHIVE, "sensitivity multiplier for precise-look" );
ConVar touch_button_info( "touch_button_info", "0", FCVAR_ARCHIVE );
#define boundmax( num, high ) ( (num) < (high) ? (num) : (high) ) #define boundmax( num, high ) ( (num) < (high) ? (num) : (high) )
#define boundmin( num, low ) ( (num) >= (low) ? (num) : (low) ) #define boundmin( num, low ) ( (num) >= (low) ? (num) : (low) )
#define bound( low, num, high ) ( boundmin( boundmax(num, high), low )) #define bound( low, num, high ) ( boundmin( boundmax(num, high), low ))
@ -143,7 +145,7 @@ CON_COMMAND( touch_addbutton, "add native touch button" )
Msg( "Usage: touch_addbutton <name> <texture> <command> [<x1> <y1> <x2> <y2> [ r g b a ] ]\n" ); Msg( "Usage: touch_addbutton <name> <texture> <command> [<x1> <y1> <x2> <y2> [ r g b a ] ]\n" );
} }
CON_COMMAND( touch_removebutton, "add native touch button" ) CON_COMMAND( touch_removebutton, "remove native touch button" )
{ {
if( args.ArgC() > 1 ) if( args.ArgC() > 1 )
gTouch.RemoveButton( args[1] ); gTouch.RemoveButton( args[1] );
@ -151,7 +153,7 @@ CON_COMMAND( touch_removebutton, "add native touch button" )
Msg( "Usage: touch_removebutton <name>\n" ); Msg( "Usage: touch_removebutton <name>\n" );
} }
CON_COMMAND( touch_settexture, "add native touch button" ) CON_COMMAND( touch_settexture, "set button texture" )
{ {
if( args.ArgC() >= 3 ) if( args.ArgC() >= 3 )
{ {
@ -500,12 +502,15 @@ void CTouchControls::Paint( )
} }
if( state == state_edit && !(btn->flags & TOUCH_FL_NOEDIT) ) if( state == state_edit && !(btn->flags & TOUCH_FL_NOEDIT) )
{
if( touch_button_info.GetInt() )
{ {
g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h, 255, 255, 255, 255, "N: %s", btn->name ); // name g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h, 255, 255, 255, 255, "N: %s", btn->name ); // name
g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+10, 255, 255, 255, 255, "T: %s", btn->texturefile ); // texture g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+10, 255, 255, 255, 255, "T: %s", btn->texturefile ); // texture
g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+20, 255, 255, 255, 255, "C: %s", btn->command ); // command g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+20, 255, 255, 255, 255, "C: %s", btn->command ); // command
g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+30, 255, 255, 255, 255, "F: %i", btn->flags ); // flags g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+30, 255, 255, 255, 255, "F: %i", btn->flags ); // flags
g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+40, 255, 255, 255, 255, "RGBA: %d %d %d %d", btn->color.r, btn->color.g, btn->color.b, btn->color.a );// color g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+40, 255, 255, 255, 255, "RGBA: %d %d %d %d", btn->color.r, btn->color.g, btn->color.b, btn->color.a );// color
}
vgui::surface()->DrawSetColor(gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a); // 255, 0, 0, 50 <- default here vgui::surface()->DrawSetColor(gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a); // 255, 0, 0, 50 <- default here
vgui::surface()->DrawFilledRect( btn->x1*screen_w, btn->y1*screen_h, btn->x2*screen_w, btn->y2*screen_h ); vgui::surface()->DrawFilledRect( btn->x1*screen_w, btn->y1*screen_h, btn->x2*screen_w, btn->y2*screen_h );
@ -870,6 +875,7 @@ void CTouchControls::WriteConfig()
filesystem->FPrintf( f, "touch_grid_enable \"%d\"\n", touch_grid_enable.GetInt() ); filesystem->FPrintf( f, "touch_grid_enable \"%d\"\n", touch_grid_enable.GetInt() );
filesystem->FPrintf( f, "touch_setgridcolor \"%d\" \"%d\" \"%d\" \"%d\"\n", gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a ); filesystem->FPrintf( f, "touch_setgridcolor \"%d\" \"%d\" \"%d\" \"%d\"\n", gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a );
filesystem->FPrintf( f, "touch_button_info \"%d\"\n", touch_button_info.GetInt() );
/* /*
filesystem->FPrintf( f, "\n// global overstroke (width, r, g, b, a)\n" ); filesystem->FPrintf( f, "\n// global overstroke (width, r, g, b, a)\n" );
filesystem->FPrintf( f, "touch_set_stroke %d %d %d %d %d\n", touch.swidth, touch.scolor[0], touch.scolor[1], touch.scolor[2], touch.scolor[3] ); filesystem->FPrintf( f, "touch_set_stroke %d %d %d %d %d\n", touch.swidth, touch.scolor[0], touch.scolor[1], touch.scolor[2], touch.scolor[3] );

Loading…
Cancel
Save