-
Notifications
You must be signed in to change notification settings - Fork 34
/
screen_palette.go
50 lines (43 loc) · 910 Bytes
/
screen_palette.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
package main
import (
"fmt"
"github.com/nsf/termbox-go"
)
type PaletteScreen int
func (screen *PaletteScreen) receiveEvents(input <-chan termbox.Event, output chan<- interface{}, quit <-chan bool) {
for {
do_quit := false
select {
case <-input:
output <- ScreenIndex(DATA_SCREEN_INDEX)
case <-quit:
do_quit = true
}
if do_quit {
break
}
}
}
func (screen *PaletteScreen) performLayout() {
}
func (screen *PaletteScreen) drawScreen(style Style) {
width, height := termbox.Size()
fg, bg := style.default_fg, style.default_bg
x, y := 2, 1
for color := 1; color <= 256; color++ {
if x+8 > width {
x = 2
y += 2
}
if y > height {
break
}
termbox.SetCell(x, y, ' ', 0, termbox.Attribute(color))
x++
termbox.SetCell(x, y, ' ', 0, termbox.Attribute(color))
x += 2
str := fmt.Sprintf("%3d", color)
x += drawStringAtPoint(str, x, y, fg, bg)
x += 2
}
}