gitignored yo!
parent
6ed1fdf427
commit
e289f1a5ff
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
@ -61,3 +61,8 @@ $RECYCLE.BIN/
|
|||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
/bin/
|
||||
|
||||
.classpath
|
||||
|
||||
.settings/org.eclipse.jdt.core.prefs
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
@ -7,6 +7,7 @@ import java.awt.Graphics;
|
|||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferStrategy;
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
|
@ -57,11 +58,14 @@ public class Engine extends Canvas {
|
|||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
this.requestFocus();
|
||||
this.addKeyListener(new Input());
|
||||
|
||||
createBufferStrategy(2);
|
||||
bs = getBufferStrategy();
|
||||
|
||||
while(true) {
|
||||
updateScene();
|
||||
repaint();
|
||||
try{
|
||||
Thread.sleep(17);
|
||||
|
|
@ -71,17 +75,21 @@ public class Engine extends Canvas {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateScene() {
|
||||
SceneManager.updateAll();
|
||||
}
|
||||
|
||||
private void loadConfig() throws Exception {
|
||||
|
||||
File configFile = null;
|
||||
try {
|
||||
configFile = new File(gameFolder + "\\build.config");
|
||||
configFile = new File(gameFolder + File.separatorChar + "build.config");
|
||||
} catch (Exception e) {
|
||||
throw new Exception("Configuration File not found");
|
||||
}
|
||||
|
||||
List<String> lines = Files.readAllLines(Paths.get(gameFolder, "build.config"));
|
||||
List<String> lines = Files.readAllLines(Paths.get(gameFolder, "build.config"), Charset.forName("UTF-8"));
|
||||
|
||||
for (String line : lines) {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package diveengine2d;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Input implements KeyListener{
|
||||
|
||||
private static boolean[] keys = new boolean[512];
|
||||
private static List<KeyListener> listeners = new ArrayList<KeyListener>();
|
||||
|
||||
public static void addKeyListener(KeyListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public static boolean getKeyDown(int keyCode) {
|
||||
return keys[keyCode];
|
||||
}
|
||||
|
||||
public static boolean getKeyUp(int keyCode) {
|
||||
return !keys[keyCode];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
keys[e.getKeyCode()] = true;
|
||||
for(KeyListener l : listeners) l.keyPressed(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
keys[e.getKeyCode()] = false;
|
||||
for(KeyListener l : listeners) l.keyReleased(e);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package diveengine2d;
|
||||
|
||||
public class RigidBody extends DiveScript{
|
||||
|
||||
public void update() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package diveengine2d;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -18,7 +19,7 @@ public class SceneManager {
|
|||
public static boolean loadScene(String scene) {
|
||||
synchronized(entities) {
|
||||
try{
|
||||
List<String> lines = Files.readAllLines(Paths.get(Engine.gameFolder, scene + ".scene"));
|
||||
List<String> lines = Files.readAllLines(Paths.get(Engine.gameFolder, scene + ".scene"), Charset.forName("UTF-8"));
|
||||
Stack<Object> scopeObject = new Stack<Object>();
|
||||
for (String line : lines) {
|
||||
//System.out.println(line);
|
||||
|
|
@ -152,4 +153,12 @@ public class SceneManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateAll() {
|
||||
for(Entity e : entities) {
|
||||
for(DiveScript script : e.components) {
|
||||
script.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue