X-Git-Url: http://git.localhorst.tv/?p=space.git;a=blobdiff_plain;f=src%2Fui%2FDualGauge.h;fp=src%2Fui%2FDualGauge.h;h=9aa30e3b32a5109902a9ab446f16e1381bc01959;hp=0000000000000000000000000000000000000000;hb=1cb5ed22d7772abe6f9893be90f26f46dbde39f7;hpb=ffd31714f3edb64ebe16b65878750c6cc5c7e884 diff --git a/src/ui/DualGauge.h b/src/ui/DualGauge.h new file mode 100644 index 0000000..9aa30e3 --- /dev/null +++ b/src/ui/DualGauge.h @@ -0,0 +1,48 @@ +#ifndef SPACE_DUALGAUGE_H_ +#define SPACE_DUALGAUGE_H_ + +#include "../graphics/Color.h" +#include "../graphics/Vector.h" + + +namespace space { + +class Canvas; + +class DualGauge { + +public: + constexpr DualGauge( + Vector size, + Vector pos, + Color borderCol, + Color bgCol, + Color posCol, + Color negCol) + : pos(pos), size(size) + , bgPos(pos + Vector(1, 1)), bgSize(size - Vector(2, 2)) + , valPos(pos.x + 2, pos.y + 2 + (size.y - 4) / 2) + , valSize(size.x - 4, (size.y - 4) / 2) + , borderCol(borderCol), bgCol(bgCol) + , posCol(posCol), negCol(negCol) { } + +public: + void Render(Canvas &, float value) const; + +private: + Vector pos; + Vector size; + Vector bgPos; + Vector bgSize; + Vector valPos; + Vector valSize; + Color borderCol; + Color bgCol; + Color posCol; + Color negCol; + +}; + +} + +#endif