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-12-21 15:46:58 -05:00
|
|
|
Rawf(category d2enum.TermCategory, format string, params ...interface{})
|
|
|
|
Printf(format string, params ...interface{})
|
|
|
|
Infof(format string, params ...interface{})
|
|
|
|
Warningf(format string, params ...interface{})
|
|
|
|
Errorf(format string, params ...interface{})
|
|
|
|
Clear()
|
|
|
|
Visible() bool
|
2020-06-28 21:40:52 -04:00
|
|
|
Hide()
|
|
|
|
Show()
|
2020-12-21 15:46:58 -05:00
|
|
|
Bind(name, description string, arguments []string, fn func(args []string) error) error
|
|
|
|
Unbind(name ...string) error
|
2020-06-28 21:40:52 -04:00
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
}
|