Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ c_src/env.mk
ebin
examples/*/*.beam
priv
.DS_Store
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ all:
cd c_src && make
erlc -o examples/bullet_engine examples/bullet_engine/*.erl
cd examples/bullet_engine && ./start.sh

hello:
erlc -o examples/hello_sdl examples/hello_sdl/*.erl
cd examples/hello_sdl && ./start.sh

clean:
@rm -f *.swp
@rm -f c_src/env.mk
@rm -rf ebin/
@rm -f examples/*/*.beam
@echo clean
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
ESDL2
=====

SDL2 Erlang NIF.
SDL2 Erlang NIFs

SDL provides cross-platform low level access to graphics, audio, keyboard, mouseand joystick hardware via OpenGL and Direct3D. This is an Erlang binding. http://www.libsdl.org/

Status
------

Week-end project. Work in progress.

The following limitations apply:


Building
--------

* Erlang 17.0+ is required
* SDL 2.0.3+ is required
* SDL 2.0.3+ is required (`http://www.libsdl.org/download-2.0.php`)
* SDL\_image is required (`https://www.libsdl.org/projects/SDL_image/`)
* No support for UTF-8 strings, only Latin-1

Tip: configure SDL\_image with --disable-webp for not having to install libwebp.

Build using `make`.

Ideas
-----
The following ideas need to be investigated:

* We may benefit from the reference receive optimization when doing calls
Expand Down
3 changes: 2 additions & 1 deletion c_src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ SDL2_LIBS = $(filter-out $(SDL2_LIBS_FILTER_OUT),$(shell sdl2-config --static-li

all: env.mk
mkdir -p $(PRIV_DIR)
gcc *.c -fPIC -shared -o $(PRIV_DIR)/esdl2.so -I $(ERTS_INCLUDE_DIR) \
gcc -undefined dynamic_lookup *.c -fPIC -shared \
-o $(PRIV_DIR)/esdl2.so -I $(ERTS_INCLUDE_DIR) \
`sdl2-config --cflags` $(SDL2_LIBS) -lSDL2_image

env.mk:
Expand Down