Merge pull request #30 from crgimenes/dev
Fix project name, upgrade Ebitengine version, add instructions to README.md
This commit is contained in:
12
README.md
12
README.md
@@ -12,6 +12,18 @@ The goal is to demonstrate the Go language with a fun and very nostalgic example
|
||||
|
||||
In this example, we used the [Ebitengine](https://ebitengine.org), an incredibly easy-to-use gaming library with a vibrant community.
|
||||
|
||||
## How to run
|
||||
|
||||
Note that some operating systems may restrict the execution of binaries downloaded from the internet for security reasons. Please consult your operating system documentation to learn how to enable Neko to run.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `-speed` The speed of the cat (default 2).
|
||||
- `-scale` The scale of the cat on the screen (default 2.0).
|
||||
- `-quiet` Disable sound.
|
||||
- `-h` Show help.
|
||||
|
||||
|
||||
## How to Contribute
|
||||
|
||||
|
||||
|
||||
6
go.mod
6
go.mod
@@ -1,10 +1,10 @@
|
||||
module crg.eti.br/go/neko
|
||||
module neko
|
||||
|
||||
go 1.22
|
||||
|
||||
require (
|
||||
crg.eti.br/go/config v1.5.0
|
||||
github.com/hajimehoshi/ebiten/v2 v2.7.1-0.20240406132856-3136de4958eb
|
||||
github.com/hajimehoshi/ebiten/v2 v2.7.1
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -12,7 +12,7 @@ require (
|
||||
github.com/ebitengine/gomobile v0.0.0-20240329170434-1771503ff0a8 // indirect
|
||||
github.com/ebitengine/hideconsole v1.0.0 // indirect
|
||||
github.com/ebitengine/oto/v3 v3.2.0 // indirect
|
||||
github.com/ebitengine/purego v0.7.0 // indirect
|
||||
github.com/ebitengine/purego v0.7.1 // indirect
|
||||
github.com/jezek/xgb v1.1.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
|
||||
6
go.sum
6
go.sum
@@ -10,8 +10,14 @@ github.com/ebitengine/oto/v3 v3.2.0 h1:FuggTJTSI3/3hEYwZEIN0CZVXYT29ZOdCu+z/f4Qj
|
||||
github.com/ebitengine/oto/v3 v3.2.0/go.mod h1:dOKXShvy1EQbIXhXPFcKLargdnFqH0RjptecvyAxhyw=
|
||||
github.com/ebitengine/purego v0.7.0 h1:HPZpl61edMGCEW6XK2nsR6+7AnJ3unUxpTZBkkIXnMc=
|
||||
github.com/ebitengine/purego v0.7.0/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
|
||||
github.com/ebitengine/purego v0.7.1 h1:6/55d26lG3o9VCZX8lping+bZcmShseiqlh2bnUDiPA=
|
||||
github.com/ebitengine/purego v0.7.1/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
|
||||
github.com/hajimehoshi/ebiten/v2 v2.7.1-0.20240406132856-3136de4958eb h1:ZDRMN3LJuHmaU2I7GmfPJBr2Ikeba5Akw7JcQICHNJ8=
|
||||
github.com/hajimehoshi/ebiten/v2 v2.7.1-0.20240406132856-3136de4958eb/go.mod h1:1vjyPw+h3n30rfTOpIsbWRXSxZ0Oz1cYc6Tq/2DKoQg=
|
||||
github.com/hajimehoshi/ebiten/v2 v2.7.1-0.20240406175607-4d268f5ce44b h1:Iit6TJ88TLW2W/zphVzUldjw2MUxm7Why52x5Kyqtss=
|
||||
github.com/hajimehoshi/ebiten/v2 v2.7.1-0.20240406175607-4d268f5ce44b/go.mod h1:1vjyPw+h3n30rfTOpIsbWRXSxZ0Oz1cYc6Tq/2DKoQg=
|
||||
github.com/hajimehoshi/ebiten/v2 v2.7.1 h1:v/t/IeQxd2eTtZ0QjJsUKL/fiGNeF64tYXjXbyJehzQ=
|
||||
github.com/hajimehoshi/ebiten/v2 v2.7.1/go.mod h1:1vjyPw+h3n30rfTOpIsbWRXSxZ0Oz1cYc6Tq/2DKoQg=
|
||||
github.com/jezek/xgb v1.1.1 h1:bE/r8ZZtSv7l9gk6nU0mYx51aXrvnyb44892TwSaqS4=
|
||||
github.com/jezek/xgb v1.1.1/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
|
||||
4
main.go
4
main.go
@@ -48,6 +48,7 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
loaded = false
|
||||
mSprite map[string]*ebiten.Image
|
||||
mSound map[string][]byte
|
||||
|
||||
@@ -77,8 +78,6 @@ func playSound(sound []byte) {
|
||||
currentplayer.Play()
|
||||
}
|
||||
|
||||
var loaded = false
|
||||
|
||||
func (m *neko) Update() error {
|
||||
m.count++
|
||||
if m.state == 10 && m.count == m.min {
|
||||
@@ -89,7 +88,6 @@ func (m *neko) Update() error {
|
||||
m.x = max(0, min(m.x, monitorWidth))
|
||||
m.y = max(0, min(m.y, monitorHeight))
|
||||
ebiten.SetWindowPosition(m.x, m.y)
|
||||
ebiten.SetWindowFloating(true)
|
||||
|
||||
mx, my := ebiten.CursorPosition()
|
||||
x := mx - (height / 2)
|
||||
|
||||
Reference in New Issue
Block a user