diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-26 20:08:10 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-26 20:08:10 +0200 |
commit | 7e5561d02f257f5c2ae54f4d55dee1093cf2ad4b (patch) | |
tree | a447fe2a109da09d9f06c67a0534873f9ac3a27b /layer.cpp | |
parent | eac5ac91ba27ae8e6d24625d6fa170425c51d459 (diff) | |
download | osc-graphics-7e5561d02f257f5c2ae54f4d55dee1093cf2ad4b.tar.gz |
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
Diffstat (limited to 'layer.cpp')
-rw-r--r-- | layer.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -4,8 +4,18 @@ #include <SDL.h> #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); +} |