Engine 0.0.4
Game engine in lua
Loading...
Searching...
No Matches
draw_fps.lua
Go to the documentation of this file.
1local function fps(self, show, x, y)
2 local s = 4
3 self.std.draw.color(0xFFFF00FF)
4 if show >= 1 then
5 self.std.draw.rect(0, x, y, 40, 24)
6 end
7 if show >= 2 then
8 self.std.draw.rect(0, x + 48, y, 40, 24)
9 end
10 if show >= 3 then
11 self.std.draw.rect(0, x + 96, y, 40, 24)
12 end
13 self.std.draw.color(0x000000FF)
14 self.std.draw.font('Tiresias', 16)
15 if show >= 3 then
16 local fps = self.std.math.floor and self.std.math.floor((1/self.game.dt) * 1000) or '--'
17 self.std.draw.text(x + s, y, fps)
18 s = s + 46
19 end
20 if show >= 1 then
21 self.std.draw.text(x + s, y, self.game.fps)
22 s = s + 46
23 end
24 if show >= 2 then
25 self.std.draw.text(x + s, y, self.game.fps_max)
26 s = s + 46
27 end
28end
29
30local function install(std, game, application)
31 std = std or {}
32 std.draw = std.draw or {}
33 std.draw.fps = function(show, x, y)
34 fps({std=std, game=game}, show, x, y)
35 end
36 return {
37 draw={
38 fps=std.draw.fps
39 }
40 }
41end
42
43local P = {
45}
46
47return P
local function fps(self, show, x, y)
local function install(std, game, application)
local application
Definition main.lua:16
local game
Definition main.lua:17
local std
Definition main.lua:18
local function draw(std, game)