mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 11:29:46 +02:00
Anpassungen an GameLoop
This commit is contained in:
@@ -9,7 +9,6 @@ import javax.swing.JPanel;
|
|||||||
|
|
||||||
import de.heatup.mapengine.MapEngine;
|
import de.heatup.mapengine.MapEngine;
|
||||||
import de.heatup.mapengine.SpawnAssistant;
|
import de.heatup.mapengine.SpawnAssistant;
|
||||||
import de.heatup.objects.DynamicObject;
|
|
||||||
import de.heatup.objects.StaticObject;
|
import de.heatup.objects.StaticObject;
|
||||||
import de.heatup.ui.KeyBindings;
|
import de.heatup.ui.KeyBindings;
|
||||||
|
|
||||||
@@ -181,6 +180,7 @@ public class GameLoopD extends JFrame implements Runnable {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
thread.sleep(5); // entlastet die cpu massiv.
|
thread.sleep(5); // entlastet die cpu massiv.
|
||||||
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ public class Opponent extends Player {
|
|||||||
this.blocked = (this.blockedCounter >= 30) ? true : false;
|
this.blocked = (this.blockedCounter >= 30) ? true : false;
|
||||||
this.prevX = this.getGridLocation().x;
|
this.prevX = this.getGridLocation().x;
|
||||||
this.prevY = this.getGridLocation().y;
|
this.prevY = this.getGridLocation().y;
|
||||||
// Blockade Erkennung
|
|
||||||
|
|
||||||
//TODO: Bei Kreuzung umentscheiden
|
//TODO: Bei Kreuzung umentscheiden
|
||||||
|
|
||||||
@@ -67,7 +66,6 @@ public class Opponent extends Player {
|
|||||||
this.blocked = false;
|
this.blocked = false;
|
||||||
this.blockedCounter = 0;
|
this.blockedCounter = 0;
|
||||||
}
|
}
|
||||||
// Blockade auflösen
|
|
||||||
|
|
||||||
// Neue Koordinaten bestimmen
|
// Neue Koordinaten bestimmen
|
||||||
if (d == 'x') {
|
if (d == 'x') {
|
||||||
|
|||||||
@@ -1,129 +0,0 @@
|
|||||||
//package de.heatup.ui;
|
|
||||||
//import java.awt.BorderLayout;
|
|
||||||
//import java.awt.Dimension;
|
|
||||||
//import java.awt.DisplayMode;
|
|
||||||
//import java.awt.EventQueue;
|
|
||||||
//import java.awt.Frame;
|
|
||||||
//import java.awt.GraphicsDevice;
|
|
||||||
//import java.awt.GraphicsEnvironment;
|
|
||||||
//import java.awt.GridLayout;
|
|
||||||
//import java.awt.Point;
|
|
||||||
//import java.awt.Toolkit;
|
|
||||||
//import java.awt.Window;
|
|
||||||
//import java.io.IOException;
|
|
||||||
//
|
|
||||||
//import javax.swing.BorderFactory;
|
|
||||||
//import javax.swing.JFrame;
|
|
||||||
//import javax.swing.JLabel;
|
|
||||||
//import javax.swing.JPanel;
|
|
||||||
//import javax.swing.UIManager;
|
|
||||||
//import javax.swing.UnsupportedLookAndFeelException;
|
|
||||||
//
|
|
||||||
//import de.heatup.mapengine.MapEngine;
|
|
||||||
//import de.heatup.objects.DynamicObject;
|
|
||||||
//import de.heatup.objects.StaticObject;
|
|
||||||
//import de.heatup.objects.logic;
|
|
||||||
//import de.heatup.testing.GameLoop;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//public class GameInterface extends JFrame {
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// *
|
|
||||||
// */
|
|
||||||
// private static final long serialVersionUID = 1L;
|
|
||||||
// private static JPanel outerPanel;
|
|
||||||
// private static JPanel statusPanel;
|
|
||||||
// private static JPanel gamePanel;
|
|
||||||
// private static JPanel actionPanel;
|
|
||||||
// //private BufferedImage image;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// public static void createGUI() {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// // TODO Auto-generated catch block
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final JFrame frame = new JFrame();
|
|
||||||
//
|
|
||||||
//// Fullscreen testing: Remember not to use pack() when using fullscreen mode
|
|
||||||
//// frame.setUndecorated(true);
|
|
||||||
//// frame.setResizable(false);
|
|
||||||
//// frame.setExtendedState(Frame.MAXIMIZED_BOTH);
|
|
||||||
//// frame.validate();
|
|
||||||
//// GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(frame);
|
|
||||||
//
|
|
||||||
// frame.setTitle("HeatUP!");
|
|
||||||
// frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
|
|
||||||
// //frame.setResizable(true);
|
|
||||||
// //frame.createBufferStrategy(2);
|
|
||||||
//
|
|
||||||
// //Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
|
||||||
// //frame.setBounds(0,0,screenSize.width, screenSize.height);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// outerPanel = new JPanel();
|
|
||||||
// outerPanel.setLayout(new BorderLayout());
|
|
||||||
// //outerPanel.setBorder(BorderFactory.createTitledBorder("outerPanel"));
|
|
||||||
// outerPanel.setVisible(true);
|
|
||||||
//
|
|
||||||
// statusPanel = new JPanel();
|
|
||||||
// statusPanel.setLayout(new GridLayout(1,4));
|
|
||||||
// statusPanel.setPreferredSize(new Dimension(800,80));
|
|
||||||
// //statusPanel.setBorder(BorderFactory.createTitledBorder("statusPanel"));
|
|
||||||
//
|
|
||||||
// gamePanel = new JPanel();
|
|
||||||
// gamePanel.setLayout(null);
|
|
||||||
// gamePanel.setPreferredSize(new Dimension(800,600));
|
|
||||||
// gamePanel.setVisible(true);
|
|
||||||
// //gamePanel.setBorder(BorderFactory.createTitledBorder("gamePanel"));
|
|
||||||
//
|
|
||||||
// actionPanel = new JPanel();
|
|
||||||
// actionPanel.setLayout(new GridLayout(1,1));
|
|
||||||
// //actionPanel.setBorder(BorderFactory.createTitledBorder("actionPanel"));
|
|
||||||
// actionPanel.setPreferredSize(new Dimension(800,80));
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// outerPanel.add(statusPanel,BorderLayout.NORTH);
|
|
||||||
// outerPanel.add(gamePanel,BorderLayout.CENTER);
|
|
||||||
// outerPanel.add(actionPanel,BorderLayout.SOUTH);
|
|
||||||
//
|
|
||||||
// frame.add(outerPanel);
|
|
||||||
// // Comment out for fullscreen
|
|
||||||
// frame.pack();
|
|
||||||
// frame.setVisible(true);
|
|
||||||
// frame.repaint();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * We need to use EQ for EDT
|
|
||||||
// *
|
|
||||||
// * TODO: add fullscreen mode
|
|
||||||
// */
|
|
||||||
// public static void main(String[] args) throws IOException, InterruptedException {
|
|
||||||
//
|
|
||||||
// EventQueue.invokeLater(new Runnable() {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// // GameInterface is static now.
|
|
||||||
// //GameInterface gameWindow = new GameInterface();
|
|
||||||
// GameInterface.createGUI();
|
|
||||||
//
|
|
||||||
// // Start game loop to add player, opponents, maps and everything you need
|
|
||||||
// GameLoop.startGameLoop();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static JPanel getGamePanel() {
|
|
||||||
// return gamePanel;
|
|
||||||
// }
|
|
||||||
// public static JPanel getStatusPanel() {
|
|
||||||
// return statusPanel;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
Reference in New Issue
Block a user