package com.badlogic.gdx.tests.bench;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.GL10;
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.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.maps.MapLayers;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TiledMapRenderer;
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer2;
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.tests.utils.OrthoCamController;

public class TiledMapBench extends GdxTest {
	
	private TiledMap map;
	private TiledMapRenderer renderer;
	private OrthographicCamera camera;
	private OrthoCamController cameraController;
	private AssetManager assetManager;
	private Texture tiles;
	private Texture texture;
	private BitmapFont font;
	private SpriteBatch batch;
	
	@Override
	public void create() {		
		float w = Gdx.graphics.getWidth();
		float h = Gdx.graphics.getHeight();
		
		camera = new OrthographicCamera();
		camera.setToOrtho(false, (w / h) * 320, 320);
		camera.update();
		
		cameraController = new OrthoCamController(camera);
		Gdx.input.setInputProcessor(cameraController);
	
		font = new BitmapFont();
		batch = new SpriteBatch();
		
		{
			tiles = new Texture(Gdx.files.internal("data/maps/tiled/tiles.png"));
			TextureRegion[][] splitTiles = TextureRegion.split(tiles, 32, 32);
			map = new TiledMap();
			MapLayers layers = map.getLayers();
			for (int l = 0; l < 20; l++) {
				TiledMapTileLayer layer = new TiledMapTileLayer(150, 100, 32, 32);
				for (int x = 0; x < 150; x++) {
					for (int y = 0; y < 100; y++) {
						int ty = (int)(Math.random() * splitTiles.length);
						int tx = (int)(Math.random() * splitTiles[ty].length);
						Cell cell = new Cell();
						cell.setTile(new StaticTiledMapTile(splitTiles[ty][tx]));
						layer.setCell(x, y, cell);
					}
				}
				layers.add(layer);
			}
		}
		
		renderer = new OrthogonalTiledMapRenderer2(map);

	}

	@Override
	public void render() {
		Gdx.gl.glClearColor(100f / 255f, 100f / 255f, 250f / 255f, 1f);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
		camera.update();
		renderer.setView(camera);
		renderer.render();
		batch.begin();
		font.draw(batch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 20); 
		batch.end();
	}
}

@@ -65,46 +65,8 @@
 dx;%0A
-import com.badlogic.gdx.InputAdapter;%0A
 impo
@@ -754,144 +754,32 @@
 led.
-renderers.OrthogonalTiledMapRenderer2;%0Aimport com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile;%0Aimport com.badlogic.gdx.math.Vector3
+tiles.StaticTiledMapTile
 ;%0Aim
@@ -2318,17 +2318,16 @@
 Renderer
-2
 (map);%0A%0A

Change renderer used in TiledMapBench.