Skip to content

Conversation

@3lack5ky
Copy link
Contributor

The scale value accepts a string now, but is also fully compatible with any normal theme. If a string is entered it calculates the scale when the reset button is pressed. The scale can be adjusted by changing the scale value as a string.

Example for scale "1.0":

Y size = scale in menu
1600 = 1.110
1440 = 0.999
1200 = 0.833
1080 = 0.750

Example for Scale "0.9":

Y size = scale in menu
1600 = 0.999
1440 = 0.899
1200 = 0.749
1080 = 0.675

I also uploaded some _AutoScale themes on my fork of the RocketStats_themes as examples for testing.

Added ability to scale the theme automatically to the display_size.y. If theme has number as scale nothing changes, if theme has string as scale e.g. "1.0" scale will automatically be changed and can be adjusted by changing the number. For Scale = "1.0":

Y size = automatic scale setting.
 1080 = 0.700 
 1200 = 0.769
 1440 = 0.907
 1600 = 1.000
 2400 = 1.461
Adjusted Values.
Example for scale "1.0":

Y size = scale in menu
 1600 = 1.110
 1440 = 0.999
 1200 = 0.833
 1080 = 0.750


Example for Scale "0.9":

Y size = scale in menu
 1600 = 0.999
 1440 = 0.899
 1200 = 0.749
 1080 = 0.675
@Lyliya
Copy link
Owner

Lyliya commented Feb 11, 2025

Hey @3lack5ky, thanks for your contribution

Can you explain how you get the value for the expression std::stof(std::string(theme_config["scale"])) * (0.500 + (display_size.y - 720) / 880 * 0.61); ?

@3lack5ky
Copy link
Contributor Author

Hey Lyliya,

I took a theme as an example (Marker by Arubinu42), I changed the resolution to 2560x1600 and adjusted the scale manually to fit the theme perfectly to the clock. I noted down the Y value (1600) and the scale value (1.110). Then I changed the resolution to a very small one 1280x720 and adjusted the theme to fit there perfectly. Then I also noted down the Y value (720) and the scale value (0.500). Then I did some math:

The formula for linear interpolation between two points (x1,y1) and (x2,y2):
y = y1 + (x - x1) * (y2 - y1) / (x2 - x1)

Substituting the values:
(Scale in game) = (Scale from example config) * (0.500 + ((screen Y size) - 720) * (1.11 - 0.500) / (1600 - 720))

Simplyfied the formula:
(Scale in game) = (Scale from example config) * (0.500 + ((screen Y size) - 720) / 880 * 0.61)

And finally with the variables from the code:
rs_scale = std::stof(std::string(theme_config["scale"])) * (0.500 + (display_size.y - 720) / 880 * 0.61);

@Lyliya
Copy link
Owner

Lyliya commented Feb 13, 2025

@3lack5ky This make sense

I will try to check this soon, but it may be a good idea to apply this to all theme 🤔

@3lack5ky
Copy link
Contributor Author

Yeah all themes could be changed to do auto scale. But we would have to determine the intended base scale for each one. On some like „Marker“ that’s pretty easy, but on some it‘s not so obvious, what is the intended scale by the author. But that would also not be a big deal, since the user can always change the scale manually, if he prefers to have a different scale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants