๋๋ถ๋ถ์ ๋ฐฑ์๋์๋ detlaTime์ ์ฌ์ค์ ํ ์ ์๋ ๋ฐฉ๋ฒ์ด ์์ต๋๋ค... ์ด๋ก ์ธํด ์ ๋๋ฉ์ด์ ์ด ํ์ํ ๋(ํนํ scene2d.ui์์ ๋ฉ๋ด์ ์ ๋๋ฉ์ด์ ์ ์ ์ฉํ ๋) ๋น์ฐ์ ๋ ๋๋ง์์ ์ฐ์ ๋ ๋๋ง์ผ๋ก ์ ํํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ๋ค์๊ณผ ๊ฐ์ ์ ๋๋ฉ์ด์ ์ ์ค์ ํ ๋ :
final TextButton button = new TextButton("New Game", textButtonStyle);
button.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
Gdx.app.debug("TestApplication", "button clicked");
MoveToAction outAction = Actions.action(MoveToAction.class);
outAction.setPosition(0, 0);
outAction.setDuration(.5f);
outAction.setInterpolation(Interpolation.pow2Out);
button.addAction(Actions.sequence(outAction, Actions.run(new Runnable() {
<strong i="6">@Override</strong>
public void run() {
Gdx.graphics.setContinuousRendering(false);
Gdx.graphics.requestRendering();
}
})));
Gdx.graphics.setContinuousRendering(true);
}
});
๋น์ฐ์ ๋ ๋๋ง์์ ๋ฒํผ์ ๋๋ฅด๋ฉด ๋ชจ์์ด ์ ๋ฐ์ดํธ๋์ง๋ง ๋ค์ด ์ด๋ฒคํธ 1์ด ํ์ up ์ด๋ฒคํธ๊ฐ click ์ด๋ฒคํธ๋ก ์ด์ด์ง๋ฉด getDeltaTime()์ด ์ ๋๋ฉ์ด์ ์ง์ ์๊ฐ๋ณด๋ค ์ปค์ง๋๋ค... ๋ฐ๋ผ์ ์ฐ์ ๋ ๋๋ง์ true๋ก ์ค์ ํฉ๋๋ค. ํจ๊ณผ๊ฐ ์์ผ๋ฉฐ ์ ๋๋ฉ์ด์ ์ด ์ฆ์ ์ข ๋ฃ๋ฉ๋๋ค.
์ฒซ ๋ฒ์งธ _new_ ํ๋ ์์ด ์ ๋๋ฉ์ด์ ์ ์ฒซ ๋ฒ์งธ ํ๋ ์(๋ง์ง๋ง ํ๋ ์์ด ์๋)๊ณผ ์ผ์นํ๋๋ก ์ฐ์ ๋ ๋๋ง์ผ๋ก ๋ณ๊ฒฝํ ๋ deltaTime์ 0์ผ๋ก ์ค์ ํ๋ ๋ฐฉ๋ฒ์ ๊ฐ๊ณ ์ถ์ต๋๋ค.
๋๋ ๋ด๋ถ ์ฑ์ฐฐ๋ก ๊ทธ๊ฒ์ ํ๊ณ ์๋๋ฐ ์ด๊ฒ์ ์ ๋ง๋ก ์ข์ ๋ฐฉ๋ฒ์ ์๋์ง๋ง ๋ฐฐํฐ๋ฆฌ ์๋ช ์ ๋ง์ด ์ ์ฝํ๊ณ ์ ๋๋ฉ์ด์ ์ ์ ์งํฉ๋๋ค.
์ด๋ป๊ฒ ์๊ฐํ๋์ ?
๋ธํ ์๊ฐ์ ์ต๋๊ฐ์ผ๋ก ์ ํํ ์ ์์ต๋๋ค.
https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/ActionTest.java ์์ ์ํ ๋ฐฉ๋ฒ์
์ข์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ๋๋ค!
์ด ์๋
์ต๋ ์๊ฐ = 0.2f
๋ธํ = ๋ธํ > ์ต๋ ์๊ฐ ? ์ต๋ ์๊ฐ: ๋ธํ ;
30fps๋ฅผ ์ป์ผ๋ฉด ์ต๋ 5ํ๋ ์์ผ๋ก ๊ฑด๋๋๋๋ค(๋ถ๋๋ฌ์ด ์์ง์์ ์ํด ํ์ฉ๋๋ ์ต์ )
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๋ธํ ์๊ฐ์ ์ต๋๊ฐ์ผ๋ก ์ ํํ ์ ์์ต๋๋ค.
https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/ActionTest.java ์์ ์ํ ๋ฐฉ๋ฒ์