Skip to content

RattleyCooper/framecounter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

framecounter

Schedule code to run after/every X frames.

Install

nimble install https://github.com/RattleyCooper/framecounter

Example

import framecounter

type 
  Cat = ref object
    name: string

var clock = FrameCounter(fps: 60)

var scrubs = Cat(name: "Scrubs")
var shadow = Cat(name: "Shadow")

clock.run after(60) do():
  scrubs.name = "Not Scrubs"
  shadow.name = "Not Shadow"

var c = 0
clock.run every(30) do():
  echo "repeating"
  if c == 3:
    echo scrubs.name
    echo shadow.name
    quit(QuitSuccess)
  c += 1
  echo c

echo scrubs.name
echo shadow.name

var dt: float32 
# assume our delta time is being updated.
while true:
  # Do stuff like detecting inputs
  
  clock.tick() # tick frame counter.

About

Schedule code to run after/every X frames.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages