package mainwindow import "lab.zaar.be/thefish/alchemyst-go/engine/types" var noborder = types.RectFill{ Top: "▄", Bottom: "▀", Left: "▐", Right: "▌", TopLeft: "▗", TopRight: "▖", BottomLeft: "▝", BottomRight: "▘", Body: "█", } var splash = types.RectFill{ Top: "█", Bottom: "█", Left: "█", Right: "█", TopLeft: "█", TopRight: "█", BottomLeft: "█", BottomRight: "█", Body: "█", } var doubleBorder = types.RectFill{ Top: "═", Bottom: "═", Left: "║", Right: "║", TopLeft: "╔", TopRight: "╗", BottomLeft: "╚", BottomRight: "╝", } type UiWindow struct { *types.Rect layer *Layer fillage types.RectFill } func (layer *Layer) NewWindow(rect *types.Rect) *UiWindow { return &UiWindow{ Rect: rect, layer: layer, } } func (uiw *UiWindow) NoBorder() { uiw.Blit(noborder, uiw.layer) } func (uiw *UiWindow) Splash() { uiw.Blit(splash, uiw.layer) } func (uiw *UiWindow) DoubleBordered(title string) { uiw.Blit(doubleBorder, uiw.layer) if len(title) > (uiw.W - 2) { title = title[:(uiw.W - 2)] } centerX := uiw.X + (uiw.W / 2) uiw.layer.Print(centerX-(len(title)/2)-1, uiw.Y, "╡"+title+"╞") }