mirror of
				https://github.com/ynerant/Level-Editor.git
				synced 2025-11-03 23:52:05 +01:00 
			
		
		
		
	Ajouté taille dans la map
This commit is contained in:
		@@ -32,7 +32,7 @@ public class EditorAPI
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return RawMap.create(cases);
 | 
			
		||||
		return RawMap.create(cases, width, height);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static Gson createGson()
 | 
			
		||||
 
 | 
			
		||||
@@ -5,16 +5,30 @@ import java.util.List;
 | 
			
		||||
public class RawMap
 | 
			
		||||
{
 | 
			
		||||
	private List<RawCase> cases;
 | 
			
		||||
	private int width;
 | 
			
		||||
	private int height;
 | 
			
		||||
	
 | 
			
		||||
	public List<RawCase> getCases()
 | 
			
		||||
	{
 | 
			
		||||
		return cases;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static RawMap create(List<RawCase> cases)
 | 
			
		||||
	public int getWidth()
 | 
			
		||||
	{
 | 
			
		||||
		return width;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public int getHeight()
 | 
			
		||||
	{
 | 
			
		||||
		return height;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static RawMap create(List<RawCase> cases, int width, int height)
 | 
			
		||||
	{
 | 
			
		||||
		RawMap rm = new RawMap();
 | 
			
		||||
		rm.cases = cases;
 | 
			
		||||
		rm.width = width;
 | 
			
		||||
		rm.height = height;
 | 
			
		||||
		return rm;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -13,11 +13,16 @@ import java.util.List;
 | 
			
		||||
public class Map
 | 
			
		||||
{
 | 
			
		||||
	private final EditorFrame frame;
 | 
			
		||||
	private int width;
 | 
			
		||||
	private int height;
 | 
			
		||||
	private List<Case> cases = new ArrayList<Case>();
 | 
			
		||||
	private java.util.Map<Point, Case> casesMap = new HashMap<Point, Case>();
 | 
			
		||||
	
 | 
			
		||||
	public Map(RawMap raw)
 | 
			
		||||
	{
 | 
			
		||||
		this.width = raw.getWidth();
 | 
			
		||||
		this.height = raw.getHeight();
 | 
			
		||||
		
 | 
			
		||||
		for (RawCase rc : raw.getCases())
 | 
			
		||||
		{
 | 
			
		||||
			cases.add(Case.create(rc.getPosX(), rc.getPosY(), SpriteRegister.getCategory(rc.getCoucheOne().getPrimaryIndex()).get(rc.getCoucheOne().getSecondaryIndex()), SpriteRegister.getCategory(rc.getCoucheTwo().getPrimaryIndex()).get(rc.getCoucheTwo().getSecondaryIndex()), SpriteRegister.getCategory(rc.getCoucheThree().getPrimaryIndex()).get(rc.getCoucheThree().getSecondaryIndex())));
 | 
			
		||||
@@ -33,6 +38,16 @@ public class Map
 | 
			
		||||
		return frame;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public int getWidth()
 | 
			
		||||
	{
 | 
			
		||||
		return width;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public int getHeight()
 | 
			
		||||
	{
 | 
			
		||||
		return height;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Case getCase(int x, int y)
 | 
			
		||||
	{
 | 
			
		||||
		if (casesMap.isEmpty())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user