still footbar can not draw

This commit is contained in:
cuu
2018-06-18 16:17:31 +08:00
parent 20ea392215
commit c9de67c78f
55 changed files with 3388 additions and 157 deletions

View File

@@ -1,15 +1,18 @@
package UI
import (
"github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/surface"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/font"
)
type LabelInterface interface {
Init( text string, font_obj *ttf.Font,col *color.Color )
SetCanvasHWND( canvas *sdl.Surface)
Coord() (int,int)
Size() (int,int)
NewCoord(x,y int)
@@ -31,7 +34,7 @@ type Label struct {
// TextSurf *sdl.Surface
}
func NewLabel() *Label() {
func NewLabel() *Label {
l := &Label{}
l.Color = &color.Color{83,83,83,255}
return l
@@ -51,6 +54,10 @@ func (self *Label) Init(text string, font_obj *ttf.Font,col *color.Color ) {
}
func (self *Label) SetCanvasHWND( canvas *sdl.Surface) {
self.CanvasHWND = canvas
}
func (self *Label) Coord() (int,int) {
return self.PosX,self.PosY
}
@@ -85,8 +92,8 @@ func (self *Label) Draw() {
font.SetBold(self.FontObj,false) // avoing same font tangling set_bold to others
my_text := font.Render(self.FontObj,self.Text, true, self.Color, nil)
rect_ := &rect.Rect{self.PosX,self.PosY,self.Width,self.Height}
rect_ := rect.Rect(self.PosX,self.PosY,self.Width,self.Height)
surface.Blit(self.CanvasHWND,my_text,rect_,nil)
surface.Blit(self.CanvasHWND,my_text,&rect_,nil)
}