Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Created December 11, 2012 18:49
Show Gist options
  • Select an option

  • Save typeoneerror/4260987 to your computer and use it in GitHub Desktop.

Select an option

Save typeoneerror/4260987 to your computer and use it in GitHub Desktop.
-- handle special cases like iPad retina
DPI_SCALE = 1
if Util.isIPadRetina () then
print ( "Why, iPad Retina; what big pixels you have." )
DPI_SCALE = 2
DISPLAY_WIDTH = 1024
DISPLAY_HEIGHT = 768
end
-- game window should be 1024
MOAISim.openWindow( GAME_NAME , DISPLAY_WIDTH, DISPLAY_HEIGHT )
-- while viewport should be @2x at 2048
VIEWPORT = MOAIViewport.new ()
VIEWPORT:setSize ( DISPLAY_WIDTH * DPI_SCALE, DISPLAY_HEIGHT * DPI_SCALE )
VIEWPORT:setScale ( GAME_SCREEN_X, -GAME_SCREEN_Y )
VIEWPORT:setOffset ( -1, 1 )
function Util.isIPadRetina ()
if MOAIEnvironment.osBrand == Util.OS_BRAND_IOS then
if DISPLAY_WIDTH >= 2048 then
return true
end
end
return false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment