expanding on Actor:Real() [shakesoda]

This commit is contained in:
AJ Kelly
2010-06-24 01:37:34 -05:00
parent 586e00d5b5
commit 8d160bdc56
@@ -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)