2013-12-08 32 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

相关问题