commit 6c78a639f557ee2405d499360508ab4ee6159448 Author: Trevor Slocum Date: Mon Aug 5 17:28:15 2024 -0700 Initial commit diff --git a/0001-game-dev-fundamentals/0001-game-dev-fundamentals.odp b/0001-game-dev-fundamentals/0001-game-dev-fundamentals.odp new file mode 100644 index 0000000..88be074 Binary files /dev/null and b/0001-game-dev-fundamentals/0001-game-dev-fundamentals.odp differ diff --git a/0001-game-dev-fundamentals/go.mod b/0001-game-dev-fundamentals/go.mod new file mode 100644 index 0000000..f47bfda --- /dev/null +++ b/0001-game-dev-fundamentals/go.mod @@ -0,0 +1,3 @@ +module helloworld + +go 1.19 diff --git a/0001-game-dev-fundamentals/main.go b/0001-game-dev-fundamentals/main.go new file mode 100644 index 0000000..f7b60bd --- /dev/null +++ b/0001-game-dev-fundamentals/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Hello, world!") +} diff --git a/0002-getting-started-with-ebitengine/game.go b/0002-getting-started-with-ebitengine/game.go new file mode 100644 index 0000000..4bc52cd --- /dev/null +++ b/0002-getting-started-with-ebitengine/game.go @@ -0,0 +1,22 @@ +package main + +import "github.com/hajimehoshi/ebiten/v2" + +type game struct { +} + +func (g game) Update() error { + return nil +} + +func (g game) Draw(screen *ebiten.Image) { + +} + +func (g game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) { + return outsideWidth, outsideHeight // Set viewport size to new window size. +} + +func newGame() *game { + return &game{} +} diff --git a/0002-getting-started-with-ebitengine/go.mod b/0002-getting-started-with-ebitengine/go.mod new file mode 100644 index 0000000..59c3000 --- /dev/null +++ b/0002-getting-started-with-ebitengine/go.mod @@ -0,0 +1,14 @@ +module gettingstarted + +go 1.19 + +require github.com/hajimehoshi/ebiten/v2 v2.7.8 + +require ( + github.com/ebitengine/gomobile v0.0.0-20240802043200-192f051f4fcc // indirect + github.com/ebitengine/hideconsole v1.0.0 // indirect + github.com/ebitengine/purego v0.7.1 // indirect + github.com/jezek/xgb v1.1.1 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.23.0 // indirect +) diff --git a/0002-getting-started-with-ebitengine/go.sum b/0002-getting-started-with-ebitengine/go.sum new file mode 100644 index 0000000..e1fecbe --- /dev/null +++ b/0002-getting-started-with-ebitengine/go.sum @@ -0,0 +1,15 @@ +github.com/ebitengine/gomobile v0.0.0-20240802043200-192f051f4fcc h1:76TYsaP1F48tiQRlrr71NsbfxBcFM9/8bEHS9/JbsQg= +github.com/ebitengine/gomobile v0.0.0-20240802043200-192f051f4fcc/go.mod h1:RM/c3pvru6dRqgGEW7RCTb6czFXYAa3MxbXu3u8/dcI= +github.com/ebitengine/hideconsole v1.0.0 h1:5J4U0kXF+pv/DhiXt5/lTz0eO5ogJ1iXb8Yj1yReDqE= +github.com/ebitengine/hideconsole v1.0.0/go.mod h1:hTTBTvVYWKBuxPr7peweneWdkUwEuHuB3C1R/ielR1A= +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.8 h1:QrlvF2byCzMuDsbxFReJkOCbM3O2z1H/NKQaGcA8PKk= +github.com/hajimehoshi/ebiten/v2 v2.7.8/go.mod h1:Ulbq5xDmdx47P24EJ+Mb31Zps7vQq+guieG9mghQUaA= +github.com/jezek/xgb v1.1.1 h1:bE/r8ZZtSv7l9gk6nU0mYx51aXrvnyb44892TwSaqS4= +github.com/jezek/xgb v1.1.1/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk= +golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= diff --git a/0002-getting-started-with-ebitengine/main.go b/0002-getting-started-with-ebitengine/main.go new file mode 100644 index 0000000..a1dbd1d --- /dev/null +++ b/0002-getting-started-with-ebitengine/main.go @@ -0,0 +1,20 @@ +package main + +import ( + "log" + + "github.com/hajimehoshi/ebiten/v2" +) + +func main() { + ebiten.SetWindowTitle("TT0002: Getting Started with Ebitengine") + ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled) + ebiten.SetWindowSize(800, 600) + ebiten.SetVsyncEnabled(true) + ebiten.SetTPS(60) + + err := ebiten.RunGame(newGame()) + if err != nil { + log.Fatal(err) + } +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..25b0b31 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Trevor Slocum + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f0cc238 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# Trevor's Tutorials - Free programming tutorials +[![Donate via LiberaPay](https://img.shields.io/liberapay/receives/rocket9labs.com.svg?logo=liberapay)](https://liberapay.com/rocket9labs.com) + +Visit [**trevors-tutorials.com**](https://trevors-tutorials.com) + +## Support + +Please share issues and suggestions [here](https://code.rocket9labs.com/tslocum/trevors-tutorials.com/issues).