summaryrefslogtreecommitdiff
path: root/meta/3rd/lovr/library/lovr.timer.lua
blob: 4bcb02f1febbfdec22f4a734f1662c8106cb76ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---@meta

---
---The `lovr.timer` module provides a few functions that deal with time.
---
---All times are measured in seconds.
---
---@class lovr.timer
lovr.timer = {}

---
---Returns the average delta over the last second.
---
---@return number delta # The average delta, in seconds.
function lovr.timer.getAverageDelta() end

---
---Returns the time between the last two frames.
---
---This is the same value as the `dt` argument provided to `lovr.update`.
---
---
---### NOTE:
---The return value of this function will remain the same until `lovr.timer.step` is called.
---
---This function should not be used to measure times for game behavior or benchmarking, use `lovr.timer.getTime` for that.
---
---@return number dt # The delta time, in seconds.
function lovr.timer.getDelta() end

---
---Returns the current frames per second, averaged over the last 90 frames.
---
---@return number fps # The current FPS.
function lovr.timer.getFPS() end

---
---Returns the time since some time in the past.
---
---This can be used to measure the difference between two points in time.
---
---@return number time # The current time, in seconds.
function lovr.timer.getTime() end

---
---Sleeps the application for a specified number of seconds.
---
---While the game is asleep, no code will be run, no graphics will be drawn, and the window will be unresponsive.
---
---@param duration number # The number of seconds to sleep for.
function lovr.timer.sleep(duration) end

---
---Steps the timer, returning the new delta time.
---
---This is called automatically in `lovr.run` and it's used to calculate the new `dt` to pass to `lovr.update`.
---
---@return number delta # The amount of time since the last call to this function, in seconds.
function lovr.timer.step() end