瀏覽代碼

look, it even works

Cary Sandvig 25 年之前
父節點
當前提交
363f579d14
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 9 0
      panda/src/gui/guiBackground.cxx
  2. 1 0
      panda/src/gui/guiBackground.h

+ 9 - 0
panda/src/gui/guiBackground.cxx

@@ -42,6 +42,15 @@ GuiBackground::GuiBackground(const string& name, GuiItem* item, Texture* tex)
   item->set_priority(_bg, P_High);
   item->set_priority(_bg, P_High);
 }
 }
 
 
+GuiBackground::GuiBackground(const string& name, GuiItem* item, GuiLabel* l)
+  : GuiItem(name), _bg(l), _item(item) {
+  _bg->set_width(_item->get_width());
+  _bg->set_height(_item->get_height());
+  _bg->set_pos(LVector3f::rfu((_item->get_left() + _item->get_right())*0.5, 0.,
+			      (_item->get_bottom() + _item->get_top())*0.5));
+  item->set_priority(_bg, P_High);
+}
+
 GuiBackground::~GuiBackground(void) {
 GuiBackground::~GuiBackground(void) {
   this->unmanage();
   this->unmanage();
 }
 }

+ 1 - 0
panda/src/gui/guiBackground.h

@@ -19,6 +19,7 @@ private:
 PUBLISHED:
 PUBLISHED:
   GuiBackground(const string&, GuiItem*);
   GuiBackground(const string&, GuiItem*);
   GuiBackground(const string&, GuiItem*, Texture*);
   GuiBackground(const string&, GuiItem*, Texture*);
+  GuiBackground(const string&, GuiItem*, GuiLabel*);
   ~GuiBackground(void);
   ~GuiBackground(void);
 
 
   virtual void manage(GuiManager*, EventHandler&);
   virtual void manage(GuiManager*, EventHandler&);