This is a brief howto for making your own loadable module in blobber.

Here's an example module file (I'm calling it test_module.cpp).

#include "blobber.h"

using namespace blobber;

class TestModule : public ModInterface {
 public:
  TestModule() : ModInterface("TestModule") {
    // initialization code
  };

  void init(Camarea &area, ProjectionWindow &pw) {
    // say we want to know about any pixles that are between 
    // RGB:60/0/0 and RGB:255/255/255
    register_poi_criteria(area, CRANGE(COLOR(60, 0, 0)));
  };

  void update(Camarea &area, ProjectionWindow &pw) {
    vector<PIXEL> poi;
    get_poi(area, poi);
  
    if(poi.size() == 0) {
      // no points of interest
    } else {
      // there are points of interest!  
      // go ahead and iterate through them and play
    }

  };
};

extern "C" {
  ModInterface *get_module() { return new TestModule(); };
};

First, compile it:

g++ test_module.cpp -c `pkg-config libblobber --cflags`

Then, make a shared library:

g++ -shared -Wl,-soname,libtestmodule.so.0 -o libtestmodule.so.0.0.0 test_module.o `pkg-config libblobber --libs`

Then, copy your new module to the module directory:

export MODDIR=`pkg-config libblobber --variable=moduledir`
sudo cp libtestmodule.so.0.0.0 $MODDIR
sudo ln -s $MODDIR/libtestmodule.so.0.0.0 $MODDIR/libtestmodule.so

If you're programming in C++ you'll probably want to use multiple files, classes, and a local Makefile for your module. Here's a sample makefile that would work for any module with any number of associated class files.

# This should be the only line you need to edit (make sure there are no spaces or 
# underscores in the name, even if your filename for your module has one)
MODNAME=pong

############################################
SRCS=$(wildcard *.cpp)
OBJS=$(patsubst %.cpp,%.o,$(SRCS))
CPPFLAGS=`pkg-config libblobber --cflags`
MODDIR=`pkg-config libblobber --variable=moduledir`
CC=g++
LIBS=`pkg-config libblobber --libs`

all: $(OBJS)
	$(CC) -shared -Wl,-soname,lib$(MODNAME).so.0 -o lib$(MODNAME).so.0.0.0 $^ $(LIBS)

install: all
	cp lib$(MODNAME).so.0.0.0 $(MODDIR)
	ln -s $(MODDIR)/lib$(MODNAME).so.0.0.0 $(MODDIR)/lib$(MODNAME).so

clean:
	rm *.o *.so.*

uninstall:
	rm $(MODDIR)/lib$(MODNAME).so.0.0.0 $(MODDIR)/lib$(MODNAME).so