----------------------------------------------------------------
-- Copyright (c) 2010-2017 Zipline Games, Inc. 
-- All Rights Reserved. 
-- http://getmoai.com
----------------------------------------------------------------

print ( "hello, iPhone!" )

function scoresCallback ( scoreArray )
	print "in score callback"
	for i, v in ipairs ( scoreArray ) do print ( i, v ) end
end

MOAIGameCenter.authenticatePlayer ()
MOAIGameCenter.setGetScoresCallback ( scoresCallback )

function threadFunc ()
	score = 10483
	while true do
		coroutine.yield ()
		if MOAIGameCenter.isSupported () then
			--MOAIGameCenter.reportScore ( score + math.random ( 23897 ), "sampleboard" )
			MOAIGameCenter.showDefaultLeaderboard ()
			break
		end
	end
end

thread = MOAIThread.new ()
thread:run ( threadFunc )

----------------------------------------------------------------

MOAISim.openWindow ( "test", 320, 480 )

viewport = MOAIViewport.new ()
viewport:setSize ( 320, 480 )
viewport:setScale ( 320, -480 )

layer = MOAILayer2D.new ()
layer:setViewport ( viewport )
MOAISim.pushRenderPass ( layer )

gfxQuad = MOAIGfxQuad2D.new ()
gfxQuad:setTexture ( "moai.png" )
gfxQuad:setRect ( -64, -64, 64, 64 )
gfxQuad:setUVRect ( 0, 0, 1, 1 )

prop = MOAIProp2D.new ()
prop:setDeck ( gfxQuad )
layer:insertProp ( prop )

prop:moveRot ( 360, 1.5 )
