add 50_Pico8

This commit is contained in:
cuu
2023-01-26 07:17:15 +00:00
parent 94b7bf121a
commit 9f70638d99
8 changed files with 225 additions and 16 deletions

View File

@@ -126,9 +126,9 @@ func Init() {
Fonts[keyname] = FontRW(fonts_data["noto"].Data, i)
}
*/
Fonts["notosanscjk12"] = FontRW(fonts_data["notocjk"].Data, 12)
Fonts["notosanscjk14"] = FontRW(fonts_data["notocjk"].Data, 14)
Fonts["notosanscjk15"] = FontRW(fonts_data["notocjk"].Data, 15)
Fonts["notosanscjk12"] = font.Font(fonts_path["notocjk"], 12)
Fonts["notosanscjk14"] = font.Font(fonts_path["notocjk"], 14)
Fonts["notosanscjk15"] = font.Font(fonts_path["notocjk"], 15)
//
keys_def_init()

View File

@@ -0,0 +1,44 @@
package UI
import (
"path/filepath"
)
type CommercialSoftwarePackage struct {
BinLocation string
MenuLocation string
}
func NewCommercialSoftwarePackage(b,m string) *CommercialSoftwarePackage{
return &CommercialSoftwarePackage{b,m}
}
func (self *CommercialSoftwarePackage) Init() {
script := filepath.Join(self.MenuLocation,"Setup.sh")
MakeExecutable(script)
script = filepath.Join(self.MenuLocation,"Run.sh")
MakeExecutable(script)
}
func (self *CommercialSoftwarePackage) IsInstalled() bool {
return FileExists(self.BinLocation)
}
func (self *CommercialSoftwarePackage) IsConfiged() bool {
return FileExists(filepath.Join(self.MenuLocation,".done"))
}
func (self *CommercialSoftwarePackage) GetRunScript() string {
return filepath.Join(self.MenuLocation,"Run.sh")
}
func (self *CommercialSoftwarePackage) RunSetup() {
if self.IsConfiged() == false {
script := filepath.Join(self.MenuLocation,"Setup.sh")
MakeExecutable(script)
System(script) /// Scripts with very short runtime
}
}

View File

@@ -55,7 +55,9 @@ type PluginConfig struct {
type MessageBox struct {
Label
Parent *MainScreen
Parent *sdl.Surface
ParentWidth int
ParentHeight int
HWND *sdl.Surface
}
@@ -66,7 +68,7 @@ func NewMessageBox() *MessageBox {
return m
}
func (self *MessageBox) Init(text string, font_obj *ttf.Font, col *color.Color) {
func (self *MessageBox) Init(text string, font_obj *ttf.Font, col *color.Color,w int, h int) {
if col != nil {
self.Color = col
}
@@ -76,9 +78,17 @@ func (self *MessageBox) Init(text string, font_obj *ttf.Font, col *color.Color)
self.Width = 0
self.Height = 0
self.CanvasHWND = surface.Surface(self.Parent.Width, self.Parent.Height)
self.HWND = self.Parent.CanvasHWND
if w == 0 || h == 0 {
self.CanvasHWND = surface.Surface(Width,Height)
self.ParentWidth = Width
self.ParentHeight = Height
}else{
self.CanvasHWND = surface.Surface(w,h)
self.ParentWidth = w
self.ParentHeight = h
}
self.HWND = self.Parent
}
@@ -94,7 +104,7 @@ func (self *MessageBox) Draw() {
words := strings.Split(self.Text, " ")
space, _ := font.Size(self.FontObj, " ")
max_width := self.Parent.Width - 40
max_width := self.ParentWidth - 40
x := 0
y := 0
@@ -130,7 +140,7 @@ func (self *MessageBox) Draw() {
self.Width = x
}
if lines >= self.Parent.Height-40 {
if lines >= self.ParentHeight-40 {
break
}
}
@@ -138,8 +148,8 @@ func (self *MessageBox) Draw() {
self.Height = lines
padding := 5
x = (self.Parent.Width - self.Width) / 2
y = (self.Parent.Height - self.Height) / 2
x = (self.ParentWidth - self.Width) / 2
y = (self.ParentHeight - self.Height) / 2
rect_ := rect.Rect(x-padding, y-padding, self.Width+padding*2, self.Height+padding*2)
@@ -147,7 +157,7 @@ func (self *MessageBox) Draw() {
draw.Rect(self.HWND, &color.Color{255, 255, 255, 255}, &rect_, 0)
rect__ := draw.MidRect(self.Parent.Width/2, self.Parent.Height/2, self.Width, self.Height, Width, Height)
rect__ := draw.MidRect(self.ParentWidth/2, self.ParentHeight/2, self.Width, self.Height, Width, Height)
dest_rect := rect.Rect(0, 0, self.Width, self.Height)
@@ -211,8 +221,8 @@ func (self *MainScreen) Init() {
self.CanvasHWND = surface.Surface(self.Width, self.Height)
self.MsgBox = NewMessageBox()
self.MsgBox.Parent = self
self.MsgBox.Init(" ", self.MsgBoxFont, &color.Color{83, 83, 83, 255})
self.MsgBox.Parent = self.CanvasHWND
self.MsgBox.Init(" ", self.MsgBoxFont, &color.Color{83, 83, 83, 255},self.Width,self.Height)
self.SkinManager = NewSkinManager()
self.SkinManager.Init()