Change viewport to FitViewport, board height/width to 4K

Enable font anti-aliasing
This commit is contained in:
Matt Low 2018-11-13 17:14:33 +04:00
parent a56d721050
commit 1fe82cb5b2

View File

@ -4,10 +4,11 @@ import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.utils.viewport.StretchViewport; import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport; import com.badlogic.gdx.utils.viewport.Viewport;
import com.me.brickbuster.state.PlayState; import com.me.brickbuster.state.PlayState;
@ -15,8 +16,8 @@ public class BrickBuster extends Game {
public static final String TITLE = "Brick Buster"; public static final String TITLE = "Brick Buster";
// 9*16 board area // 9*16 board area
public static final int BOARD_WIDTH = 2250; public static final int BOARD_WIDTH = 2160;
public static final int BOARD_HEIGHT = 4000; public static final int BOARD_HEIGHT = 3840;
public OrthographicCamera cam; public OrthographicCamera cam;
public Viewport viewport; public Viewport viewport;
@ -28,10 +29,13 @@ public class BrickBuster extends Game {
@Override @Override
public void create () { public void create () {
cam = new OrthographicCamera(); cam = new OrthographicCamera();
viewport = new StretchViewport(BOARD_WIDTH, BOARD_HEIGHT, cam); viewport = new FitViewport(BOARD_WIDTH, BOARD_HEIGHT, cam);
viewport.apply(true); viewport.apply(true);
font = new BitmapFont(); font = new BitmapFont();
font.getData().setScale(4);
font.getRegion().getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
sb = new SpriteBatch(); sb = new SpriteBatch();
sr = new ShapeRenderer(); sr = new ShapeRenderer();