Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Right align #47

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions UltimateMedals.as
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ vec2 anchor = vec2(0, 170);
[Setting category="Display Settings" name="Lock window position" description="Prevents the window moving when click and drag or when the game window changes size."]
bool lockPosition = false;

[Setting category="Display Settings" name="Right-align window" description="Makes it so the right side of the window rather than the left side remains fixed as window size changes."]
bool rightAlign = false;

[Setting category="Display Settings" name="Font face" description="To avoid a memory issue with loading a large number of fonts, you must reload the plugin for font changes to be applied."]
string fontFace = "";

Expand Down Expand Up @@ -230,6 +233,7 @@ UI::Font@ font = null;
uint64 limitMapNameLengthTime = 0;
uint64 limitMapNameLengthTimeEnd = 0;

float windowWidth = 0;

bool held = false;
void OnKeyPress(bool down, VirtualKey key)
Expand Down Expand Up @@ -283,7 +287,7 @@ void Render() {
if(!lockPosition) {
anchor = UI::GetWindowPos();
}

bool hasComment = string(map.MapInfo.Comments).Length > 0;

UI::BeginGroup();
Expand Down Expand Up @@ -437,7 +441,15 @@ void Render() {
UI::PopTextWrapPos();
UI::EndTooltip();
}


float newWidth = UI::GetWindowSize().x;
if (windowWidth != newWidth) {
if(rightAlign && windowWidth != 0) {
UI::SetWindowPos(UI::GetWindowPos() - vec2(newWidth - windowWidth, 0));
}
windowWidth = newWidth;
}

UI::End();

UI::PopFont();
Expand Down