From 7e5561d02f257f5c2ae54f4d55dee1093cf2ad4b Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 26 Sep 2012 20:08:10 +0200 Subject: isolated OSC server specific code in OscServer class and allow to register methods in order to localize OSC method handling i.e. every Layer class is stand-alone now --- layer.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'layer.cpp') diff --git a/layer.cpp b/layer.cpp index d0516ab..8820834 100644 --- a/layer.cpp +++ b/layer.cpp @@ -4,8 +4,18 @@ #include #include "osc_graphics.h" +#include "osc_server.h" #include "layer.h" +Layer::Layer(const char *name) +{ + mutex = SDL_CreateMutex(); + Layer::name = strdup(name); + + geo_osc_id = register_method("geo", GEO_TYPES, geo_osc); + alpha_osc_id = register_method("alpha", "f", alpha_osc); +} + void LayerList::insert(int pos, Layer *layer) { @@ -58,3 +68,12 @@ LayerList::render(SDL_Surface *target) unlock(); } + +Layer::~Layer() +{ + unregister_method(alpha_osc_id); + unregister_method(geo_osc_id); + + free(name); + SDL_DestroyMutex(mutex); +} -- cgit v1.2.3