/sdl2-examples

LFE SDL2 Examples using Loïc's Erlang NIF

Primary LanguageErlangOtherNOASSERTION

sdl2-examples

SDL2 Examples in LFE

Contents

Introduction

Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.

The Erlang/LFE/Elixir ecosystem have access to SDL via the following Erlang libraries:

The example in this repo take advantage of the newer SDL2 library and the Erlang bindings for it that Loïc has made available with esdl2.

Dependencies

The following are required to be installed on your system:

  • Erlang
  • rebar3
  • SDL2

If installing on a Mac with Homebrew, you will need sdl2 and sdl2_image. The list of packages developed against for Ubuntu are listed in this project's .travis.yml config file.

Installation

In your rebar.config file, update your deps section to include lutil:

{deps, [
  {sdl2ex, {git, "https://github.com/lfex/sdl2-examples.git"}}
]}

Usage

Example 1

Start up the LFE repl:

$ make repl

Then run the example:

> (sdl2ex-hello:run)

This will open up a window like you see here:

Hello SDL screenshot

When you're done admiring the logo, closing the window will cause the LFE application to shutdown.

License

Original Erlang:

Copyright © 2014-2015, Loïc Hoguin

LFE port:

Copyright © 2016 Duncan McGreggor

Distributed under the Apache License, Version 2.0.