mirror of
https://github.com/clockworkpi/LauncherGoDev.git
synced 2025-12-13 16:38:52 +01:00
plugin test
This commit is contained in:
parent
a1f49ad1d9
commit
74723955d9
Binary file not shown.
9
build.sh
Executable file
9
build.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
go build main.go
|
||||||
|
|
||||||
|
##HelloWorld
|
||||||
|
cd Menu/GameShell/HelloWorld/
|
||||||
|
go build -o HelloWorld.so -buildmode=plugin
|
||||||
|
cd -
|
||||||
|
|
||||||
@ -103,9 +103,19 @@ func (self *MultiLabel) blit_text(surf *sdl.Surface,text string, pos_x,pos_y int
|
|||||||
row_total_width := 0
|
row_total_width := 0
|
||||||
lines := 0
|
lines := 0
|
||||||
|
|
||||||
for _,line := range words[:4] {
|
tmp := words
|
||||||
|
if len(words) > 4 {
|
||||||
|
tmp = words[:4]
|
||||||
|
}
|
||||||
|
|
||||||
|
for _,line := range tmp {
|
||||||
word_height := 0
|
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_surface := font.Render(fnt,word,true,self.Color,nil)
|
||||||
word_width := surface.GetWidth(word_surface)
|
word_width := surface.GetWidth(word_surface)
|
||||||
word_height = surface.GetHeight(word_surface)
|
word_height = surface.GetHeight(word_surface)
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package UI
|
package UI
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/veandco/go-sdl2/sdl"
|
"github.com/veandco/go-sdl2/sdl"
|
||||||
// "github.com/veandco/go-sdl2/ttf"
|
// "github.com/veandco/go-sdl2/ttf"
|
||||||
|
|
||||||
@ -31,6 +33,7 @@ type ListScroller struct{
|
|||||||
|
|
||||||
func NewListScroller() *ListScroller {
|
func NewListScroller() *ListScroller {
|
||||||
l := &ListScroller{}
|
l := &ListScroller{}
|
||||||
|
l.Width = 7
|
||||||
l.Color = &color.Color{131,199,219,255} // SkinManager().GiveColor('Front')
|
l.Color = &color.Color{131,199,219,255} // SkinManager().GiveColor('Front')
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
@ -81,7 +84,10 @@ func (self *ListScroller) Draw() {
|
|||||||
w_,h_ := self.Parent.Size()
|
w_,h_ := self.Parent.Size()
|
||||||
|
|
||||||
start_rect := draw.MidRect(self.PosX+self.StartX,self.StartY+self.Value,self.Width,self.Height,w_,h_)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
test.go
5
test.go
@ -41,7 +41,7 @@ func run() int {
|
|||||||
fmt.Println(screen.Pitch)
|
fmt.Println(screen.Pitch)
|
||||||
fmt.Println( screen.BytesPerPixel() )
|
fmt.Println( screen.BytesPerPixel() )
|
||||||
|
|
||||||
img_surf := image.Load("skin/default/sys.go/gameshell/icons/roundcorners.png")
|
img_surf := image.Load("skin/default/sysgo/gameshell/icons/roundcorners.png")
|
||||||
|
|
||||||
|
|
||||||
fmt.Println("WxH: ", img_surf.W,img_surf.H)
|
fmt.Println("WxH: ", img_surf.W,img_surf.H)
|
||||||
@ -68,6 +68,9 @@ func run() int {
|
|||||||
rect2 := rect.Rect(3,120,200,30)
|
rect2 := rect.Rect(3,120,200,30)
|
||||||
draw.AARoundRect(screen,&rect2,&color.Color{0,213,222,255},10,0, &color.Color{0,213,222,255})
|
draw.AARoundRect(screen,&rect2,&color.Color{0,213,222,255},10,0, &color.Color{0,213,222,255})
|
||||||
|
|
||||||
|
rect3 := rect.Rect(300,12,7,200)
|
||||||
|
draw.AARoundRect(screen,&rect3,&color.Color{0,213,222,255},3,0, &color.Color{0,213,222,255})
|
||||||
|
|
||||||
font.Init()
|
font.Init()
|
||||||
|
|
||||||
font_path := "skin/default/truetype/NotoSansCJK-Regular.ttf"
|
font_path := "skin/default/truetype/NotoSansCJK-Regular.ttf"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user