-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path2_interface.lua
More file actions
51 lines (44 loc) · 938 Bytes
/
2_interface.lua
File metadata and controls
51 lines (44 loc) · 938 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
49
50
51
--
-- ////\\\\
-- ////\\\\ TUTORIAL
-- ////\\\\ PART 2
-- \\\\////
-- \\\\//// INTERFACE
-- \\\\////
--
local viewport = { width = 128, height = 64 }
local focus = { x = 0, y = 0 }
-- Main
function init()
-- Render Style
screen.level(15)
screen.aa(0)
screen.line_width(1)
-- Center focus
focus.x = viewport.width/2
focus.y = viewport.height/2
-- Render
redraw()
end
-- Render
function draw_frame()
screen.rect(1, 1, viewport.width-1, viewport.height-1)
screen.stroke()
end
function draw_crosshair()
screen.move(focus.x,focus.y - 4)
screen.line(focus.x,focus.y - 2)
screen.move(focus.x - 4,focus.y)
screen.line(focus.x - 2,focus.y)
screen.move(focus.x,focus.y + 3)
screen.line(focus.x,focus.y + 1)
screen.move(focus.x + 3,focus.y)
screen.line(focus.x + 1,focus.y)
screen.stroke()
end
function redraw()
screen.clear()
draw_frame()
draw_crosshair()
screen.update()
end