Skip to content

Instantly share code, notes, and snippets.

@byBretema
Created July 21, 2017 11:25
Show Gist options
  • Save byBretema/4b20cfa034043055db906d027d91b7fe to your computer and use it in GitHub Desktop.
Save byBretema/4b20cfa034043055db906d027d91b7fe to your computer and use it in GitHub Desktop.
On Windows,
Install mingw-w64 from Mingw-builds
- Version: latest (at time of writing 6.3.0)
- Architecture: x86_64
- Threads: win32
- Exception: seh
- Build revision: 1
- Destination Folder: Select a folder that your Windows user owns
Install SDL2 http://libsdl.org/download-2.0.php
- Extract the SDL2 folder from the archive using a tool like 7zip
- Inside the folder, copy the i686-w64-mingw32 and/or x86_64-w64-mingw32 depending on the architecture you chose into your mingw-w64 folder e.g. C:\Program Files\mingw-w64\x86_64-6.3.0-win32-seh-rt_v5-rev1\mingw64
Setup Path environment variable
- Put your mingw-w64 binaries location into your system Path environment variable. e.g. C:\Program Files\mingw-w64\x86_64-6.3.0-win32-seh-rt_v5-rev1\mingw64\bin and C:\Program Files\mingw-w64\x86_64-6.3.0-win32-seh-rt_v5-rev1\mingw64\x86_64-w64-mingw32\bin
Open up a terminal such as Git Bash and run go get -v github.com/veandco/go-sdl2/sdl. To prove that it's working correctly, you can change directory by running cd go/src/github.com/veandco/go-sdl2/examples/events and run go run events.go. A window should pop up and you can see event logs printed when moving your mouse over it or typing on your keyboard.
(Optional) You can repeat Step 2 for SDL_image, SDL_mixer, SDL_ttf
- NOTE: pre-build the libraries for faster compilation by running go install github.com/veandco/go-sdl2/sdl_{image,mixer,ttf}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment