์, ์ด์ ๊ด๋ จ ๋ฌธ์ ๋ฅผ ์ดํด ๋ณด์์ต๋๋ค : # 4341, # 4002, # 3476
ํ ์คํธ ์กฐ๊ฐ์ ๋ง๋ค๊ณ ํ๋ฉด ์ค๋ฅธ์ชฝ์ ์ ๋ ฌ ํ ๋ค์ ํ๋ฉด ์ค๋ฅธ์ชฝ์ ์ ๋ ฌ ๋ ์ํ๋ก ์ ์งํ๋ฉด์ ํ ์คํธ๋ฅผ ์ ๋ฐ์ดํธํ๊ณ ์ถ์ต๋๋ค.
anchor.x = 1
์ฌ์ฉํ๋ ์ฒซ ๋ฒ์งธ ์ ๊ทผ ๋ฐฉ์์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
https://jsfiddle.net/r63ud8yL/1/
const app = new PIXI.Application({resizeTo: document.body, backgroundColor: 0xFFFFFF})
document.body.append(app.view)
// Forcing app.stage to occupy width of screen
// Is there a better way to do this?
const neCorner = new PIXI.Sprite()
neCorner.x = 0
neCorner.y = 0
const swCorner = new PIXI.Sprite()
swCorner.x = document.body.clientWidth
swCorner.y = document.body.clientHeight
app.stage.addChild(neCorner, swCorner)
const text = new PIXI.Text('first')
app.stage.addChild(text)
text.anchor.x = 1
// Align text to right edge
text.x = app.stage.width
// Replacing text with a longer string
text.text = 'second'
// It extends past the edge of the window; only 'sec' is visible
๋ค์์ (stage.width - text.width)
์ฌ์ฉํ๋ ๋ ๋ฒ์งธ ์ ๊ทผ ๋ฐฉ์์
๋๋ค.
https://jsfiddle.net/r63ud8yL/2/
const app = new PIXI.Application({resizeTo: document.body, backgroundColor: 0xFFFFFF})
document.body.append(app.view)
// Forcing app.stage to occupy width of screen
// Is there a better way to do this?
const neCorner = new PIXI.Sprite()
neCorner.x = 0
neCorner.y = 0
const swCorner = new PIXI.Sprite()
swCorner.x = document.body.clientWidth
swCorner.y = document.body.clientHeight
app.stage.addChild(neCorner, swCorner)
const text = new PIXI.Text('first')
app.stage.addChild(text)
// Align text to right edge
text.x = (app.stage.width - text.width)
// Replacing text with a longer string
// It extends past the edge of the window; only 'sec' is visible
text.text = 'second'
// Attempting to align text to right edge again...
text.x = (app.stage.width - text.width)
// ...but the longer text expanded the width of app.stage
// so still only 'sec' is visible
์๋ ๋๋น ์ธ app.stage
ํ๊ณ ํ
์คํธ๋ฅผ ์ ๋ ฌ ํ ์ ์๋ค๊ณ ๊ฐ์ ํ์ง๋ง ํด๋น ๊ฐ์ ์ ์ฅํ ํ์๋ ์์ต๋๋ค. ์๊ตฌ ์ต์ปค์์ ์ค๋ฅธ์ชฝ์์ ์ผ์ชฝ์ผ๋ก ํ ์ค ํ
์คํธ๋ฅผ "ํ๋ฅด๋"๋ฐฉ๋ฒ์ด ์์ด์ผํ๋ ๊ฒ ๊ฐ์ต๋๋ค. ๋จ๊ณ๋ฅผ ๋์น๊ณ ์์ต๋๊น?
pixi.js
๋ฒ์ : 5.1.0์ด๊ฑด ์ด๋์? (๋ถ๋ชจ ๊ฒฝ๊ณ๊ฐ ์ ์ ์ธ ๊ฒฝ์ฐ)
https://jsfiddle.net/5o0yjusv/
๋ถ๋ชจ์ ๊ฒฝ๊ณ๊ฐ ์๊ธฐ์น ์๊ฒ ๋ณ๊ฒฝ๋๋ฉด ํ ์คํธ๋ฅผ ์ ์ธํ ๊ฒฝ๊ณ๋ฅผ ๊ณ์ฐํด์ผํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
๋ด ์๊ฒฌ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. https://jsfiddle.net/b9zp5kuh/
๋ ๋๋ฌ ์์ฒด์ ๋๋น๋ฅผ ์ฌ์ฉํ๊ธฐ ๋งํ๋ฉด๋ฉ๋๋ค.
๊ฐ์ฌํฉ๋๋ค, @themoonrat . ์ด๊ฒ์ ๋๋ฅผ ์ฌ๋ฐ๋ฅธ ๊ธธ๋ก ์ธ๋ํ์ต๋๋ค. ๋๋ ๊ฐ๊ฑฐ์ผ app.screen
๋์ app.renderer
. ๋ด window.devicePixelRatio
๋ 2์ด๋ฏ๋ก ๋ ๋๋ฌ์ ๋๋น๋ ๋ด ์ฐฝ์ "์ค์ "๋๋น์ 2 ๋ฐฐ์
๋๋ค. app.screen
์ 1x์
๋๋ค.
๋ง์ด ๋๋ค์! '๊ณ ์ '์ ํ ๋ ์ ํํ ์๋ ค์ง ํฝ์ ๋ก ์์ ํด์ผํ๋ฉฐ ์ปจํ ์ด๋ ๋๋น / ๋์ด๋ ์์ ์์ญ์ ๋์ ์ด๊ธฐ ๋๋ฌธ์ ์ ๋๋ก ์๋ํ์ง ์์ต๋๋ค.