X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavedroid%2Fmisc%2FRenderer.java;h=c2577d36e4940a996468b3dbb382369b19eb000d;hb=refs%2Fheads%2Fmaster;hp=637eed7c3b3f6dfd3f73fb35b94bbb122f7cec10;hpb=0a855ca3c1d0c84de41a928cc99fd8544a933015;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavedroid/misc/Renderer.java b/core/src/ru/deadsoftware/cavedroid/misc/Renderer.java deleted file mode 100644 index 637eed7..0000000 --- a/core/src/ru/deadsoftware/cavedroid/misc/Renderer.java +++ /dev/null @@ -1,72 +0,0 @@ -package ru.deadsoftware.cavedroid.misc; - -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.cavedroid.GameScreen; - -public abstract class Renderer { - - private OrthographicCamera camera; - - protected ShapeRenderer shaper; - protected SpriteBatch spriter; - protected SpriteCache spriteCache; - - public Renderer() { - this(GameScreen.getWidth(), GameScreen.getHeight()); - } - - public Renderer(float width, float height) { - camera = new OrthographicCamera(); - camera.setToOrtho(true, width, height); - shaper = new ShapeRenderer(); - shaper.setProjectionMatrix(camera.combined); - spriter = new SpriteBatch(); - spriter.setProjectionMatrix(camera.combined); - spriteCache = new SpriteCache(); - spriteCache.setProjectionMatrix(camera.combined); - } - - public float getWidth() { - return camera.viewportWidth; - } - - public float getHeight() { - return camera.viewportHeight; - } - - public float getCamX() { - return camera.position.x; - } - - public float getCamY() { - return camera.position.y; - } - - public void setCamPos(float x, float y) { - camera.position.set(x, y, 0); - } - - public void setFontScale(float scale) { - Assets.mcFont.getData().setScale(scale); - } - - protected void setFontColor(int r, int g, int b) { - Assets.mcFont.setColor(r / 255f, g / 255f, b / 255f, 1f); - } - - protected void drawString(String str, float x, float y) { - Assets.mcFont.draw(spriter, str, x, y); - } - - protected void drawString(String str) { - Assets.mcFont.draw(spriter, str, - getWidth() / 2 - (float) Assets.getStringWidth(str) / 2, - getHeight() / 2 - (float) Assets.getStringHeight(str) / 2); - } - - public abstract void render(); - -}