-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_debug.lua
52 lines (44 loc) · 1.18 KB
/
game_debug.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
local game_debug = {}
Party = require "party"
Gui = require "gui"
conf = require "conf"
local map_name = ""
local debug_text = ""
local is_debug= false
local party = 0
local worldScreen = 0
function game_debug:new(newParty,newWorldScreen)
party = newParty
worldScreen = worldScreen
end
function game_debug:prepareDebugText(debug_party)
love.graphics.setFont(Gui.font)
debug_text = "Map name: " .. map_name .. "\n" ..
"Party location, X: " .. debug_party:getX() .. ", Y: " .. debug_party:getY() .. "\n" ..
"Party direction: " .. debug_party:getDirection()
end
function game_debug:print_message()
love.graphics.push()
love.graphics.scale(0.25)
love.graphics.setFont(Gui.font)
game_debug:prepareDebugText(party)
if is_debug == true then
love.graphics.print(debug_text,20,20)
for i=5,1,-1 do
love.graphics.print(table.concat(viewMatrix[i]),20,120-(i*10))
end
end
love.graphics.pop()
end
function game_debug:switchDebug()
if is_debug == false then
is_debug = true
love.graphics.setFont(Gui.font)
print("Info: Debug mode enabled!")
else
is_debug = false
love.graphics.setFont(Gui.font)
print("Info: Debug mode disabled!")
end
end
return game_debug