Guest User

LevelBuilder

a guest
Jun 8th, 2023
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.57 KB | None | 0 0
  1. import static utils.Constants.WINDOW_WIDTH;
  2. import static utils.Constants.WINDOW_HEIGHT;
  3. import static utils.Constants.LB_BACKGROUND;
  4. import static utils.Constants.CELLS_IN_COL;
  5. import static utils.Constants.CELLS_IN_ROW;
  6. import static utils.Constants.CELL_SIZE;
  7.  
  8. import utils.DrawCell;
  9. import utils.DrawLine;
  10. import utils.Updater;
  11.  
  12. import java.awt.Color;
  13. import java.awt.Dimension;
  14. import java.awt.Graphics;
  15. import java.awt.Graphics2D;
  16. import java.awt.event.MouseEvent;
  17. import java.awt.event.MouseListener;
  18. import java.awt.event.WindowAdapter;
  19. import java.awt.event.WindowEvent;
  20. import java.util.Arrays;
  21. import java.util.List;
  22.  
  23. import javax.swing.JFrame;
  24. import javax.swing.JPanel;
  25. import javax.swing.ImageIcon;
  26.  
  27. public class LevelBuilder extends JFrame {
  28.     public LevelBuilder() {
  29.         super("Level Builder");
  30.  
  31.         setResizable(false);
  32.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  33.         setIconImage(new ImageIcon("assets/level-builder-logo.png").getImage());
  34.         setLayout(null);
  35.  
  36.         getContentPane().setBackground(LB_BACKGROUND);
  37.         getContentPane().setPreferredSize(new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT));
  38.         pack();
  39.  
  40.         for (int horLine = 0; horLine < CELLS_IN_COL; horLine++) {
  41.             add(new DrawLine(0, CELL_SIZE * horLine, WINDOW_WIDTH, CELL_SIZE * horLine, 10));
  42.         }
  43.  
  44.         for (int verLine = 0; verLine < CELLS_IN_ROW; verLine++) {
  45.             add(new DrawLine(CELL_SIZE * verLine, 0, CELL_SIZE * verLine, WINDOW_HEIGHT, 10));
  46.         }
  47.  
  48.        
  49.  
  50.         setVisible(true);
  51.     }
  52.  
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment