Skip to content

Commit

Permalink
Fixed mixups of width and height
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMcLean committed Nov 21, 2016
1 parent dc0cb6c commit 31afc8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class GraphicsViewer implements Screen, InputProcessor {
private Viewport worldView = new FitViewport(VIRTUAL_WIDTH, VIRTUAL_HEIGHT);
private Viewport screenView = new FitViewport(VIRTUAL_WIDTH, VIRTUAL_HEIGHT);
private SpriteBatch batch = new SpriteBatch();
private FrameBuffer frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, VIRTUAL_HEIGHT, VIRTUAL_WIDTH, true, true);
private FrameBuffer frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, true, true);
private Texture screenTexture;
private TextureRegion screenRegion = new TextureRegion();
private BitmapFont font = new BitmapFont(Gdx.files.internal("tiny/tiny.fnt"));
Expand All @@ -44,7 +44,7 @@ public void show() {
keyPressed[i] = false;
font.setColor(Color.WHITE);
screenView.getCamera().position.set(32, 32, 0);
screenView.update(VIRTUAL_HEIGHT, VIRTUAL_WIDTH);
screenView.update(VIRTUAL_WIDTH, VIRTUAL_HEIGHT);
Gdx.input.setInputProcessor(this);
}

Expand Down
8 changes: 4 additions & 4 deletions core/src/net/benmclean/badroguelike/view/GameScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public GameScreen (long SEED) {
private SpriteBatch batch = new SpriteBatch();
private TiledMap map = new TiledMap();
private TiledMapRenderer tiledMapRenderer;
private FrameBuffer frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, VIRTUAL_HEIGHT, VIRTUAL_WIDTH, true, true);
private FrameBuffer frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, true, true);
private Texture screenTexture;
private TextureRegion screenRegion = new TextureRegion();
private OrthogonalTiledMapIterator visibleIterator;
Expand All @@ -62,7 +62,7 @@ public static TiledMapTileLayer.Cell makeCell(TiledMapTile tile) {
@Override
public void show() {
MapLayers layers = map.getLayers();
TiledMapTileLayer layer = new TiledMapTileLayer(world.SIZE_X, world.SIZE_Y, TILE_HEIGHT, TILE_WIDTH);
TiledMapTileLayer layer = new TiledMapTileLayer(world.SIZE_X, world.SIZE_Y, TILE_WIDTH, TILE_HEIGHT);
for (int x = 0; x < world.SIZE_X; x++) {
for (int y = 0; y < world.SIZE_Y; y++) {
StaticTiledMapTile tile = null;
Expand All @@ -77,7 +77,7 @@ else if (answer != null)
layers.add(layer);
tiledMapRenderer = new OrthogonalTiledMapRenderer(map);
screenView.getCamera().position.set(32, 32, 0);
screenView.update(VIRTUAL_HEIGHT, VIRTUAL_WIDTH);
screenView.update(VIRTUAL_WIDTH, VIRTUAL_HEIGHT);
visibleIterator = new OrthogonalTiledMapIterator((OrthographicCamera) worldView.getCamera(), layer);

batch.enableBlending();
Expand All @@ -91,7 +91,7 @@ public void render(float delta) {
Gdx.gl.glClearColor(worldBackgroundColor.r, worldBackgroundColor.g, worldBackgroundColor.b, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
worldView.apply();
worldView.getCamera().position.set(world.getPlayerX() * TILE_HEIGHT + 4, world.getPlayerY() * TILE_WIDTH + 4, 0);
worldView.getCamera().position.set(world.getPlayerX() * TILE_WIDTH + 4, world.getPlayerY() * TILE_HEIGHT + 4, 0);
worldView.update(VIRTUAL_WIDTH, VIRTUAL_HEIGHT);
tiledMapRenderer.setView((OrthographicCamera) worldView.getCamera());
tiledMapRenderer.render();
Expand Down

0 comments on commit 31afc8f

Please sign in to comment.