-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhud.lua
65 lines (51 loc) · 2.04 KB
/
hud.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
hud = {}
hud.enabled = false
--open = love.joystick.open( 1 )
--print(open)
function hud.draw()
if hud.enabled then
-- Setting tilesizes
local tilewidth = 1
local tileheight = 1
if map.loaded then
tilewidth = map.loaded.tilewidth
tileheight = map.loaded.tileheight
end
physics.draw()
-- Entities
for i = 1, #entities.data do
love.graphics.setColor(255, 255, 255, 102)
-- love.graphics.rectangle("fill", entities.data[i].getX(), entities.data[i].getY(), 32, 32)
love.graphics.setColor(0, 255, 255, 255)
love.graphics.print(i, entities.data[i].getX(), entities.data[i].getY())
if entities.data[i].getDirection then
love.graphics.print(math.floor(entities.data[i].getDirection() + 0.5), entities.data[i].getX(), entities.data[i].getY() + 10)
end
end
-- Text background
love.graphics.setColor(0, 0, 0, 204)
love.graphics.rectangle("fill", camera.x, camera.y, 100, 82)
-- Text
love.graphics.setColor(0, 255, 0, 255)
love.graphics.print("FPS: "..love.timer.getFPS(), camera.x + 2, camera.y + 2)
if player then
love.graphics.print("Cord: "..player.getX()..":"..player.getY(), camera.x + 2, camera.y + 12)
love.graphics.print("Tile: "..math.floor( player.getX() / tilewidth + 0.5 )..":"..math.floor( player.getY() / tileheight + 0.5 ), camera.x + 2, camera.y + 22)
end
love.graphics.print("View: "..map.view.x..":"..map.view.y, camera.x + 2, camera.y + 32)
love.graphics.print("Buffer: "..buffer.length, camera.x + 2, camera.y + 42)
love.graphics.print("Physics: "..physics.world:getBodyCount(), camera.x + 2, camera.y + 52)
if love.joystick.getNumJoysticks() > 0 then
xisDir1, axisDir2, axisDirN = love.joystick.getAxes( 1 )
love.graphics.print(xisDir1, camera.x + 2, camera.y + 52)
love.graphics.print(axisDir2, camera.x + 2, camera.y + 62)
love.graphics.print(love.joystick.getNumAxes(1), camera.x + 2, camera.y + 72)
end
end
end
grid = {}
grid.width = 128
grid.height = 64
function grid.draw()
--for i = 1, 16, i++ do
end