-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrid.lua
More file actions
53 lines (47 loc) · 2 KB
/
Copy pathgrid.lua
File metadata and controls
53 lines (47 loc) · 2 KB
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
local grid = {
WindowHeight = 1080 * 0.7,
WindowWidth = 1920 / 2 * 0.7,
WindowX = (love.graphics.getWidth() / 2) + ((1920 / 2 * 0.3) / 2),
WindowY = 200,
}
function grid:DrawGrid(topLeft, bottomRight, gridSize)
local width, height = love.graphics.getWidth(), love.graphics.getHeight()
local gridSize = gridSize or 100
local topLeft = topLeft or {0, 0}
local bottomRight = bottomRight or {width, height}
love.graphics.setColor(0.8, 0.8, 0.8, 0.4)
for x = topLeft[1], bottomRight[1], gridSize do
love.graphics.line(x, topLeft[2], x, bottomRight[2])
end
for y = topLeft[2], bottomRight[2], gridSize do
love.graphics.line(topLeft[1], y, bottomRight[1], y)
end
love.graphics.setColor(1, 1, 1, 1)
end
function grid:DrawGridWindow()
self:DrawGrid({self.WindowX, self.WindowY}, {self.WindowX + self.WindowWidth, self.WindowY + self.WindowHeight}, 40)
end
function grid:DrawWindow()
Helpers.codeLeft = true
Helpers.bodyOffset = self.WindowY
love.graphics.setColor(Theme.White)
love.graphics.rectangle("line", self.WindowX, self.WindowY, self.WindowWidth, self.WindowHeight)
if Level.loaded then
love.graphics.push()
-- offset the drawing to the window's position
love.graphics.translate(self.WindowX, self.WindowY)
love.graphics.setScissor(self.WindowX, self.WindowY, self.WindowWidth, self.WindowHeight)
Level:Draw()
love.graphics.setScissor()
love.graphics.pop()
end
end
function grid:DrawWindowEdges()
-- draw the background around the window to prevent the ball from being seen outside the window
love.graphics.setColor(Theme.Background)
-- Draw left of the window
love.graphics.rectangle("fill", love.graphics.getWidth() / 2, self.WindowY, self.WindowX - (love.graphics.getWidth() / 2), love.graphics.getHeight())
--- Draw right of the window
love.graphics.rectangle("fill", self.WindowX + self.WindowWidth, self.WindowY, love.graphics.getWidth(), love.graphics.getHeight())
end
return grid