-
Notifications
You must be signed in to change notification settings - Fork 1
Installation and setup
dmd is the reference compiler for the D programming language, and dub is the package / project manager. On Windows, install dmd from here and dub from here to get started. On macOS, if you have homebrew, you can use brew install dub and brew install dmd. On Linux your distribution should allow you to install dub and dmd from the central repository, or you can just go with the links above.
Open your system's command line (The command prompt on Windows, Terminal on macOS, and one of various programs on Linux), and make a directory that you want to store your project in. Run the command dub init and enter the information it asks for. When it prompts for dependencies, add dgt to get the project.
libdgt depends on SDL2 and its related libraries for things like opening a drawable window on Windows, macOS, and Linux, or loading a font file, or loading images. On macOS and Linux you need to install the libraries in a directory they can be linked from. (For those who don't know, linking is a process of combining bits of compiled code into an executable.) On Windows, you just need to get the DLLs for each library and paste them into the directory of your project.
You can find the DLLs here. Make sure to download runtime binaries. If you're not sure if you should get x86 (32 bit) or x64 (64 bit) you probably need x64. However, if in the next section of the tutorial you get an error, try switching which DLLs you have.
- SDL2: https://www.libsdl.org/download-2.0.php
- SDL2_image: https://www.libsdl.org/projects/SDL_image/
- SDL2_ttf: https://www.libsdl.org/projects/SDL_ttf/
- SDL2_mixer: https://www.libsdl.org/projects/SDL_mixer/
First you definitely need homebrew for this step. If you don't have it, download it here. Once brew is installed run brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer. That should take care of SDL.
- Debian / Ubuntu / Mint / etc.:
sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev - RedHat / Fedora / openSUSE: Use your package manager (
yum/dnf/zypper) and installSDL2-devel SDL2_image-devel SDL2_ttf-devel SDL2_mixer-devel
Now you can run your project with the dub command, and you're all set!