Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package graphics;
- import java.awt.Color;
- import java.awt.Graphics;
- import javax.swing.JPanel;
- import main.Main;
- import map.MapReader;
- public class MapDrawer extends JPanel{
- private static final long serialVersionUID = 6623157779044794935L;
- public Cube [] [] map;
- public static int sizex = 100;
- public static int sizey = 100;
- //public MapReader r = Main.getreader();
- public int [][] mapi;
- public void paintComponent(Graphics g){
- super.paintComponent(g);
- this.setBackground(Color.WHITE);
- mapi = Main.getMap();
- int x = 0;
- int y = 0;
- for(int i = 0; i < mapi.length; i++){
- for(int j = 0; j < mapi[i].length; j++){
- switch(mapi[i][j]){
- case 0:
- map[i][j] = new Cube(25, 25, Color.GRAY, x, y);
- break;
- }
- x += 25;
- y += 25;
- }
- }
- /*for(int i = 0; i < 24; i++){
- for(int j = 0; j < 32; j++){
- map[i][j] = r.c[i][j];
- }
- }*/
- /*if(r.c != null){
- System.out.println(r.c);
- }else{
- System.out.println("null");
- }*/
- //System.out.println(r.getCubeMap());
- /*for(int i = 0; i < map.length; i++){
- for(int j = 0; j < map[i].length; j++){
- g.setColor(map[i][j].color);
- g.fillRect(map[i][j].x, map[i][j].y, map[i][j].width, map[i][j].height);
- }
- }*/
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement