Skip to content

Commit

Permalink
v0.0.5: LatestRelease <- Development (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmbek committed Apr 22, 2024
2 parents d8b76a3 + 9eff92f commit be9d5f6
Show file tree
Hide file tree
Showing 58 changed files with 2,878 additions and 561 deletions.
1 change: 1 addition & 0 deletions cross-platform/go-on-mobile/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.apk
10 changes: 10 additions & 0 deletions cross-platform/go-on-mobile/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module go-on-mobile

go 1.20

require (
golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/image v0.13.0 // indirect
golang.org/x/mobile v0.0.0-20231006135142-2b44d11868fe // indirect
golang.org/x/sys v0.13.0 // indirect
)
8 changes: 8 additions & 0 deletions cross-platform/go-on-mobile/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 h1:3AGKexOYqL+ztdWdkB1bDwXgPBuTS/S8A4WzuTvJ8Cg=
golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63/go.mod h1:UH99kUObWAZkDnWqppdQe5ZhPYESUw8I0zVV1uWBR+0=
golang.org/x/image v0.13.0 h1:3cge/F/QTkNLauhf2QoE9zp+7sr+ZcL4HnoZmdwg9sg=
golang.org/x/image v0.13.0/go.mod h1:6mmbMOeV28HuMTgA6OSRkdXKYw/t5W9Uwn2Yv1r3Yxk=
golang.org/x/mobile v0.0.0-20231006135142-2b44d11868fe h1:lrXv4yHeD9FA8PSJATWowP1QvexpyAPWmPia+Kbzql8=
golang.org/x/mobile v0.0.0-20231006135142-2b44d11868fe/go.mod h1:BrnXpEObnFxpaT75Jo9hsCazwOWcp7nVIa8NNuH5cuA=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.20
go 1.21

use (
.
Expand Down
7 changes: 7 additions & 0 deletions cross-platform/go-on-mobile/go.work.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dmitri.shuralyov.com/gpu/mtl v0.0.0-20221208032759-85de2813cf6b h1:a26Bdkl2B9PmYN6vGXnnfB2UGKjz0Moif1aEg+xTd7M=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I=
github.com/jezek/xgb v1.0.0 h1:s2rRzAV8KQRlpsYA7Uyxoidv1nodMF0m6dIG6FhhVLQ=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
23 changes: 23 additions & 0 deletions cross-platform/go-on-mobile/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

import (
"fmt"
"golang.org/x/mobile/app"
"golang.org/x/mobile/event/lifecycle"
"golang.org/x/mobile/event/paint"
)

func main() {
app.Main(func(a app.App) {
for e := range a.Events() {
switch e.(type) {
case lifecycle.Event:
// Initialize your app here
case paint.Event:
// Paint your UI here
fmt.Println("Hello, GoMobile!")
a.Publish()
}
}
})
}
3 changes: 3 additions & 0 deletions cross-platform/go-webview/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.exe
*.aar
*.aab
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module go-webview

go 1.20
go 1.22
6 changes: 6 additions & 0 deletions cross-platform/go-webview/go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
go 1.22

use (
.
./webview_go
)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@ type Count struct {
}

func main() {

if err := runSingleInstance(); err != nil {
fmt.Println(err)
return
}

/*
err := runMultiInstance()
if err != nil {
fmt.Println(err)
}
*/
}

// TODO: rework lock files into something else, as the lockfile is not always removed when program shuts down
func createLockFile(lockfile string) {
file, err := os.Create(lockfile)
if err != nil {
Expand All @@ -37,6 +47,16 @@ func removeLockFile(lockfile string) {
}
}

func runMultiInstance() error {
// run webview
err := startWebview("index.html", "My Webview", 1280, 720)
if err != nil {
return err
}

return nil
}

func runSingleInstance() error {
lockFile := "myapp.lock"

Expand Down Expand Up @@ -80,7 +100,7 @@ func startWebview(htmlFile, title string, width, height int) error {
defer webview.Destroy()
webview.SetTitle("My Webview")
//w.SetSize(480, 320, webview.HintNone)
webview.SetSize(1280, 720, webviewWindow.HintMax)
webview.SetSize(1280, 720, webviewWindow.HintNone)

// A binding that increments a value and immediately returns the new value.
err = webview.Bind("increment", func() Count { return increment() })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ void CgoWebViewBind(webview_t w, const char *name, uintptr_t index) {
ctx->index = index;
webview_bind(w, name, _webview_binding_cb, (void *)ctx);
}

void CgoWebViewUnbind(webview_t w, const char *name) {
webview_unbind(w, name);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module webview_go

go 1.21
go 1.22
Loading

0 comments on commit be9d5f6

Please sign in to comment.