Maunuel Mode Prototype

This commit is contained in:
Noah
2021-09-30 22:33:46 +02:00
parent 4aec1db908
commit d63a2d0dfd
3 changed files with 104 additions and 21 deletions
+73 -14
View File
@@ -64,6 +64,7 @@ public class GUI {
/* End of Game view Elements */
private JFrame jfGameManuel;
public GUI(Control control) {
@@ -375,20 +376,6 @@ public class GUI {
draw.setVisible(true);
jfGame.addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseDragged(MouseEvent e) {
int x=e.getX();
int y=e.getY();
System.out.println(x+","+y);
}
@Override
public void mouseMoved(MouseEvent e) {
System.out.println("Not Pressed");
}
});
jfGame.add(draw);
jfGame.pack();
@@ -397,6 +384,78 @@ public class GUI {
jfGame.setVisible(true);
}
public void manuelGameWindow(int xSize, int ySize) {
this.xSize = xSize;
this.ySize = ySize;
jfGameManuel = new JFrame(title);
jfGameManuel.getContentPane().setPreferredSize(new Dimension(1000, 1000));
jfGameManuel.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jfGameManuel.setResizable(false);
float ratio = (float)(ySize) / (float)(xSize);
draw = new Draw(this.xSize, this.ySize, ratio);
jfGameManuel.setBounds(0, 0, 800, 800);
jfGameManuel.setVisible(true);
jfGameManuel.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
control.startGame();
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
jfGameManuel.addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseDragged(MouseEvent e) {
control.removeCell(e.getX(), e.getY());
}
@Override
public void mouseMoved(MouseEvent e) {
control.addCell(e.getX(), e.getY());
}
});
jfGameManuel.add(draw);
jfGameManuel.pack();
jfGameManuel.setLayout(null);
jfGameManuel.setLocationRelativeTo(null);
jfGameManuel.setVisible(true);
}
private void initGameComponents() {