Skip to content

Commit

Permalink
Support for TimeDelta and TimeElapsed as procs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nycto committed Feb 5, 2024
1 parent ea22d4f commit c65ff0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/NecsusDemo.nim
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ proc simulate(
proc move(dt: TimeDelta, bodies: FullQuery[(ptr Position, ptr Velocity)]) =
## Moves all the bodies based on their velocity
for eid, (pos, vel) in bodies:
pos.position += vel.velocity * dt * 100
pos.position += vel.velocity * dt() * 100

proc cleanup(bodies: FullQuery[(ptr Position, )], screenSize: Shared[ScreenSize], delete: Delete) =
## Destroys any bodies that get too far off screen
Expand Down
2 changes: 1 addition & 1 deletion src/sdl2util.nim
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ template initialize*(screenSize: ScreenSize, window, renderer, code: untyped) =
raise

proc enforceFrameRate*(delta: TimeDelta) =
delay max(0, ((1 / 30) - delta) * 1000).uint32
delay max(0, ((1 / 30) - delta()) * 1000).uint32

proc exitGame*(exit: Shared[NecsusRun]) =
## A necsus system that uses SDL2 events to detect when to exit
Expand Down

0 comments on commit c65ff0f

Please sign in to comment.