1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-15 20:15:24 +00:00
OpenDiablo2/d2common/d2interface/terminal.go

59 lines
1.2 KiB
Go
Raw Normal View History

2020-06-29 01:40:52 +00:00
package d2interface
import (
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2input"
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2render"
)
type TermCategory int
const (
TermCategoryNone TermCategory = iota
TermCategoryInfo
TermCategoryWarning
TermCategoryError
)
const (
termCharWidth = 6
termCharHeight = 16
termRowCount = 24
termRowCountMax = 32
termColCountMax = 128
termAnimLength = 0.5
)
type termVis int
const (
termVisHidden termVis = iota
termVisShowing
termVisShown
termVisHiding
)
type Terminal interface {
BindLogger()
Advance(elapsed float64) error
OnKeyDown(event d2input.KeyEvent) bool
OnKeyChars(event d2input.KeyCharsEvent) bool
Render(surface d2render.Surface) error
Execute(command string) error
OutputRaw(text string, category TermCategory)
Output(format string, params ...interface{})
OutputInfo(format string, params ...interface{})
OutputWarning(format string, params ...interface{})
OutputError(format string, params ...interface{})
OutputClear()
IsVisible() bool
Hide()
Show()
BindAction(name, description string, action interface{}) error
UnbindAction(name string) error
}
type TerminalLogger interface {
Write(p []byte) (int, error)
}