intelliJ conversion
parent
54de4b5ee2
commit
0bd51788cb
|
|
@ -12,7 +12,7 @@ import java.nio.file.Files;
|
|||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Engine extends Canvas {
|
||||
public static String gameFolder = null;
|
||||
|
|
@ -20,11 +20,12 @@ public class Engine extends Canvas {
|
|||
public static String startScene = null;
|
||||
public static String name = null;
|
||||
public static BufferStrategy bs = null;
|
||||
public static boolean running = true;
|
||||
|
||||
public Engine(String gameFolder) {
|
||||
|
||||
// setup the folder
|
||||
this.gameFolder = gameFolder;
|
||||
Engine.gameFolder = gameFolder;
|
||||
|
||||
System.out.println("Engine started with folder " + gameFolder + " ...");
|
||||
|
||||
|
|
@ -57,7 +58,7 @@ public class Engine extends Canvas {
|
|||
this.setPreferredSize(new Dimension(WIDTH, HEIGHT));
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
this.requestFocus();
|
||||
this.addKeyListener(new Input());
|
||||
this.addMouseMotionListener(new Input());
|
||||
|
|
@ -67,9 +68,8 @@ public class Engine extends Canvas {
|
|||
bs = getBufferStrategy();
|
||||
|
||||
Time.nanos = System.nanoTime();
|
||||
|
||||
|
||||
while(true) {
|
||||
|
||||
while(running) {
|
||||
|
||||
Time.startTime = System.currentTimeMillis();
|
||||
if (System.currentTimeMillis() > Time.nextSecond) {
|
||||
|
|
@ -111,9 +111,8 @@ public class Engine extends Canvas {
|
|||
|
||||
private void loadConfig() throws Exception {
|
||||
|
||||
File configFile = null;
|
||||
try {
|
||||
configFile = new File(gameFolder + File.separatorChar + "build.config");
|
||||
new File(gameFolder + File.separatorChar + "build.config");
|
||||
} catch (Exception e) {
|
||||
throw new Exception("Configuration File not found");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,12 +93,15 @@ public class SceneManager {
|
|||
int intValue;
|
||||
try{
|
||||
intValue = Integer.parseInt(value);
|
||||
}catch(Exception e) {
|
||||
scopeObject.peek().getClass().getField(key).set(scopeObject.peek(), intValue);
|
||||
}catch(NoSuchFieldException e) {
|
||||
System.out.println(value + " isnt a property of " + ((DiveScript)scopeObject.peek()).name + "(" + scopeObject.peek() + ")");
|
||||
continue;
|
||||
}catch(NumberFormatException e) {
|
||||
System.out.println(value + " is not an int");
|
||||
continue;
|
||||
}
|
||||
|
||||
scopeObject.peek().getClass().getField(key).set(scopeObject.peek(), intValue);
|
||||
|
||||
}else if(value.endsWith("F") || value.endsWith("f")) {
|
||||
value = value.substring(0, value.length() - 1);
|
||||
|
||||
|
|
@ -168,7 +171,7 @@ public class SceneManager {
|
|||
}
|
||||
}catch(Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
return entities;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package diveengine2d;
|
||||
package diveengine2d.components;
|
||||
|
||||
import diveengine2d.DiveScript;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
|
||||
public class RectRenderer extends DiveScript{
|
||||
public class RectRenderer extends DiveScript {
|
||||
|
||||
public Color color = null;
|
||||
public int width, height;
|
||||
|
|
@ -1,9 +1,13 @@
|
|||
package diveengine2d;
|
||||
package diveengine2d.components;
|
||||
|
||||
import diveengine2d.DebugSettings;
|
||||
import diveengine2d.DiveScript;
|
||||
import diveengine2d.Time;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
public class RigidBody extends DiveScript{
|
||||
public class RigidBody extends DiveScript {
|
||||
|
||||
private static Color xAxisColor = new Color(244, 67, 54); //A500 red
|
||||
private static Color yAxisColor = new Color(33, 150, 243); //A500 blue
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package diveengine2d.components.ui;
|
||||
|
||||
import diveengine2d.DiveScript;
|
||||
|
||||
/**
|
||||
* Created by Marcus on 3/10/2016.
|
||||
*/
|
||||
public class Button extends DiveScript {
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue