// Path: core/src/com/v5ent/game/utils/Constants.java
// public class Constants {
// 	// Visible game world is 5 meters wide
// //	public static final float VIEWPORT_WIDTH = 854f;//20f;//640.0f/32;
// 	// Visible game world is 5 meters tall
// //	public static final float VIEWPORT_HEIGHT = 480f;//15f;//480.0f/32;
// 	// Visible game world is 5 meters wide
// 	public static final float VIEWPORT_WIDTH = 640f;//20f;//640.0f/32;
// 	// Visible game world is 5 meters tall
// 	public static final float VIEWPORT_HEIGHT = 480f;//15f;//480.0f/32;
// 
// }
// 
// Path: core/src/com/v5ent/game/utils/DebugMarker.java
// public class DebugMarker {
// 	private static ShapeRenderer debugRenderer = new ShapeRenderer();
// 	
// 	private static final String TAG = DebugMarker.class.getName();
// 	
// 	public static void dispose(){
// 		debugRenderer.dispose();
// 	}
//     public static void drawDebugLine(Vector2 start, Vector2 end, int lineWidth, Color color, Matrix4 projectionMatrix)
//     {
//         Gdx.gl.glLineWidth(lineWidth);
//         debugRenderer.setProjectionMatrix(projectionMatrix);
//         debugRenderer.begin(ShapeRenderer.ShapeType.Line);
//         debugRenderer.setColor(color);
//         debugRenderer.line(start, end);
//         debugRenderer.end();
//         Gdx.gl.glLineWidth(1);
//     }
//     
//     public static void drawPolygon(Polygon polygon, Matrix4 projectionMatrix)
//     {
//     	
//     	Gdx.gl.glLineWidth(2);
//     	debugRenderer.setProjectionMatrix(projectionMatrix);
//     	debugRenderer.begin(ShapeRenderer.ShapeType.Line);
//     	
//     	debugRenderer.setColor(Color.RED);
//     	float[] vertices = polygon.getVertices();
//         for(int i=0; i<vertices.length; i+=2){
//         	debugRenderer.line(vertices[i], vertices[i+1], vertices[(i+2)%vertices.length], vertices[(i+3)%vertices.length]);
//         }
//     	debugRenderer.end();
//     	Gdx.gl.glLineWidth(1);
//     }
// 
//     public static void drawDebugLine(Vector2 start, Vector2 end, Matrix4 projectionMatrix)
//     {
//         Gdx.gl.glLineWidth(2);
//         debugRenderer.setProjectionMatrix(projectionMatrix);
//         debugRenderer.begin(ShapeRenderer.ShapeType.Line);
//         debugRenderer.setColor(Color.WHITE);
//         debugRenderer.line(start, end);
//         debugRenderer.end();
//         Gdx.gl.glLineWidth(1);
//     }
// 
// 	public static void drawTrace(List<Vector2> points, Matrix4 projectionMatrix) {
// 		Gdx.gl.glLineWidth(2);
//         debugRenderer.setProjectionMatrix(projectionMatrix);
//         debugRenderer.begin(ShapeRenderer.ShapeType.Line);
//         debugRenderer.setColor(Color.WHITE);
//         for(int i=0;i<points.size()-1;i++){
//         	debugRenderer.line(points.get(i), points.get(i+1));
//         }
//         debugRenderer.end();
//         Gdx.gl.glLineWidth(1);
// 	}
// 	
// 	public static ShapeRenderer getDebugRenderer() {
// 		return debugRenderer;
// 	}
// }


import com.badlogic.gdx.Application;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
import com.badlogic.gdx.maps.tiled.tiles.AnimatedTiledMapTile;
import com.badlogic.gdx.utils.Disposable;
import com.v5ent.game.utils.Constants;
import com.v5ent.game.utils.DebugMarker;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
		}
		//show roles order by Y-axis
		List<Sprite> temp =new ArrayList<Sprite>();
		temp.add(worldController.player);
		temp.addAll(worldController.mapMgr.npcs);
		temp.addAll(worldController.mapMgr.enemies);
		temp.addAll(worldController.mapMgr.traps);
		Collections.sort(temp, new Comparator<Sprite>() {
			@Override
			public int compare(Sprite lhs, Sprite rhs) {
				// -1 - less than, 1 - greater than, 0 - equal, all inversed for descending
				return lhs.getY() > rhs.getY() ? -1 : (lhs.getY() < rhs.getY() ) ? 1 : 0;
			}
		});
		for (Sprite sprite : temp) {
			sprite.draw(mapRenderer.getBatch());
		}
		//ceil layer
		TiledMapTileLayer ceilMapLayer = (TiledMapTileLayer)worldController.mapMgr.getCurrentMap().getLayers().get(MapsManager.CEILING_LAYER);
		if( ceilMapLayer != null){
			mapRenderer.renderTileLayer(ceilMapLayer);
		}
		if(worldController.skill!=null)worldController.skill.draw(mapRenderer.getBatch());
		//TODO Sky Layer

		mapRenderer.getBatch().end();
	}


	public void resize (int width, int height) {
// Path: core/src/com/v5ent/game/utils/Constants.java
// public class Constants {
// 	// Visible game world is 5 meters wide
// //	public static final float VIEWPORT_WIDTH = 854f;//20f;//640.0f/32;
// 	// Visible game world is 5 meters tall
// //	public static final float VIEWPORT_HEIGHT = 480f;//15f;//480.0f/32;
// 	// Visible game world is 5 meters wide
// 	public static final float VIEWPORT_WIDTH = 640f;//20f;//640.0f/32;
// 	// Visible game world is 5 meters tall
// 	public static final float VIEWPORT_HEIGHT = 480f;//15f;//480.0f/32;
// 
// }
// 
// Path: core/src/com/v5ent/game/utils/DebugMarker.java
// public class DebugMarker {
// 	private static ShapeRenderer debugRenderer = new ShapeRenderer();
// 	
// 	private static final String TAG = DebugMarker.class.getName();
// 	
// 	public static void dispose(){
// 		debugRenderer.dispose();
// 	}
//     public static void drawDebugLine(Vector2 start, Vector2 end, int lineWidth, Color color, Matrix4 projectionMatrix)
//     {
//         Gdx.gl.glLineWidth(lineWidth);
//         debugRenderer.setProjectionMatrix(projectionMatrix);
//         debugRenderer.begin(ShapeRenderer.ShapeType.Line);
//         debugRenderer.setColor(color);
//         debugRenderer.line(start, end);
//         debugRenderer.end();
//         Gdx.gl.glLineWidth(1);
//     }
//     
//     public static void drawPolygon(Polygon polygon, Matrix4 projectionMatrix)
//     {
//     	
//     	Gdx.gl.glLineWidth(2);
//     	debugRenderer.setProjectionMatrix(projectionMatrix);
//     	debugRenderer.begin(ShapeRenderer.ShapeType.Line);
//     	
//     	debugRenderer.setColor(Color.RED);
//     	float[] vertices = polygon.getVertices();
//         for(int i=0; i<vertices.length; i+=2){
//         	debugRenderer.line(vertices[i], vertices[i+1], vertices[(i+2)%vertices.length], vertices[(i+3)%vertices.length]);
//         }
//     	debugRenderer.end();
//     	Gdx.gl.glLineWidth(1);
//     }
// 
//     public static void drawDebugLine(Vector2 start, Vector2 end, Matrix4 projectionMatrix)
//     {
//         Gdx.gl.glLineWidth(2);
//         debugRenderer.setProjectionMatrix(projectionMatrix);
//         debugRenderer.begin(ShapeRenderer.ShapeType.Line);
//         debugRenderer.setColor(Color.WHITE);
//         debugRenderer.line(start, end);
//         debugRenderer.end();
//         Gdx.gl.glLineWidth(1);
//     }
// 
// 	public static void drawTrace(List<Vector2> points, Matrix4 projectionMatrix) {
// 		Gdx.gl.glLineWidth(2);
//         debugRenderer.setProjectionMatrix(projectionMatrix);
//         debugRenderer.begin(ShapeRenderer.ShapeType.Line);
//         debugRenderer.setColor(Color.WHITE);
//         for(int i=0;i<points.size()-1;i++){
//         	debugRenderer.line(points.get(i), points.get(i+1));
//         }
//         debugRenderer.end();
//         Gdx.gl.glLineWidth(1);
// 	}
// 	
// 	public static ShapeRenderer getDebugRenderer() {
// 		return debugRenderer;
// 	}
// }


// Path: core/src/com/v5ent/game/core/WorldRenderer.java
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
import com.badlogic.gdx.maps.tiled.tiles.AnimatedTiledMapTile;
import com.badlogic.gdx.utils.Disposable;
import com.v5ent.game.utils.Constants;
import com.v5ent.game.utils.DebugMarker;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

		}
		//show roles order by Y-axis
		List<Sprite> temp =new ArrayList<Sprite>();
		temp.add(worldController.player);
		temp.addAll(worldController.mapMgr.npcs);
		temp.addAll(worldController.mapMgr.enemies);
		temp.addAll(worldController.mapMgr.traps);
		Collections.sort(temp, new Comparator<Sprite>() {
			@Override
			public int compare(Sprite lhs, Sprite rhs) {
				// -1 - less than, 1 - greater than, 0 - equal, all inversed for descending
				return lhs.getY() > rhs.getY() ? -1 : (lhs.getY() < rhs.getY() ) ? 1 : 0;
			}
		});
		for (Sprite sprite : temp) {
			sprite.draw(mapRenderer.getBatch());
		}
		//ceil layer
		TiledMapTileLayer ceilMapLayer = (TiledMapTileLayer)worldController.mapMgr.getCurrentMap().getLayers().get(MapsManager.CEILING_LAYER);
		if( ceilMapLayer != null){
			mapRenderer.renderTileLayer(ceilMapLayer);
		}
		if(worldController.skill!=null)worldController.skill.draw(mapRenderer.getBatch());
		//TODO Sky Layer

		mapRenderer.getBatch().end();
	}


	public void resize (int width, int height) {
		worldController.camera.viewportWidth = (Constants.VIEWPORT_HEIGHT / height) * width;