Compare commits
No commits in common. "fb3a988375a20aaa4e1b5c8f598accd28af6fe7f" and "0bc2be66b391aa9a8a78ee987df4c0b56434235c" have entirely different histories.
fb3a988375
...
0bc2be66b3
|
@ -1,62 +0,0 @@
|
||||||
package com.danitheskunk.skunkworks;
|
|
||||||
|
|
||||||
|
|
||||||
import com.danitheskunk.skunkworks.audio.AudioEngine;
|
|
||||||
import com.danitheskunk.skunkworks.gfx.Color;
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
|
||||||
|
|
||||||
public abstract class GameSkunkAdvance {
|
|
||||||
protected BaseGamepad gamepad;
|
|
||||||
private AudioEngine audioEngine;
|
|
||||||
private Engine engine;
|
|
||||||
private IWindow window;
|
|
||||||
|
|
||||||
public GameSkunkAdvance(String title) {
|
|
||||||
engine = new Engine();
|
|
||||||
window = engine.openWindow(new Vec2i(304, 176), title);
|
|
||||||
window.setScaler("integer");
|
|
||||||
window.setWindowSize(new Vec2i(1280, 720));
|
|
||||||
gamepad = window.getGamepad(0);
|
|
||||||
audioEngine = new AudioEngine(48000, 256, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
double lastTime, currentTime, delta, currentFrameTime;
|
|
||||||
|
|
||||||
currentFrameTime = 0;
|
|
||||||
|
|
||||||
lastTime = GLFW.glfwGetTime();
|
|
||||||
while(!window.shouldClose()) {
|
|
||||||
currentTime = GLFW.glfwGetTime();
|
|
||||||
delta = currentTime - lastTime;
|
|
||||||
lastTime = currentTime;
|
|
||||||
currentFrameTime += delta;
|
|
||||||
engine.tick();
|
|
||||||
window.tick();
|
|
||||||
gamepad.tick();
|
|
||||||
//todo: frame rate control
|
|
||||||
if(currentFrameTime >= 1.0 / 60.0) {
|
|
||||||
update();
|
|
||||||
var p2d = window.getPipeline2D();
|
|
||||||
window.startFrame();
|
|
||||||
p2d.startFrame();
|
|
||||||
p2d.getRenderContext().clear(Color.WHITE);
|
|
||||||
//render(p2d.getRenderContext());
|
|
||||||
p2d.finishFrame();
|
|
||||||
window.finishFrame();
|
|
||||||
currentFrameTime -= 1.0 / 60.0;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
Thread.sleep(1);
|
|
||||||
} catch(InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
audioEngine.refill();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void update() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.danitheskunk.skunkworks;
|
|
||||||
|
|
||||||
public class TestGSA extends GameSkunkAdvance {
|
|
||||||
public TestGSA() {
|
|
||||||
super("Game Skunk Advance Test");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new TestGSA().run();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -70,10 +70,6 @@ class TextureAtlas {
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int height;
|
int height;
|
||||||
|
|
||||||
if(textures.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
textures.sort(new TextureHeightComparator().reversed());
|
textures.sort(new TextureHeightComparator().reversed());
|
||||||
height = textures.get(0).getImg().getHeight();
|
height = textures.get(0).getImg().getHeight();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue