Rev 268 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
package com.gebauz.pingk.entities;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.gebauz.Bauzoid.graphics.sprite.Sprite;
import com.gebauz.pingk.game.GameConsts;
import com.gebauz.pingk.game.GameLogic;
public class PlayField
extends Entity
{
private Sprite mBackground =
null;
private float mVirtualHeight = 0.0f
;
public PlayField
(GameLogic gameLogic
)
{
super(gameLogic
);
mVirtualHeight =
GameConsts.
VIRTUAL_SCREEN_HEIGHT -
((GameConsts.
SCORE_BAR_HEIGHT * getGraphics
().
getDipToPixelScale() +
0.5f
) * (GameConsts.
VIRTUAL_SCREEN_HEIGHT /
(float)getGraphics
().
getHeight()));
}
@
Override
public void init
()
{
Texture texture =
new Texture
(Gdx.
files.
internal("data/textures/playfield.png"));
mBackground =
new Sprite
(getGraphics
(), texture
);
mBackground.
pivotX =
0;
mBackground.
pivotY =
0;
mBackground.
x =
0;
mBackground.
y =
0;
mBackground.
w = GameConsts.
VIRTUAL_SCREEN_WIDTH;
mBackground.
h = mVirtualHeight
;
}
@
Override
public void exit
()
{
if (mBackground
!=
null)
{
mBackground.
dispose();
mBackground =
null;
}
}
@
Override
public void update
(float deltaTime
)
{
mBackground.
update(deltaTime
);
}
@
Override
public void render
()
{
mBackground.
render();
}
public float getVirtualHeight
()
{
return mVirtualHeight
;
}
}