2020-06-28 21:40:52 -04:00
|
|
|
package d2interface
|
|
|
|
|
2020-07-06 21:26:08 -04:00
|
|
|
import "github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
|
2020-06-28 21:40:52 -04:00
|
|
|
|
2020-06-29 00:41:58 -04:00
|
|
|
// Terminal is a drop-down terminal and shell
|
|
|
|
// It is used throughout the codebase, most parts of the engine will
|
|
|
|
// `bind` commands, which are available for use in the shell
|
2020-06-28 21:40:52 -04:00
|
|
|
type Terminal interface {
|
|
|
|
BindLogger()
|
|
|
|
|
|
|
|
Advance(elapsed float64) error
|
2020-07-03 15:09:16 -04:00
|
|
|
OnKeyDown(event KeyEvent) bool
|
|
|
|
OnKeyChars(event KeyCharsEvent) bool
|
2020-06-29 00:41:58 -04:00
|
|
|
Render(surface Surface) error
|
2020-06-28 21:40:52 -04:00
|
|
|
Execute(command string) error
|
2020-07-06 21:26:08 -04:00
|
|
|
OutputRaw(text string, category d2enum.TermCategory)
|
2020-06-30 17:04:41 -04:00
|
|
|
Outputf(format string, params ...interface{})
|
|
|
|
OutputInfof(format string, params ...interface{})
|
|
|
|
OutputWarningf(format string, params ...interface{})
|
|
|
|
OutputErrorf(format string, params ...interface{})
|
2020-06-28 21:40:52 -04:00
|
|
|
OutputClear()
|
|
|
|
IsVisible() bool
|
|
|
|
Hide()
|
|
|
|
Show()
|
|
|
|
BindAction(name, description string, action interface{}) error
|
|
|
|
UnbindAction(name string) error
|
|
|
|
}
|
|
|
|
|
2020-06-29 00:41:58 -04:00
|
|
|
// TerminalLogger is used tomake the Terminal write out
|
|
|
|
// (eg. to the system shell or to a file)
|
2020-06-28 21:40:52 -04:00
|
|
|
type TerminalLogger interface {
|
|
|
|
Write(p []byte) (int, error)
|
|
|
|
}
|