diff options
author | Stijn Buys <ingar@osirion.org> | 2010-11-29 21:09:45 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-11-29 21:09:45 +0000 |
commit | 0e54df2a4939809b0e73a78f51ac5930c815c682 (patch) | |
tree | 178897328ca2e77f6931e9ebf79d333391b47516 /src/client | |
parent | c157f244c1d25fcc5b76c5f73767e2f64cc13afe (diff) |
Added r_wireframe and r_normals buttons to the model viewer.
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/testmodelview.cc | 13 | ||||
-rw-r--r-- | src/client/testmodelview.h | 5 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/client/testmodelview.cc b/src/client/testmodelview.cc index 40ae1aa..16d9cc1 100644 --- a/src/client/testmodelview.cc +++ b/src/client/testmodelview.cc @@ -25,6 +25,10 @@ TestModelView::TestModelView(ui::Widget *parent) testmodelview_text->set_background(false); testmodelview_text->set_border(false); + testmodelview_wireframebutton = new ui::IconButton(this, "bitmaps/icons/button_wireframe", "toggle r_wireframe"); + + testmodelview_normalsbutton = new ui::IconButton(this, "bitmaps/icons/button_normals", "toggle r_normals"); + testmodelview_closebutton = new ui::Button(this); testmodelview_closebutton->set_text("Close"); testmodelview_closebutton->set_background(true); @@ -62,6 +66,15 @@ void TestModelView::resize() testmodelview_modelview->set_size(width(),height()); testmodelview_modelview->set_location(0.0f, 0.0f); + // resize icon buttons + const float icon_margin = 4.0f; + const float icon_size = 48.0f; + const float icon_count = 2; + const float l = (width() - ((icon_count + 1) * icon_margin) - (icon_count * icon_size)) * 0.5f; + + testmodelview_wireframebutton->set_geometry(l, icon_margin, icon_size, icon_size); + testmodelview_normalsbutton->set_geometry(l + 1.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + // reposition close button testmodelview_closebutton->set_size( ui::UI::elementsize.width() * 1.5f, diff --git a/src/client/testmodelview.h b/src/client/testmodelview.h index 6a3d9f3..fd363f0 100644 --- a/src/client/testmodelview.h +++ b/src/client/testmodelview.h @@ -9,6 +9,7 @@ #include "ui/widget.h" #include "ui/button.h" +#include "ui/iconbutton.h" #include "ui/plaintext.h" #include "ui/modelview.h" @@ -45,8 +46,10 @@ protected: private: ui::ModelView *testmodelview_modelview; - ui::Button *testmodelview_closebutton; ui::PlainText *testmodelview_text; + ui::Button *testmodelview_closebutton; + ui::IconButton *testmodelview_wireframebutton; + ui::IconButton *testmodelview_normalsbutton; }; // class TestModelView |