diff --git a/README.md b/README.md
index ad114c9..aa4598a 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
-###### Run in a local testing environment:
+###### gomobile, build .apk for development and testing:
@@ -23,7 +23,15 @@ alias pixel4='$ANDROID_HOME/emulator/emulator -avd "Pixel_4_API_30"'
-
+###### ebitenmobile, build .aar for Android Studio binding:
+
+
+
+// Navigate to skulls/ and generate the .aar
binding:
+ebitenmobile bind -target android -javapkg com.<your username>.skulls -o skulls.aar github.com/rootVIII/skulls/skullsebitenbind
+
+
+
-
diff --git a/skulls.go b/skulls.go
index b397326..e24b3d5 100644
--- a/skulls.go
+++ b/skulls.go
@@ -619,7 +619,7 @@ func readAudio(context *audio.Context, asset []byte) (*audio.Player, error) {
}
// Play is the entry point to the game.
-func Play() (*Game, error) {
+func Load() (*Game, error) {
audioContext := audio.NewContext(44100)
@@ -694,22 +694,10 @@ func Play() (*Game, error) {
game.clear.SetVolume(.50)
game.beep.SetVolume(.50)
- // for _, item := range game.skullCollector {
- // fmt.Printf("%v\n", item)
- // }
-
- // for _, item := range game.skullCoords {
- // fmt.Printf("%v\n", item)
- // }
-
game.spawn()
ebiten.SetWindowSize(screenW, screenH)
ebiten.SetWindowTitle("💀")
- if err := ebiten.RunGame(game); err != nil {
- return nil, err
- }
-
return game, nil
}
diff --git a/skullsebitenbind/main.go b/skullsebitenbind/main.go
index 59f54c0..ccda5d2 100644
--- a/skullsebitenbind/main.go
+++ b/skullsebitenbind/main.go
@@ -7,11 +7,11 @@ import (
func init() {
- sp, err := skulls.Play()
+ game, err := skulls.Load()
if err != nil {
panic(err)
}
- mobile.SetGame(sp)
+ mobile.SetGame(game)
}
// Dummy forces gomobile to compile this package.
diff --git a/skullsgomobile/main.go b/skullsgomobile/main.go
index 0f7ade1..5df6a8c 100644
--- a/skullsgomobile/main.go
+++ b/skullsgomobile/main.go
@@ -6,15 +6,23 @@ import (
"log"
"os"
+ "github.com/hajimehoshi/ebiten/v2"
"github.com/rootVIII/skulls"
)
+func exitErr(err error) {
+ logf, _ := os.OpenFile("SKULLS-ERROR.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
+ log.SetOutput(logf)
+ log.Println("** An error occurred during startup **")
+ log.Fatal(err)
+}
+
func main() {
- _, err := skulls.Play()
+ game, err := skulls.Load()
if err != nil {
- logf, _ := os.OpenFile("SKULLS-ERROR.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
- log.SetOutput(logf)
- log.Println("** An error occurred during startup **")
- log.Fatal(err)
+ exitErr(err)
+ }
+ if err := ebiten.RunGame(game); err != nil {
+ exitErr(err)
}
}