diff --git a/core/src/ru/deadsoftware/cavecraft/misc/Renderer.java b/core/src/ru/deadsoftware/cavecraft/misc/Renderer.java
index c22ec4901f3c37328d70bf84fc594e2f164503cd..b2acb6d67c988014a6965652173cfdb939b7ea7d 100644 (file)
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
+import com.badlogic.gdx.graphics.g2d.SpriteCache;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import ru.deadsoftware.cavecraft.GameScreen;
private OrthographicCamera camera;
- public ShapeRenderer shaper;
- public SpriteBatch spriter;
+ protected ShapeRenderer shaper;
+ protected SpriteBatch spriter;
+ protected SpriteCache spriteCache;
public Renderer() {
this(GameScreen.getWidth(), GameScreen.getHeight());
shaper.setProjectionMatrix(camera.combined);
spriter = new SpriteBatch();
spriter.setProjectionMatrix(camera.combined);
+ spriteCache = new SpriteCache();
+ spriteCache.setProjectionMatrix(camera.combined);
}
public float getWidth() {
Assets.mcFont.getData().setScale(scale);
}
- public void setFontColor(int r, int g, int b) {
+ protected void setFontColor(int r, int g, int b) {
Assets.mcFont.setColor(r / 255f, g / 255f, b / 255f, 1f);
}
- public void drawString(String str, float x, float y) {
+ protected void drawString(String str, float x, float y) {
Assets.mcFont.draw(spriter, str, x, y);
}
- public void drawString(String str) {
+ protected void drawString(String str) {
Assets.mcFont.draw(spriter, str,
- getWidth() / 2 - Assets.getStringWidth(str) / 2,
- getHeight() / 2 - Assets.getStringHeight(str) / 2);
+ getWidth() / 2 - (float) Assets.getStringWidth(str) / 2,
+ getHeight() / 2 - (float) Assets.getStringHeight(str) / 2);
}
public abstract void render();