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_box.h | |
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_box.h')
-rw-r--r-- | layer_box.h | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/layer_box.h b/layer_box.h index bba2f98..3c9dace 100644 --- a/layer_box.h +++ b/layer_box.h @@ -4,34 +4,53 @@ #include <SDL.h> #include "osc_graphics.h" +#include "osc_server.h" #include "layer.h" +#define LayerBox_Info_Name "box" +#define LayerBox_Info_Types "iii" /* r, g, b */ + class LayerBox : public Layer { Sint16 x1, y1, x2, y2; Uint8 r, g, b, a; public: + static void register_layer() {} + LayerBox(const char *name, SDL_Rect geo, float opacity, - SDL_Color color) : Layer(name) + SDL_Color color); + static Layer * + ctor_osc(const char *name, SDL_Rect geo, float opacity, lo_arg **argv) { - LayerBox::geo(geo); - LayerBox::color(color); - LayerBox::alpha(opacity); + SDL_Color color = { + (Uint8)argv[0]->i, (Uint8)argv[1]->i, (Uint8)argv[2]->i + }; + return new LayerBox(name, geo, opacity, color); } + ~LayerBox(); + void frame(SDL_Surface *target); + +private: void geo(SDL_Rect geo); void alpha(float opacity); - void + inline void color(SDL_Color color) { r = color.r; g = color.g; b = color.b; } - - - void frame(SDL_Surface *target); + OscServer::MethodHandlerId *color_osc_id; + static void + color_osc(LayerBox *obj, lo_arg **argv) + { + SDL_Color color = { + (Uint8)argv[0]->i, (Uint8)argv[1]->i, (Uint8)argv[2]->i + }; + obj->color(color); + } }; #endif
\ No newline at end of file |