-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDebugUi.lua
65 lines (48 loc) · 1.31 KB
/
DebugUi.lua
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
60
61
62
63
64
65
local DebugUi = {}
DebugUi.__index = DebugUi
suit = require "suit"
function DebugUi:create()
local result = {}
result.enabled = true
setmetatable(result, DebugUi)
result.showMatches = {checked = false, text = "Matches"}
result.showMoves = {checked = false, text = "Moves"}
result.fullscreen = {checked = false, text = "Fullscreen"}
result.numMoves = -1
return result
end
function DebugUi:update()
if not self.enabled then
return
end
love.graphics.setNewFont(14)
suit.layout:reset(10,10)
suit.layout:padding(10)
local w = 120
local h = 30
suit.Checkbox(self.showMatches, suit.layout:row(w,h))
suit.Checkbox(self.showMoves, suit.layout:row(w,h))
if suit.Checkbox(self.fullscreen, suit.layout:row(w,h)).hit then
love.window.setFullscreen(self.fullscreen.checked)
end
if suit.Button("Randomize", suit.layout:row(w,h)).hit then
self.randomize()
end
if suit.Button("Remove", suit.layout:row(w,h)).hit then
self.remove()
end
if suit.Button("Drop Old", suit.layout:row(w,h)).hit then
self.dropOld()
end
if suit.Button("Drop New", suit.layout:row(w,h)).hit then
self.dropNew()
end
if suit.Button("Find moves", suit.layout:row(w,h)).hit then
self.findMoves()
end
suit.Label("Moves: "..self.numMoves, suit.layout:row(w,h))
end
function DebugUi:render()
suit.draw()
end
return DebugUi