diff --git a/Themes/_fallback/Scripts/03 ProductivityHelpers.lua b/Themes/_fallback/Scripts/03 ProductivityHelpers.lua index 2fb7c704b9..d8a719a7dc 100644 --- a/Themes/_fallback/Scripts/03 ProductivityHelpers.lua +++ b/Themes/_fallback/Scripts/03 ProductivityHelpers.lua @@ -24,18 +24,49 @@ Health = { } -- Make graphics their true size at any resolution. +--[[ + Note: for screens taller than wide (i.e. phones, sideways displays), + you'll need to get width rather than height (I just don't feel like + uglyfying my code just to handle rare cases). -shake +--]] + function Actor:Real() -- normal local theme = THEME:GetMetric("Common","ScreenHeight") local res = PREFSMAN:GetPreference("DisplayHeight") - + -- scale back down to real pixels. self:basezoom(theme/res) - + -- don't make this ugly self:SetTextureFiltering(false) end +-- Scale things back up after they have already been scaled down. +function Actor:RealInverse() + -- normal + local theme = THEME:GetMetric("Common","ScreenHeight") + local res = PREFSMAN:GetPreference("DisplayHeight") + + -- scale back up to theme resolution + self:basezoom(res/theme) + + self:SetTextureFiltering(true) +end + +-- useful +function GetReal() + local theme = THEME:GetMetric("Common","ScreenHeight") + local res = PREFSMAN:GetPreference("DisplayHeight") + return theme/res +end + +function GetRealInverse() + local theme = THEME:GetMetric("Common","ScreenHeight") + local res = PREFSMAN:GetPreference("DisplayHeight") + return res/theme +end + --[[ Actor commands ]] function Actor:CenterX() self:x(SCREEN_CENTER_X)