Documentation ¶
Index ¶
- func LoadFace(file string, dpi float64, size float64) (font.Face, error)
- func LoadFaceBytes(file []byte, dpi float64, size float64) (font.Face, error)
- func SysKill()
- type ChangeScrollingRegionSeq
- type ConcurrentRW
- type CursorBackSeq
- type CursorDownSeq
- type CursorForwardSeq
- type CursorHorizontalSeq
- type CursorNextLineSeq
- type CursorPositionSeq
- type CursorPreviousLineSeq
- type CursorUpSeq
- type DeleteLineSeq
- type EmptyAdapter
- type EraseDisplaySeq
- type EraseLineSeq
- type FontWeight
- type Fonts
- type GridCell
- type InputAdapter
- type InsertLineSeq
- type KeyPress
- type MouseButton
- type MouseMotion
- type MouseWheel
- type RestoreCursorPositionSeq
- type SGRBgTrueColor
- type SGRBold
- type SGRFgTrueColor
- type SGRItalic
- type SGRReset
- type SGRUnsetBold
- type SGRUnsetItalic
- type SaveCursorPositionSeq
- type ScrollDownSeq
- type ScrollUpSeq
- type Window
- func (g *Window) Draw(screen *ebiten.Image)
- func (g *Window) Kill()
- func (g *Window) Layout(outsideWidth, outsideHeight int) (int, int)
- func (g *Window) PrintChar(r rune, fg, bg color.Color, weight FontWeight)
- func (g *Window) RecalculateBackgrounds()
- func (g *Window) ResetSGR()
- func (g *Window) Run(title string) error
- func (g *Window) SetBgPixels(x, y int, c color.Color)
- func (g *Window) SetShader(shader ...shader.Shader)
- func (g *Window) ShowTPS(val bool)
- func (g *Window) Update() error
- type WindowSize
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadFace ¶
LoadFace loads a font face from a file. The dpi and size are used to generate the font face. Supports ttf and otf.
Example: LoadFace("./fonts/Mono-Regular.ttf", 72.0, 16.0)
func LoadFaceBytes ¶ added in v0.0.4
LoadFaceBytes loads a font face from bytes. The dpi and size are used to generate the font face. The normal, bold, and italic files must be provided. Supports ttf and otf.
Types ¶
type ConcurrentRW ¶
type ConcurrentRW struct {
// contains filtered or unexported fields
}
ConcurrentRW is a concurrent read/write buffer via channels.
func NewConcurrentRW ¶
func NewConcurrentRW() *ConcurrentRW
NewConcurrentRW creates a new concurrent read/write buffer.
func (*ConcurrentRW) Read ¶
func (rw *ConcurrentRW) Read(p []byte) (n int, err error)
Read reads data from the buffer.
func (*ConcurrentRW) Run ¶
func (rw *ConcurrentRW) Run()
Run starts the concurrent read/write buffer.
type CursorBackSeq ¶
type CursorBackSeq struct {
Count int
}
type CursorDownSeq ¶
type CursorDownSeq struct {
Count int
}
type CursorForwardSeq ¶
type CursorForwardSeq struct {
Count int
}
type CursorHorizontalSeq ¶
type CursorHorizontalSeq struct {
Count int
}
type CursorNextLineSeq ¶
type CursorNextLineSeq struct {
Count int
}
type CursorPositionSeq ¶
type CursorPreviousLineSeq ¶
type CursorPreviousLineSeq struct {
Count int
}
type CursorUpSeq ¶
type CursorUpSeq struct {
Count int
}
type DeleteLineSeq ¶
type DeleteLineSeq struct {
Count int
}
type EmptyAdapter ¶
type EmptyAdapter struct{}
func NewEmptyAdapter ¶
func NewEmptyAdapter() *EmptyAdapter
func (*EmptyAdapter) HandleKeyPress ¶
func (e *EmptyAdapter) HandleKeyPress()
func (*EmptyAdapter) HandleMouseButton ¶
func (e *EmptyAdapter) HandleMouseButton(button MouseButton)
func (*EmptyAdapter) HandleMouseMotion ¶
func (e *EmptyAdapter) HandleMouseMotion(motion MouseMotion)
func (*EmptyAdapter) HandleMouseWheel ¶
func (e *EmptyAdapter) HandleMouseWheel(wheel MouseWheel)
func (*EmptyAdapter) HandleWindowSize ¶
func (e *EmptyAdapter) HandleWindowSize(size WindowSize)
type EraseDisplaySeq ¶
type EraseDisplaySeq struct {
Type int
}
type EraseLineSeq ¶
type EraseLineSeq struct {
Type int
}
type FontWeight ¶
type FontWeight byte
FontWeight is the weight of a font at a certain terminal cell.
const ( // FontWeightNormal is the default font weight. FontWeightNormal FontWeight = iota // FontWeightBold is a bold font weight. FontWeightBold // FontWeightItalic is an italic font weight. FontWeightItalic )
type Fonts ¶
func LoadFaces ¶
LoadFaces loads a set of fonts from files. The normal, bold, and italic files must be provided. The dpi and size are used to generate the font faces. Supports ttf and otf.
func LoadFacesBytes ¶ added in v0.0.4
func LoadFacesBytes(normal []byte, bold []byte, italic []byte, dpi float64, size float64) (Fonts, error)
LoadFacesBytes loads a set of fonts from bytes. The normal, bold, and italic files must be provided. The dpi and size are used to generate the font faces. Supports ttf and otf.
type InputAdapter ¶
type InputAdapter interface { HandleMouseButton(button MouseButton) HandleMouseMotion(motion MouseMotion) HandleMouseWheel(wheel MouseWheel) HandleKeyPress() HandleWindowSize(size WindowSize) }
type InsertLineSeq ¶
type InsertLineSeq struct {
Count int
}
type MouseButton ¶
type MouseMotion ¶
type MouseWheel ¶
type RestoreCursorPositionSeq ¶
type RestoreCursorPositionSeq struct{}
type SGRBgTrueColor ¶
type SGRBgTrueColor struct {
R, G, B byte
}
type SGRFgTrueColor ¶
type SGRFgTrueColor struct {
R, G, B byte
}
type SGRUnsetBold ¶
type SGRUnsetBold struct{}
type SGRUnsetItalic ¶
type SGRUnsetItalic struct{}
type SaveCursorPositionSeq ¶
type SaveCursorPositionSeq struct{}
type ScrollDownSeq ¶
type ScrollDownSeq struct {
Count int
}
type ScrollUpSeq ¶
type ScrollUpSeq struct {
Count int
}
type Window ¶
func NewGame ¶
func NewGame(width int, height int, fonts Fonts, tty io.Reader, adapter InputAdapter, defaultBg color.Color) (*Window, error)
NewGame creates a new terminal game with the given dimensions and font faces.
func (*Window) PrintChar ¶
func (g *Window) PrintChar(r rune, fg, bg color.Color, weight FontWeight)
PrintChar prints a character to the screen.
func (*Window) RecalculateBackgrounds ¶
func (g *Window) RecalculateBackgrounds()
RecalculateBackgrounds syncs the background colors to the background pixels.
func (*Window) ResetSGR ¶
func (g *Window) ResetSGR()
ResetSGR resets the SGR attributes to their default values.
func (*Window) SetBgPixels ¶
SetBgPixels sets a chunk of background pixels in the size of the cell.
func (*Window) SetShader ¶ added in v0.0.2
SetShader sets a shader that is applied to the whole screen.