From 59a76335613b836312f03a539e61c00a09b0962d Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 17 Oct 2023 03:26:58 +0100 Subject: initial commit --- build.sh | 13 +++++++++++++ go.mod | 14 ++++++++++++++ index.html | 16 ++++++++++++++++ pengui.go | 30 ++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100755 build.sh create mode 100644 go.mod create mode 100644 index.html create mode 100644 pengui.go diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..ae7e042 --- /dev/null +++ b/build.sh @@ -0,0 +1,13 @@ +#!/bin/sh +name=pengui + +rm -rf build +mkdir -p build + +cd build +env GOOS=js GOARCH=wasm go build -o $name.wasm .. +cp $(go env GOROOT)/misc/wasm/wasm_exec.js . +cp ../index.html . + +[ "$1" = "serve" ] && gopherjs serve + diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..d1057e7 --- /dev/null +++ b/go.mod @@ -0,0 +1,14 @@ +module pengui + +go 1.18 + +require ( + github.com/ebitengine/purego v0.5.0 // indirect + github.com/hajimehoshi/ebiten/v2 v2.6.2 // indirect + github.com/jezek/xgb v1.1.0 // indirect + golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 // indirect + golang.org/x/image v0.12.0 // indirect + golang.org/x/mobile v0.0.0-20230922142353-e2f452493d57 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.12.0 // indirect +) diff --git a/index.html b/index.html new file mode 100644 index 0000000..cdc36b5 --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ + + + diff --git a/pengui.go b/pengui.go new file mode 100644 index 0000000..60612a9 --- /dev/null +++ b/pengui.go @@ -0,0 +1,30 @@ +package main + +import ( + "log" + + "github.com/hajimehoshi/ebiten/v2" + "github.com/hajimehoshi/ebiten/v2/ebitenutil" +) + +type Game struct{} + +func (g *Game) Update() error { + return nil +} + +func (g *Game) Draw(screen *ebiten.Image) { + ebitenutil.DebugPrint(screen, "Hello, World!") +} + +func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) { + return 320, 240 +} + +func main() { + ebiten.SetWindowSize(640, 480) + ebiten.SetWindowTitle("Hello, World!") + if err := ebiten.RunGame(&Game{}); err != nil { + log.Fatal(err) + } +} -- cgit v1.2.1