plugin test

This commit is contained in:
cuu
2018-09-18 18:10:44 +08:00
parent a1f49ad1d9
commit 74723955d9
5 changed files with 33 additions and 5 deletions

View File

@@ -103,9 +103,19 @@ func (self *MultiLabel) blit_text(surf *sdl.Surface,text string, pos_x,pos_y int
row_total_width := 0
lines := 0
for _,line := range words[:4] {
tmp := words
if len(words) > 4 {
tmp = words[:4]
}
for _,line := range tmp {
word_height := 0
for _,word := range line[:12] {
tmp2 := line
if len(line) > 12 {
tmp2 = line[:12]
}
for _,word := range tmp2 {
word_surface := font.Render(fnt,word,true,self.Color,nil)
word_width := surface.GetWidth(word_surface)
word_height = surface.GetHeight(word_surface)

View File

@@ -1,6 +1,8 @@
package UI
import (
"fmt"
"github.com/veandco/go-sdl2/sdl"
// "github.com/veandco/go-sdl2/ttf"
@@ -31,6 +33,7 @@ type ListScroller struct{
func NewListScroller() *ListScroller {
l := &ListScroller{}
l.Width = 7
l.Color = &color.Color{131,199,219,255} // SkinManager().GiveColor('Front')
return l
}
@@ -81,7 +84,10 @@ func (self *ListScroller) Draw() {
w_,h_ := self.Parent.Size()
start_rect := draw.MidRect(self.PosX+self.StartX,self.StartY+self.Value,self.Width,self.Height,w_,h_)
draw.AARoundRect(self.CanvasHWND,start_rect,self.Color,3,0,self.Color)
if self.Width < 1 {
fmt.Println("ListScroller width error")
}else {
draw.AARoundRect(self.CanvasHWND,start_rect,self.Color,3,0,self.Color)
}
}