From d40fc0e6b8c24fa5974ff21ec4233e0e998588e3 Mon Sep 17 00:00:00 2001 From: Unbewohnte Date: Mon, 3 Jun 2024 17:49:25 +0300 Subject: [PATCH] CODE: Debloated files by moving parts of logic into separate packages --- src/game/game.go | 291 ++++++++++++++++++ src/go.mod | 1 + src/go.sum | 1 + src/main.go | 281 +---------------- src/{ => resources}/resources.go | 12 +- .../{ => resources}/PixeloidMono.otf | Bin .../{ => resources}/PixeloidSans-Bold.otf | Bin .../{ => resources}/Thirteen-Pixel-Fonts.ttf | Bin .../{ => resources}/background_1.png | Bin .../{ => resources}/background_2.png | Bin src/resources/{ => resources}/boop.wav | Bin src/resources/{ => resources}/capybara_1.png | Bin src/resources/{ => resources}/capybara_2.png | Bin src/resources/{ => resources}/capybara_3.png | Bin src/resources/{ => resources}/leather.wav | Bin src/resources/{ => resources}/levelup.wav | Bin src/resources/{ => resources}/menu_switch.wav | Bin src/resources/{ => resources}/pixeloid.zip | Bin .../{ => resources}/thirteen-pixel-fonts.zip | Bin src/resources/{ => resources}/woop.wav | Bin 20 files changed, 304 insertions(+), 282 deletions(-) create mode 100644 src/game/game.go rename src/{ => resources}/resources.go (87%) rename src/resources/{ => resources}/PixeloidMono.otf (100%) rename src/resources/{ => resources}/PixeloidSans-Bold.otf (100%) rename src/resources/{ => resources}/Thirteen-Pixel-Fonts.ttf (100%) rename src/resources/{ => resources}/background_1.png (100%) rename src/resources/{ => resources}/background_2.png (100%) rename src/resources/{ => resources}/boop.wav (100%) rename src/resources/{ => resources}/capybara_1.png (100%) rename src/resources/{ => resources}/capybara_2.png (100%) rename src/resources/{ => resources}/capybara_3.png (100%) rename src/resources/{ => resources}/leather.wav (100%) rename src/resources/{ => resources}/levelup.wav (100%) rename src/resources/{ => resources}/menu_switch.wav (100%) rename src/resources/{ => resources}/pixeloid.zip (100%) rename src/resources/{ => resources}/thirteen-pixel-fonts.zip (100%) rename src/resources/{ => resources}/woop.wav (100%) diff --git a/src/game/game.go b/src/game/game.go new file mode 100644 index 0000000..c6ca2f8 --- /dev/null +++ b/src/game/game.go @@ -0,0 +1,291 @@ +package game + +import ( + "Unbewohnte/capyclick/conf" + "Unbewohnte/capyclick/logger" + "Unbewohnte/capyclick/resources" + "Unbewohnte/capyclick/save" + "Unbewohnte/capyclick/util" + "fmt" + "image/color" + "path/filepath" + "strings" + + "github.com/hajimehoshi/ebiten/v2" + "github.com/hajimehoshi/ebiten/v2/audio" + "github.com/hajimehoshi/ebiten/v2/inpututil" + "github.com/hajimehoshi/ebiten/v2/text" + "golang.org/x/image/font" + "golang.org/x/image/font/opentype" +) + +type AnimationData struct { + Squish float64 + Theta float64 + BounceDirectionFlag bool +} + +type Game struct { + WorkingDir string + Config conf.Configuration + Save save.Save + AudioContext *audio.Context + AudioPlayers map[string]*audio.Player + ImageResources map[string]*ebiten.Image + FontFace font.Face + AnimationData AnimationData + PassiveIncomeTicker int +} + +func NewGame() *Game { + audioCtx := audio.NewContext(44000) + fnt := resources.GetFont("PixeloidSans-Bold.otf") + + return &Game{ + WorkingDir: ".", + Config: conf.Default(), + Save: save.Default(), + AudioContext: audioCtx, + AudioPlayers: map[string]*audio.Player{ + "boop": resources.GetAudioPlayer(audioCtx, "boop.wav"), + "woop": resources.GetAudioPlayer(audioCtx, "woop.wav"), + "menu_switch": resources.GetAudioPlayer(audioCtx, "menu_switch.wav"), + "levelup": resources.GetAudioPlayer(audioCtx, "levelup.wav"), + }, + ImageResources: map[string]*ebiten.Image{ + "capybara1": ebiten.NewImageFromImage(resources.ImageFromFile("capybara_1.png")), + "capybara2": ebiten.NewImageFromImage(resources.ImageFromFile("capybara_2.png")), + "capybara3": ebiten.NewImageFromImage(resources.ImageFromFile("capybara_3.png")), + "background1": ebiten.NewImageFromImage(resources.ImageFromFile("background_1.png")), + "background2": ebiten.NewImageFromImage(resources.ImageFromFile("background_2.png")), + }, + FontFace: util.NewFace(fnt, &opentype.FaceOptions{ + Size: 32, + DPI: 72, + Hinting: font.HintingVertical, + }), + AnimationData: AnimationData{ + Theta: 0.0, + BounceDirectionFlag: true, + Squish: 0, + }, + PassiveIncomeTicker: 0, + } +} + +// Plays sound and rewinds the player +func (g *Game) PlaySound(soundKey string) { + if strings.TrimSpace(soundKey) != "" { + g.AudioPlayers[soundKey].Rewind() + g.AudioPlayers[soundKey].Play() + } +} + +// Saves configuration information and game data +func (g *Game) SaveData(saveFileName string, configurationFileName string) error { + // Save configuration information and game data + err := save.Create(filepath.Join(g.WorkingDir, saveFileName), g.Save) + if err != nil { + logger.Error("[SaveData] Failed to save game data before closing: %s!", err) + return err + } + + err = conf.Create(filepath.Join(g.WorkingDir, configurationFileName), g.Config) + if err != nil { + logger.Error("[SaveData] Failed to save game configuration before closing: %s!", err) + return err + } + + return nil +} + +// Returns how many points required to be considered of level +func pointsForLevel(level uint32) uint64 { + return 25 * uint64(level*level) +} + +func (g *Game) Update() error { + if ebiten.IsWindowBeingClosed() { + return ebiten.Termination + } + + // Update configuration and save information + width, height := ebiten.WindowSize() + g.Config.WindowSize = [2]int{width, height} + + x, y := ebiten.WindowPosition() + g.Config.LastWindowPosition = [2]int{x, y} + + if inpututil.IsKeyJustPressed(ebiten.KeyEscape) { + // Exit + return ebiten.Termination + } + + if inpututil.IsKeyJustPressed(ebiten.KeyF12) { + if ebiten.IsFullscreen() { + // Turn fullscreen off + ebiten.SetFullscreen(false) + } else { + // Go fullscreen + ebiten.SetFullscreen(true) + } + } + + if inpututil.IsKeyJustPressed(ebiten.KeyArrowLeft) { + // Decrease volume + if g.Config.Volume-0.2 >= 0 { + g.Config.Volume -= 0.2 + for _, player := range g.AudioPlayers { + player.SetVolume(g.Config.Volume) + } + } + } else if inpututil.IsKeyJustPressed(ebiten.KeyArrowRight) { + // Increase volume + if g.Config.Volume+0.2 <= 1.0 { + g.Config.Volume += 0.2 + for _, player := range g.AudioPlayers { + player.SetVolume(g.Config.Volume) + } + } + } + + if inpututil.IsMouseButtonJustPressed(ebiten.MouseButtonLeft) || + len(inpututil.AppendJustPressedTouchIDs(nil)) != 0 { + // Click! + g.Save.TimesClicked++ + g.Save.Points++ + g.AnimationData.Squish += 0.5 + g.PlaySound("woop") + } + + // Capybara Animation + if g.AnimationData.Theta >= 0.03 { + g.AnimationData.BounceDirectionFlag = false + } else if g.AnimationData.Theta <= -0.03 { + g.AnimationData.BounceDirectionFlag = true + } + + if g.AnimationData.Squish >= 0 { + g.AnimationData.Squish -= 0.05 + } + + // Passive points income + if g.PassiveIncomeTicker == ebiten.TPS() { + g.PassiveIncomeTicker = 0 + g.Save.Points += g.Save.PassiveIncome + } else { + g.PassiveIncomeTicker++ + } + + if g.Save.Points > 0 && g.Save.Points >= pointsForLevel(g.Save.Level+1) { + // Level progression + g.Save.Level++ + g.Save.PassiveIncome++ + g.PlaySound("levelup") + } + + return nil +} + +func (g *Game) Draw(screen *ebiten.Image) { + // Background + screen.Fill(color.Black) + + backBounds := g.ImageResources["background1"].Bounds() + op := &ebiten.DrawImageOptions{} + op.GeoM.Scale( + float64(screen.Bounds().Dx())/float64(backBounds.Dx()), + float64(screen.Bounds().Dy())/float64(backBounds.Dy()), + ) + screen.DrawImage(g.ImageResources["background1"], op) + + // Capybara + var capybaraKey string + switch g.Save.Level { + case 1: + capybaraKey = "capybara1" + case 2: + capybaraKey = "capybara2" + case 3: + capybaraKey = "capybara3" + default: + capybaraKey = "capybara3" + } + + op = &ebiten.DrawImageOptions{} + if g.AnimationData.BounceDirectionFlag { + g.AnimationData.Theta += 0.001 + } else { + g.AnimationData.Theta -= 0.001 + } + + capybaraBounds := g.ImageResources[capybaraKey].Bounds() + scale := float64(screen.Bounds().Dx()) / float64(capybaraBounds.Dx()) / 2.5 + op.GeoM.Scale( + scale+g.AnimationData.Squish, + scale-g.AnimationData.Squish, + ) + op.GeoM.Rotate(g.AnimationData.Theta) + + capyWidth := float64(g.ImageResources[capybaraKey].Bounds().Dx()) * scale + capyHeight := float64(g.ImageResources[capybaraKey].Bounds().Dy()) * scale + op.GeoM.Translate( + float64(screen.Bounds().Dx()/2)-capyWidth/2, + float64(screen.Bounds().Dy()/2)-capyHeight/2, + ) + + screen.DrawImage(g.ImageResources[capybaraKey], op) + + // Points + msg := fmt.Sprintf("Points: %d", g.Save.Points) + text.Draw( + screen, + msg, + g.FontFace, + 10, + g.FontFace.Metrics().Height.Ceil(), + color.White, + ) + + // Level + msg = fmt.Sprintf( + "Level: %d (+%d)", + g.Save.Level, + pointsForLevel(g.Save.Level+1)-g.Save.Points, + ) + text.Draw( + screen, + msg, + g.FontFace, + 10, + g.FontFace.Metrics().Height.Ceil()*2, + color.White, + ) + + // Times Clicked + msg = fmt.Sprintf("Clicks: %d", g.Save.TimesClicked) + text.Draw( + screen, + msg, + g.FontFace, + 10, + screen.Bounds().Dy()-g.FontFace.Metrics().Height.Ceil()*2, + color.White, + ) + + // Volume + msg = fmt.Sprintf("Volume: %d%% (← or →)", int(g.Config.Volume*100.0)) + text.Draw( + screen, + msg, + g.FontFace, + 10, + screen.Bounds().Dy()-g.FontFace.Metrics().Height.Ceil(), + color.White, + ) +} + +func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) { + scaleFactor := ebiten.DeviceScaleFactor() + return int(float64(outsideWidth) * scaleFactor), int(float64(outsideHeight) * scaleFactor) +} diff --git a/src/go.mod b/src/go.mod index 17d7719..b931a34 100644 --- a/src/go.mod +++ b/src/go.mod @@ -12,6 +12,7 @@ require ( github.com/ebitengine/purego v0.5.0 // indirect github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200707082815-5321531c36a2 // indirect github.com/hajimehoshi/ebiten v1.12.12 // indirect + github.com/hajimehoshi/oto v0.6.8 // indirect github.com/jezek/xgb v1.1.0 // indirect golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 // indirect golang.org/x/mobile v0.0.0-20230922142353-e2f452493d57 // indirect diff --git a/src/go.sum b/src/go.sum index 0ad04e1..8187018 100644 --- a/src/go.sum +++ b/src/go.sum @@ -17,6 +17,7 @@ github.com/hajimehoshi/ebiten/v2 v2.6.5/go.mod h1:TZtorL713an00UW4LyvMeKD8uXWnuI github.com/hajimehoshi/file2byteslice v0.0.0-20200812174855-0e5e8a80490e/go.mod h1:CqqAHp7Dk/AqQiwuhV1yT2334qbA/tFWQW0MD2dGqUE= github.com/hajimehoshi/go-mp3 v0.3.1/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM= github.com/hajimehoshi/oto v0.6.1/go.mod h1:0QXGEkbuJRohbJaxr7ZQSxnju7hEhseiPx2hrh6raOI= +github.com/hajimehoshi/oto v0.6.8 h1:yRb3EJQ4lAkBgZYheqmdH6Lr77RV9nSWFsK/jwWdTNY= github.com/hajimehoshi/oto v0.6.8/go.mod h1:0QXGEkbuJRohbJaxr7ZQSxnju7hEhseiPx2hrh6raOI= github.com/jakecoffman/cp v1.0.0/go.mod h1:JjY/Fp6d8E1CHnu74gWNnU0+b9VzEdUVPoJxg2PsTQg= github.com/jezek/xgb v1.1.0 h1:wnpxJzP1+rkbGclEkmwpVFQWpuE2PUGNUzP8SbfFobk= diff --git a/src/main.go b/src/main.go index fbbbbb4..f3f8962 100644 --- a/src/main.go +++ b/src/main.go @@ -20,24 +20,19 @@ package main import ( "Unbewohnte/capyclick/conf" + "Unbewohnte/capyclick/game" "Unbewohnte/capyclick/logger" + "Unbewohnte/capyclick/resources" "Unbewohnte/capyclick/save" "Unbewohnte/capyclick/util" "flag" "fmt" - "image/color" "io" "os" "path/filepath" - "strings" "time" "github.com/hajimehoshi/ebiten/v2" - "github.com/hajimehoshi/ebiten/v2/audio" - "github.com/hajimehoshi/ebiten/v2/inpututil" - "github.com/hajimehoshi/ebiten/v2/text" - "golang.org/x/image/font" - "golang.org/x/image/font/opentype" ) const Version string = "v0.1" @@ -53,272 +48,6 @@ const ( SaveFileName string = "capyclickSave.json" ) -type AnimationData struct { - Squish float64 - Theta float64 - BounceDirectionFlag bool -} - -type Game struct { - WorkingDir string - Config conf.Configuration - Save save.Save - AudioContext *audio.Context - AudioPlayers map[string]*audio.Player - ImageResources map[string]*ebiten.Image - FontFace font.Face - AnimationData AnimationData - PassiveIncomeTicker int -} - -func NewGame() *Game { - audioCtx := audio.NewContext(44000) - fnt := ResourceGetFont("PixeloidSans-Bold.otf") - - return &Game{ - WorkingDir: ".", - Config: conf.Default(), - Save: save.Default(), - AudioContext: audioCtx, - AudioPlayers: map[string]*audio.Player{ - "boop": GetAudioPlayer(audioCtx, "boop.wav"), - "woop": GetAudioPlayer(audioCtx, "woop.wav"), - "menu_switch": GetAudioPlayer(audioCtx, "menu_switch.wav"), - "levelup": GetAudioPlayer(audioCtx, "levelup.wav"), - }, - ImageResources: map[string]*ebiten.Image{ - "capybara1": ebiten.NewImageFromImage(ImageFromFile("capybara_1.png")), - "capybara2": ebiten.NewImageFromImage(ImageFromFile("capybara_2.png")), - "capybara3": ebiten.NewImageFromImage(ImageFromFile("capybara_3.png")), - "background1": ebiten.NewImageFromImage(ImageFromFile("background_1.png")), - "background2": ebiten.NewImageFromImage(ImageFromFile("background_2.png")), - }, - FontFace: util.NewFace(fnt, &opentype.FaceOptions{ - Size: 32, - DPI: 72, - Hinting: font.HintingVertical, - }), - AnimationData: AnimationData{ - Theta: 0.0, - BounceDirectionFlag: true, - Squish: 0, - }, - PassiveIncomeTicker: 0, - } -} - -// Plays sound and rewinds the player -func (g *Game) PlaySound(soundKey string) { - if strings.TrimSpace(soundKey) != "" { - g.AudioPlayers[soundKey].Rewind() - g.AudioPlayers[soundKey].Play() - } -} - -// Saves configuration information and game data -func (g *Game) SaveData() error { - // Save configuration information and game data - err := save.Create(filepath.Join(g.WorkingDir, SaveFileName), g.Save) - if err != nil { - logger.Error("[SaveData] Failed to save game data before closing: %s!", err) - return err - } - - err = conf.Create(filepath.Join(g.WorkingDir, ConfigurationFileName), g.Config) - if err != nil { - logger.Error("[SaveData] Failed to save game configuration before closing: %s!", err) - return err - } - - return nil -} - -func getPointsForLevel(level uint32) uint64 { - return 100 * uint64(level) -} - -func (g *Game) Update() error { - if ebiten.IsWindowBeingClosed() { - return ebiten.Termination - } - - // Update configuration and save information - width, height := ebiten.WindowSize() - g.Config.WindowSize = [2]int{width, height} - - x, y := ebiten.WindowPosition() - g.Config.LastWindowPosition = [2]int{x, y} - - if inpututil.IsKeyJustPressed(ebiten.KeyEscape) { - // Exit - return ebiten.Termination - } - - if inpututil.IsKeyJustPressed(ebiten.KeyF12) { - if ebiten.IsFullscreen() { - // Turn fullscreen off - ebiten.SetFullscreen(false) - } else { - // Go fullscreen - ebiten.SetFullscreen(true) - } - } - - if inpututil.IsKeyJustPressed(ebiten.KeyArrowLeft) { - // Decrease volume - if g.Config.Volume-0.2 >= 0 { - g.Config.Volume -= 0.2 - for _, player := range g.AudioPlayers { - player.SetVolume(g.Config.Volume) - } - } - } else if inpututil.IsKeyJustPressed(ebiten.KeyArrowRight) { - // Increase volume - if g.Config.Volume+0.2 <= 1.0 { - g.Config.Volume += 0.2 - for _, player := range g.AudioPlayers { - player.SetVolume(g.Config.Volume) - } - } - } - - if inpututil.IsMouseButtonJustPressed(ebiten.MouseButtonLeft) || - len(inpututil.AppendJustPressedTouchIDs(nil)) != 0 { - // Click! - g.Save.TimesClicked++ - g.Save.Points++ - g.AnimationData.Squish += 0.5 - g.PlaySound("boop") - } - - // Capybara Animation - if g.AnimationData.Theta >= 0.03 { - g.AnimationData.BounceDirectionFlag = false - } else if g.AnimationData.Theta <= -0.03 { - g.AnimationData.BounceDirectionFlag = true - } - - if g.AnimationData.Squish >= 0 { - g.AnimationData.Squish -= 0.05 - } - - // Passive points income - if g.PassiveIncomeTicker == ebiten.TPS() { - g.PassiveIncomeTicker = 0 - g.Save.Points += g.Save.PassiveIncome - } else { - g.PassiveIncomeTicker++ - } - - if g.Save.Points > 0 && g.Save.Points >= getPointsForLevel(g.Save.Level) { - // Level progression - g.Save.Level++ - g.Save.PassiveIncome++ - g.PlaySound("levelup") - } - - return nil -} - -func (g *Game) Draw(screen *ebiten.Image) { - // Background - screen.Fill(color.Black) - - backBounds := g.ImageResources["background1"].Bounds() - op := &ebiten.DrawImageOptions{} - op.GeoM.Scale( - float64(screen.Bounds().Dx())/float64(backBounds.Dx()), - float64(screen.Bounds().Dy())/float64(backBounds.Dy()), - ) - screen.DrawImage(g.ImageResources["background1"], op) - - // Capybara - var capybaraKey string - switch g.Save.Level { - case 1: - capybaraKey = "capybara1" - case 2: - capybaraKey = "capybara2" - case 3: - capybaraKey = "capybara3" - default: - capybaraKey = "capybara3" - } - - op = &ebiten.DrawImageOptions{} - if g.AnimationData.BounceDirectionFlag { - g.AnimationData.Theta += 0.001 - } else { - g.AnimationData.Theta -= 0.001 - } - - capybaraBounds := g.ImageResources[capybaraKey].Bounds() - scale := float64(screen.Bounds().Dx()) / float64(capybaraBounds.Dx()) / 2.5 - op.GeoM.Scale( - scale+g.AnimationData.Squish, - scale-g.AnimationData.Squish, - ) - op.GeoM.Rotate(g.AnimationData.Theta) - - capyWidth := float64(g.ImageResources[capybaraKey].Bounds().Dx()) * scale - capyHeight := float64(g.ImageResources[capybaraKey].Bounds().Dy()) * scale - op.GeoM.Translate( - float64(screen.Bounds().Dx()/2)-capyWidth/2, - float64(screen.Bounds().Dy()/2)-capyHeight/2, - ) - - screen.DrawImage(g.ImageResources[capybaraKey], op) - - // Points - msg := fmt.Sprintf("Points: %d", g.Save.Points) - text.Draw( - screen, - msg, - g.FontFace, - 10, - g.FontFace.Metrics().Height.Ceil(), - color.White, - ) - - // Level - msg = fmt.Sprintf("Level: %d", g.Save.Level) - text.Draw( - screen, - msg, - g.FontFace, - 10, - g.FontFace.Metrics().Height.Ceil()*2, - color.White, - ) - - // Times Clicked - msg = fmt.Sprintf("Clicks: %d", g.Save.TimesClicked) - text.Draw( - screen, - msg, - g.FontFace, - 10, - screen.Bounds().Dy()-g.FontFace.Metrics().Height.Ceil()*2, - color.White, - ) - - // Volume - msg = fmt.Sprintf("Volume: %d%% (← or →)", int(g.Config.Volume*100.0)) - text.Draw( - screen, - msg, - g.FontFace, - 10, - screen.Bounds().Dy()-g.FontFace.Metrics().Height.Ceil(), - color.White, - ) -} - -func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) { - scaleFactor := ebiten.DeviceScaleFactor() - return int(float64(outsideWidth) * scaleFactor), int(float64(outsideHeight) * scaleFactor) -} - func main() { // Set logging output logger.SetOutput(os.Stdout) @@ -337,7 +66,7 @@ func main() { } // Create a game instance - var game *Game = NewGame() + var game *game.Game = game.NewGame() if *saveFiles { // Work out working directory @@ -372,7 +101,7 @@ func main() { } // Set up window options - ebiten.SetWindowIcon(util.GenerateIcons(ImageFromFile("capybara_2.png"), [][2]uint{ + ebiten.SetWindowIcon(util.GenerateIcons(resources.ImageFromFile("capybara_2.png"), [][2]uint{ {32, 32}, })) ebiten.SetWindowClosingHandled(true) // So we can save data @@ -414,7 +143,7 @@ func main() { if err == ebiten.Termination || err == nil { logger.Info("[Main] Shutting down!") if *saveFiles { - game.SaveData() + game.SaveData(SaveFileName, ConfigurationFileName) } os.Exit(0) } else { diff --git a/src/resources.go b/src/resources/resources.go similarity index 87% rename from src/resources.go rename to src/resources/resources.go index 0d67790..1e1b1bf 100644 --- a/src/resources.go +++ b/src/resources/resources.go @@ -16,7 +16,7 @@ along with this program. If not, see . */ -package main +package resources import ( "bytes" @@ -32,7 +32,7 @@ import ( var ResourcesFS embed.FS // Reads file with given filename from embedded resources FS and returns its contents -func ResourceGet(filename string) []byte { +func Get(filename string) []byte { data, err := ResourcesFS.ReadFile("resources/" + filename) if err != nil { return nil @@ -43,7 +43,7 @@ func ResourceGet(filename string) []byte { // Returns a decoded image from an image file func ImageFromFile(filename string) image.Image { - data := ResourceGet(filename) + data := Get(filename) if data == nil { return nil } @@ -57,8 +57,8 @@ func ImageFromFile(filename string) image.Image { return img } -func ResourceGetFont(fontFile string) *sfnt.Font { - tt, err := opentype.Parse(ResourceGet(fontFile)) +func GetFont(fontFile string) *sfnt.Font { + tt, err := opentype.Parse(Get(fontFile)) if err != nil { return nil } @@ -67,7 +67,7 @@ func ResourceGetFont(fontFile string) *sfnt.Font { } func GetAudioPlayer(audioContext *audio.Context, audioFile string) *audio.Player { - data := bytes.NewReader(ResourceGet(audioFile)) + data := bytes.NewReader(Get(audioFile)) player, err := audioContext.NewPlayer(data) if err != nil { return nil diff --git a/src/resources/PixeloidMono.otf b/src/resources/resources/PixeloidMono.otf similarity index 100% rename from src/resources/PixeloidMono.otf rename to src/resources/resources/PixeloidMono.otf diff --git a/src/resources/PixeloidSans-Bold.otf b/src/resources/resources/PixeloidSans-Bold.otf similarity index 100% rename from src/resources/PixeloidSans-Bold.otf rename to src/resources/resources/PixeloidSans-Bold.otf diff --git a/src/resources/Thirteen-Pixel-Fonts.ttf b/src/resources/resources/Thirteen-Pixel-Fonts.ttf similarity index 100% rename from src/resources/Thirteen-Pixel-Fonts.ttf rename to src/resources/resources/Thirteen-Pixel-Fonts.ttf diff --git a/src/resources/background_1.png b/src/resources/resources/background_1.png similarity index 100% rename from src/resources/background_1.png rename to src/resources/resources/background_1.png diff --git a/src/resources/background_2.png b/src/resources/resources/background_2.png similarity index 100% rename from src/resources/background_2.png rename to src/resources/resources/background_2.png diff --git a/src/resources/boop.wav b/src/resources/resources/boop.wav similarity index 100% rename from src/resources/boop.wav rename to src/resources/resources/boop.wav diff --git a/src/resources/capybara_1.png b/src/resources/resources/capybara_1.png similarity index 100% rename from src/resources/capybara_1.png rename to src/resources/resources/capybara_1.png diff --git a/src/resources/capybara_2.png b/src/resources/resources/capybara_2.png similarity index 100% rename from src/resources/capybara_2.png rename to src/resources/resources/capybara_2.png diff --git a/src/resources/capybara_3.png b/src/resources/resources/capybara_3.png similarity index 100% rename from src/resources/capybara_3.png rename to src/resources/resources/capybara_3.png diff --git a/src/resources/leather.wav b/src/resources/resources/leather.wav similarity index 100% rename from src/resources/leather.wav rename to src/resources/resources/leather.wav diff --git a/src/resources/levelup.wav b/src/resources/resources/levelup.wav similarity index 100% rename from src/resources/levelup.wav rename to src/resources/resources/levelup.wav diff --git a/src/resources/menu_switch.wav b/src/resources/resources/menu_switch.wav similarity index 100% rename from src/resources/menu_switch.wav rename to src/resources/resources/menu_switch.wav diff --git a/src/resources/pixeloid.zip b/src/resources/resources/pixeloid.zip similarity index 100% rename from src/resources/pixeloid.zip rename to src/resources/resources/pixeloid.zip diff --git a/src/resources/thirteen-pixel-fonts.zip b/src/resources/resources/thirteen-pixel-fonts.zip similarity index 100% rename from src/resources/thirteen-pixel-fonts.zip rename to src/resources/resources/thirteen-pixel-fonts.zip diff --git a/src/resources/woop.wav b/src/resources/resources/woop.wav similarity index 100% rename from src/resources/woop.wav rename to src/resources/resources/woop.wav