Package:Simple DirectMedia Layer

From Funtoo
Jump to: navigation, search

Simple DirectMedia Layer

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.

Introduction

Simple DirectMedia Layer is commonly referred to by its acronym sdl. There are two versions of the sdl libraries commonly used: sdl and sdl2. The distinction is all libraries pre-version 2.0 are sdl while post-version 2.0 are sdl2. Version in this case is important as post-2.0 release involved a major changed to the SDL code base with non-backwards compatible changes to its API.

sdl (pre-2.0) is considered outdated and new development with sdl is discouraged. Components of sdl and sdl2 cannot be intermixed.

This page covers sdl2 only.

Usage(Simple)

Applications may only require the presence of the core sdl2 library. For this, executing below should be sufficient:

root #  emerge media-libs/libsdl2

Usage(Source)

Some game applications may also require additional SDL2 component libraries below:

ComponentDescription
SDL2-GFXGraphics drawing primitives library for SDL2
SDL2-ImageImage file loading library
SDL2-MixerAudio and sound mixing functionality
SDL2-NetNetworking support
SDL2-TTFTrue Type Font handling functions

These subsystems can be installed, libsdl2 is pulled in as a dependency, by executing the following:

root #  emerge media-libs/sdl2-gfx media-libs/sdl2-image media-libs/sdl2-mixer media-libs/sdl2-net media-libs/sdl2-ttf

or more simply using shell brace expansion:

root #  emerge media-libs/sdl2-{gfx,image,mixer,net,ttf}

Further Reading

Simple DirectMedia Layer Wiki Home Page
Wikipedia - Simple DirectMedia Layer
Flare Game Engine - example of needing SDL2 source install
Lazy Foo Productions - SDL2 programming tutorial