-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
55 lines (40 loc) · 1.16 KB
/
doc.go
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
/*
Package dull is a text user interface library.
It provides a means of writing applications with
windows that display a grid of cells.
The windows bear a resemblance to terminal windows,
but the similarity is purely visual.
Example initialisation and window creation
func main() {
dull.Run(initialise)
}
func initialise(app *dull.Application, err error) {
if err != nil {
panic(err)
}
window, err := app.NewWindow(&dull.WindowOptions{})
if err != nil {
panic(err)
}
// put some text in the top left corner
window.Grid().PrintAt(0, 0, "some text")
// make the window visible
window.Show()
}
Threads
Because of the way that an underlying library (glfw) works,
almost all calls to dull functions should occur in the main thread.
All callbacks to functions provided to dull will occur on the main thread.
So it is safe to call any dull function in a callback.
A function may be run on the main thread by calling one of the Do... functions.
go func(window *dull.Window) {
c := 0
t := time.Tick(time.Second)
for range t {
window.Do(func() {
window.PrintAt(0, 2, fmt.Sprintf("count : %d", c++))
})
}
}(window)
*/
package dull