Skip to content
Adrian Pistol edited this page Apr 26, 2018 · 1 revision

Writing a backend for sled is relatively simple.

Create a out_mybackend.c file in src/modules/.

Check out the various out modules already existing. out_dummy and out_sdl2 for example.

The out plugins should buffer, only updating the matrix when render() gets called.

int init(int moduleno, char* argstr)

The init function, this is where you allocate your buffers and initialize everything necessary to start drawing.

int set(int x, int y, RGB *color)

Set the pixel at (x, y) in the buffer to the color represented by color.

int clear(void)

Clears the buffer, setting it to #000000/black/turning the pixel off.

int getx(void)

Get the width of the matrix.

int gety(void)

Get the height of the matrix.

ulong wait_until(ulong desired_usec)

Wait until the desired usec hit.

If you don't need to do anything special, you can just return wait_until_core(desired_usec);.

int deinit(void)

Free all the buffers here.