update readme to remove SDL

main
Sean Hickey 2022-11-22 00:20:14 -08:00
parent ce5ff1a552
commit cee1d19f36
3 changed files with 41 additions and 35 deletions

View File

@ -2,11 +2,11 @@
This is some game project that we are working on for fun.
This project is written in Go using SDL2.
This project is written in Go using raylib.
## Compiling
See the [Setup Docs][1] for installing all the necessary dependencies. It's fairly bare-bones, only requiring SDL.
See the [Setup Docs][1] for installing all the necessary dependencies. It's fairly bare-bones, only requiring raylib (which bundles everything, only depending on base graphics libs like X11).
Then you can use the Makefile:
```sh
@ -23,10 +23,6 @@ A release build can be build with these extra flags:
go build -x -v -ldflags "-s -w"
```
## Running
You may need the SDL2 libraries in order to run the resulting binary. Copy the SDL2 *.dll or *.so files into the same directory as the output executable and run the program.
## Docs
For initial environment setup, see the [Setup Docs][1].

View File

@ -2,10 +2,6 @@
Windows is a bit of a different beast when it comes to setting up a development environment. Hopefully this documentation helps get you started. This guide tries to detail everything you would need to download and configure to get this to work.
I originally wrote this documentation back when we were using SDL for development rather than raylib. I left the SDL install instructions because they might be helpful for future projects, and the set up on Windows is particularly weird. For the new raylib version, you still need to set up GCC, but you do not need to install SDL.
As a side note, there is a cool tool called `Scoop` that you could use to install a lot of these tools. However, I ran into an issue using the Scoop versions of SDL2 because the directory names were different from what the header files were expecting. Below I just installed everything manually instead.
## Install Git
If you don't have Git yet, you can download it here.
https://git-scm.com/
@ -43,19 +39,6 @@ There is no installer for this, so we just need to put this in a folder that we'
Later on, we will need to set up the environment variables so that other software knows where we installed GCC.
## Install SDL2
Download the "devel mingw" versions of the following SDL2 releases (again, ideally the latest versions, just providing links for examples).
* SDL2 https://github.com/libsdl-org/SDL/releases/download/release-2.24.0/SDL2-devel-2.24.0-mingw.zip
* SDL2_Image https://github.com/libsdl-org/SDL_image/releases/download/release-2.6.2/SDL2_image-devel-2.6.2-mingw.zip
* SDL2_TTF https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.20.1/SDL2_ttf-devel-2.20.1-mingw.zip
* SDL2_Mixer https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.6.2/SDL2_mixer-devel-2.6.2-mingw.zip
Extract the zip files (you can use 7zip or the built-in Windows zip tool) to get a directory for each. They should look something like `SDL2_ttf-2.20.1`.
Then put these all in some folder you will remember, something like `C:\Users\Username\SDL2`.
You should end up with 4 folders inside the `SDL2` folder you created, one for each of the things we downloaded.
## Set environment variables
Now that we have all the software downloaded, we need to set some environment variables so that everything will know where we installed the software.
@ -73,14 +56,9 @@ Then we need to enable CGO (allowing the Go compiler to use a C compiler too):
CGO_ENABLED = 1
```
Then we need to set our "include" path. This is all of the directories that contain C header files to be included in our code. We need this to include the default GCC include directory as well as each of the SDL2 library include directories that we downloaded. This might be easier to copy-paste yourself if the versions are different. Also, change the `Username` to match your actual username (use search-replace to make this easier).
Then we need to set our "include" path. This is all of the directories that contain C header files to be included in our code. We need this to include the default GCC include directory. (Depending on how you installed GCC, this may already be set). Below is an example, but it would probably be easier to copy-paste your path to get the version information correct.
```
C_INCLUDE_PATH = C:\Users\Username\GCC\x86_64-12.1.0-release-win32-seh-rt_v10-rev3\mingw64\include;C:\Users\Username\SDL2\SDL2_image-2.6.2\x86_64-w64-mingw32\include;C:\Users\Username\SDL2\SDL2_mixer-2.6.2\x86_64-w64-mingw32\include;C:\Users\Username\SDL2\SDL2_ttf-2.20.1\x86_64-w64-mingw32\include;C:\Users\Username\SDL2\SDL2-2.24.0\x86_64-w64-mingw32\include;C:\Users\Username\SDL2\SDL2-2.24.0\x86_64-w64-mingw32\include\SDL2;
```
Then we need to set our "library" path. This is all of the directories that contain compiled library files (on Windows these are `*.dll` files) that can be imported into our code. This only needs to add all of the SDL2 directories.
```
LIBRARY_PATH = C:\Users\Username\SDL2\SDL2-2.24.0\x86_64-w64-mingw32\lib;C:\Users\Username\SDL2\SDL2_ttf-2.20.1\x86_64-w64-mingw32\lib;C:\Users\Username\SDL2\SDL2_mixer-2.6.2\x86_64-w64-mingw32\lib;C:\Users\Username\SDL2\SDL2_image-2.6.2\x86_64-w64-mingw32\lib;
C_INCLUDE_PATH = C:\Users\Username\GCC\x86_64-12.1.0-release-win32-seh-rt_v10-rev3\mingw64\include;
```
And depending on how you installed GCC, you may need to also add its `bin` directory to your path so that you will be able to call the `gcc` compiler. There are probably other entries already in your `PATH` variable, so just add this as an additional entry:
@ -88,11 +66,6 @@ And depending on how you installed GCC, you may need to also add its `bin` direc
PATH = C:\Users\Username\GCC\x86_64-12.1.0-release-win32-seh-rt_v10-rev3\mingw64\bin
```
## Copy the SDL2 libraries into your code directory
Your code may compile successfully, but it might not run because of the missing SDL2 libraries. Copy each of the `*.dll` library files into your code directory so that your resulting binary can load them correctly.
The DLL files should be in each of the `bin` directories of the SDL2 libraries that you downloaded.
## Build the software
Now we can just build the software and hope it works!
```

37
docs/setup/windows-sdl.md Normal file
View File

@ -0,0 +1,37 @@
# Setting up SDL on Windows
Note: this project no longer uses SDL, but I wanted to keep the documentation around on how to set up and configure SDL on Windows because it was particularly weird.
As a side note, there is a cool tool called `Scoop` that you could use to install a lot of these tools. However, I ran into an issue using the Scoop versions of SDL2 because the directory names were different from what the header files were expecting. Below I just installed everything manually instead.
## Install SDL2
Download the "devel mingw" versions of the following SDL2 releases (again, ideally the latest versions, just providing links for examples).
* SDL2 https://github.com/libsdl-org/SDL/releases/download/release-2.24.0/SDL2-devel-2.24.0-mingw.zip
* SDL2_Image https://github.com/libsdl-org/SDL_image/releases/download/release-2.6.2/SDL2_image-devel-2.6.2-mingw.zip
* SDL2_TTF https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.20.1/SDL2_ttf-devel-2.20.1-mingw.zip
* SDL2_Mixer https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.6.2/SDL2_mixer-devel-2.6.2-mingw.zip
Extract the zip files (you can use 7zip or the built-in Windows zip tool) to get a directory for each. They should look something like `SDL2_ttf-2.20.1`.
Then put these all in some folder you will remember, something like `C:\Users\Username\SDL2`.
You should end up with 4 folders inside the `SDL2` folder you created, one for each of the things we downloaded.
## Set environment variables
Now that we've downloaded SDL, we need to set some environment variables so that everything will know where we installed it.
We need to set our "include" path. This is all of the directories that contain C header files to be included in our code. We need this to include the default GCC include directory as well as each of the SDL2 library include directories that we downloaded. This might be easier to copy-paste yourself if the versions are different. Also, change the `Username` to match your actual username (use search-replace to make this easier).
```
C_INCLUDE_PATH = C:\Users\Username\GCC\x86_64-12.1.0-release-win32-seh-rt_v10-rev3\mingw64\include;C:\Users\Username\SDL2\SDL2_image-2.6.2\x86_64-w64-mingw32\include;C:\Users\Username\SDL2\SDL2_mixer-2.6.2\x86_64-w64-mingw32\include;C:\Users\Username\SDL2\SDL2_ttf-2.20.1\x86_64-w64-mingw32\include;C:\Users\Username\SDL2\SDL2-2.24.0\x86_64-w64-mingw32\include;C:\Users\Username\SDL2\SDL2-2.24.0\x86_64-w64-mingw32\include\SDL2;
```
Then we need to set our "library" path. This is all of the directories that contain compiled library files (on Windows these are `*.dll` files) that can be imported into our code. This only needs to add all of the SDL2 directories.
```
LIBRARY_PATH = C:\Users\Username\SDL2\SDL2-2.24.0\x86_64-w64-mingw32\lib;C:\Users\Username\SDL2\SDL2_ttf-2.20.1\x86_64-w64-mingw32\lib;C:\Users\Username\SDL2\SDL2_mixer-2.6.2\x86_64-w64-mingw32\lib;C:\Users\Username\SDL2\SDL2_image-2.6.2\x86_64-w64-mingw32\lib;
```
## Copy the SDL2 libraries into your code directory
Your code may compile successfully, but it might not run because of the missing SDL2 libraries. Copy each of the `*.dll` library files into your code directory so that your resulting binary can load them correctly.
The DLL files should be in each of the `bin` directories of the SDL2 libraries that you downloaded.