From 951494cda91a943468fa9b0aad5e67150cf02090 Mon Sep 17 00:00:00 2001 From: auria Date: Sun, 5 Apr 2009 00:58:52 +0000 Subject: [PATCH] first introduction of a help menu git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3363 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- data/gui/help1.stkgui | 78 +++++++++++++++++++++++++++++++++++++++ src/gui/state_manager.cpp | 4 +- src/gui/widget.cpp | 19 ++++++++++ 3 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 data/gui/help1.stkgui diff --git a/data/gui/help1.stkgui b/data/gui/help1.stkgui new file mode 100644 index 000000000..5b3a15706 --- /dev/null +++ b/data/gui/help1.stkgui @@ -0,0 +1,78 @@ +
+ +
+ + + diff --git a/src/gui/state_manager.cpp b/src/gui/state_manager.cpp index b5201e2e7..0071c1d8c 100644 --- a/src/gui/state_manager.cpp +++ b/src/gui/state_manager.cpp @@ -51,9 +51,9 @@ namespace StateManager main_loop->abort(); return; } - else if (selection == "options") + else if (selection == "help") { - pushMenu("options_av.stkgui"); + pushMenu("help1.stkgui"); } } diff --git a/src/gui/widget.cpp b/src/gui/widget.cpp index 6aac7ee40..33f90b41e 100644 --- a/src/gui/widget.cpp +++ b/src/gui/widget.cpp @@ -169,6 +169,25 @@ void Widget::readCoords(Widget* parent) else if(texture_h > -1) this->h = texture_h; else if(label_h > -1) this->h = label_h; } + + // can't make widget bigger than parent + + if(this->h > (int)parent_h) + { + float ratio = (float)parent_h/this->h; + std::cout << "scaling down, ratio=" << ratio << " parent_h=" << parent_h << " this->h=" << this->h << std::endl; + + this->w *= ratio; + this->h *= ratio; + } + if(this->w > (int)parent_w) + { + float ratio = (float)parent_w/this->w; + std::cout << "scaling down, ratio=" << ratio << std::endl; + + this->w *= ratio; + this->h *= ratio; + } } // -----------------------------------------------------------------------------