diff --git a/Makefile b/Makefile
index edd6036..a1257a5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,25 @@
game:=capyclick
-bin:=bin
+desktopBin:=bin/desktop
+webBin:=bin/web
+wasmHtml:=build/capyclick.html
+wasmExec:=$(shell go env GOROOT)
-all: clean
- mkdir -p bin
- cd src && go build && mv $(game)* ../bin
+current: clean environment
+ cd src && go build && mv $(game)* ../$(desktopBin)
-cross: clean
- mkdir -p bin
- cd src && GOOS=windows GOARCH=amd64 go build && mv $(game)* ../bin
-
+web: environment
+ cd src && env GOOS=js GOARCH=wasm go build -o $(game).wasm . && mv $(game).wasm ../$(webBin)
+ cp $(wasmHtml) $(webBin)
+ cp $(wasmExec)/misc/wasm/wasm_exec.js $(webBin)
+
+desktop: clean environment
+ cd src && GOOS=windows GOARCH=amd64 go build && mv $(game)* ../$(desktopBin)
+ cd src && GOOS=linux GOARCH=amd64 go build && mv $(game)* ../$(desktopBin)
+
+cross: clean environment web desktop
+
+environment:
+ mkdir -p $(desktopBin) $(webBin)
clean:
rm -rf bin
\ No newline at end of file
diff --git a/build/capyclick.html b/build/capyclick.html
new file mode 100644
index 0000000..3b19caf
--- /dev/null
+++ b/build/capyclick.html
@@ -0,0 +1,16 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/main.go b/src/main.go
index 0d4f31f..87b6b2e 100644
--- a/src/main.go
+++ b/src/main.go
@@ -25,9 +25,9 @@ import (
const Version string = "v0.1"
var (
- silent *bool = flag.Bool("silent", false, "Set to true in order to discard all logging")
- version *bool = flag.Bool("version", false, "Prints version information")
- noFiles *bool = flag.Bool("no-files", false, "Run the game without outputting/reading configuration or save files")
+ silent *bool = flag.Bool("silent", false, "Set to true in order to discard all logging")
+ version *bool = flag.Bool("version", false, "Prints version information")
+ saveFiles *bool = flag.Bool("saveFiles", false, "Run the game with configuration and save files")
)
const (
@@ -316,7 +316,7 @@ func main() {
// Create a game instance
var game *Game = NewGame()
- if !*noFiles {
+ if *saveFiles {
// Work out working directory
exeDir, err := os.Executable()
if err != nil {
@@ -328,7 +328,7 @@ func main() {
game.WorkingDir = ""
}
- if !*noFiles {
+ if *saveFiles {
// Open/Create configuration file
var config *conf.Configuration
config, err := conf.FromFile(filepath.Join(game.WorkingDir, ConfigurationFileName))
@@ -361,7 +361,7 @@ func main() {
ebiten.SetWindowPosition(game.Config.LastWindowPosition[0], game.Config.LastWindowPosition[1])
ebiten.SetWindowTitle(fmt.Sprintf("Capyclick %s", Version))
- if !*noFiles {
+ if *saveFiles {
// Open/Create save file
gameSave, err := save.FromFile(filepath.Join(game.WorkingDir, SaveFileName))
if err != nil {
@@ -390,7 +390,9 @@ func main() {
err := ebiten.RunGame(game)
if err == ebiten.Termination || err == nil {
logger.Info("[Main] Shutting down!")
- game.SaveData()
+ if *saveFiles {
+ game.SaveData()
+ }
os.Exit(0)
} else {
logger.Error("[Main] Fatal game error: %s", err)