diff options
Diffstat (limited to 'src/interface')
| -rw-r--r-- | src/interface/DropDown.cpp | 12 | ||||
| -rw-r--r-- | src/interface/DropDown.h | 1 | ||||
| -rw-r--r-- | src/interface/Window.cpp | 3 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/interface/DropDown.cpp b/src/interface/DropDown.cpp index ea7d56a..d5af4c4 100644 --- a/src/interface/DropDown.cpp +++ b/src/interface/DropDown.cpp @@ -79,7 +79,8 @@ public: DropDown::DropDown(Point position, Point size): Component(position, size), isMouseInside(false), - optionIndex(-1) + optionIndex(-1), + callback(NULL) { background = activeBackground = Colour(0, 0, 0); activeText = text = activeBackground = border = activeBorder = Colour(255, 255, 255); @@ -114,6 +115,15 @@ void DropDown::Draw(const Point& screenPos) } + std::pair<std::string, int> DropDown::GetOption() + { + if(optionIndex!=-1) + { + return options[optionIndex]; + } + return std::pair<std::string, int>("", -1); + } + void DropDown::SetOption(std::string option) { for(int i = 0; i < options.size(); i++) diff --git a/src/interface/DropDown.h b/src/interface/DropDown.h index 34310df..40fac68 100644 --- a/src/interface/DropDown.h +++ b/src/interface/DropDown.h @@ -33,6 +33,7 @@ class DropDown: public ui::Component { std::vector<std::pair<std::string, int> > options; public: DropDown(Point position, Point size); + std::pair<std::string, int> GetOption(); void SetOption(int option); void SetOption(std::string option); void AddOption(std::pair<std::string, int> option); diff --git a/src/interface/Window.cpp b/src/interface/Window.cpp index 86221ab..8dba69a 100644 --- a/src/interface/Window.cpp +++ b/src/interface/Window.cpp @@ -1,3 +1,4 @@ +#include <iostream> #include "Window.h" #include "Component.h" #include "interface/Point.h" @@ -209,7 +210,7 @@ void Window::DoTick(float dt) void Window::DoKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt) { #ifdef DEBUG - if(character = 'd' && ctrl && shift) + if(key == KEY_TAB && ctrl) debugMode = !debugMode; if(debugMode) { |
