mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-08 23:07:46 +07:00
Implemented frame delta with time steps
This commit is contained in:
@ -35,6 +35,7 @@ public class BIK {
|
||||
final int width;
|
||||
final int height;
|
||||
final float fps;
|
||||
final float delta;
|
||||
final int flags;
|
||||
final int numTracks;
|
||||
final BinkAudio[] tracks;
|
||||
@ -96,7 +97,8 @@ public class BIK {
|
||||
}
|
||||
|
||||
fps = (float) fpsDividend / fpsDivisor;
|
||||
log.trace("fps: {} fps", fps);
|
||||
delta = 1 / fps;
|
||||
log.trace("fps: {} fps ({}s)", fps, delta);
|
||||
|
||||
flags = in.read32();
|
||||
if (log.traceEnabled()) log.tracef("flags: 0x%08x (%s)", flags, getFlagsString());
|
||||
|
@ -9,6 +9,8 @@ public class VideoPlayer implements Disposable {
|
||||
private BIK bik;
|
||||
private AudioDevice[] audio;
|
||||
private float[][][] out;
|
||||
private int frame;
|
||||
private float time, nextFrame;
|
||||
|
||||
public VideoPlayer() {
|
||||
|
||||
@ -35,9 +37,12 @@ public class VideoPlayer implements Disposable {
|
||||
|
||||
}
|
||||
|
||||
int f = 0;
|
||||
public void update(float delta) {
|
||||
bik.decode(f++, audio, out[0]);
|
||||
time += delta;
|
||||
if (time > nextFrame) {
|
||||
nextFrame += bik.delta;
|
||||
bik.decode(frame++, audio, out[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(Batch batch) {
|
||||
|
Reference in New Issue
Block a user