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_box.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'layer_box.cpp') diff --git a/layer_box.cpp b/layer_box.cpp index d229833..0ccaf7c 100644 --- a/layer_box.cpp +++ b/layer_box.cpp @@ -6,6 +6,17 @@ #include "osc_graphics.h" #include "layer_box.h" +LayerBox::LayerBox(const char *name, SDL_Rect geo, float opacity, + SDL_Color color) : Layer(name) +{ + color_osc_id = register_method("color", "iii", + (OscServer::MethodHandlerCb)color_osc); + + LayerBox::geo(geo); + LayerBox::color(color); + LayerBox::alpha(opacity); +} + void LayerBox::geo(SDL_Rect geo) { @@ -27,3 +38,8 @@ LayerBox::frame(SDL_Surface *target) boxRGBA(target, x1, y1, x2 ? : target->w, y2 ? : target->h, r, g, b, a); } + +LayerBox::~LayerBox() +{ + unregister_method(color_osc_id); +} -- cgit v1.2.3