-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathoverview.bas
More file actions
115 lines (112 loc) · 3.48 KB
/
overview.bas
File metadata and controls
115 lines (112 loc) · 3.48 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
rem adapted from love-nuklear example, see: https://github.com/keharriso/love-nuklear.git
rem An overview of most of the supported widgets.
option predef grmode 850x600
import nuklear as nk
local checkA = {value: false}
local checkB = {value: true}
local radio = {value: "A"}
local selectA = {value: false}
local selectB = {value: true}
local slider = {value: 0.2}
local progress = {value: 5}
local colorPicker = {value: "#ff0000"}
local property = {value: 6}
local edit = {value: "Edit text"}
local comboA = {value: 1, items: ["A", "B", "C"]}
while 1
if nk.windowBegin("Overview", 10, 10, "100% - 20", "100% - 20") then
nk.menubarBegin()
nk.layoutRow("dynamic", 30, 1)
if nk.menuBegin("Menu", nil, 120, 120) then
nk.layoutRow("dynamic", 30, 1)
if nk.menuItem("Item A") then
print "A"
endif
if nk.menuItem("Item B") then
print "B"
endif
if nk.menuItem("Item C") then
print "C"
endif
nk.menuEnd()
endif
nk.menubarEnd()
nk.layoutRow("dynamic", 500, 3)
nk.groupBegin("Group 1", "border")
nk.layoutRow("dynamic", 30, 1)
nk.label("Left label")
nk.label("Centered label", "centered")
nk.label("Right label", "right")
nk.label("Colored label", "left", "#ff0000")
nk.label("A very long wrapped label - The quick brown fox jumps over the ...", "right", "wrap")
if nk.treePush("tab", "Tree Tab") then
if nk.treePush("node", "Tree Node 1") then
nk.label("Label 1")
nk.treePop()
endif
if nk.treePush("node", "Tree Node 2") then
nk.label("Label 2")
nk.treePop()
endif
nk.treePop()
endif
nk.spacing(1)
if nk.button("Button") then
print("button pressed!")
endif
nk.spacing(1)
nk.checkbox("Checkbox A", checkA)
nk.checkbox("Checkbox B", checkB)
nk.groupEnd()
nk.groupBegin("Group 2", "border")
nk.layoutRow("dynamic", 30, 1)
nk.label("Radio buttons:")
nk.layoutRow("dynamic", 30, 3)
nk.radio("A", radio)
nk.radio("B", radio)
nk.radio("C", radio)
nk.layoutRow("dynamic", 30, 1)
nk.selectable("Selectable A", selectA)
nk.selectable("Selectable B", selectB)
nk.layoutRow("dynamic", 30, 1)
nk.label("Slider:")
nk.slider(1, progress, 10, .5)
nk.label("Progress:")
nk.progress(progress, 10, true)
nk.layoutRow("dynamic", 30, 2)
nk.spacing(2)
nk.label("Color picker:")
nk.button(colorPicker.value)
nk.layoutRow("dynamic", 90, 1)
nk.colorPicker(colorPicker)
nk.groupEnd()
nk.groupBegin("Group 3", "border")
nk.layoutRow("dynamic", 30, 1)
nk.property("Property", 0, property, 10, 0.25, 0.05)
nk.spacing(1)
nk.label("Edit:")
nk.layoutRow("dynamic", 90, 1)
nk.edit("box", edit)
nk.layoutRow("dynamic", 5, 1)
nk.spacing(1)
nk.layoutRow("dynamic", 30, 1)
nk.label("Combobox:")
nk.combobox(comboA)
nk.layoutRow("dynamic", 5, 1)
nk.spacing(1)
nk.layoutRow("dynamic", 30, 1)
if nk.widgetIsHovered() then
nk.tooltip("Test tooltip")
endif
[x, y, w, h] = nk.widgetBounds()
if nk.contextualBegin(100, 100, x, y, w, h) then
nk.layoutRow("dynamic", 30, 1)
nk.contextualItem("Item A")
nk.contextualItem("Item B")
nk.contextualEnd()
endif
nk.label("Contextual (Right click me)")
nk.groupEnd()
endif
nk.windowEnd()
wend