Пример #1
0
func (s *Display) CleanUp() {
	ansi.ClearScreen()
	ansi.ShowCursor()
	ansi.SetForeground(ansi.BLACK)
	ansi.SetBackground(ansi.BRIGHT | ansi.WHITE)
	exec.Command("setfont").Run()
}
Пример #2
0
func (s *Display) drawFrame(screenData *types.Screen) {
	for y := 0; y < SCREEN_HEIGHT; y++ {
		for x := 0; x < SCREEN_WIDTH; x += 2 {
			c1 := screenData[y][x]
			c2 := screenData[y][x+1]

			var fg, bg int

			switch c1.Red {
			case 0:
				fg = ansi.BLACK
			case 96:
				fg = ansi.BLUE
			case 196:
				fg = ansi.CYAN
			case 235:
				fg = ansi.WHITE
			}

			switch c2.Red {
			case 0:
				bg = ansi.BLACK
			case 96:
				bg = ansi.BLUE
			case 196:
				bg = ansi.CYAN
			case 235:
				bg = ansi.WHITE
			}

			ansi.SetForeground(fg)
			ansi.SetBackground(bg)
			ansi.PutRune('▌', x/2+s.offX, y+s.offY)
		}
	}
}