+}
+
+/*
+ * Cat mouse button string. special_glyphs include SR glyphs
+ */
+static void vg_mouse_button_string( vg_str *str, u32 button,
+ int special_glyphs ){
+ if ( button == SDL_BUTTON_LEFT )
+ vg_strcat( str, special_glyphs? "\x99": "left mouse" );
+ else if( button == SDL_BUTTON_RIGHT )
+ vg_strcat( str, special_glyphs? "\x9a": "right mouse" );
+ else if( button == SDL_BUTTON_MIDDLE )
+ vg_strcat( str, special_glyphs? "\x9c": "middle mouse" );
+ else{
+ vg_strcat( str, "mouse button #" );
+ vg_strcati32( str, button );
+ }
+}
+
+/*
+ * Cat string represeinting single axis
+ */
+static void vg_joy_axis_string( vg_str *str,
+ SDL_GameControllerAxis axis, int special_glyphs ){
+ if( axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT )
+ vg_strcat( str, special_glyphs?"\x8f":"left trigger" );
+ else if( axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT )
+ vg_strcat( str, special_glyphs?"\x90":"right trigger" );
+ else if( axis == SDL_CONTROLLER_AXIS_LEFTX )
+ vg_strcat( str, special_glyphs?"\x88":"left stick horizontal" );
+ else if( axis == SDL_CONTROLLER_AXIS_LEFTY )
+ vg_strcat( str, special_glyphs?"\x89":"left stick vertical" );
+ else if( axis == SDL_CONTROLLER_AXIS_RIGHTX )
+ vg_strcat( str, special_glyphs?"\x8c":"right stick horizontal" );
+ else if( axis == SDL_CONTROLLER_AXIS_RIGHTY )
+ vg_strcat( str, special_glyphs?"\x8d":"right stick vertical" );
+ else{
+ vg_strcat( str, "axis " );
+ vg_strcati32( str, axis );
+ }
+}
+
+/*
+ * Cat string represeinting whole joystick
+ */
+static void vg_joy_string( vg_str *str, vg_input_op op, int special_glyphs ){
+ if( op == vg_joy_ls )
+ vg_strcat( str, special_glyphs? "\x87": "left stick" );
+ else
+ vg_strcat( str, special_glyphs? "\x8b": "right stick" );
+}
+
+/*
+ * Convert an input program into a readable string
+ */
+static void vg_input_string( vg_str *str, vg_input_op *ops, int glyphs ){
+ u32 pc = 0;
+ int applicable = 0, visible = 1;
+
+next_code:;
+ vg_input_op op = ops[ pc ++ ];
+
+ if( (op == vg_keyboard) || (op == vg_mouse) ){
+ if( (vg_input.display_input_method == k_input_method_kbm) && visible ){
+ applicable = 1;
+
+ if( op == vg_keyboard )
+ vg_keyboard_key_string( str, ops[pc], glyphs );
+ else
+ vg_mouse_button_string( str, ops[pc], glyphs );
+ }
+ else applicable = 0;
+ pc ++;
+ }
+ else if( (op == vg_joy_button) || (op == vg_joy_axis) ){
+ if( (vg_input.display_input_method == k_input_method_controller)
+ && visible ){
+ applicable = 1;
+
+ if( op == vg_joy_button )
+ vg_strcat( str, controller_button_str(ops[pc]) );
+ else
+ vg_joy_axis_string( str, ops[pc], glyphs );
+ }
+ else applicable = 0;
+ pc ++;
+ }
+ else if( (op == vg_joy_ls) || (op == vg_joy_rs) ){
+ if( (vg_input.display_input_method == k_input_method_controller)
+ && visible ){
+ applicable = 1;
+ vg_joy_string( str, op, glyphs );
+ }
+ else applicable = 0;
+ }
+ else if( op == vg_mode_mul ){
+ if( applicable && visible )
+ vg_strcat( str, " + " );
+ }
+ else if( op == vg_index )
+ pc ++;
+ else if( op == vg_gui_visible )
+ visible = ops[pc++];
+ else if( op == vg_end )
+ return;