added slick util, trying to font
parent
874328be87
commit
f4436848f4
|
|
@ -4,7 +4,6 @@
|
|||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.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
|
||||
* @param g
|
||||
*/
|
||||
public void render(Graphics2D g) {}
|
||||
public void render() {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ public class Engine {
|
|||
Tests.run(g);
|
||||
bs.show();
|
||||
*/
|
||||
SceneManager.render();
|
||||
}
|
||||
|
||||
private void updateScene() {
|
||||
|
|
@ -218,7 +219,25 @@ public class Engine {
|
|||
|
||||
//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);
|
||||
glfwPollEvents();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import java.awt.Graphics2D;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.newdawn.slick.Color;
|
||||
|
||||
public class Entity {
|
||||
public float x = 0, y = 0, rotation = 0;
|
||||
public boolean enabled = true;
|
||||
|
|
@ -39,7 +41,10 @@ public class Entity {
|
|||
components.add(component);
|
||||
}
|
||||
|
||||
public void render(Graphics2D g) {
|
||||
if(DebugSettings.debugLevel > 0) g.drawString("" + x + ", " + y, x, y - 2);
|
||||
public void render() {
|
||||
//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(DiveScript script : e.components) {
|
||||
script.render(g);
|
||||
script.render();
|
||||
}
|
||||
e.render(g);
|
||||
e.render();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue