Skip to content

Commit 7b49dfd

Browse files
Update ebiten -> ebitengine
Also update to latest version. Unfortunately the audio is broken, so I raised hajimehoshi/ebiten#2970.
1 parent f348fc9 commit 7b49dfd

File tree

8 files changed

+256
-177
lines changed

8 files changed

+256
-177
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ tinygo-canvas: clean
5050
cp ./canvas/index.html ./html/index.html
5151
cp ./canvas/main.go ./html/main.go
5252

53-
.PHONY: ebiten
54-
ebiten: clean
55-
GOOS=js GOARCH=wasm go build -o ./html/ebiten.wasm ./ebiten/main.go
56-
cp ./ebiten/index.html ./html/index.html
53+
.PHONY: ebitengine
54+
ebitengine: clean
55+
GOOS=js GOARCH=wasm go build -o ./html/ebitengine.wasm ./ebitengine/main.go
56+
cp ./ebitengine/index.html ./html/index.html
5757
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js
5858

5959
.PHONY: vugu

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ send a HTTP request, parse the result and write it to the DOM.
9090
An updated version of the [repulsion](https://stdiopt.github.io/gowasm-experiments/repulsion)
9191
demo by [Luis Figuerido](https://github.com/stdiopt).
9292

93-
### Ebiten
93+
### Ebitengine
9494

95-
A short demo of using the [Ebiten game engine](https://github.com/hajimehoshi/ebiten)
96-
to create a WebGL based flappy bird clone. Copied from the Ebiten examples.
95+
A short demo of using the [Ebitengine game engine](https://github.com/hajimehoshi/ebiten)
96+
to create a WebGL based flappy bird clone. Copied from the Ebitengine examples.
9797

9898
### Vugu
9999

File renamed without changes.

ebitengine/crt.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//go:build ignore
2+
3+
//kage:unit pixels
4+
5+
// Reference: a public domain CRT effect
6+
// https://github.com/libretro/glsl-shaders/blob/master/crt/shaders/crt-lottes.glsl
7+
8+
package main
9+
10+
func Warp(pos vec2) vec2 {
11+
const (
12+
warpX = 0.031
13+
warpY = 0.041
14+
)
15+
pos = pos*2 - 1
16+
pos *= vec2(1+(pos.y*pos.y)*warpX, 1+(pos.x*pos.x)*warpY)
17+
return pos/2 + 0.5
18+
}
19+
20+
func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 {
21+
// Adjust the texture position to [0, 1].
22+
origin := imageSrc0Origin()
23+
size := imageSrc0Size()
24+
pos := srcPos
25+
pos -= origin
26+
pos /= size
27+
28+
pos = Warp(pos)
29+
return imageSrc0At(pos*size + origin)
30+
}

ebiten/index.html renamed to ebitengine/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111

1212
const go = new Go();
13-
WebAssembly.instantiateStreaming(fetch("ebiten.wasm"), go.importObject).then(result => {
13+
WebAssembly.instantiateStreaming(fetch("ebitengine.wasm"), go.importObject).then(result => {
1414
go.run(result.instance);
1515
});
1616
</script>

0 commit comments

Comments
 (0)