mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-27 05:04:01 +08:00
* added 2 new options to the overlay appearance Notification_Margin_x
and Notification_Margin_y
* updated the built-in overlay appearance & the example overlay ini file with a darker look and feel + changed some defaults
This commit is contained in:
parent
b6f0a7f41b
commit
6e4c42410c
@ -8,9 +8,11 @@
|
||||
* fixed a bug where sanitizing paths in the settings parser would remove the colon ':' character,
|
||||
preventing the usage of absolute paths on Windows, like: `C:\aa\bb`
|
||||
* corrected the size of the auth ticket used in `Steam_User::GetAuthTicketForWebApi()`
|
||||
* added 2 new options to the overlay appearance `Notification_Margin_x` and `Notification_Margin_y` which allow specifying a small gap horizontally or vertically for the notifications
|
||||
* added a new switch `-revert` for the tool `migrate_gse`, which allows converting `.ini` files back to `.txt` files,
|
||||
also added some common switches for the help page `/?`, `-?`, etc...
|
||||
note that this option isn't 100% perfect
|
||||
* updated the built-in overlay appearance & the example overlay ini file with a darker look and feel + changed some defaults, inspired by additions of **[schmurger]**
|
||||
|
||||
---
|
||||
|
||||
|
@ -120,38 +120,42 @@ struct Overlay_Appearance {
|
||||
float font_glyph_extra_spacing_x = 1.0f;
|
||||
float font_glyph_extra_spacing_y = 0.0f;
|
||||
|
||||
float notification_r = 0.16f;
|
||||
float notification_g = 0.29f;
|
||||
float notification_b = 0.48f;
|
||||
float notification_r = 0.12f;
|
||||
float notification_g = 0.14f;
|
||||
float notification_b = 0.21f;
|
||||
float notification_a = 1.0f;
|
||||
float notification_rounding = 0.0f; // corners roundness for all notifications
|
||||
uint32 notification_animation = 0; // sliding animation duration (millisec)
|
||||
|
||||
float notification_rounding = 10.0f; // corners roundness for all notifications
|
||||
float notification_margin_x = 5.0f; // horizontal margin
|
||||
float notification_margin_y = 5.0f; // vertical margin
|
||||
|
||||
uint32 notification_animation = 350; // sliding animation duration (millisec)
|
||||
|
||||
std::string ach_unlock_datetime_format = "%Y/%m/%d - %H:%M:%S";
|
||||
|
||||
float background_r = -1.0f;
|
||||
float background_g = -1.0f;
|
||||
float background_b = -1.0f;
|
||||
float background_a = -1.0f;
|
||||
float background_r = 0.12f;
|
||||
float background_g = 0.11f;
|
||||
float background_b = 0.11f;
|
||||
float background_a = 1.0f;
|
||||
|
||||
float element_r = -1.0f;
|
||||
float element_g = -1.0f;
|
||||
float element_b = -1.0f;
|
||||
float element_a = -1.0f;
|
||||
float element_r = 0.30f;
|
||||
float element_g = 0.32f;
|
||||
float element_b = 0.40f;
|
||||
float element_a = 1.0f;
|
||||
|
||||
float element_hovered_r = -1.0f;
|
||||
float element_hovered_g = -1.0f;
|
||||
float element_hovered_b = -1.0f;
|
||||
float element_hovered_a = -1.0f;
|
||||
float element_hovered_r = 0.278f;
|
||||
float element_hovered_g = 0.393f;
|
||||
float element_hovered_b = 0.602f;
|
||||
float element_hovered_a = 1.0f;
|
||||
|
||||
float element_active_r = -1.0f;
|
||||
float element_active_g = -1.0f;
|
||||
float element_active_b = -1.0f;
|
||||
float element_active_a = -1.0f;
|
||||
|
||||
NotificationPosition ach_earned_pos = default_pos; // achievement earned
|
||||
NotificationPosition ach_earned_pos = NotificationPosition::bot_right; // achievement earned
|
||||
NotificationPosition invite_pos = default_pos; // lobby/game invitation
|
||||
NotificationPosition chat_msg_pos = default_pos; // chat message from a friend
|
||||
NotificationPosition chat_msg_pos = NotificationPosition::top_center; // chat message from a friend
|
||||
|
||||
static NotificationPosition translate_notification_position(const std::string &str)
|
||||
{
|
||||
|
@ -256,6 +256,14 @@ static void load_overlay_appearance(class Settings *settings_client, class Setti
|
||||
float nnotification_rounding = std::stof(value, NULL);
|
||||
settings_client->overlay_appearance.notification_rounding = nnotification_rounding;
|
||||
settings_server->overlay_appearance.notification_rounding = nnotification_rounding;
|
||||
} else if (name.compare("Notification_Margin_x") == 0) {
|
||||
float val = std::stof(value, NULL);
|
||||
settings_client->overlay_appearance.notification_margin_x = val;
|
||||
settings_server->overlay_appearance.notification_margin_x = val;
|
||||
} else if (name.compare("Notification_Margin_y") == 0) {
|
||||
float val = std::stof(value, NULL);
|
||||
settings_client->overlay_appearance.notification_margin_y = val;
|
||||
settings_server->overlay_appearance.notification_margin_y = val;
|
||||
} else if (name.compare("Notification_Animation") == 0) {
|
||||
uint32 nnotification_animation = (uint32)(std::stof(value, NULL) * 1000.0f); // convert sec to milli
|
||||
settings_client->overlay_appearance.notification_animation = nnotification_animation;
|
||||
|
@ -95,10 +95,11 @@ struct Overlay_Achievement
|
||||
uint8_t icon_gray_load_trials = ICON_LOAD_MAX_TRIALS;
|
||||
};
|
||||
|
||||
struct NotificationsIndexes
|
||||
// notification coordinates { x, y }
|
||||
struct NotificationsCoords
|
||||
{
|
||||
int top_left = 0, top_center = 0, top_right = 0;
|
||||
int bot_left = 0, bot_center = 0, bot_right = 0;
|
||||
std::pair<float, float> top_left{}, top_center{}, top_right{};
|
||||
std::pair<float, float> bot_left{}, bot_center{}, bot_right{};
|
||||
};
|
||||
|
||||
class Steam_Overlay
|
||||
@ -187,7 +188,7 @@ class Steam_Overlay
|
||||
// Double click on friend
|
||||
void build_friend_window(Friend const& frd, friend_window_state &state);
|
||||
// Notifications like achievements, chat and invitations
|
||||
void set_next_notification_pos(float width, float height, std::chrono::milliseconds elapsed, const Notification ¬i, struct NotificationsIndexes &idx);
|
||||
void set_next_notification_pos(std::pair<float, float> scrn_size, std::chrono::milliseconds elapsed, const Notification ¬i, struct NotificationsCoords &coords);
|
||||
// factor controlling the amount of sliding during the animation, 0 means disabled
|
||||
float animate_factor(std::chrono::milliseconds elapsed);
|
||||
void build_notifications(int width, int height);
|
||||
|
@ -834,9 +834,12 @@ void Steam_Overlay::build_friend_window(Friend const& frd, friend_window_state&
|
||||
}
|
||||
|
||||
// set the position of the next notification
|
||||
void Steam_Overlay::set_next_notification_pos(float width, float height, std::chrono::milliseconds elapsed, const Notification ¬i, struct NotificationsIndexes &idx)
|
||||
void Steam_Overlay::set_next_notification_pos(std::pair<float, float> scrn_size, std::chrono::milliseconds elapsed, const Notification ¬i, struct NotificationsCoords &coords)
|
||||
{
|
||||
const float noti_width = width * Notification::width_percent;
|
||||
const float scrn_width = scrn_size.first;
|
||||
const float scrn_height = scrn_size.second;
|
||||
|
||||
const float noti_width = scrn_width * Notification::width_percent;
|
||||
|
||||
auto &global_style = ImGui::GetStyle();
|
||||
const float padding_all_sides = 2 * (global_style.WindowPadding.y + global_style.WindowPadding.x);
|
||||
@ -878,55 +881,49 @@ void Steam_Overlay::set_next_notification_pos(float width, float height, std::ch
|
||||
// 0 on the y-axis is top, 0 on the x-axis is left
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
float anchor_margin = 5.0f;
|
||||
float margin_y = 0.0f;
|
||||
float animate_size = 0.0f;
|
||||
const float margin_y = settings->overlay_appearance.notification_margin_y;
|
||||
const float margin_x = settings->overlay_appearance.notification_margin_x;
|
||||
|
||||
switch (pos) {
|
||||
// top
|
||||
case Overlay_Appearance::NotificationPosition::top_left:
|
||||
animate_size = animate_factor(elapsed) * noti_width;
|
||||
margin_y = anchor_margin * (idx.top_left + 1);
|
||||
x = anchor_margin - animate_size;
|
||||
y = margin_y + noti_height * idx.top_left;
|
||||
++idx.top_left;
|
||||
x = margin_x - animate_size;
|
||||
y = coords.top_left.second + margin_y;
|
||||
coords.top_left.second = y + noti_height;
|
||||
break;
|
||||
case Overlay_Appearance::NotificationPosition::top_center:
|
||||
animate_size = animate_factor(elapsed) * noti_height;
|
||||
margin_y = anchor_margin * (idx.top_center + 1);
|
||||
x = (width / 2) - (noti_width / 2);
|
||||
y = (margin_y + noti_height * idx.top_center) - animate_size;
|
||||
++idx.top_center;
|
||||
x = (scrn_width / 2) - (noti_width / 2);
|
||||
y = coords.top_center.second + margin_y - animate_size;
|
||||
coords.top_center.second = y + noti_height;
|
||||
break;
|
||||
case Overlay_Appearance::NotificationPosition::top_right:
|
||||
animate_size = animate_factor(elapsed) * noti_width;
|
||||
margin_y = anchor_margin * (idx.top_right + 1);
|
||||
x = (width - noti_width - anchor_margin) + animate_size;
|
||||
y = margin_y * (idx.top_center + 1) + noti_height * idx.top_right;
|
||||
++idx.top_right;
|
||||
x = (scrn_width - noti_width - margin_x) + animate_size;
|
||||
y = coords.top_right.second + margin_y;
|
||||
coords.top_right.second = y + noti_height;
|
||||
break;
|
||||
|
||||
// bot
|
||||
case Overlay_Appearance::NotificationPosition::bot_left:
|
||||
animate_size = animate_factor(elapsed) * noti_width;
|
||||
margin_y = anchor_margin * (idx.bot_left + 1);
|
||||
x = anchor_margin - animate_size;
|
||||
y = height - noti_height * (idx.bot_left + 1) - margin_y;
|
||||
++idx.bot_left;
|
||||
x = margin_x - animate_size;
|
||||
y = scrn_height - coords.bot_left.second - margin_y - noti_height;
|
||||
coords.bot_left.second = scrn_height - y;
|
||||
break;
|
||||
case Overlay_Appearance::NotificationPosition::bot_center:
|
||||
animate_size = animate_factor(elapsed) * noti_height;
|
||||
margin_y = anchor_margin * (idx.bot_center + 1);
|
||||
x = (width / 2) - (noti_width / 2);
|
||||
y = height - noti_height * (idx.bot_center + 1) - margin_y + animate_size;
|
||||
++idx.bot_center;
|
||||
x = (scrn_width / 2) - (noti_width / 2);
|
||||
y = scrn_height - coords.bot_center.second - margin_y - noti_height + animate_size;
|
||||
coords.bot_center.second = scrn_height - y;
|
||||
break;
|
||||
case Overlay_Appearance::NotificationPosition::bot_right:
|
||||
animate_size = animate_factor(elapsed) * noti_width;
|
||||
margin_y = anchor_margin * (idx.bot_right + 1);
|
||||
x = width - noti_width - anchor_margin + animate_size;
|
||||
y = height - noti_height * (idx.bot_right + 1) - margin_y;
|
||||
++idx.bot_right;
|
||||
x = (scrn_width - noti_width - margin_x) + animate_size;
|
||||
y = scrn_height - coords.bot_right.second - margin_y - noti_height;
|
||||
coords.bot_right.second = scrn_height - y;
|
||||
break;
|
||||
|
||||
default: /* satisfy compiler warning */ break;
|
||||
@ -934,7 +931,7 @@ void Steam_Overlay::set_next_notification_pos(float width, float height, std::ch
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2( x, y ));
|
||||
ImGui::SetNextWindowSize(ImVec2(noti_width, noti_height));
|
||||
ImGui::SetNextWindowBgAlpha(0.9f);
|
||||
ImGui::SetNextWindowBgAlpha(0.95f);
|
||||
}
|
||||
|
||||
float Steam_Overlay::animate_factor(std::chrono::milliseconds elapsed)
|
||||
@ -969,11 +966,11 @@ void Steam_Overlay::build_notifications(int width, int height)
|
||||
// Add window rounding
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, settings->overlay_appearance.notification_rounding);
|
||||
|
||||
NotificationsIndexes idx{};
|
||||
NotificationsCoords coords{};
|
||||
for (auto it = notifications.begin(); it != notifications.end(); ++it) {
|
||||
auto elapsed_notif = now - it->start_time;
|
||||
|
||||
set_next_notification_pos(width, height, elapsed_notif, *it, idx);
|
||||
set_next_notification_pos({(float)width, (float)height}, elapsed_notif, *it, coords);
|
||||
|
||||
if ( elapsed_notif < Notification::fade_in) { // still appearing (fading in)
|
||||
float alpha = settings->overlay_appearance.notification_a * (elapsed_notif.count() / static_cast<float>(Notification::fade_in.count()));
|
||||
|
@ -46,13 +46,16 @@ Icon_Size=64.0
|
||||
Font_Glyph_Extra_Spacing_x=1.0
|
||||
Font_Glyph_Extra_Spacing_y=0.0
|
||||
|
||||
Notification_R=0.14
|
||||
Notification_G=0.15
|
||||
Notification_B=0.18
|
||||
Notification_R=0.12
|
||||
Notification_G=0.14
|
||||
Notification_B=0.21
|
||||
Notification_A=1.0
|
||||
|
||||
# notifications corners roundness
|
||||
Notification_Rounding=10.0
|
||||
# horizontal (x) and vertical (y) margins for the notifications
|
||||
Notification_Margin_x=5.0
|
||||
Notification_Margin_y=5.0
|
||||
|
||||
# notification animation in seconds. Set to 0 to disable
|
||||
Notification_Animation=0.35
|
||||
@ -62,26 +65,27 @@ Notification_Animation=0.35
|
||||
# look for the format here: https://en.cppreference.com/w/cpp/chrono/c/strftime
|
||||
Achievement_Unlock_Datetime_Format=%Y/%m/%d - %H:%M:%S
|
||||
|
||||
Background_R=-1.0
|
||||
Background_G=-1.0
|
||||
Background_B=-1.0
|
||||
Background_A=-1.0
|
||||
Background_R=0.12
|
||||
Background_G=0.11
|
||||
Background_B=0.11
|
||||
Background_A=1.0
|
||||
|
||||
Element_R=-1.0
|
||||
Element_G=-1.0
|
||||
Element_B=-1.0
|
||||
Element_A=-1.0
|
||||
Element_R=0.30
|
||||
Element_G=0.32
|
||||
Element_B=0.40
|
||||
Element_A=1.0
|
||||
|
||||
ElementHovered_R=-1.0
|
||||
ElementHovered_G=-1.0
|
||||
ElementHovered_B=-1.0
|
||||
ElementHovered_A=-1.0
|
||||
ElementHovered_R=0.278
|
||||
ElementHovered_G=0.393
|
||||
ElementHovered_B=0.602
|
||||
ElementHovered_A=1.0
|
||||
|
||||
ElementActive_R=-1.0
|
||||
ElementActive_G=-1.0
|
||||
ElementActive_B=-1.0
|
||||
ElementActive_A=-1.0
|
||||
|
||||
# ############################# #
|
||||
# available options:
|
||||
# top_left
|
||||
# top_center
|
||||
@ -91,8 +95,9 @@ ElementActive_A=-1.0
|
||||
# bot_right
|
||||
|
||||
# position of achievements
|
||||
PosAchievement=top_right
|
||||
PosAchievement=bot_right
|
||||
# position of invitations
|
||||
PosInvitation=top_right
|
||||
# position of chat messages
|
||||
PosChatMsg=top_right
|
||||
PosChatMsg=top_center
|
||||
# ############################# #
|
||||
|
Loading…
Reference in New Issue
Block a user