mirror of
https://github.com/clockworkpi/LauncherGoDev.git
synced 2026-03-19 10:22:41 +01:00
add 50_Pico8
This commit is contained in:
@@ -653,7 +653,7 @@ func (self *WareHouse) Click() {
|
||||
}
|
||||
if cur_li.Value["type"] == "pico8" && cur_li.ReadOnly == false {
|
||||
if UI.FileExists("/home/cpi/games/PICO-8/pico-8/pico8") {
|
||||
game_sh := "/home/cpi/launcher/Menu/GameShell/50_PICO-8/PICO-8.sh"
|
||||
game_sh := "/home/cpi/launchergo/Menu/GameShell/50_PICO-8/PICO-8.sh"
|
||||
self.Screen.RunEXE(game_sh) //pico8 manages its games self
|
||||
}
|
||||
}
|
||||
|
||||
111
Menu/GameShell/50_Pico8/game_page.go
Normal file
111
Menu/GameShell/50_Pico8/game_page.go
Normal file
@@ -0,0 +1,111 @@
|
||||
package Pico8
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cuu/gogame/event"
|
||||
"github.com/cuu/gogame/rect"
|
||||
"github.com/cuu/gogame/surface"
|
||||
"github.com/veandco/go-sdl2/ttf"
|
||||
|
||||
"github.com/cuu/gogame/color"
|
||||
|
||||
"github.com/clockworkpi/LauncherGoDev/sysgo/UI"
|
||||
)
|
||||
|
||||
type GamePage struct {
|
||||
UI.Page
|
||||
ListFontObj *ttf.Font
|
||||
URLColor *color.Color
|
||||
TextColor *color.Color
|
||||
Labels map[string]UI.LabelInterface
|
||||
Icons map[string]UI.IconItemInterface
|
||||
|
||||
|
||||
MsgBox *UI.MessageBox
|
||||
NotFound bool
|
||||
|
||||
Pkg *UI.CommercialSoftwarePackage
|
||||
}
|
||||
|
||||
func NewGamePage() *GamePage {
|
||||
p := &GamePage{}
|
||||
p.PageIconMargin = 20
|
||||
p.SelectedIconTopOffset = 20
|
||||
p.EasingDur = 10
|
||||
|
||||
p.Align = UI.ALIGN["SLeft"]
|
||||
|
||||
p.FootMsg = [5]string{"Nav.", "", "", "Back", ""}
|
||||
|
||||
|
||||
p.URLColor = UI.MySkinManager.GiveColor("URL")
|
||||
p.TextColor = UI.MySkinManager.GiveColor("Text")
|
||||
p.ListFontObj = UI.MyLangManager.TrFont("varela18")
|
||||
|
||||
//p.Labels = make(map[string]UI.LabelInterface)
|
||||
|
||||
//p.Icons = make(map[string]UI.IconItemInterface)
|
||||
p.NotFound = true
|
||||
|
||||
p.Pkg = UI.NewCommercialSoftwarePackage("/home/cpi/games/PICO-8/pico-8/pico8_dyn","/home/cpi/launchergo/Menu/GameShell/50_Pico8/")
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (self *GamePage) OnLoadCb() {
|
||||
self.PosY = 0
|
||||
if self.Pkg.IsInstalled() {
|
||||
self.Pkg.RunSetup()
|
||||
fmt.Println("Run pico8")
|
||||
self.MsgBox.SetText("Running Pico8")
|
||||
self.Screen.RunEXE(self.Pkg.GetRunScript())
|
||||
|
||||
}else{
|
||||
self.MsgBox.SetText("Please purchase the PICO-8 and copy it to the \"~/games/PICO-8\"")
|
||||
}
|
||||
|
||||
fmt.Println("GamePage OnLoadCb")
|
||||
}
|
||||
|
||||
|
||||
func (self *GamePage) Init() {
|
||||
if self.Screen == nil {
|
||||
panic("No Screen")
|
||||
}
|
||||
|
||||
if self.Screen.CanvasHWND != nil && self.CanvasHWND == nil {
|
||||
self.HWND = self.Screen.CanvasHWND
|
||||
self.CanvasHWND = surface.Surface(self.Screen.Width, self.Screen.Height)
|
||||
}
|
||||
|
||||
self.PosX = self.Index * self.Screen.Width
|
||||
self.Width = self.Screen.Width
|
||||
self.Height = self.Screen.Height
|
||||
|
||||
self.MsgBox = UI.NewMessageBox()
|
||||
self.MsgBox.Parent = self.CanvasHWND
|
||||
self.MsgBox.Init("Please purchase the PICO-8 and copy it to the \"~/games/PICO-8\"",self.ListFontObj,nil,self.Width,self.Height)
|
||||
|
||||
self.Pkg.Init()
|
||||
}
|
||||
|
||||
func (self *GamePage) KeyDown(ev *event.Event) {
|
||||
if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] {
|
||||
self.ReturnToUpLevelPage()
|
||||
self.Screen.Refresh()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (self *GamePage) Draw() {
|
||||
self.ClearCanvas()
|
||||
|
||||
self.MsgBox.Draw()
|
||||
|
||||
if self.HWND != nil {
|
||||
surface.Fill(self.HWND, UI.MySkinManager.GiveColor("white"))
|
||||
rect_ := rect.Rect(self.PosX, self.PosY, self.Width, self.Height)
|
||||
surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil)
|
||||
}
|
||||
}
|
||||
4
Menu/GameShell/50_Pico8/plugin.json
Normal file
4
Menu/GameShell/50_Pico8/plugin.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"SO_FILE":"",
|
||||
"NAME":"Pico8"
|
||||
}
|
||||
38
Menu/GameShell/50_Pico8/plugin_init.go
Normal file
38
Menu/GameShell/50_Pico8/plugin_init.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package Pico8
|
||||
|
||||
import (
|
||||
/*
|
||||
"github.com/veandco/go-sdl2/ttf"
|
||||
|
||||
"github.com/cuu/gogame/surface"
|
||||
"github.com/cuu/gogame/event"
|
||||
"github.com/cuu/gogame/rect"
|
||||
"github.com/cuu/gogame/color"
|
||||
*/
|
||||
"github.com/clockworkpi/LauncherGoDev/sysgo/UI"
|
||||
//"github.com/clockworkpi/LauncherGoDev/sysgo/DBUS"
|
||||
)
|
||||
|
||||
/******************************************************************************/
|
||||
type GamePlugin struct {
|
||||
UI.Plugin
|
||||
MainPage *GamePage
|
||||
}
|
||||
|
||||
func (self *GamePlugin) Init(main_screen *UI.MainScreen) {
|
||||
self.MainPage = NewGamePage()
|
||||
self.MainPage.SetScreen(main_screen)
|
||||
self.MainPage.SetName("Pico8")
|
||||
self.MainPage.Init()
|
||||
}
|
||||
|
||||
func (self *GamePlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.MainPage)
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
var APIOBJ GamePlugin
|
||||
Reference in New Issue
Block a user