Added a better README.md and removed the dockerfile. A Makefile was added for building on linux. Signed-off-by: Luca Francesca <luca@lucafrancesca.me> |
||
|---|---|---|
| .gitignore | ||
| FyneApp.toml | ||
| go.mod | ||
| go.sum | ||
| Icon.png | ||
| list.go | ||
| main.go | ||
| Makefile | ||
| pkmn.go | ||
| README.md | ||
| windows.go | ||
pkmnviewer
PKMViewer is a small desktop GUI application that looks up Pokémon information using the public PokéAPI and displays sprites, abilities, types, and base stats. The UI is built with the Fyne GUI toolkit.
This README contains build and run instructions, prerequisites, a short file overview, and basic troubleshooting tips.
Prerequisites
- Go (recommended >= 1.24). The module declares
go 1.24.0and the project was developed with a Go toolchain referenced asgo1.25.5. Using a recent Go release (1.24 or newer) is recommended. - Network access (the app queries the public PokéAPI at runtime).
- No API keys are required.
Platform-specific notes:
- On macOS the app should run out of the box with Go installed.
- On Linux, Fyne may require additional system libraries (OpenGL / X11 / Wayland) depending on your distribution. If you see errors related to graphics or windowing, consult the Fyne docs for platform-specific requirements.
Dependencies (from go.mod):
fyne.io/fyne/v2— GUI toolkitgithub.com/mtslzr/pokeapi-go— PokéAPI client
Build & Run
From the project root (the directory containing go.mod):
-
Run directly (for development):
go run .
-
Build a local executable:
go build -o pkmnviewer
-
Run the built executable:
./pkmnviewer(on macOS / Linux)pkmnviewer.exe(on Windows)
-
Ensure modules are fetched / tidy if needed:
go mod tidygo mod download
Cross-compilation examples:
- Linux amd64:
GOOS=linux GOARCH=amd64 go build -o pkmnviewer-linux-amd64
- macOS arm64:
GOOS=darwin GOARCH=arm64 go build -o pkmnviewer-darwin-arm64
- Windows amd64:
GOOS=windows GOARCH=amd64 go build -o pkmnviewer.exe
Note: Cross-compiling GUI applications can be more complicated if system-specific libraries or cgo are required by your GUI backend. If you run into issues, build on the target platform or consult Fyne cross-compilation guidance.
Optional tooling:
- The
fyneCLI can help with packaging native bundles (optional). Install it with:go install fyne.io/fyne/v2/cmd/fyne@latest- See Fyne docs for packaging for macOS, Windows, Linux.
How the app works (brief)
- The main window shows:
- A generation selector (e.g. "1", "2", ...).
- After selecting a generation, a second selector populates with Pokémon species names from that generation.
- Selecting a Pokémon loads its details from the PokéAPI and opens a secondary window with:
- Normal and shiny sprites (front/back).
- Abilities and whether they are hidden.
- Types.
- Base stats displayed with progress bars and total.
No persistent storage is used; every selection queries the PokéAPI at runtime.
Project layout / important files
go.mod— module and dependency declarations.main.go— application entrypoint, creates the main Fyne app and window.windows.go— UI glue: dropdowns, handlers for generation and Pokémon selection, fetching data viapokeapi-go, creating the secondary window and layout.pkmn.go— UI helper functions: sprite creation, stats / type / ability containers and other view helpers.list.go— simple list of available generation strings (genList).README.md— this file.
Troubleshooting
-
Unknown imports or build failures:
- Run
go mod tidyand thengo buildorgo run . - Run
go envto check GOPATH/GOMOD settings if modules are not resolving.
- Run
-
Fyne / GUI issues on Linux:
- Ensure required system libraries for windowing / OpenGL are installed for your distro.
- Consult the Fyne documentation: https://fyne.io/
-
Sprites not loading or empty images:
- The app loads sprite URLs from the PokéAPI. If the API is unreachable or a specific sprite URL is empty, images may not render.
- Make sure you have network connectivity and the PokéAPI is reachable.
-
App shows simple errors via dialogs or notifications — check those messages for actionable hints.
Extending the app
- Add caching to reduce API requests (e.g., in-memory or file-based cache).
- Add pagination or search for Pokémon by name/ID.
- Add localization (Fyne supports text rendering and multiple languages).
- Add packaging scripts using the
fyneCLI to produce native installers.
Notes
- This project uses the public PokéAPI and does not bundle or host any API keys.
- The window title prints the CPU architecture (the code uses
runtime.GOARCH).
If you need a packaged installer for a specific platform or help debugging a build error, tell me which OS and the exact error output and I can suggest next steps.