X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vg%2Fvg_console.h;fp=vg%2Fvg_console.h;h=0e974f83b0223e2d87f257a0cd41b7357aa81467;hb=79844daac2e6c95698639247b2affcf75fabe5db;hp=612e81552e1465d543decad078d54dcde617f48f;hpb=4528469af4267280885db212dd5c68ee938ebd92;p=fishladder.git diff --git a/vg/vg_console.h b/vg/vg_console.h index 612e815..0e974f8 100644 --- a/vg/vg_console.h +++ b/vg/vg_console.h @@ -121,6 +121,25 @@ void vg_console_println( const char *str ) vg_console.current = 0; } +static int vg_console_list( int argc, char const *argv[] ) +{ + for( int i = 0; i < arrlen( vg_console.functions ); i ++ ) + { + struct vg_cmd *cmd = &vg_console.functions[ i ]; + vg_info( "* %s\n", cmd->name ); + } + + vg_info( "* snowsound\n" ); + + for( int i = 0; i < arrlen( vg_console.convars ); i ++ ) + { + struct vg_convar *cv = &vg_console.convars[ i ]; + vg_info( "%s\n", cv->name ); + } + + return 0; +} + static void vg_console_init(void) { vg_log_callback = vg_console_println; @@ -128,6 +147,11 @@ static void vg_console_init(void) vg_convar_push( (struct vg_convar) { .name = "console_scale", .data = &vg_console.scale, .data_type = k_convar_dtype_i32, .opt_i32 = { .clamp = 1, .min = 1, .max = 7 } } ); + + vg_function_push( (struct vg_cmd){ + .name = "list", + .function = vg_console_list + }); } static void vg_console_free(void) @@ -223,7 +247,7 @@ static void execute_console_input( const char *cmd ) } } - vg_error( "No command/variable named '%s'\n", args[0] ); + vg_error( "No command/variable named '%s'. Use 'list' to view all\n", args[0] ); } // =============================================================================================================================