Browse files

Method to get the current active colour on the UI.

  • Loading branch information...
1 parent b9ca6d3 commit 61a29fbcfb9f516ca1f1bdf90aed16698c3ad3df @acaudwell committed Feb 12, 2012
Showing with 18 additions and 0 deletions.
  1. +15 −0 ui/ui.cpp
  2. +3 −0 ui/ui.h
View
15 ui/ui.cpp
@@ -5,6 +5,7 @@
#include "scroll_bar.h"
#include "select.h"
#include "button.h"
+#include "colour.h"
UI::UI() : selectedElement(0) {
font = fontmanager.grab("FreeSans.ttf", 12);
@@ -233,3 +234,17 @@ UIElement* UI::click(const MouseCursor& cursor) {
return selected;
}
+
+UIColour* UI::getActiveColour() {
+
+ std::list<UIElement*> found;
+ elementsByType(found, UI_COLOUR);
+
+ foreach(UIElement* e, found) {
+ UIColour* c = (UIColour*)e;
+
+ if(c->active) return c;
+ }
+
+ return 0;
+}
View
3 ui/ui.h
@@ -9,6 +9,7 @@
#include <list>
class UIElement;
+class UIColour;
class UI {
UIElement* selectedElement;
@@ -56,6 +57,8 @@ class UI {
virtual vec4 getTextColour();
virtual vec4 getAlpha();
+ UIColour* getActiveColour();
+
void update(float dt);
void draw();

0 comments on commit 61a29fb

Please sign in to comment.