summaryrefslogtreecommitdiff
path: root/src/modules/stub/stub.c
blob: b7fabac24c048978e0ab36cdf8833c1bcd6514b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "til.h"
#include "til_fb.h"

/* Sample module fills the frame with white pixels in a non-threaded manner,
 * replace the body of stub_render_fragment() with your own algorithm.
 *
 * To finalize a module implementation derived from this stub, perform a global
 * substitution of "stub" with your module's name, including copying into
 * src/modules/$name, and updating all the build system and til.c references.
 *
 * A quick way to see what's involved in introducing a new module is to just
 * `git show` the commit adding this stub module to rototiller.
 *
 * XXX: Note that since this module has the TIL_MODULE_EXPERIMENTAL flag set, it
 * won't appear in the modules list or participate in randomizers.  You can stil
 * access it explicitly by name via the ":" prefix override, e.g.:
 * rototiller --module=:stub
 *
 * Or just remove the TIL_MODULE_EXPERIMENTAL flag during development so it's
 * treated normally.
 */

static void stub_render_fragment(til_module_context_t *context, til_stream_t *stream, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
	til_fb_fragment_t	*fragment = *fragment_ptr;

	for (unsigned y = fragment->y; y < fragment->y + fragment->height; y++) {
		for (unsigned x = fragment->x; x < fragment->x + fragment->width; x++) {
			til_fb_fragment_put_pixel_unchecked(fragment, 0, x, y, 0xffffffff);
		}
	}
}


til_module_t	stub_module = {
	.render_fragment = stub_render_fragment,
	.name = "stub",
	.description = "Minimal stub sample module",
	.author = "Your Name <your@email.address>",
	.flags = TIL_MODULE_EXPERIMENTAL,	/* XXX: remove this line to make module generally available */
};
© All Rights Reserved