ui starting, menu screen, ingame help

This commit is contained in:
2019-11-08 03:36:26 +03:00
parent 4532320ce3
commit cb7718860a
11 changed files with 271 additions and 40 deletions

View File

@ -6,12 +6,12 @@ import (
)
type Layer struct {
idx int
Idx int
defaultColor uint32
}
func (layer *Layer) before() *Layer {
blt.Layer(layer.idx)
blt.Layer(layer.Idx)
return layer
}
@ -61,6 +61,7 @@ func (Layer *Layer) PutToBase(x,y int, symbol interface{}, fg uint32, bg uint32)
rnes := []rune(symbol.(string))
prevColor := uint32(blt.State(blt.TK_COLOR))
prevBgColor := uint32(blt.State(blt.TK_BKCOLOR))
blt.Layer(0)
blt.BkColor(bg)
blt.Color(fg)
if (len(rnes)) > 0 {
@ -87,7 +88,13 @@ func (layer Layer) Put(x, y int, symbol interface{}) {
}
func (layer Layer) Print(x, y int, txt string) (w, h int) {
return blt.Print(x, y, txt)
w, h = blt.Print(x, y, txt)
//blt.Layer(0)
return w, h
}
func (layer Layer) PrintInside(rect *types.Rect, text string, alignment int) (width int, height int) {
return blt.PrintExt(rect.X + 2, rect.Y + 2, rect.W - 4, rect.H - 4, alignment, text)
}
func (layer *Layer) Decorate(f func(args ...interface{})) func(args ...interface{}) {
@ -99,7 +106,10 @@ func (layer *Layer) Decorate(f func(args ...interface{})) func(args ...interface
}
func (layer *Layer) ClearRect(r *types.Rect) {
prevLayer := int(blt.State(blt.TK_LAYER))
blt.Layer(layer.Idx)
blt.ClearArea(r.X, r.Y, r.W, r.H)
blt.Layer(prevLayer)
}
func (layer *Layer) ClearArea(x,y,w,h int) {