X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vg_console.h;h=1024b82ac468b0b6e6c08d557e7561e965ffc387;hb=76d234b7dc5e6500e8a54009b367e7620f11ef97;hp=6f3c2bad7128e2650073138a6b8ed97137298101;hpb=11c1052e4f820d3002d2096f931bca70a4f3ef08;p=vg.git diff --git a/vg_console.h b/vg_console.h index 6f3c2ba..1024b82 100644 --- a/vg_console.h +++ b/vg_console.h @@ -73,29 +73,29 @@ struct vg_console{ } static vg_console; -VG_STATIC void _vg_console_draw( void ); +static void _vg_console_draw( void ); void _vg_console_println( const char *str ); -VG_STATIC int _vg_console_list( int argc, char const *argv[] ); -VG_STATIC void _vg_console_init(void); -VG_STATIC void _vg_console_write_persistent(void); -VG_STATIC void _vg_console_free(void); -VG_STATIC void vg_execute_console_input( const char *cmd ); +static int _vg_console_list( int argc, char const *argv[] ); +static void _vg_console_init(void); +static void _vg_console_write_persistent(void); +static void _vg_console_free(void); +static void vg_execute_console_input( const char *cmd ); /* * Console interface */ -VG_STATIC void console_history_get( char* buf, int entry_num ); -VG_STATIC int _vg_console_enabled(void); -VG_STATIC void console_proc_key( SDL_Keysym ev ); +static void console_history_get( char* buf, int entry_num ); +static int _vg_console_enabled(void); +static void console_proc_key( SDL_Keysym ev ); /* * Implementation */ -VG_STATIC int _vg_console_enabled(void){ +static int _vg_console_enabled(void){ return vg_console.enabled; } -VG_STATIC +static void vg_console_reg_var( const char *alias, void *ptr, enum vg_var_dtype type, u32 flags ) { @@ -115,7 +115,7 @@ void vg_console_reg_var( const char *alias, void *ptr, enum vg_var_dtype type, vg_info( "Console variable '%s' registered\n", alias ); } -VG_STATIC +static void vg_console_reg_cmd( const char *alias, int (*function)(int argc, const char *argv[]), void (*poll_suggest)(int argc, const char *argv[]) ) @@ -132,7 +132,7 @@ void vg_console_reg_cmd( const char *alias, vg_info( "Console function '%s' registered\n", alias ); } -VG_STATIC int _vg_console_list( int argc, char const *argv[] ){ +static int _vg_console_list( int argc, char const *argv[] ){ for( int i=0; iname ); @@ -194,19 +194,25 @@ int _ccmd_vg_console_defaults( int argc, const char *argv[] ){ return 0; } -VG_STATIC void _vg_console_init(void){ +static void _vg_console_init(void){ vg_console_reg_cmd( "list", _vg_console_list, NULL ); vg_console_reg_cmd( "crash", _test_break, NULL ); vg_console_reg_cmd( "exec", _vg_console_exec, NULL ); vg_console_reg_cmd( "defaults", _ccmd_vg_console_defaults, NULL ); - vg_console_reg_var( "cheats", &vg_console.cheats, k_var_dtype_i32, 0 ); + vg_console_reg_var( "cheats", &vg_console.cheats, k_var_dtype_i32, +#ifdef VG_DEVWINDOW + VG_VAR_PERSISTENT +#else + 0 +#endif + ); } -VG_STATIC void vg_console_load_autos(void){ +static void vg_console_load_autos(void){ _vg_console_exec( 1, (const char *[]){ "auto.conf" } ); } -VG_STATIC void _vg_console_write_persistent(void){ +static void _vg_console_write_persistent(void){ FILE *fp = fopen( "cfg/auto.conf", "w" ); for( int i=0; iline_height, log_lines = 32; int console_lines = VG_MIN( log_lines, vg_log.log_line_count ); ui_rect rect_log = { 0, 0, vg.window_x, log_lines*fh }, @@ -710,7 +716,8 @@ VG_STATIC void _vg_console_draw(void) .change = _vg_console_on_update, .enter = _vg_console_on_enter }; - ui_textbox( rect_input, vg_console.input, vg_list_size(vg_console.input), + ui_textbox( rect_input, NULL, + vg_console.input, vg_list_size(vg_console.input), 1, UI_TEXTBOX_AUTOFOCUS, &callbacks ); /* @@ -720,9 +727,9 @@ VG_STATIC void _vg_console_draw(void) ui_rect rect_suggest; rect_copy( rect_input, rect_suggest ); - rect_suggest[0] += 6 + UI_GLYPH_SPACING_X*vg_console.suggestion_pastepos; + rect_suggest[0] += 6 + vg_ui.font->spacing*vg_console.suggestion_pastepos; rect_suggest[1] += rect_input[3]; - rect_suggest[2] = UI_GLYPH_SPACING_X * vg_console.suggestion_maxlen; + rect_suggest[2] = vg_ui.font->spacing * vg_console.suggestion_maxlen; rect_suggest[3] = vg_console.suggestion_count * fh; ui_fill( rect_suggest, bg_colour );