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 (); }
void TileViewer_Layout(t_app_tile_viewer *app, bool setup) { al_set_target_bitmap(app->box->gfx_buffer); al_clear_to_color(COLOR_SKIN_WINDOW_BACKGROUND); if (setup) { // Add closebox widget widget_closebox_add(app->box, (t_widget_callback)TileViewer_Switch); // Create invisible buttons for hovering/selecting palette app->tiles_display_zone = widget_button_add(app->box, &app->tiles_display_frame, 1, TileViewer_SelectedTile_Select, FONTID_NONE, NULL); widget_button_add(app->box, &app->tiles_display_frame, 2, (t_widget_callback)TileViewer_Change_Palette, FONTID_NONE, NULL); } if (setup) { t_frame frame; frame.SetPos(100, 2); frame.SetSize(4*6, 7); static const int step_count = 4; app->vram_addr_tms9918_scrollbar = widget_scrollbar_add(app->box, WIDGET_SCROLLBAR_TYPE_HORIZONTAL, &frame, &step_count, &app->vram_addr_tms9918_current, 1, NULL); } // Separators al_draw_line(0, app->tiles_display_frame.pos.y-1+0.5f, app->tiles_display_frame.size.x, app->tiles_display_frame.pos.y-1+0.5f, COLOR_SKIN_WINDOW_SEPARATORS, 0); al_draw_line(0, 13+app->tiles_display_frame.size.y+0.5f, app->tiles_display_frame.size.x, 13+app->tiles_display_frame.size.y+0.5f, COLOR_SKIN_WINDOW_SEPARATORS, 0); // Rectangle enclosing current/selected tile const t_frame* fr = &app->tile_selected_frame; gui_rect(LOOK_THIN, fr->pos.x, fr->pos.y, fr->pos.x + 11, fr->pos.y + 11, COLOR_SKIN_WIDGET_GENERIC_BORDER); }
static void AboutBox_Layout(bool setup) { t_app_about_box *app = &AboutBox; // Global instance const int dragon_h = al_get_bitmap_height(Graphics.Misc.Dragon); al_set_target_bitmap(app->box->gfx_buffer); al_clear_to_color(COLOR_SKIN_WINDOW_BACKGROUND); if (setup) widget_closebox_add(app->box, (t_widget_callback)AboutBox_Switch); // Draw MEKA dragon sprite al_draw_bitmap(Graphics.Misc.Dragon, 16, (app->box->frame.size.y - dragon_h) / 2, 0); // Print about information lines { int y = 12; Font_SetCurrent((t_font_id)g_config.font_about); for (int i = 0; i < 4; i ++) { char buffer[256]; switch (i) { case 0: snprintf(buffer, countof(buffer), Msg_Get(MSG_About_Line_Meka_Date), MEKA_NAME_VERSION, MEKA_DATE); break; case 1: snprintf(buffer, countof(buffer), Msg_Get(MSG_About_Line_Authors), MEKA_AUTHORS_SHORT); break; case 2: snprintf(buffer, countof(buffer), Msg_Get(MSG_About_Line_Homepage), MEKA_HOMEPAGE); break; case 3: snprintf(buffer, countof(buffer), "Built %s, %s", MEKA_BUILD_DATE, MEKA_BUILD_TIME); break; } const int x = (( (app->box->frame.size.x - dragon_h - 18 - 6) - Font_TextWidth(FONTID_CUR, buffer) ) / 2) + dragon_h + 8 + 6; Font_Print(FONTID_CUR, buffer, x, y, COLOR_SKIN_WINDOW_TEXT); y += Font_Height() + 3; } } }
static void TB_Message_Layout(t_app_messages *app, bool setup) { al_set_target_bitmap(app->box->gfx_buffer); al_clear_to_color(COLOR_SKIN_WINDOW_BACKGROUND); // Add closebox widget if (setup) widget_closebox_add(app->box, (t_widget_callback)TB_Message_Switch); // Create textbox widget t_frame frame; frame.pos.x = 4; frame.pos.y = 2; frame.size.x = app->box->frame.size.x - (4*2); frame.size.y = app->box->frame.size.y - (2*2); if (setup) app->widget_textbox = widget_textbox_add(app->box, &frame, (t_font_id)g_configuration.font_messages); else app->widget_textbox->frame = frame; }
static void TechInfo_Layout(t_app_tech_info *app, bool setup) { // Clear clear_to_color(app->box->gfx_buffer, COLOR_SKIN_WINDOW_BACKGROUND); if (setup) { // Add closebox widget widget_closebox_add(app->box, TechInfo_Switch); // Easter Egg: BreakOut { t_frame frame; frame.pos.x = app->box->frame.size.x - 50; frame.pos.y = 30; frame.size.x = app->box->frame.size.x - 38; frame.size.y = 40; widget_button_add(app->box, &frame, 1, BreakOut_Start, WIDGET_BUTTON_STYLE_INVISIBLE, NULL); } } }
static void Options_Layout(t_app_options* app, bool setup) { app->font_id = (t_font_id)g_configuration.font_options; t_frame frame; al_set_target_bitmap(app->box->gfx_buffer); al_clear_to_color(COLOR_SKIN_WINDOW_BACKGROUND); if (setup) { // Add closebox widget widget_closebox_add(Options.box, (t_widget_callback)Options_Switch); // Add close button frame.size.x = Font_TextWidth(app->font_id, Msg_Get(MSG_Options_Close))+15; frame.size.y = Font_Height(app->font_id)*2; frame.pos.x = Options.box->frame.size.x - frame.size.x - OPTIONS_PAD_X; frame.pos.y = Options.box->frame.size.y - frame.size.y - OPTIONS_PAD_Y; widget_button_add(Options.box, &frame, 1, (t_widget_callback)Options_Switch, app->font_id, Msg_Get(MSG_Options_Close)); } // Draw option lines frame.pos.x = Font_Height(app->font_id)-2; frame.pos.y = OPTIONS_PAD_Y; frame.size.x = Font_Height(app->font_id); frame.size.y = Font_Height(app->font_id); Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_BIOS_Enable), &g_configuration.enable_BIOS, NULL); Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_DB_Display), &g_configuration.fb_uses_DB, Option_Switch_Uses_VLFN); Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_Product_Number), &g_configuration.show_product_number, NULL); //Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_Bright_Palette), &g_configuration.palette_type, Palette_Emu_Reload); Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_Allow_Opposite_Directions), &g_configuration.allow_opposite_directions, NULL); Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_Load_Close), &g_configuration.fb_close_after_load, NULL); Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_Load_FullScreen), &g_configuration.fullscreen_after_load, NULL); Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_FullScreen_Messages), &g_configuration.show_fullscreen_messages, NULL); Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_GUI_VSync), &g_configuration.video_mode_gui_vsync, NULL); Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_Capture_Crop_Align), &g_configuration.capture_crop_align_8x8, NULL); Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_NES_Enable), &g_configuration.enable_NES, Option_Switch_NES_Crap); }