mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-06 11:34:15 -04:00
* fixed lint errors in button.go * fixed lint errors in checkbox.go * Removed d2ui singleton, fixed nearly all lint errors - Changed `UI` struct to `UIManager`, removed singleton - UI element provider functions are now methods of the UI Manager - Screens now use the UI manager to create UI elements - game panels in d2player now use the UI Manager to create UI elements - Only the UI manager knows about "widgets"; calls to `d2ui.AddWidget` in Screen instances have been removed * changed ui element provider methods from `Create` to `New`
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package d2screen
|
|
|
|
import (
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2interface"
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2ui"
|
|
)
|
|
|
|
// NewScreenManager creates a screen manager
|
|
func NewScreenManager(ui *d2ui.UIManager) *ScreenManager {
|
|
sm := &ScreenManager{
|
|
uiManager: ui,
|
|
}
|
|
|
|
return sm
|
|
}
|
|
|
|
// Screen is an exported interface
|
|
type Screen interface{}
|
|
|
|
// ScreenLoadHandler is an exported interface
|
|
type ScreenLoadHandler interface {
|
|
// OnLoad performs all necessary loading to prepare a screen to be shown such as loading assets, placing and binding
|
|
// of ui elements, etc. This loading is done asynchronously. The provided channel will allow implementations to
|
|
// provide progress via Error, Progress, or Done
|
|
OnLoad(loading LoadingState)
|
|
}
|
|
|
|
// ScreenUnloadHandler is an exported interface
|
|
type ScreenUnloadHandler interface {
|
|
OnUnload() error
|
|
}
|
|
|
|
// ScreenRenderHandler is an exported interface
|
|
type ScreenRenderHandler interface {
|
|
Render(target d2interface.Surface) error
|
|
}
|
|
|
|
// ScreenAdvanceHandler is an exported interface
|
|
type ScreenAdvanceHandler interface {
|
|
Advance(elapsed float64) error
|
|
}
|