Fertig zum testen...

This commit is contained in:
andreas
2014-11-01 22:53:14 +01:00
parent 2f51160bf1
commit 16ce45ca12
4 changed files with 18 additions and 11 deletions
@@ -39,12 +39,11 @@ public class DynamicObject extends JComponent{
g2d.drawImage(bf1, 0, 0, this); g2d.drawImage(bf1, 0, 0, this);
//g2d.setStroke(new BasicStroke(8.0f)); //g2d.setStroke(new BasicStroke(8.0f));
g2d.finalize(); g2d.finalize();
System.out.println("paintComponent");
} }
private void loadBufferedImage() { private void loadBufferedImage() {
try { try {
this.bf1 = ImageIO.read(new File("src/de/heatup/resources/images/dummy_image.png")); this.bf1 = ImageIO.read(new File("src/de/heatup/resources/images/little_green_guy.png"));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
+1
View File
@@ -6,6 +6,7 @@ import java.util.Random;
/* /*
* Static class for opponent movement still quick n' dirty * Static class for opponent movement still quick n' dirty
* TODO: Move to other package ex. AI
*/ */
public class logic { public class logic {
+11 -1
View File
@@ -1,19 +1,29 @@
package de.heatup.testing; package de.heatup.testing;
import de.heatup.mapengine.MapEngine; import de.heatup.mapengine.MapEngine;
import de.heatup.objects.DynamicObject;
import de.heatup.objects.StaticObject; import de.heatup.objects.StaticObject;
import de.heatup.objects.logic;
import de.heatup.ui.GameInterface; import de.heatup.ui.GameInterface;
public class GameLoop { public class GameLoop {
public static void startGameLoop() { public static void startGameLoop() {
DynamicObject dynO1 = new DynamicObject();
GameInterface.getGamePanel().add(dynO1);
MapEngine me = new MapEngine(1); MapEngine me = new MapEngine(1);
for (StaticObject currentStaticObject : me.getAllMapObjects()) { for (StaticObject currentStaticObject : me.getAllMapObjects()) {
GameInterface.getGamePanel().add(currentStaticObject); GameInterface.getGamePanel().add(currentStaticObject);
} }
//GameInterface.getGamePanel().repaint();
//GameInterface.getGamePanel().setComponentZOrder(dynO1, 1);
//GameInterface.getGamePanel().add(dynO1);
logic.startMovement(dynO1);
} }
} }
+4 -7
View File
@@ -40,22 +40,22 @@ public class GameInterface extends JFrame {
outerPanel = new JPanel(); outerPanel = new JPanel();
outerPanel.setLayout(new BorderLayout()); outerPanel.setLayout(new BorderLayout());
outerPanel.setBorder(BorderFactory.createTitledBorder("outerPanel")); //outerPanel.setBorder(BorderFactory.createTitledBorder("outerPanel"));
outerPanel.setVisible(true); outerPanel.setVisible(true);
statusPanel = new JPanel(); statusPanel = new JPanel();
statusPanel.setLayout(new GridLayout(1,4)); statusPanel.setLayout(new GridLayout(1,4));
statusPanel.setPreferredSize(new Dimension(800,80)); statusPanel.setPreferredSize(new Dimension(800,80));
statusPanel.setBorder(BorderFactory.createTitledBorder("statusPanel")); //statusPanel.setBorder(BorderFactory.createTitledBorder("statusPanel"));
gamePanel = new JPanel(); gamePanel = new JPanel();
gamePanel.setLayout(null); gamePanel.setLayout(null);
gamePanel.setPreferredSize(new Dimension(800,600)); gamePanel.setPreferredSize(new Dimension(800,600));
gamePanel.setBorder(BorderFactory.createTitledBorder("gamePanel")); //gamePanel.setBorder(BorderFactory.createTitledBorder("gamePanel"));
actionPanel = new JPanel(); actionPanel = new JPanel();
actionPanel.setLayout(new GridLayout(1,1)); actionPanel.setLayout(new GridLayout(1,1));
actionPanel.setBorder(BorderFactory.createTitledBorder("actionPanel")); //actionPanel.setBorder(BorderFactory.createTitledBorder("actionPanel"));
actionPanel.setPreferredSize(new Dimension(800,80)); actionPanel.setPreferredSize(new Dimension(800,80));
@@ -65,9 +65,6 @@ public class GameInterface extends JFrame {
frame.add(outerPanel); frame.add(outerPanel);
frame.pack(); frame.pack();
frame.setVisible(true); frame.setVisible(true);
frame.repaint(); frame.repaint();