Skip to content

f1sty/sexdl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sexdl

SDL2 bindings for Elixir (NIFs)

TODO

  • refresh on NIFs
  • research on SDL library
  • MVP with window showed
  • unify error handling in NIFs
  • add helper functions into Sexdl.Video for SDL_WindowFlags enum values
  • make NIFs compilation process easier
  • fix sdl_convert_surface_nif to accept same params as API function
  • look into enif_alloc_resource more and decide how to handle pointers
  • separate SDL2/SDL_video.h functions into Sexdl.Video module (maybe?)
  • return map from new function in sdl_event.c
  • fix elixir actions

Run MVP

To compile NIFs and launch sanity test program, run:

$ mix do deps.get, compile
$ iex -S mix

followed by:

iex> Sexdl.Mvp.run(~c"title")

Black window should appear for about 3 seconds.

You also can run:

iex> Sexdl.Mvp.run(~c"title", ~c"priv/test.png")

And you should see an owl on black background for the same time span:).

Implemented bindings (so far)

  • SDL_Init
  • SDL_CreateWindow
  • SDL_GetWindowSurface
  • SDL_UpdateWindowSurface
  • SDL_BlitSurface
  • SDL_FreeSurface
  • SDL_DestroyWindow
  • SDL_Quit
  • SDL_PollEvent
  • IMG_Init
  • IMG_Load
  • IMG_Quit
  • SDL_ConvertSurface partially (see TODO list)