Merge remote-tracking branch 'refs/remotes/origin/master' into LWJGL-Render-engine
commit
4abea448f8
|
|
@ -4,7 +4,6 @@
|
||||||
.mtj.tmp/
|
.mtj.tmp/
|
||||||
|
|
||||||
# Package Files #
|
# Package Files #
|
||||||
*.jar
|
|
||||||
*.war
|
*.war
|
||||||
*.ear
|
*.ear
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -27,5 +27,5 @@ public abstract class DiveScript {
|
||||||
* render method beeboop
|
* render method beeboop
|
||||||
* @param g
|
* @param g
|
||||||
*/
|
*/
|
||||||
public void render(Graphics2D g) {}
|
public void render() {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ public class Engine {
|
||||||
Tests.run(g);
|
Tests.run(g);
|
||||||
bs.show();
|
bs.show();
|
||||||
*/
|
*/
|
||||||
|
SceneManager.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateScene() {
|
private void updateScene() {
|
||||||
|
|
@ -218,7 +219,25 @@ public class Engine {
|
||||||
|
|
||||||
//glRotatef(50.f, 0.f, 0.f, 1.f);
|
//glRotatef(50.f, 0.f, 0.f, 1.f);
|
||||||
|
|
||||||
|
Time.startTime = System.currentTimeMillis();
|
||||||
|
if (System.currentTimeMillis() > Time.nextSecond) {
|
||||||
|
Time.nextSecond += 1000;
|
||||||
|
Time.FPS = Time.framesInCurrentSecond;
|
||||||
|
Time.framesInCurrentSecond = 0;
|
||||||
|
System.out.println("Timed Frames: " + Time.timedFramesCurrent);
|
||||||
|
System.out.println("Calculated Frames: " + Time.FPS);
|
||||||
|
Time.timedFramesCurrent = 0;
|
||||||
|
}
|
||||||
|
Time.framesInCurrentSecond++;
|
||||||
|
|
||||||
|
render();
|
||||||
|
updateScene();
|
||||||
|
Time.tickTime = (System.nanoTime() - Time.nanos)/16640000d;
|
||||||
|
Time.deltaTime = Time.tickTime * Time.timeScale;
|
||||||
|
Time.nanos = System.nanoTime();
|
||||||
|
// System.out.println("dTime: " + Time.deltaTime);
|
||||||
|
|
||||||
|
Time.timedFramesCurrent += Time.deltaTime;
|
||||||
|
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ import java.awt.Graphics2D;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.newdawn.slick.Color;
|
||||||
|
|
||||||
public class Entity {
|
public class Entity {
|
||||||
public float x = 0, y = 0, rotation = 0;
|
public float x = 0, y = 0, rotation = 0;
|
||||||
public boolean enabled = true;
|
public boolean enabled = true;
|
||||||
|
|
@ -39,7 +41,10 @@ public class Entity {
|
||||||
components.add(component);
|
components.add(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(Graphics2D g) {
|
public void render() {
|
||||||
if(DebugSettings.debugLevel > 0) g.drawString("" + x + ", " + y, x, y - 2);
|
//if(DebugSettings.debugLevel > 0) g.drawString("" + x + ", " + y, x, y - 2);
|
||||||
|
Color.white.bind();
|
||||||
|
|
||||||
|
Fonts.defaultFont.drawString(100, 50, "THE LIGHTWEIGHT JAVA GAMES LIBRARY", Color.yellow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package diveengine2d;
|
||||||
|
|
||||||
|
import java.awt.Font;
|
||||||
|
|
||||||
|
import org.newdawn.slick.TrueTypeFont;
|
||||||
|
|
||||||
|
public class Fonts {
|
||||||
|
public static TrueTypeFont defaultFont;
|
||||||
|
|
||||||
|
static {
|
||||||
|
|
||||||
|
Font awtFont = new Font("Times New Roman", Font.BOLD, 24);
|
||||||
|
defaultFont = new TrueTypeFont(awtFont, true);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -186,12 +186,12 @@ public class SceneManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void render(Graphics2D g) {
|
public static void render() {
|
||||||
for(Entity e : entities) {
|
for(Entity e : entities) {
|
||||||
for(DiveScript script : e.components) {
|
for(DiveScript script : e.components) {
|
||||||
script.render(g);
|
script.render();
|
||||||
}
|
}
|
||||||
e.render(g);
|
e.render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue