-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
83 lines (60 loc) · 2.05 KB
/
main.lua
File metadata and controls
83 lines (60 loc) · 2.05 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
local argparse = require("argparse")
local Editor = require("gutter.editor.Editor")
local Slab = require("Slab")
function love.load(arg)
local parser = argparse("love <directory>", "Mesh and draw a CSG model")
parser:flag("--fullscreen", "Enable fullscreen mode")
parser:flag("--high-dpi", "Enable high DPI mode")
parser:option("--mesher", "Meshing algorithm"):args(1)
parser:option("--msaa", "Antialiasing samples"):args(1):convert(tonumber)
parser:argument("model", "Model filename"):args("?")
local parsedArgs = parser:parse(arg)
parsedArgs.mesher = parsedArgs.mesher or "surface-splatting"
if parsedArgs.mesher ~= "dual-contouring" and parsedArgs.mesher ~= "surface-splatting" then
print("Error: argument for option '--mesher' must be one of 'dual-contouring', 'surface-splatting'")
love.event.quit(1)
return
end
-- Disabled in conf.lua to avoid window flicker on early exit
require('love.window')
love.window.setTitle("Gutter")
love.window.setMode(800, 600, {
fullscreen = parsedArgs.fullscreen,
highdpi = parsedArgs.high_dpi,
minwidth = 800,
minheight = 600,
msaa = parsedArgs.msaa,
resizable = true,
})
love.graphics.setBackgroundColor(0.125, 0.125, 0.125, 1)
editor = Editor.new({}, parsedArgs)
Slab.SetINIStatePath(nil)
Slab.Initialize(arg)
end
function love.update(dt)
editor:update(dt)
end
function love.draw()
editor:draw()
end
function love.keypressed(key, scancode, isrepeat)
editor:keypressed(key, scancode, isrepeat)
end
function love.keyreleased(key, scancode)
editor:keyreleased(key, scancode)
end
function love.mousemoved(x, y, dx, dy, istouch)
editor:mousemoved(x, y, dx, dy, istouch)
end
function love.mousepressed(x, y, button, istouch, presses)
editor:mousepressed(x, y, button, istouch, presses)
end
function love.mousereleased(x, y, button, istouch, presses)
editor:mousereleased(x, y, button, istouch, presses)
end
function love.threaderror(thread, errorstr)
print("Thread error: " .. errorstr)
end
function love.wheelmoved(x, y)
editor:wheelmoved(x, y)
end