Documentation
¶
Overview ¶
Package window is a desktop window as a terminal.Host, drawn by glyph.Raster. On X11, under Linux and FreeBSD, Xlib opens it and EGL shows each frame as one texture, through GLES 2 or desktop OpenGL, all loaded at run time with purego; on Windows it is a Win32 window and GDI shows the frame. Neither needs cgo. Ctrl with =, - or the wheel zooms within Config.Zoom; Ctrl with 0 undoes the zoom.
Index ¶
- type Config
- type Window
- func (w *Window) Blocked() time.Duration
- func (w *Window) Cell() float64
- func (w *Window) Close()
- func (w *Window) ColorMode() terminal.ColorMode
- func (w *Window) Events() <-chan terminal.Event
- func (w *Window) Flush(cells []terminal.Cell, width, height int)
- func (w *Window) SetKeyReport(report terminal.KeyReport, allow terminal.KeySource) error
- func (w *Window) SetPointerMode(enabled, motion bool)
- func (w *Window) Size() (cols, rows int)
- func (w *Window) Sync()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Title string
Font *glyph.Font
Cols, Rows int
Scale int
// Cell is the zoom the window opens at, a cell's height in dp of Scale pixels,
// 0 for the font's own, its largest strike's; Zoom is the range its player's
// zoom keeps to, the zero Zoom none
Cell float64
Zoom glyph.Zoom
// Maximized or Fullscreen is the state the window opens in, on X11 asked of the
// window manager; the grid follows the size that gives, as it follows any resize.
// Windows has no manager to toggle full screen: F11 and Alt+Enter do there.
Maximized, Fullscreen bool
}
Config is the window as it opens: its title, the font cells are drawn with, the grid it is sized for and the window pixels a pixel of the font's largest strike covers each way, at least 1, which Windows multiplies by its display's scale
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window is a terminal.Host over a window of the platform's. Frames, Sync and the pointer mode may be set from any goroutine; one locked OS thread owns the window and what draws in it. Its close button posts terminal.EventClosed and leaves it open: Close, which the Fini of NewWithHost's Terminal calls, closes it. On Windows Ctrl-Shift-V and Shift-Insert post the clipboard's text as a paste.
func Open ¶
Open opens the window and starts its thread; it returns once the window is placed on screen, so Size is the grid it then holds
func (*Window) Cell ¶
Cell is the zoom the player left the window at, a cell's height in dp, 0 for the font's own, which a program keeps for the next run
func (*Window) Close ¶
func (w *Window) Close()
Close stops the thread and releases the window and what draws in it
func (*Window) Flush ¶
Flush posts a frame; the window draws the newest one it holds when it is free
func (*Window) SetKeyReport ¶
SetKeyReport asks for each key's release, which the window answers with an EventKeyReport: presses alone on an X server that repeats a held key as releases and presses, since those can't be told from the player's own
func (*Window) SetPointerMode ¶
SetPointerMode selects the pointer events posted: none, buttons and drags, or every motion as well