diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-21 18:24:57 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-21 18:24:57 +0200 |
commit | 75667b81215bdb3896599ec477a256c41fc90436 (patch) | |
tree | 44eb5919b596666997b972fc75fe5fdea60a633b /layer_box.cpp | |
parent | 0e81cd9a89de9bdd6824bbe7265f91f3835dae97 (diff) | |
download | osc-graphics-75667b81215bdb3896599ec477a256c41fc90436.tar.gz |
split program into multiple files; switched to C++
Diffstat (limited to 'layer_box.cpp')
-rw-r--r-- | layer_box.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/layer_box.cpp b/layer_box.cpp new file mode 100644 index 0000000..d229833 --- /dev/null +++ b/layer_box.cpp @@ -0,0 +1,29 @@ +#include <math.h> + +#include <SDL.h> +#include <SDL_gfxPrimitives.h> + +#include "osc_graphics.h" +#include "layer_box.h" + +void +LayerBox::geo(SDL_Rect geo) +{ + x1 = geo.x; + y1 = geo.y; + x2 = geo.x + geo.w; + y2 = geo.y + geo.h; +} + +void +LayerBox::alpha(float opacity) +{ + a = (Uint8)ceilf(opacity*SDL_ALPHA_OPAQUE); +} + +void +LayerBox::frame(SDL_Surface *target) +{ + boxRGBA(target, x1, y1, x2 ? : target->w, y2 ? : target->h, + r, g, b, a); +} |