Skip to content

Commit

Permalink
add util to convert numbers for different theme heights
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Dec 12, 2021
1 parent 2f1d766 commit e1cc49c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Themes/Rebirth/Scripts/98 util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ function getHWKeepAspectRatio(h, w, ratio)
return he, we
end

-- find the multiplier to use when converting old coordinates to new theme resolutions
function getThemeHeightRatio(new)
local old = 480 -- most people are used to 480 which is what we always used until now
return new / old
end

-- bias a magic number (height based) based on the difference between the current theme size and the old one
function convertForThemeHeight(x)
return x * getThemeHeightRatio(SCREEN_HEIGHT)
end

-- string split, return a list given a string and a separator between items
function strsplit(given, separator)
if separator == nil then
Expand Down

0 comments on commit e1cc49c

Please sign in to comment.