aboutsummaryrefslogtreecommitdiff
path: root/layer_box.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-09-26 20:08:10 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-09-26 20:08:10 +0200
commit7e5561d02f257f5c2ae54f4d55dee1093cf2ad4b (patch)
treea447fe2a109da09d9f06c67a0534873f9ac3a27b /layer_box.cpp
parenteac5ac91ba27ae8e6d24625d6fa170425c51d459 (diff)
downloadosc-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_box.cpp')
-rw-r--r--layer_box.cpp16
1 files changed, 16 insertions, 0 deletions
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);
+}