expanding on Actor:Real() [shakesoda]
This commit is contained in:
@@ -24,6 +24,12 @@ Health = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Make graphics their true size at any resolution.
|
-- 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()
|
function Actor:Real()
|
||||||
-- normal
|
-- normal
|
||||||
local theme = THEME:GetMetric("Common","ScreenHeight")
|
local theme = THEME:GetMetric("Common","ScreenHeight")
|
||||||
@@ -36,6 +42,31 @@ function Actor:Real()
|
|||||||
self:SetTextureFiltering(false)
|
self:SetTextureFiltering(false)
|
||||||
end
|
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 ]]
|
--[[ Actor commands ]]
|
||||||
function Actor:CenterX()
|
function Actor:CenterX()
|
||||||
self:x(SCREEN_CENTER_X)
|
self:x(SCREEN_CENTER_X)
|
||||||
|
|||||||
Reference in New Issue
Block a user