Skip to content

Commit 816ef6d

Browse files
Changed Engine loop
1 parent 031b6fe commit 816ef6d

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

engine/Engine.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ internal static void Start()
6767

6868
// Phase 2: Game logic and physics update
6969
GameTimeAccumulator += DeltaTime;
70-
// while (GameTimeAccumulator >= FixedDeltaTime)
71-
// {
72-
GameSystems?.BeforeUpdate(in FixedDeltaTime);
73-
GameSystems?.Update(in FixedDeltaTime);
74-
GameSystems?.AfterUpdate(in FixedDeltaTime);
75-
GameTimeAccumulator -= FixedDeltaTime;
76-
// }
70+
while (GameTimeAccumulator >= FixedDeltaTime)
71+
{
72+
GameSystems?.BeforeUpdate(in FixedDeltaTime);
73+
GameSystems?.Update(in FixedDeltaTime);
74+
GameSystems?.AfterUpdate(in FixedDeltaTime);
75+
GameTimeAccumulator -= FixedDeltaTime;
76+
}
7777

7878
// Phase 3: Physics simulation
7979
// PhysicsSystems?.SimulatePhysics(in FixedDeltaTime);
@@ -86,19 +86,19 @@ internal static void Start()
8686

8787
// Phase 6: Rendering
8888
FrameTimeAccumulator += DeltaTime;
89-
// while (FrameTimeAccumulator >= 1.0 / FrameRate)
90-
// {
91-
RenderSystems?.BeforeUpdate(in FixedDeltaTime);
92-
RenderSystems?.Update(in FixedDeltaTime);
93-
RenderSystems?.AfterUpdate(in FixedDeltaTime);
94-
95-
if (RenderSystems?.Count() > 0)
89+
while (FrameTimeAccumulator >= 1.0 / FrameRate)
9690
{
97-
Bgfx.bgfx.frame(false);
98-
}
91+
RenderSystems?.BeforeUpdate(in FixedDeltaTime);
92+
RenderSystems?.Update(in FixedDeltaTime);
93+
RenderSystems?.AfterUpdate(in FixedDeltaTime);
94+
95+
if (RenderSystems?.Count() > 0)
96+
{
97+
Bgfx.bgfx.frame(false);
98+
}
9999

100-
FrameTimeAccumulator -= 1.0 / FrameRate;
101-
// }
100+
FrameTimeAccumulator -= 1.0 / FrameRate;
101+
}
102102

103103
// Phase 7: Audio rendering
104104
// AudioSystems?.Render(in FixedDeltaTime);

0 commit comments

Comments
 (0)