Compare commits

...

6 Commits

Author SHA1 Message Date
Jeremy Faller
6bf9ab8b6a
Merge 615a008ea0 into b7015c4354 2024-06-21 23:20:07 +01:00
Hajime Hoshi
b7015c4354 .github/workflows: bug fix: wrong version was specified 2024-06-22 02:45:29 +09:00
Hajime Hoshi
96984210e1 .github/workflows: update action versions 2024-06-22 02:43:36 +09:00
Hajime Hoshi
1cd6a1f10c examples/wav: add -bits option to specify 8bits 2024-06-22 01:25:04 +09:00
Hajime Hoshi
0eb2b9980d all: update purego 2024-06-20 21:08:12 +09:00
Hajime Hoshi
76a170eecf examples/resources/images: update the licenses 2024-06-20 03:25:39 +09:00
10 changed files with 35 additions and 17 deletions

View File

@ -21,14 +21,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v5
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./.github/workflows/site
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
deploy:
environment:
@ -39,4 +39,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4

View File

@ -13,7 +13,7 @@ jobs:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Docker build (amd64)
run: |

View File

@ -23,15 +23,15 @@ jobs:
git config --global core.eol lf
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Setup JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'

View File

@ -39,10 +39,10 @@ jobs:
git config --global core.eol lf
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

View File

@ -22,6 +22,9 @@ var (
//go:embed jab.wav
Jab_wav []byte
//go:embed jab8.wav
Jab8_wav []byte
//go:embed jump.ogg
Jump_ogg []byte

Binary file not shown.

View File

@ -10,17 +10,18 @@ http://www.sozai-page.com/02_sozai/b/b04/b04_002/b04_002.html
```
The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/)
The design is licensed under the Creative Commons 3.0 Attributions license.
The design is licensed under the Creative Commons 4.0 Attributions license.
Read this article for more details: https://blog.golang.org/gopher
```
## gophers.jpg
```
http://blog.golang.org/go-programming-language-turns-two
https://go.dev/blog/2years
https://go.dev/copyright
Photograph by Chris Nokleberg
the Creative Commons Attribution 3.0 License
The Creative Commons Attribution 4.0 License
```
## runner.png
@ -175,5 +176,5 @@ MIT License
```
Copyright 2014 Hajime Hoshi
the Creative Commons Attribution 3.0 License
The Creative Commons Attribution 4.0 License
```

View File

@ -16,6 +16,8 @@ package main
import (
"bytes"
"flag"
"io"
"log"
"github.com/hajimehoshi/ebiten/v2"
@ -32,6 +34,10 @@ const (
sampleRate = 48000
)
var (
flagBitsPerSample = flag.Int("bits", 16, "bits per sample")
)
type Game struct {
audioContext *audio.Context
audioPlayer *audio.Player
@ -59,7 +65,14 @@ func NewGame() (*Game, error) {
// ...
// Decode wav-formatted data and retrieve decoded PCM stream.
d, err := wav.DecodeWithoutResampling(bytes.NewReader(raudio.Jab_wav))
var r io.Reader
switch *flagBitsPerSample {
case 8:
r = bytes.NewReader(raudio.Jab8_wav)
default:
r = bytes.NewReader(raudio.Jab_wav)
}
d, err := wav.DecodeWithoutResampling(r)
if err != nil {
return nil, err
}
@ -99,6 +112,7 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
}
func main() {
flag.Parse()
g, err := NewGame()
if err != nil {
log.Fatal(err)

2
go.mod
View File

@ -6,7 +6,7 @@ require (
github.com/ebitengine/gomobile v0.0.0-20240518074828-e86332849895
github.com/ebitengine/hideconsole v1.0.0
github.com/ebitengine/oto/v3 v3.3.0-alpha.1
github.com/ebitengine/purego v0.8.0-alpha.2
github.com/ebitengine/purego v0.8.0-alpha.2.0.20240620120633-4c3273e2bc2e
github.com/gen2brain/mpeg v0.3.2-0.20240412154320-a2ac4fc8a46f
github.com/go-text/typesetting v0.1.1
github.com/hajimehoshi/bitmapfont/v3 v3.2.0-alpha.2

4
go.sum
View File

@ -4,8 +4,8 @@ github.com/ebitengine/hideconsole v1.0.0 h1:5J4U0kXF+pv/DhiXt5/lTz0eO5ogJ1iXb8Yj
github.com/ebitengine/hideconsole v1.0.0/go.mod h1:hTTBTvVYWKBuxPr7peweneWdkUwEuHuB3C1R/ielR1A=
github.com/ebitengine/oto/v3 v3.3.0-alpha.1 h1:J2nBmQwPLKc4+yLObytq1jKNydI96l6EjZfgefiqGbk=
github.com/ebitengine/oto/v3 v3.3.0-alpha.1/go.mod h1:T2/VV0UWG97GEEf4kORMU2nCneYT/YmwSTxPutSVaUg=
github.com/ebitengine/purego v0.8.0-alpha.2 h1:+Kyr9n4eXAGMzhtWJxfdQ7AzGn0+6ZWihfCCxul3Dso=
github.com/ebitengine/purego v0.8.0-alpha.2/go.mod h1:w5fARo4H5UrAgQTz0yqDfZ6bjstTQwUFmO+TN+nHlWE=
github.com/ebitengine/purego v0.8.0-alpha.2.0.20240620120633-4c3273e2bc2e h1:Do0Ag7xIjxmXpZ0dSBt56bg/POw5wOjevFndam1L2cQ=
github.com/ebitengine/purego v0.8.0-alpha.2.0.20240620120633-4c3273e2bc2e/go.mod h1:cJsFmQCiLTx+cpFhVN3pj+pQfpYnn2OLeJtaKsRmVoA=
github.com/gen2brain/mpeg v0.3.2-0.20240412154320-a2ac4fc8a46f h1:ysqRe+lvUiL0dH5XzkH0Bz68bFMPJ4f5Si4L/HD9SGk=
github.com/gen2brain/mpeg v0.3.2-0.20240412154320-a2ac4fc8a46f/go.mod h1:i/ebyRRv/IoHixuZ9bElZnXbmfoUVPGQpdsJ4sVuX38=
github.com/go-text/typesetting v0.1.1 h1:bGAesCuo85nXnEN5LmFMVGAGpGkCPtHrZLi//qD7EJo=