-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvd.lua
More file actions
61 lines (61 loc) · 1.4 KB
/
Copy pathvd.lua
File metadata and controls
61 lines (61 loc) · 1.4 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
local config = loadConfig("vd")
local libv = {
grid = require("libv.grid"),
frame = require("libv.frame"),
buffer = require("libv.buffer"),
render = require("libv.render"),
platform = require("libv.platform")
}
local echo = kdprint("vd")
echo("starting server")
local Grid
Grid = libv.grid.Grid
local GRID
local _exp_0 = config.gridSize
if "screen" == _exp_0 then
GRID = Grid(libv.platform.getScreenSize())
else
GRID = Grid(config.gridSize[1], config.gridSize[2])
end
local Frame
Frame = libv.frame.Frame
local FRAME
local _exp_1 = config.frameSize
if "screen" == _exp_1 then
FRAME = Frame(libv.platform.getScreenSize())
else
FRAME = Frame(config.frameSize[1], config.frameSize[2])
end
local Reference
Reference = libv.grid.Reference
local newBuffer = Reference(GRID)
local capture
capture = libv.frame.capture
local newCapture = ((capture(FRAME))(GRID))
vrh = {
GRID = GRID,
FRAME = FRAME
}
local Buffer
Buffer = libv.buffer.Buffer
vrh.Window = function(def)
expect(1, def.x, {
"number"
}, "vrh.Window")
expect(2, def.y, {
"number"
}, "vrh.Window")
expect(3, def.d, {
"number"
}, "vrh.Window")
local x, y, d = def.x, def.y, def.d
def.x, def.y, def.d = nil, nil, nil
local window = Buffer(def)
newBuffer(x, y, d, window)
return window
end
vrh.render = function()
local screen = libv.frame.merge(newCapture(1, 1))
return libv.render.render(screen)
end
return PA_BREAK()