1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#ifndef __LAYER_BOX_H
#define __LAYER_BOX_H
#include <SDL.h>
#include "osc_graphics.h"
#include "osc_server.h"
#include "layer.h"
class LayerBox : public Layer {
Sint16 x1, y1, x2, y2;
Uint8 r, g, b, a;
public:
LayerBox(const char *name, SDL_Rect geo, float opacity,
SDL_Color color);
static CtorInfo ctor_info;
static Layer *
ctor_osc(const char *name, SDL_Rect geo, float opacity, lo_arg **argv)
{
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);
inline void
color(SDL_Color color)
{
r = color.r;
g = color.g;
b = color.b;
}
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
|