diff options
-rw-r--r-- | src/base/config.cpp | 15 | ||||
-rw-r--r-- | src/base/config.hpp | 5 | ||||
-rw-r--r-- | src/menu/drawable_control.cpp | 10 |
3 files changed, 29 insertions, 1 deletions
diff --git a/src/base/config.cpp b/src/base/config.cpp index 630ac3b6..7a5807af 100644 --- a/src/base/config.cpp +++ b/src/base/config.cpp @@ -31,7 +31,8 @@ namespace usdx log4cpp::Category::getInstance("usdx.base.config"); Config::Config() - : graphics_fullscreen(false), graphics_resolution(800,600) + : graphics_fullscreen(false), graphics_resolution(800,600), + debug_boxes(false) { try { // TODO: handling different paths @@ -39,6 +40,7 @@ namespace usdx graphics_fullscreen = pt.get("graphics.fullscreen", graphics_fullscreen); graphics_resolution = pt.get("graphics.resolution", graphics_resolution); + debug_boxes = pt.get("debug.boxes", debug_boxes); } catch(...) { log << log4cpp::Priority::ERROR << "Loading of configuration failed."; @@ -82,4 +84,15 @@ namespace usdx { return graphics_resolution; } + + void Config::set_debug_boxes(bool value) + { + debug_boxes = value; + pt.put("debug.boxes", value); + } + + bool Config::get_debug_boxes(void) const + { + return debug_boxes; + } }; diff --git a/src/base/config.hpp b/src/base/config.hpp index 83028400..36ee5394 100644 --- a/src/base/config.hpp +++ b/src/base/config.hpp @@ -51,6 +51,8 @@ namespace usdx bool graphics_fullscreen; Dimension<int> graphics_resolution; + bool debug_boxes; + public: Config(); virtual ~Config(); @@ -63,6 +65,9 @@ namespace usdx void set_graphics_resolution(Dimension<int> value); Dimension<int> get_graphics_resolution(void) const; + + void set_debug_boxes(bool value); + bool get_debug_boxes(void) const; }; }; diff --git a/src/menu/drawable_control.cpp b/src/menu/drawable_control.cpp index 298abdfe..864855f8 100644 --- a/src/menu/drawable_control.cpp +++ b/src/menu/drawable_control.cpp @@ -27,6 +27,8 @@ #include "drawable_control.hpp" #include "container.hpp" #include "clipping_helper.hpp" +#include "static_rectangle.hpp" +#include "application.hpp" #include "modelview_matrix_cache.hpp" namespace usdx @@ -105,6 +107,14 @@ namespace usdx Drawable::repaint(); } } + + if (Application::get_config()->get_debug_boxes()) + { + boost::shared_lock<boost::shared_mutex> lock(size_mutex); + StaticRectangle s(RgbColor(255, 0, 0), size); + s.set_stroke_width(2.0f); + s.repaint(); + } } void DrawableControl::set_position(const Point<int>& position) |