summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2019-11-23 12:46:50 -0800
committerVito Caputo <vcaputo@pengaru.com>2022-04-01 22:12:48 -0700
commit9e49e8145c874d0120353c58df0352c3053fa5bb (patch)
tree7315c9f3ac97cd6c23569ce8aae7d623fc51571b
parent4351afc62b3dd1c7fb7f0bc563dae22ee0ec73d9 (diff)
stub: add a stub sample modulestub
Intended as a bootstrap for new module creation, particularly aimed at new contributors so without context, concurrency, or settings.
-rw-r--r--configure.ac1
-rw-r--r--src/Makefile.am2
-rw-r--r--src/modules/Makefile.am2
-rw-r--r--src/modules/stub/Makefile.am3
-rw-r--r--src/modules/stub/stub.c23
-rw-r--r--src/til.c2
6 files changed, 31 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 974b33d..0f366a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,6 +57,7 @@ AC_CONFIG_FILES([
src/modules/sparkler/Makefile
src/modules/spiro/Makefile
src/modules/stars/Makefile
+ src/modules/stub/Makefile
src/modules/submit/Makefile
src/modules/swab/Makefile
src/modules/swarm/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index aa42c08..5761ab9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@ SUBDIRS = libs modules
noinst_LTLIBRARIES = libtil.la
libtil_la_SOURCES = til_args.c til_args.h til_fb.c til_fb.h til_knobs.h til.c til.h til_settings.h til_settings.c til_threads.c til_threads.h til_util.c til_util.h
libtil_la_CPPFLAGS = -I@top_srcdir@/src
-libtil_la_LIBADD = modules/compose/libcompose.la modules/drizzle/libdrizzle.la modules/flui2d/libflui2d.la modules/julia/libjulia.la modules/meta2d/libmeta2d.la modules/montage/libmontage.la modules/pixbounce/libpixbounce.la modules/plasma/libplasma.la modules/plato/libplato.la modules/ray/libray.la modules/roto/libroto.la modules/rtv/librtv.la modules/snow/libsnow.la modules/sparkler/libsparkler.la modules/spiro/libspiro.la modules/stars/libstars.la modules/submit/libsubmit.la modules/swab/libswab.la modules/swarm/libswarm.la libs/grid/libgrid.la libs/puddle/libpuddle.la libs/ray/libray.la libs/sig/libsig.la libs/txt/libtxt.la libs/ascii/libascii.la libs/din/libdin.la
+libtil_la_LIBADD = modules/compose/libcompose.la modules/drizzle/libdrizzle.la modules/flui2d/libflui2d.la modules/julia/libjulia.la modules/meta2d/libmeta2d.la modules/montage/libmontage.la modules/pixbounce/libpixbounce.la modules/plasma/libplasma.la modules/plato/libplato.la modules/ray/libray.la modules/roto/libroto.la modules/rtv/librtv.la modules/snow/libsnow.la modules/sparkler/libsparkler.la modules/spiro/libspiro.la modules/stars/libstars.la modules/stub/libstub.la modules/submit/libsubmit.la modules/swab/libswab.la modules/swarm/libswarm.la libs/grid/libgrid.la libs/puddle/libpuddle.la libs/ray/libray.la libs/sig/libsig.la libs/txt/libtxt.la libs/ascii/libascii.la libs/din/libdin.la
if ENABLE_ROTOTILLER
bin_PROGRAMS = rototiller
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am
index 28fc7fd..0d7e53b 100644
--- a/src/modules/Makefile.am
+++ b/src/modules/Makefile.am
@@ -1 +1 @@
-SUBDIRS = compose drizzle flui2d julia meta2d montage pixbounce plasma plato ray roto rtv snow sparkler spiro stars submit swab swarm
+SUBDIRS = compose drizzle flui2d julia meta2d montage pixbounce plasma plato ray roto rtv snow sparkler spiro stars stub submit swab swarm
diff --git a/src/modules/stub/Makefile.am b/src/modules/stub/Makefile.am
new file mode 100644
index 0000000..c7f5e2f
--- /dev/null
+++ b/src/modules/stub/Makefile.am
@@ -0,0 +1,3 @@
+noinst_LTLIBRARIES = libstub.la
+libstub_la_SOURCES = stub.c
+libstub_la_CPPFLAGS = -I@top_srcdir@/src
diff --git a/src/modules/stub/stub.c b/src/modules/stub/stub.c
new file mode 100644
index 0000000..cd87781
--- /dev/null
+++ b/src/modules/stub/stub.c
@@ -0,0 +1,23 @@
+#include "til.h"
+#include "til_fb.h"
+
+/* This sample fills the frame with white pixels in a non-threaded manner,
+ * replace the body of stub_render_fragment() with your own algorithm.
+ */
+
+static void stub_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
+{
+ 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, 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>",
+};
diff --git a/src/til.c b/src/til.c
index 3cbd294..3de08d7 100644
--- a/src/til.c
+++ b/src/til.c
@@ -38,6 +38,7 @@ extern til_module_t snow_module;
extern til_module_t sparkler_module;
extern til_module_t spiro_module;
extern til_module_t stars_module;
+extern til_module_t stub_module;
extern til_module_t submit_module;
extern til_module_t swab_module;
extern til_module_t swarm_module;
@@ -59,6 +60,7 @@ static const til_module_t *modules[] = {
&sparkler_module,
&spiro_module,
&stars_module,
+ &stub_module,
&submit_module,
&swab_module,
&swarm_module,
© 2021 All Rights Reserved