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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
package main
import t "tafl"
main :: proc() {
width, height : i32 = 1920, 1080
t.start_window(width, height, "tafl test")
for !t.window_should_close() {
if t.resized(){
width, height = t.get_window_size()
}
{
t.tafl( // ROOT tafl
sizing_width=t.FIXED(int(width)),
sizing_height=t.FIXED(int(height)),
layout=.LEFT_TO_RIGHT,
color=colors.background,
padding={5,5,5,5},
child_gap=5,
)
{ // Left bar
t.tafl(color=colors.panel_blackground,
sizing_height=t.GROW,
sizing_width=t.FIT,
layout=.TOP_TO_BOTTOM)
{t.tafl(color={0,0,0,0},
sizing_height=t.GROW,
sizing_width=t.GROW)}
{t.tafl(
padding={8,8,8,8},
child_gap=8,
color={.0, .0, .0, 0.4},
)
button("Yeet")
button("Test")
button("Render")
}
}
{ // Middle section
t.tafl(color=colors.panel_blackground,
sizing_width=t.GROW,
sizing_height=t.GROW,
position_horizontal=.MIDDLE,
position_vertical=.MIDDLE,
child_gap=5,
layout=.TOP_TO_BOTTOM,)
{// Red square
t.tafl(color={1,0,0,1},
sizing_width=t.FIXED(300),
sizing_height=t.FIXED(300),
padding={1,1,1,1},)
{
t.tafl(color={0,0,0,0.5},
sizing_width=t.GROW,
sizing_height=t.GROW)
}
}
{// Red square
t.tafl(color={1,0,0,1},
sizing_width=t.FIXED(200),
sizing_height=t.FIXED(200),
padding={1,1,1,1},)
{
t.tafl(color={0,0,0,0.5},
sizing_width=t.GROW,
sizing_height=t.GROW)
}
}
}
{ // Right bar
t.tafl(color=colors.panel_blackground,
sizing_width=t.FIXED(300),
sizing_height=t.GROW,
child_gap=20,
layout=.TOP_TO_BOTTOM)
{
{t.tafl(color={.5, .5, .5, 1},
sizing_height=t.FIXED(50),
sizing_width=t.GROW,
)}
{t.tafl(color={.5, .5, .5, 1},
sizing_height=t.FIXED(50),
sizing_width=t.GROW,
)}
{t.tafl(color={.5, .5, .8, 1},
sizing_height=t.GROW,
sizing_width=t.GROW,
)}
{t.tafl(color={.5, .5, .5, 1},
sizing_height=t.FIXED(50),
sizing_width=t.GROW,
)}
}
}
}
t.render()
}
}
button :: proc(text : string) {
t.tafl(sizing_width=t.FIXED(120),
sizing_height=t.FIXED(40),
color=colors.button_outline,
padding={2,2,2,2})
t.tafl(sizing_width=t.GROW,
sizing_height=t.GROW,
color={.1,.1,.1, 1},
position_horizontal=.MIDDLE,
position_vertical=.MIDDLE,)
t.tafl(text=text)
}
Color_Scheme :: struct {
background : t.Color,
panel_blackground : t.Color,
panel_border : t.Color,
button_outline : t.Color,
}
colors : Color_Scheme = {
background = {.1, .1, .1, 1},
panel_blackground = {.2, .2, .2, 1},
panel_border = {.35, .35, .35, 1},
button_outline = {.1, .5, 1, 1},
}
panel :: proc() {
}
|