Advertisement
Guest User

g

a guest
Jan 26th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 KB | None | 0 0
  1. package graphics;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Graphics;
  5.  
  6. import javax.swing.JPanel;
  7.  
  8. import main.Main;
  9. import map.MapReader;
  10.  
  11. public class MapDrawer extends JPanel{
  12.     private static final long serialVersionUID = 6623157779044794935L;
  13.     public Cube [] [] map;
  14.     public static int sizex = 100;
  15.     public static int sizey = 100;
  16.     //public MapReader r = Main.getreader();
  17.     public int [][] mapi;
  18.    
  19.     public void paintComponent(Graphics g){
  20.         super.paintComponent(g);
  21.         this.setBackground(Color.WHITE);
  22.         mapi = Main.getMap();
  23.         int x = 0;
  24.         int y = 0;
  25.         for(int i = 0; i < mapi.length; i++){
  26.             for(int j = 0; j < mapi[i].length; j++){
  27.                 switch(mapi[i][j]){
  28.                 case 0:
  29.                     map[i][j] = new Cube(25, 25, Color.GRAY, x, y);
  30.                     break;
  31.                 }
  32.                 x += 25;
  33.                 y += 25;
  34.             }
  35.         }
  36.         /*for(int i = 0; i < 24; i++){
  37.             for(int j = 0; j < 32; j++){
  38.                 map[i][j] = r.c[i][j];
  39.             }
  40.         }*/
  41.         /*if(r.c != null){
  42.             System.out.println(r.c);
  43.         }else{
  44.             System.out.println("null");
  45.         }*/
  46.         //System.out.println(r.getCubeMap());
  47.         /*for(int i = 0; i < map.length; i++){
  48.             for(int j = 0; j < map[i].length; j++){
  49.                 g.setColor(map[i][j].color);
  50.                 g.fillRect(map[i][j].x, map[i][j].y, map[i][j].width, map[i][j].height);
  51.             }
  52.         }*/
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement