Merge pull request #8626 from retrotails/master

add rgui snow
This commit is contained in:
Twinaphex 2019-04-24 01:39:44 +02:00 committed by GitHub
commit 3e15f1b512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 72 additions and 0 deletions

View File

@ -398,6 +398,7 @@ static bool rgui_full_width_layout = true;
static unsigned rgui_aspect = RGUI_ASPECT_RATIO_4_3;
static unsigned rgui_aspect_lock = RGUI_ASPECT_RATIO_LOCK_NONE;
static bool rgui_shadows = false;
static bool rgui_snow = false;
static bool rgui_extended_ascii = false;
#else

View File

@ -1509,6 +1509,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("rgui_border_filler_thickness_enable", &settings->bools.menu_rgui_border_filler_thickness_enable, true, true, false);
SETTING_BOOL("rgui_border_filler_enable", &settings->bools.menu_rgui_border_filler_enable, true, true, false);
SETTING_BOOL("menu_rgui_shadows", &settings->bools.menu_rgui_shadows, true, rgui_shadows, false);
SETTING_BOOL("menu_rgui_snow", &settings->bools.menu_rgui_snow, true, rgui_snow, false);
SETTING_BOOL("menu_rgui_full_width_layout", &settings->bools.menu_rgui_full_width_layout, true, rgui_full_width_layout, false);
SETTING_BOOL("rgui_inline_thumbnails", &settings->bools.menu_rgui_inline_thumbnails, true, rgui_inline_thumbnails, false);
SETTING_BOOL("rgui_swap_thumbnails", &settings->bools.menu_rgui_swap_thumbnails, true, rgui_swap_thumbnails, false);

View File

@ -173,6 +173,7 @@ typedef struct settings
bool menu_rgui_border_filler_enable;
bool menu_rgui_full_width_layout;
bool menu_rgui_shadows;
bool menu_rgui_snow;
bool menu_rgui_inline_thumbnails;
bool menu_rgui_swap_thumbnails;
bool menu_rgui_extended_ascii;

View File

@ -1627,6 +1627,8 @@ MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_FULL_WIDTH_LAYOUT,
"menu_rgui_full_width_layout")
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_SHADOWS,
"menu_rgui_shadows")
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_SNOW,
"menu_rgui_snow")
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_EXTENDED_ASCII,
"rgui_extended_ascii")
MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_REWIND,

View File

@ -6958,6 +6958,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_RGUI_SHADOWS,
"Enable drop shadows for menu text, borders and thumbnails. Has a modest performance impact."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_RGUI_SNOW,
"Snow"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_RGUI_SNOW,
"Enable snow, forces menu to update every frame"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_RGUI_EXTENDED_ASCII,
"Extended ASCII Support"

View File

@ -535,6 +535,7 @@ default_sublabel_macro(action_bind_sublabel_menu_rgui_aspect_ratio_lock,
default_sublabel_macro(action_bind_sublabel_rgui_menu_color_theme, MENU_ENUM_SUBLABEL_RGUI_MENU_COLOR_THEME)
default_sublabel_macro(action_bind_sublabel_rgui_menu_theme_preset, MENU_ENUM_SUBLABEL_RGUI_MENU_THEME_PRESET)
default_sublabel_macro(action_bind_sublabel_menu_rgui_shadows, MENU_ENUM_SUBLABEL_MENU_RGUI_SHADOWS)
default_sublabel_macro(action_bind_sublabel_menu_rgui_snow, MENU_ENUM_SUBLABEL_MENU_RGUI_SNOW)
default_sublabel_macro(action_bind_sublabel_menu_rgui_inline_thumbnails, MENU_ENUM_SUBLABEL_MENU_RGUI_INLINE_THUMBNAILS)
default_sublabel_macro(action_bind_sublabel_menu_rgui_swap_thumbnails, MENU_ENUM_SUBLABEL_MENU_RGUI_SWAP_THUMBNAILS)
default_sublabel_macro(action_bind_sublabel_menu_rgui_thumbnail_downscaler, MENU_ENUM_SUBLABEL_MENU_RGUI_THUMBNAIL_DOWNSCALER)
@ -2451,6 +2452,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_MENU_RGUI_SHADOWS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_rgui_shadows);
break;
case MENU_ENUM_LABEL_MENU_RGUI_SNOW:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_rgui_snow);
break;
case MENU_ENUM_LABEL_MENU_RGUI_INLINE_THUMBNAILS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_rgui_inline_thumbnails);
break;

View File

@ -484,6 +484,7 @@ typedef struct
bool border_thickness;
bool border_enable;
bool shadow_enable;
bool snow_enable;
bool extended_ascii_enable;
float scroll_y;
char *msgbox;
@ -518,6 +519,8 @@ static unsigned mini_thumbnail_max_height = 0;
static bool font_lut[NUM_FONT_GLYPHS_EXTENDED][FONT_WIDTH * FONT_HEIGHT];
float snowflakes[1024];
/* ==============================
* Custom Symbols (glyphs) START
* ============================== */
@ -1553,6 +1556,15 @@ static void rgui_cache_background(rgui_t *rgui)
6, fb_height - 5, fb_width - 10, 1, rgui->colors.shadow_color);
}
}
if (rgui->snow_enable) {
size_t i = 0;
for (i = 0; i < 1024; i += 4) {
snowflakes[i ] = rand()%fb_width;
snowflakes[i + 1] = rand()%fb_height;
snowflakes[i + 2] = (rand()%64 - 16)*.1;
snowflakes[i + 3] = (rand()%64 - 48)*.1;
}
}
}
static void prepare_rgui_colors(rgui_t *rgui, settings_t *settings)
@ -2428,6 +2440,23 @@ static void rgui_render(void *data, bool is_idle)
/* Render background */
rgui_render_background();
/* Snow */
if (rgui->snow_enable && rgui_frame_buf.data) {
for (i = 0; i < 1024; i += 4) {
snowflakes[i + 2] = snowflakes[i + 2] + (rand()%16 - 9)*.01;
snowflakes[i + 3] = snowflakes[i + 3] + (rand()%16 - 7)*.01;
if (snowflakes[i + 2] < -0.4) snowflakes[i + 2] = -0.4;
if (snowflakes[i + 2] > 0.1) snowflakes[i + 2] = 0.1;
if (snowflakes[i + 3] < -0.1) snowflakes[i + 3] = -0.1;
if (snowflakes[i + 3] > 0.4) snowflakes[i + 3] = 0.4;
snowflakes[i ] = fmod(snowflakes[i ] + snowflakes[i + 2], fb_width);
snowflakes[i + 1] = fmod(snowflakes[i + 1] + snowflakes[i + 3], fb_height);
if (snowflakes[i ] < 0) snowflakes[i ] += fb_width;
if (snowflakes[i + 1] < 0) snowflakes[i + 1] += fb_height;
rgui_frame_buf.data[ (int) snowflakes[i+1] * (fb_pitch >> 1) + (int) snowflakes[i]] = rgui->colors.normal_color;
}
}
/* We use a single ticker for all text animations,
* with the following configuration: */
@ -3143,6 +3172,7 @@ static void *rgui_init(void **userdata, bool video_is_threaded)
rgui->border_thickness = settings->bools.menu_rgui_border_filler_thickness_enable;
rgui->border_enable = settings->bools.menu_rgui_border_filler_enable;
rgui->shadow_enable = settings->bools.menu_rgui_shadows;
rgui->snow_enable = settings->bools.menu_rgui_snow;
rgui->extended_ascii_enable = settings->bools.menu_rgui_extended_ascii;
rgui->last_width = rgui_frame_buf.width;
@ -3637,6 +3667,8 @@ static void rgui_frame(void *data, video_frame_info_t *video_info)
{
rgui_t *rgui = (rgui_t*)data;
settings_t *settings = config_get_ptr();
if (rgui->snow_enable)
rgui->force_redraw = true;
if (settings->bools.menu_rgui_background_filler_thickness_enable != rgui->bg_thickness)
{
@ -3669,6 +3701,12 @@ static void rgui_frame(void *data, video_frame_info_t *video_info)
rgui->force_redraw = true;
}
if (settings->bools.menu_rgui_snow != rgui->snow_enable)
{
rgui->snow_enable = settings->bools.menu_rgui_snow;
rgui->bg_modified = true;
}
if (settings->bools.menu_rgui_extended_ascii != rgui->extended_ascii_enable)
{
rgui_set_blit_functions(

View File

@ -4159,6 +4159,7 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct
{MENU_ENUM_LABEL_RGUI_MENU_COLOR_THEME, PARSE_ONLY_UINT},
{MENU_ENUM_LABEL_RGUI_MENU_THEME_PRESET, PARSE_ONLY_PATH},
{MENU_ENUM_LABEL_MENU_RGUI_SHADOWS, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_MENU_RGUI_SNOW, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_DPI_OVERRIDE_ENABLE, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_DPI_OVERRIDE_VALUE, PARSE_ONLY_UINT},
{MENU_ENUM_LABEL_XMB_ALPHA_FACTOR, PARSE_ONLY_UINT},

View File

@ -8599,6 +8599,21 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);
CONFIG_BOOL(
list, list_info,
&settings->bools.menu_rgui_snow,
MENU_ENUM_LABEL_MENU_RGUI_SNOW,
MENU_ENUM_LABEL_VALUE_MENU_RGUI_SNOW,
rgui_snow,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
CONFIG_BOOL(
list, list_info,
&settings->bools.menu_rgui_extended_ascii,

View File

@ -873,6 +873,7 @@ enum msg_hash_enums
MENU_LABEL(MENU_RGUI_ASPECT_RATIO_LOCK),
MENU_LABEL(MENU_RGUI_FULL_WIDTH_LAYOUT),
MENU_LABEL(MENU_RGUI_SHADOWS),
MENU_LABEL(MENU_RGUI_SNOW),
MENU_LABEL(MENU_RGUI_EXTENDED_ASCII),
MENU_LABEL(MENU_LINEAR_FILTER),
MENU_LABEL(MENU_HORIZONTAL_ANIMATION),