static void Inputs_CFG_Layout(t_app_inputs_config *app, bool setup) { t_frame frame; // Clear clear_to_color(app->box->gfx_buffer, COLOR_SKIN_WINDOW_BACKGROUND); if (setup) { // Add closebox widget widget_closebox_add(app->box, Inputs_CFG_Switch); // Peripheral change button frame.pos.x = 10; frame.pos.y = 18; frame.size.x = Graphics.Inputs.InputsBase->w; frame.size.y = 80-2; widget_button_add(app->box, &frame, 1, Inputs_CFG_Peripheral_Change_Handler, WIDGET_BUTTON_STYLE_INVISIBLE, NULL); // Input source change button frame.pos.x = 170; frame.pos.y = 10-Font_Height(F_MIDDLE)/2; frame.size.x = INPUTS_CFG_FRAME_X - 5; frame.size.y = Font_Height(F_MIDDLE); widget_button_add(app->box, &frame, 1|2, Inputs_CFG_Current_Source_Change, WIDGET_BUTTON_STYLE_INVISIBLE, NULL); // Input map change button frame.pos.x = 170 /* + (INPUTS_CFG_FRAME_X / 2)*/; frame.pos.y = 48; frame.size.x = (INPUTS_CFG_FRAME_X /* / 2 */) - 10; frame.size.y = INPUT_MAP_MAX * (Font_Height(F_SMALL) + GUI_LOOK_LINES_SPACING_Y); widget_button_add(app->box, &frame, 1, Inputs_CFG_Map_Change_Handler, WIDGET_BUTTON_STYLE_INVISIBLE, NULL); // 'Enabled' checkbox frame.pos.x = 170; frame.pos.y = 19; frame.size.x = INPUTS_CFG_CHECK_X; frame.size.y = INPUTS_CFG_CHECK_Y; app->CheckBox_Enabled = widget_checkbox_add(app->box, &frame, &Inputs.Sources [app->Current_Source]->enabled, NULL); // Emulate Digital check need to be added before drawing source // because currently it is drawn on the box before having the chance // to be disabled... so anyway drawing source will clear it. frame.pos.x = 170; frame.pos.y = 19 + (7 * 2) + (2 + 6) * (Font_Height(F_SMALL) + GUI_LOOK_LINES_SPACING_Y); frame.size.x = INPUTS_CFG_CHECK_X; frame.size.y = INPUTS_CFG_CHECK_Y; app->CheckBox_Emulate_Digital = widget_checkbox_add(app->box, &frame, &app->CheckBox_Emulate_Digital_Value, Inputs_CFG_Emulate_Digital_Handler); widget_disable(app->CheckBox_Emulate_Digital); } // Draw input base draw_sprite(app->box->gfx_buffer, Graphics.Inputs.InputsBase, 10, 34); // Draw current peripheral Inputs_CFG_Peripherals_Draw(); // Draw current input source Inputs_CFG_Current_Source_Draw (); }
static void Options_Layout_AddLine(t_app_options* app, bool setup, t_frame *frame, const char *text, bool *v, void (*func)()) { frame->pos.x = OPTIONS_PAD_X; if (setup) widget_checkbox_add(Options.box, frame, v, (t_widget_callback)func); // FIXME: Cast frame->pos.x += frame->size.x + Font_TextWidth(app->font_id, " "); Font_Print(app->font_id, text, frame->pos.x, frame->pos.y+2, COLOR_SKIN_WINDOW_TEXT); frame->pos.y += (int)(Font_Height(app->font_id) * 1.3f); }