forked from LeenkxTeam/LNXSDK
moisesjpelaez - Physics Improvements
This commit is contained in:
parent
8d9f248d2f
commit
421463a642
@ -37,7 +37,7 @@ class App {
|
||||
function new(done: Void->Void) {
|
||||
done();
|
||||
kha.System.notifyOnFrames(render);
|
||||
kha.Scheduler.addTimeTask(update, 0, iron.system.Time.delta);
|
||||
kha.Scheduler.addTimeTask(update, 0, iron.system.Time.step);
|
||||
}
|
||||
|
||||
public static function reset() {
|
||||
@ -53,6 +53,8 @@ class App {
|
||||
static function update() {
|
||||
if (Scene.active == null || !Scene.active.ready) return;
|
||||
if (pauseUpdates) return;
|
||||
|
||||
iron.system.Time.update();
|
||||
|
||||
#if lnx_debug
|
||||
startTime = kha.Scheduler.realTime();
|
||||
@ -60,6 +62,14 @@ class App {
|
||||
|
||||
Scene.active.updateFrame();
|
||||
|
||||
|
||||
time += iron.system.Time.delta;
|
||||
|
||||
while (time >= iron.system.Time.fixedStep) {
|
||||
for (f in traitFixedUpdates) f();
|
||||
time -= iron.system.Time.fixedStep;
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
var l = traitUpdates.length;
|
||||
while (i < l) {
|
||||
@ -81,13 +91,6 @@ class App {
|
||||
l <= traitLateUpdates.length ? i++ : l = traitLateUpdates.length;
|
||||
}
|
||||
|
||||
time += iron.system.Time.realTime() - last;
|
||||
last = iron.system.Time.realTime();
|
||||
while (time >= iron.system.Time.fixedStep) {
|
||||
for (f in traitFixedUpdates) f();
|
||||
time -= iron.system.Time.fixedStep;
|
||||
}
|
||||
|
||||
if (onEndFrames != null) for (f in onEndFrames) f();
|
||||
|
||||
#if lnx_debug
|
||||
@ -117,7 +120,7 @@ class App {
|
||||
var frame = frames[0];
|
||||
framebuffer = frame;
|
||||
|
||||
iron.system.Time.update();
|
||||
iron.system.Time.render();
|
||||
|
||||
if (Scene.active == null || !Scene.active.ready) {
|
||||
render2D(frame);
|
||||
|
Loading…
x
Reference in New Issue
Block a user