1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-18 02:16:23 -05:00
OpenDiablo2/d2core/d2ui/d2ui.go
gucio321 9ffbf1320c
D2core logger (#934)
* logger for d2audio & d2map

* logger for d2ui e.t.c

* d2inventory now passes on error messages

* no more importing log in d2core

* implemented #925

* added logger to part of d2networking & fixed "need to be changed" comments

* fixed lints

* fixed errors

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2020-11-21 02:33:22 -08:00

54 lines
1.2 KiB
Go

package d2ui
import (
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2interface"
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2asset"
)
// CursorButton represents a mouse button
type CursorButton uint8
const (
logPrefix = "UI Manager"
)
const (
// CursorButtonLeft represents the left mouse button
CursorButtonLeft CursorButton = 1
// CursorButtonRight represents the right mouse button
CursorButtonRight CursorButton = 2
)
// HorizontalAlign type, determines alignment along x-axis within a layout
type HorizontalAlign int
// Horizontal alignment types
const (
HorizontalAlignLeft HorizontalAlign = iota
HorizontalAlignCenter
HorizontalAlignRight
)
// NewUIManager creates a UIManager instance with the given input and audio provider
func NewUIManager(
asset *d2asset.AssetManager,
renderer d2interface.Renderer,
input d2interface.InputManager,
l d2util.LogLevel,
audio d2interface.AudioProvider,
) *UIManager {
ui := &UIManager{
asset: asset,
renderer: renderer,
inputManager: input,
audio: audio,
}
ui.Logger = d2util.NewLogger()
ui.Logger.SetPrefix(logPrefix)
ui.Logger.SetLevel(l)
return ui
}