go fmt ./...

This commit is contained in:
cuu
2021-10-11 13:55:54 +08:00
parent 0fe6399441
commit 7382cc40b1
88 changed files with 10028 additions and 10478 deletions

View File

@@ -1,44 +1,39 @@
package UI
import (
"github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/surface"
)
type TextItemInterface interface{
IconItemInterface
type TextItemInterface interface {
IconItemInterface
GetBold() bool
SetBold(bold bool)
GetStr() string
}
type TextItem struct {
IconItem
Str string
Color *color.Color
Str string
Color *color.Color
FontObj *ttf.Font
Bold bool
Bold bool
}
func NewTextItem() *TextItem {
p := &TextItem{}
p.Align = ALIGN["VCenter"]
p.Color = &color.Color{83,83,83,255}
p.Color = &color.Color{83, 83, 83, 255}
p.MyType = ICON_TYPES["LETTER"]
p.Bold = false
p.Bold = false
return p
}
@@ -55,20 +50,19 @@ func (self *TextItem) GetStr() string {
}
func (self *TextItem) Draw() {
font.SetBold(self.FontObj,self.Bold)
font.SetBold(self.FontObj, self.Bold)
my_text := font.Render(self.FontObj,self.Str,true,self.Color,nil)
my_text := font.Render(self.FontObj, self.Str, true, self.Color, nil)
if surface.GetWidth(my_text) != self.Width {
self.Width = surface.GetWidth(my_text)
}
if surface.GetHeight(my_text) != self.Height {
self.Height = surface.GetHeight(my_text)
}
rect_ := draw.MidRect(self.PosX,self.PosY,self.Width,self.Height,Width,Height)
surface.Blit(self.Parent.GetCanvasHWND(),my_text,rect_,nil)
rect_ := draw.MidRect(self.PosX, self.PosY, self.Width, self.Height, Width, Height)
surface.Blit(self.Parent.GetCanvasHWND(), my_text, rect_, nil)
my_text.Free()
}