2017-09-16 2 views
0

현재 화면의 네 구석에 텍스트를 넣으려고했지만 일부 화면 해상도 (예 : 1080 * 1920)에서 구석에 앵커 포인트가 맞지 않습니다. 어떤 이유에서든 x 값은 동일하지만 y 값은 변경되며 화면 모서리에 근접하지 않습니다. 이 모든 화면 해상도 작동하지 않는 이유를 이해할 수없는앵커 포인트가 다른 왜곡에서 왜 다른가요?

local myText = display.newText("RIGHT", 0, 0, native.systemFont, 16) 
     myText:setFillColor(0, 0, 0) 
     myText.anchorX = 1 
     myText.anchorY = 0 
     myText.x = display.contentWidth 
     myText.y = 0 

: 여기에 오른쪽 상단에 텍스트를 배치 나의 예입니다.

답변

1

당신을 위해이 작업은 다음을 표시 객체의

-- Top 
myText.y = display.screenOriginY; 

-- Bottom 
myText.y = display.contentHeight - display.screenOriginY; 

-- Right 
myText.x = display.contentWidth - display.screenOriginX; 

-- Left 
myText.x = display.screenOriginX; 
+0

내가 바닥에 놓아두면 어떨까요? 어떻게 작동할까요? –

+0

@referferferferferf 답변을 업데이트했습니다. –

1

타 앵커 포인트는 변경되지 않습니다.

화면 변경 좌표계는 배율 모드에 따라 다릅니다. 따라서 왼쪽 상단의 점이 항상 (0, 0)이되지는 않습니다. 예를 들어 letterbox 모드 왼쪽 상단의 점은 (display.screenOriginX, display.screenOriginY)입니다. 코로나 documentation 가입일

"letterbox" — scales the content area to fill the screen while preserving the same aspect ratio. The entire content area will reside on the screen, but this might result in "black bars" on devices with aspect ratios that differ from your content aspect ratio. Note, however, that you can still utilize this "blank" area and fill it with visual elements by positioning them or extending them outside the content area bounds. Essentially, "letterbox" is an ideal scale mode if you want to ensure that everything in your content area appears within the screen bounds on all devices. 

"zoomEven" — scales the content area to fill the screen while preserving the same aspect ratio. Some content may "bleed" off the screen edges on devices with aspect ratios that differ from your content aspect ratio. Basically, "zoomEven" is a good option to ensure that the entire screen is filled by the content area on all devices (and content clipping near the outer edges is acceptable). 
  • 레터

enter image description here

  • zoomEven

enter image description here

Content Scaling에 대해 자세히 알아보십시오.

관련 문제