No description
Find a file
2020-09-12 13:07:34 -06:00
docs Add docs 2020-04-26 15:20:37 -06:00
src Add static compilation for sdl_gpu and sdl_gfx 2020-09-12 13:07:34 -06:00
.gitignore Add static compilation for sdl_gpu and sdl_gfx 2020-09-12 13:07:34 -06:00
nim.cfg Use isDefined 2020-08-23 20:36:50 -06:00
README.md Update README.md 2020-04-28 07:23:36 -06:00
sdl2.nimble Use nimterop head 2020-09-12 11:10:21 -06:00

nim-sdl2

NOTE: This project is not in a ready to use state yet. Working on adding support for Windows & Linux.

Autogenerated Nim bindings around SDL2. These bindings should be complete.

Bindings are autogenerated at compile time and all related libraries are downloaded and built for you as well. You can specify the version of each SDL2 lib using the information in the Configuration section below.

Installation

nimble install nim_sdl2

Usage

Examples are coming. To import (and use all libs except sdl2_gpu), use

import sdl2
import sdl2 / sdl2_gpu

If you want to only use specific libs, import individually:

import sdl2 / sdl2
import sdl2 / sdl2_image
import sdl2 / sdl2_ttf
import sdl2 / sdl2_net
import sdl2 / sdl2_mixer
import sdl2 / sdl2_gfx

import sdl2 / sdl2_gpu

Configuration

This project uses nimterop to generate it's bindings and documentation.

As such, nimterop provides a nice configuration for choosing which versions of libraries get installed. To do so, create a nim.cfg file in your project's root directory (if one doesn't exist), and add the following:

-d:SDL_SetVer="2.0.12" -d:SDL_DL -d:SDL_Static
-d:SDL_ImageSetVer="2.0.5" -d:SDL_Image_DL -d:SDL_Image_Static
-d:SDL_NetSetVer="2.0.1" -d:SDL_Net_DL -d:SDL_Net_Static
-d:SDL_MixerSetVer="2.0.4" -d:SDL_Mixer_DL -d:SDL_Mixer_Static
-d:SDL_ttf_SetVer="2.0.15" -d:SDL_TTF_DL -d:SDL_ttf_Static
-d:SDL_GpuSetVer="def5ea1" -d:SDL_GPU_Git -d:SDL_Gpu_Static
-d:SDL2_GFXPrimitivesSetVer="1.0.4" -d:SDL2_GFXPrimitives_DL -d:SDL2_GFXPrimitives_Static -d:SDL2_GFX_Static

Change the versions as needed above. sdl-gpu is in a git repo, so the version it uses is the commit hash. SDL2_GFXPrimitives is sdl2-gfx, just the naming is a bit weird. If you want to build a dynamically linked library, remove the _Static options above.

Documentation

View autogenerated documentation here.

All symbols and procedure definitions should be in line with their C counterparts, except with the prefixes removed (GPU_, SDL_, etc).

See the SDL2 docs for more information.