2020-01-25 23:28:21 -05:00
|
|
|
package d2term
|
|
|
|
|
|
|
|
import (
|
2020-07-06 21:26:08 -04:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
|
2020-06-30 17:04:41 -04:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2interface"
|
2020-01-25 23:28:21 -05:00
|
|
|
)
|
|
|
|
|
2020-07-13 20:29:17 -04:00
|
|
|
// New creates and initializes the terminal
|
|
|
|
func New(inputManager d2interface.InputManager) (d2interface.Terminal, error) {
|
2020-06-28 21:40:52 -04:00
|
|
|
term, err := createTerminal()
|
2020-01-25 23:28:21 -05:00
|
|
|
if err != nil {
|
2020-06-28 21:40:52 -04:00
|
|
|
return nil, err
|
2020-01-25 23:28:21 -05:00
|
|
|
}
|
|
|
|
|
2020-07-13 20:29:17 -04:00
|
|
|
if err := inputManager.BindHandlerWithPriority(term, d2enum.PriorityHigh); err != nil {
|
2020-06-28 21:40:52 -04:00
|
|
|
return nil, err
|
2020-02-09 14:12:04 -05:00
|
|
|
}
|
|
|
|
|
2020-06-28 21:40:52 -04:00
|
|
|
return term, nil
|
2020-02-09 14:12:04 -05:00
|
|
|
}
|