From be06560334a8f9b5e290a5a5ef1dc4916c55b691 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 9 Nov 2013 13:17:57 +0000 Subject: Added reputation bars. --- src/ui/paint.cc | 14 ++++++++++++++ src/ui/paint.h | 45 +++++++++++++++++++++++++++++++++++---------- 2 files changed, 49 insertions(+), 10 deletions(-) (limited to 'src/ui') diff --git a/src/ui/paint.cc b/src/ui/paint.cc index 7b8e43f..6dd85b8 100644 --- a/src/ui/paint.cc +++ b/src/ui/paint.cc @@ -58,6 +58,20 @@ void Paint::draw_rectangle(const math::Vector2f &global_location, const math::Ve end(); } +void Paint::draw_rectangle_gradient(const math::Vector2f &global_location, const math::Vector2f &size, const math::Color & color_left, const math::Color & color_right) +{ + gl::begin(gl::Quads); + gl::color(color_left); + gl::vertex(global_location.x(), global_location.y()); + gl::color(color_right); + gl::vertex(global_location.x() + size.width(), global_location.y()); + gl::color(color_right); + gl::vertex(global_location.x() + size.width(), global_location.y() + size.height()); + gl::color(color_left); + gl::vertex(global_location.x(), global_location.y() + size.height()); + gl::end(); +} + // draw a bitmap void Paint::draw_bitmap(const math::Vector2f &global_location, const math::Vector2f &size, const std::string &texture) { diff --git a/src/ui/paint.h b/src/ui/paint.h index d21aaa0..b2829ea 100644 --- a/src/ui/paint.h +++ b/src/ui/paint.h @@ -19,23 +19,40 @@ namespace ui { class Paint { public: - /// set paint color to RGB value + /** + * @brief set paint color to RGB value + * */ static void set_color(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f); - /// set paint color to RGB value + /** + * @brief set paint color to RGB value + * */ static void set_color(math::Color const & color); - /// set paint color to system color code + /** + * @brief set paint color to system color code + * */ static void set_system_color(const char c); - /// assign system color code + /** + * @brief assign system color code + * */ static void assign_system_color(const char c, const math::Color &color); - /// draw a border + /** + * @brief draw a border + * */ static void draw_border(const math::Vector2f &global_location, const math::Vector2f &size); - /// draw a rectangle + /** + * @brief draw a rectangle + * */ static void draw_rectangle(const math::Vector2f &global_location, const math::Vector2f &size); + + /** + * @brief draw a color gradient rectangle + * */ + static void draw_rectangle_gradient(const math::Vector2f &global_location, const math::Vector2f &size, const math::Color & color_left, const math::Color & color_right); /** * @brief draw a rectangular bitmap @@ -43,16 +60,24 @@ public: **/ static void draw_bitmap(const math::Vector2f &global_location, const math::Vector2f &size, const std::string &texture); - /// draw a rectangular bitmap and overrride material color + /** + * @brief draw a rectangular bitmap and overrride material color + * */ static void draw_bitmap(const math::Vector2f &global_location, const math::Vector2f &size, const math::Color & color, const std::string &texture); - /// draw a tiled bitmap + /** + * @brief draw a tiled bitmap + * */ static void draw_material(const math::Vector2f &global_location, const math::Vector2f &size, const std::string &texture); - /// draw unaligned text + /** + * @brief draw unaligned text + * */ static void draw_text(const math::Vector2f &global_location, const Font *font, const std::string &text); - /// draw aligned text + /** + * @brief draw aligned text + * */ static void draw_label(const math::Vector2f &global_location, const math::Vector2f &size, const Font *font, const std::string &text, const unsigned int alignment = AlignCenter); }; -- cgit v1.2.3