counter screen and interval checking in main.go

This commit is contained in:
cuu
2018-12-06 16:05:26 +08:00
parent d596d71cbb
commit 47ff78e11d
14 changed files with 501 additions and 30 deletions

View File

@@ -22,6 +22,7 @@ type LabelInterface interface {
GetText() string
SetText(text string)
Draw()
DrawCenter(bold bool)
}
type Label struct {
@@ -87,6 +88,15 @@ func (self *Label) SetText(text string) {
self.Width,self.Height = font.Size(self.FontObj, self.Text)
}
func (self *Label) DrawCenter(bold bool) { // default bold is false
font.SetBold(self.FontObj,bold)
my_text := font.Render(self.FontObj,self.Text, true, self.Color, nil)
rect_ := draw.MidRect(self.PosX,self.PosY,self.Width,self.Height,Width,Height)
surface.Blit(self.CanvasHWND,my_text,rect_,nil)
}
func (self *Label) Draw() {
font.SetBold(self.FontObj,false) // avoing same font tangling set_bold to others