Browse Source

Merge pull request #1628 from AtomicGameEngine/DJR-UIBARGRAPH-FIX

Exposed SetColor for UIBargraph so that it can be used from script
JoshEngebretson 8 years ago
parent
commit
77e1bf1bf2
2 changed files with 11 additions and 0 deletions
  1. 9 0
      Source/Atomic/UI/UIBargraph.cpp
  2. 2 0
      Source/Atomic/UI/UIBargraph.h

+ 9 - 0
Source/Atomic/UI/UIBargraph.cpp

@@ -50,6 +50,15 @@ UIBargraph::~UIBargraph()
 {
 {
 }
 }
 
 
+void UIBargraph::SetColor(Color color) 
+{
+
+        if (!widget_)
+              return;
+
+        ((TBBarGraph*)widget_)->SetColor(color.r_ * 255, color.g_ * 255, color.b_ * 255, color.a_ * 255);
+}
+
 bool UIBargraph::OnEvent(const tb::TBWidgetEvent &ev)
 bool UIBargraph::OnEvent(const tb::TBWidgetEvent &ev)
 {
 {
     return UIWidget::OnEvent(ev);
     return UIWidget::OnEvent(ev);

+ 2 - 0
Source/Atomic/UI/UIBargraph.h

@@ -38,6 +38,8 @@ public:
     UIBargraph(Context* context, bool createWidget = true);
     UIBargraph(Context* context, bool createWidget = true);
     virtual ~UIBargraph();
     virtual ~UIBargraph();
 
 
+    void SetColor(Color col);
+
 protected:
 protected:
 
 
     virtual bool OnEvent(const tb::TBWidgetEvent &ev);
     virtual bool OnEvent(const tb::TBWidgetEvent &ev);