aboutsummaryrefslogtreecommitdiff
path: root/layer_box.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-09-21 18:24:57 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-09-21 18:24:57 +0200
commit75667b81215bdb3896599ec477a256c41fc90436 (patch)
tree44eb5919b596666997b972fc75fe5fdea60a633b /layer_box.cpp
parent0e81cd9a89de9bdd6824bbe7265f91f3835dae97 (diff)
downloadosc-graphics-75667b81215bdb3896599ec477a256c41fc90436.tar.gz
split program into multiple files; switched to C++
Diffstat (limited to 'layer_box.cpp')
-rw-r--r--layer_box.cpp29
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);
+}