mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-23 11:15:34 +08:00
Added configuration for notification animation duration
This commit is contained in:
parent
6f0eea3a10
commit
2eab708bb6
@ -125,6 +125,7 @@ struct Overlay_Appearance {
|
|||||||
float notification_b = 0.48f;
|
float notification_b = 0.48f;
|
||||||
float notification_a = 1.0f;
|
float notification_a = 1.0f;
|
||||||
float notification_rounding = 0.0f;
|
float notification_rounding = 0.0f;
|
||||||
|
float notification_animation = 0.0f;
|
||||||
std::string ach_unlock_datetime_format = "%Y/%m/%d - %H:%M:%S";
|
std::string ach_unlock_datetime_format = "%Y/%m/%d - %H:%M:%S";
|
||||||
|
|
||||||
float background_r = -1.0f;
|
float background_r = -1.0f;
|
||||||
|
@ -256,6 +256,10 @@ static void load_overlay_appearance(class Settings *settings_client, class Setti
|
|||||||
float nnotification_rounding = std::stof(value, NULL);
|
float nnotification_rounding = std::stof(value, NULL);
|
||||||
settings_client->overlay_appearance.notification_rounding = nnotification_rounding;
|
settings_client->overlay_appearance.notification_rounding = nnotification_rounding;
|
||||||
settings_server->overlay_appearance.notification_rounding = nnotification_rounding;
|
settings_server->overlay_appearance.notification_rounding = nnotification_rounding;
|
||||||
|
} else if (name.compare("Notification_Animation") == 0) {
|
||||||
|
float nnotification_animation = std::stof(value, NULL);
|
||||||
|
settings_client->overlay_appearance.notification_animation = nnotification_animation;
|
||||||
|
settings_server->overlay_appearance.notification_animation = nnotification_animation;
|
||||||
} else if (name.compare("Achievement_Unlock_Datetime_Format") == 0) {
|
} else if (name.compare("Achievement_Unlock_Datetime_Format") == 0) {
|
||||||
settings_client->overlay_appearance.ach_unlock_datetime_format = value;
|
settings_client->overlay_appearance.ach_unlock_datetime_format = value;
|
||||||
settings_server->overlay_appearance.ach_unlock_datetime_format = value;
|
settings_server->overlay_appearance.ach_unlock_datetime_format = value;
|
||||||
|
@ -62,7 +62,6 @@ enum class notification_type
|
|||||||
struct Notification
|
struct Notification
|
||||||
{
|
{
|
||||||
static constexpr float width_percent = 0.25f; // percentage from total width
|
static constexpr float width_percent = 0.25f; // percentage from total width
|
||||||
static constexpr float animation_duration = 500.0f; //animation duration in miliseconds
|
|
||||||
static constexpr std::chrono::milliseconds fade_in = std::chrono::milliseconds(2000);
|
static constexpr std::chrono::milliseconds fade_in = std::chrono::milliseconds(2000);
|
||||||
static constexpr std::chrono::milliseconds fade_out = std::chrono::milliseconds(2000);
|
static constexpr std::chrono::milliseconds fade_out = std::chrono::milliseconds(2000);
|
||||||
static constexpr std::chrono::milliseconds show_time = std::chrono::milliseconds(6000) + fade_in + fade_out;
|
static constexpr std::chrono::milliseconds show_time = std::chrono::milliseconds(6000) + fade_in + fade_out;
|
||||||
|
@ -940,15 +940,19 @@ void Steam_Overlay::set_next_notification_pos(float width, float height, float e
|
|||||||
float Steam_Overlay::animate_factor(float elapsed)
|
float Steam_Overlay::animate_factor(float elapsed)
|
||||||
{
|
{
|
||||||
float factor = 0.0f;
|
float factor = 0.0f;
|
||||||
|
float animation_duration = settings->overlay_appearance.notification_animation * 1000;
|
||||||
PRINT_DEBUG("ELAPSED %f", elapsed);
|
PRINT_DEBUG("ELAPSED %f", elapsed);
|
||||||
if (elapsed < Notification::animation_duration) {
|
|
||||||
factor = 1 - (elapsed / Notification::animation_duration);
|
if (animation_duration > 0) {
|
||||||
|
if (elapsed < animation_duration) {
|
||||||
|
factor = 1 - (elapsed / animation_duration);
|
||||||
PRINT_DEBUG("SHOW FACTOR %f", factor);
|
PRINT_DEBUG("SHOW FACTOR %f", factor);
|
||||||
}
|
}
|
||||||
else if (elapsed > Notification::show_time.count() - Notification::animation_duration) {
|
else if (elapsed > Notification::show_time.count() - animation_duration) {
|
||||||
factor = 1 - (Notification::show_time.count() - elapsed) / Notification::animation_duration;
|
factor = 1 - (Notification::show_time.count() - elapsed) / animation_duration;
|
||||||
PRINT_DEBUG("HIDE FACTOR %f", factor);
|
PRINT_DEBUG("HIDE FACTOR %f", factor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return factor;
|
return factor;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,9 @@ Notification_A=1.0
|
|||||||
# notification rounded corners
|
# notification rounded corners
|
||||||
Notification_Rounding=10.0
|
Notification_Rounding=10.0
|
||||||
|
|
||||||
|
# notification animation in seconds
|
||||||
|
Notification_Animation=0.5
|
||||||
|
|
||||||
# format for the achievement unlock date/time, limited to 79 characters
|
# format for the achievement unlock date/time, limited to 79 characters
|
||||||
# if the output formatted string exceeded this limit, the builtin format will be used
|
# if the output formatted string exceeded this limit, the builtin format will be used
|
||||||
# look for the format here: https://en.cppreference.com/w/cpp/chrono/c/strftime
|
# look for the format here: https://en.cppreference.com/w/cpp/chrono/c/strftime
|
||||||
|
Loading…
Reference in New Issue
Block a user