some inventory improvements

This commit is contained in:
anton.gurov
2019-11-19 17:25:24 +03:00
parent 0a6c642dc2
commit 25aad1c2f5
6 changed files with 201 additions and 132 deletions

View File

@ -97,6 +97,17 @@ func (layer Layer) PrintInside(rect types.Rect, text string, alignment int) (wid
return blt.PrintExt(rect.X + 2, rect.Y + 2, rect.W - 4, rect.H - 4, alignment, text)
}
func (layer Layer) PutStringInto(rect types.Rect, topOffset int, string string, alignment int) bool {
if len(string) > rect.W - 2 {
string = string[:rect.W-5]+"..."
}
if topOffset > rect.H - 2 {
return false
}
blt.PrintExt(rect.X + 2, rect.Y + topOffset, rect.W - 4, rect.H - 4, alignment, string)
return true
}
func (layer *Layer) Decorate(f func(args ...interface{})) func(args ...interface{}) {
return func(args ...interface{}) {
layer.before()