2013-12-08 30 views
1

所以我有一個與display.setRefencePoint一起工作的電暈應用程序,但是現在嘗試運行它時,它不起作用。在網上看起來好像我現在需要使用Anchors。下面是我目前的部分,但我很難將其轉換爲Anchor分,請幫助。如何將Corona setReferencePoint轉換爲Anchor?

background = display.newImage ("Background.png"); 

--Sets its position reference point 
background:setReferencePoint (display.TopLeftReferencePoint); 

回答

3

試試這個:

background = display.newImage ("Background.png"); 
-- to make reference point at TopLeftcorner 
background.anchorX = 0.0; 
background.anchorY = 0.0; 

欲瞭解更多信息,請訪問:Tutorial: Anchor Points in Graphics 2.0

3

與Karishna的答案達成一致,但也有另一種方式在Config.lua加入graphicsCompatibility領域獲得支持的setReferencePoint文件爲:

application = 
{ 
    content = 
    { 
     graphicsCompatibility = 1, -- Turn on V1 Compatibility Mode 

     width = 320, 
     height = 480, 
     scale = "letterbox" 
    }, 
} 

最新版本Graphics 2.0與上述代碼中提到的設置V1 Compatibility Mode兼容Graphics 1.0。這是特殊模式,可顯着減少遷移所需的工作量。此模式默認爲off更多您可以訪問Here

相關問題