Skip to content

Commit

Permalink
Method to get the current active colour on the UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
acaudwell committed Feb 11, 2012
1 parent b9ca6d3 commit 61a29fb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ui/ui.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
3 changes: 3 additions & 0 deletions ui/ui.h
Expand Up @@ -9,6 +9,7 @@
#include <list>

class UIElement;
class UIColour;

class UI {
UIElement* selectedElement;
Expand Down Expand Up @@ -56,6 +57,8 @@ class UI {
virtual vec4 getTextColour();
virtual vec4 getAlpha();

UIColour* getActiveColour();

void update(float dt);

void draw();
Expand Down

0 comments on commit 61a29fb

Please sign in to comment.