-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.lua
More file actions
48 lines (36 loc) · 929 Bytes
/
main.lua
File metadata and controls
48 lines (36 loc) · 929 Bytes
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
love.graphics.setDefaultFilter("nearest", "nearest")
love.graphics.setBackgroundColor(0.75, 0.75, 0.75)
local Lovox = require("lovox")
local img = love.graphics.newImage("boat/texture.png")
local myVoxelBatch = Lovox.newVoxelBatch(img, 16, 256, "dynamic")
local myCamera = Lovox.newCamera()
for i = 1, 256 do
myVoxelBatch:add(i * 64, 100)
end
function love.update()
end
local function draw()
love.graphics.clear()
myVoxelBatch:draw()
end
function love.draw()
myCamera:renderTo(draw)
myCamera:render()
love.graphics.print(love.timer.getFPS())
end
function love.resize(w, h)
myCamera:resize(w, h)
end
function love.keypressed(key)
if key == "q" then
love.event.quit()
end
if key == "a" and myVoxelBatch:getCount() > 0 then
for i = 1, 16 do
myVoxelBatch:setTransformation(i, i * 64, 300)
end
end
if key == "d" then
myVoxelBatch:clear()
end
end