Structure UpDate
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 7.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB |
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
package data.database;
|
||||
package database;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
@@ -1,6 +1,6 @@
|
||||
package game;
|
||||
package gamecontrol;
|
||||
|
||||
import gui.GUI;
|
||||
import gui.control.GUI;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@@ -1,9 +1,8 @@
|
||||
package game;
|
||||
package gamecontrol;
|
||||
|
||||
import data.database.DataBase;
|
||||
import gui.GUI;
|
||||
import database.DataBase;
|
||||
import gui.control.GUI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package gui;
|
||||
package gui.basics;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -1,20 +1,17 @@
|
||||
package gui;
|
||||
package gui.basics;
|
||||
|
||||
import javax.swing.text.AttributeSet;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.PlainDocument;
|
||||
|
||||
class JTextFieldLimit extends PlainDocument {
|
||||
public class JTextFieldLimit extends PlainDocument {
|
||||
private int limit;
|
||||
JTextFieldLimit(int limit) {
|
||||
|
||||
public JTextFieldLimit(int limit) {
|
||||
super();
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
JTextFieldLimit(int limit, boolean upper) {
|
||||
super();
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public void insertString(int offset, String str, AttributeSet attr) throws BadLocationException {
|
||||
if (str == null)
|
||||
@@ -1,4 +1,4 @@
|
||||
package gui;
|
||||
package gui.basics;
|
||||
|
||||
import javax.swing.border.Border;
|
||||
import java.awt.*;
|
||||
@@ -8,7 +8,7 @@ public class RoundedBorder implements Border {
|
||||
private int radius;
|
||||
|
||||
|
||||
RoundedBorder(int radius) {
|
||||
public RoundedBorder(int radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package gui;
|
||||
package gui.control;
|
||||
|
||||
import game.Control;
|
||||
import gamecontrol.Control;
|
||||
import gui.windows.ControlWindow;
|
||||
import gui.windows.GameWindow;
|
||||
import gui.windows.MenuWindow;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
@@ -1,9 +1,9 @@
|
||||
package draw;
|
||||
package gui.draw;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Draw extends JPanel {
|
||||
public class DrawGrid extends JPanel {
|
||||
private int xSize, ySize;
|
||||
private int width, height;
|
||||
private float ratio;
|
||||
@@ -14,7 +14,7 @@ public class Draw extends JPanel {
|
||||
|
||||
private boolean drawLocked = false;
|
||||
|
||||
public Draw(int gridSizeX, int gridSizeY, int width, int height, float ratio, int offset) {
|
||||
public DrawGrid(int gridSizeX, int gridSizeY, int width, int height, float ratio, int offset) {
|
||||
this.xSize = gridSizeX;
|
||||
this.ySize = gridSizeY;
|
||||
this.width = width;
|
||||
@@ -1,4 +1,9 @@
|
||||
package gui;
|
||||
package gui.windows;
|
||||
|
||||
import gui.control.GUI;
|
||||
import gui.basics.Hover;
|
||||
import gui.basics.JTextFieldLimit;
|
||||
import gui.basics.RoundedBorder;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
@@ -1,6 +1,7 @@
|
||||
package gui;
|
||||
package gui.windows;
|
||||
|
||||
import draw.Draw;
|
||||
import gui.control.GUI;
|
||||
import gui.draw.DrawGrid;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -9,7 +10,7 @@ import java.awt.event.*;
|
||||
public class GameWindow {
|
||||
|
||||
private final JFrame gameWindow;
|
||||
private final Draw draw;
|
||||
private final DrawGrid drawGrid;
|
||||
|
||||
private final int cellCountX;
|
||||
private final int cellCountY;
|
||||
@@ -134,14 +135,14 @@ public class GameWindow {
|
||||
gameWindow.setResizable(false);
|
||||
|
||||
ratio = (float) (cellCountY) / (float) (cellCountX);
|
||||
draw = new Draw(this.cellCountX, this.cellCountY, width, height, ratio, offset);
|
||||
draw.setBounds(0, 0, width, height);
|
||||
drawGrid = new DrawGrid(this.cellCountX, this.cellCountY, width, height, ratio, offset);
|
||||
drawGrid.setBounds(0, 0, width, height);
|
||||
|
||||
|
||||
|
||||
draw.setVisible(true);
|
||||
drawGrid.setVisible(true);
|
||||
|
||||
gameWindow.add(draw);
|
||||
gameWindow.add(drawGrid);
|
||||
|
||||
gameWindow.pack();
|
||||
gameWindow.setLayout(null);
|
||||
@@ -150,8 +151,8 @@ public class GameWindow {
|
||||
}
|
||||
|
||||
public void showGrid(boolean[][] grid) {
|
||||
if (draw != null) {
|
||||
draw.showGrid(grid);
|
||||
if (drawGrid != null) {
|
||||
drawGrid.showGrid(grid);
|
||||
} else {
|
||||
System.err.println("you need to build the game gameWindow before showing a grid");
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package gui;
|
||||
package gui.windows;
|
||||
|
||||
|
||||
import gui.control.GUI;
|
||||
import gui.basics.Hover;
|
||||
import gui.basics.RoundedBorder;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
+3
-3
@@ -1,8 +1,7 @@
|
||||
package main;
|
||||
|
||||
|
||||
import data.database.DataBase;
|
||||
import game.Control;
|
||||
import gamecontrol.Control;
|
||||
|
||||
public class Main {
|
||||
|
||||
@@ -18,10 +17,11 @@ public class Main {
|
||||
//TODO: Limit input length
|
||||
//TODO: DB Reload when Menu windows Opened
|
||||
|
||||
//TODO: Implement Corona Virus. Infected, Vaccinated, Recovered and Normal
|
||||
//TODO: Implement Corona Virus. Infected, Vaccinated, Recovered and Normal | Normal, 3G, 2G, 2G+ Zones
|
||||
//TODO: Implement Picture to grid function
|
||||
//TODO: Implement a war mode.
|
||||
|
||||
//TODO: Fucking 3D Grid
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Reference in New Issue
Block a user