forked from LeenkxTeam/LNXSDK
moisesjpelaez - Physics Improvements
This commit is contained in:
@ -37,7 +37,7 @@ class App {
|
|||||||
function new(done: Void->Void) {
|
function new(done: Void->Void) {
|
||||||
done();
|
done();
|
||||||
kha.System.notifyOnFrames(render);
|
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() {
|
public static function reset() {
|
||||||
@ -54,12 +54,22 @@ class App {
|
|||||||
if (Scene.active == null || !Scene.active.ready) return;
|
if (Scene.active == null || !Scene.active.ready) return;
|
||||||
if (pauseUpdates) return;
|
if (pauseUpdates) return;
|
||||||
|
|
||||||
|
iron.system.Time.update();
|
||||||
|
|
||||||
#if lnx_debug
|
#if lnx_debug
|
||||||
startTime = kha.Scheduler.realTime();
|
startTime = kha.Scheduler.realTime();
|
||||||
#end
|
#end
|
||||||
|
|
||||||
Scene.active.updateFrame();
|
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 i = 0;
|
||||||
var l = traitUpdates.length;
|
var l = traitUpdates.length;
|
||||||
while (i < l) {
|
while (i < l) {
|
||||||
@ -81,13 +91,6 @@ class App {
|
|||||||
l <= traitLateUpdates.length ? i++ : l = traitLateUpdates.length;
|
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 (onEndFrames != null) for (f in onEndFrames) f();
|
||||||
|
|
||||||
#if lnx_debug
|
#if lnx_debug
|
||||||
@ -117,7 +120,7 @@ class App {
|
|||||||
var frame = frames[0];
|
var frame = frames[0];
|
||||||
framebuffer = frame;
|
framebuffer = frame;
|
||||||
|
|
||||||
iron.system.Time.update();
|
iron.system.Time.render();
|
||||||
|
|
||||||
if (Scene.active == null || !Scene.active.ready) {
|
if (Scene.active == null || !Scene.active.ready) {
|
||||||
render2D(frame);
|
render2D(frame);
|
||||||
|
Reference in New Issue
Block a user