Ver código fonte

Fixed width festival

jancoow 10 anos atrás
pai
commit
c7d68bdf79
1 arquivos alterados com 20 adições e 22 exclusões
  1. 20 22
      src/gui/simulator/Terrain.java

+ 20 - 22
src/gui/simulator/Terrain.java

@@ -34,10 +34,10 @@ public class Terrain extends JPanel {
     private Draw dragObject, selectedObject;
     private BufferedImage background;
     
-    private int length, width;
+    private int festivallength, festivalwidth;
     private int sideBarWidth = 200;
     private SimulatorPane.Terrains terrain;
-    Point2D cameraPoint = new Point2D.Double(width/2,length/2);
+    Point2D cameraPoint = new Point2D.Double(festivalwidth/2,festivallength/2);
 	float cameraScale = 1;
 	
 	Point2D lastClickPosition;
@@ -45,10 +45,8 @@ public class Terrain extends JPanel {
 
     public Terrain(int length, int width, SimulatorPane.Terrains terrain){
     	//get values
-    	this.length = 2000;
-    	this.width = 3000;
-    	setLength(length);
-    	setWidth(width);
+    	setFestivalLength(length);
+    	setFestivalWidth(width);
     	this.terrain = terrain;
     	//set terrainbackground
     	switch(terrain){
@@ -87,13 +85,13 @@ public class Terrain extends JPanel {
 		{
 			if(e.getY() < 300){
 				dragObject = new Stage((int)clickPoint.getX(),(int)clickPoint.getY(), 0.5, 10);
-			}else if(e.getY() > 300 && e.getY() < 500){
+			}else if(e.getY() > 300 && e.getY() < 550){
 				dragObject = new RestRoom((int)clickPoint.getX(),(int)clickPoint.getY(), 0.5, 10);
-			}else if(e.getY() > 500 && e.getY() < 700){
+			}else if(e.getY() > 550 && e.getY() < 800){
 				dragObject = new AccessPoint(this, (int)clickPoint.getX(),(int)clickPoint.getY(), 0.5, 10);
 			}
-			else if(e.getY() > 700 && e.getY() < 900){
-				dragObject = new ExitPoint(this, (int)clickPoint.getX(),(int)clickPoint.getY(), 0.5, 10);
+			else if(e.getY() > 800 && e.getY() < 1100){
+				//dragObject = new custom facility
 			}
 			entities.add(dragObject);
 		}
@@ -214,9 +212,6 @@ public class Terrain extends JPanel {
         Draw object3 = new AccessPoint(this, 0,550, 0.5, 10);
         object3.draw(g2);
         g2.drawString("ingang", 70, 675);
-        Draw object4 = new ExitPoint(this, 0,700, 0.5, 10);
-        object4.draw(g2);
-        g2.drawString("uitgang", 70, 800);
 		
 		//draw simulation field
 		g2.setClip(new Rectangle2D.Double(200, 0, getWidth()-200, getHeight()));
@@ -225,7 +220,10 @@ public class Terrain extends JPanel {
 		g2.setTransform(getCamera());
         TexturePaint p = new TexturePaint(background, new Rectangle2D.Double(0, 0, 200, 200));
 		g2.setPaint(p);
-		g2.fill(new Rectangle2D.Double(0,0,width,length));
+		g2.fill(new Rectangle2D.Double(0,0,festivalwidth,festivallength));
+		for(int i = 0; i < (festivalwidth/100); i++){
+			
+		};
         
 		for(Draw drawObject: entities){
             drawObject.draw(g2); 
@@ -287,18 +285,18 @@ public class Terrain extends JPanel {
 		return tx;
 	}
     
-    public void setLength(int length){
-    	this.length = length;
+    public void setFestivalLength(int length){
+    	this.festivallength = length;
     }
     
-    public void setWidth(int width){
-    	this.width = width;
+    public void setFestivalWidth(int width){
+    	this.festivalwidth = width;
     }
     
-    public int getLength(){
-    	return length;
+    public int getFestivalLength(){
+    	return festivallength;
     }
-    public int getWidth(){
-    	return width;
+    public int getFestivalWidth(){
+    	return festivalwidth;
     }
 }