Home

Awesome

SDL2 for Nim

This package contains the bindings for SDL2 to Nim.

Pre-requisites

You must install the SDL2 C libraries before these Nim bindings can be used.

macOS

Homebrew

If you don't already have Homebrew installed, install it from the Homebrew site.

Install the SDL2 C libraries:

brew install sdl2{,_gfx,_image,_mixer,_net,_ttf}

MacPorts

If you don't already have Macports installed, install it from the Macports site.

sudo port install libsdl2 libsdl2_gfx libsdl2_image libsdl2_mixer libsdl2_ttf libsdl2_net

Linux

Install SDL2 development libraries using your distribution's packaging tool of choice.

Windows

Using SDL2 with mingw-w64 environment

Static linking SDL2

Pass the following options to nim on compilation: --dynlibOverride:libSDL2 --passL:"-static -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" Options for the linker (--passL:) except -static are taken from sdl2-config.cmake which is included in SDL2 Development Libraries.

Installation

Add requires "sdl2" to your .nimble file.

You can also install manually with nimble install sdl2 if your project does not yet have a nimble package file.

For more information on using nimble, consult the nim documentation.

Documentation

For documentation about SDL2 see wiki.libsdl.org.