Browse Source

add setDecal

David Rose 20 years ago
parent
commit
b57675552f
1 changed files with 13 additions and 0 deletions
  1. 13 0
      direct/src/gui/OnscreenText.py

+ 13 - 0
direct/src/gui/OnscreenText.py

@@ -29,6 +29,7 @@ class OnscreenText(DirectObject, NodePath):
                  align = None,
                  align = None,
                  wordwrap = None,
                  wordwrap = None,
                  drawOrder = None,
                  drawOrder = None,
+                 decal = 0,
                  font = None,
                  font = None,
                  parent = None,
                  parent = None,
                  sort = 0,
                  sort = 0,
@@ -81,6 +82,10 @@ class OnscreenText(DirectObject, NodePath):
               The text will actually use drawOrder through drawOrder +
               The text will actually use drawOrder through drawOrder +
               2.
               2.
 
 
+          decal: if this is True, the text is decalled onto its
+              background card.  Useful when the text will be parented
+              into the 3-D scene graph.
+
           font: the font to use for the text.
           font: the font to use for the text.
 
 
           parent: the NodePath to parent the text to initially.
           parent: the NodePath to parent the text to initially.
@@ -154,6 +159,9 @@ class OnscreenText(DirectObject, NodePath):
         self.pos = pos
         self.pos = pos
         self.roll = roll
         self.roll = roll
 
 
+        if decal:
+            textNode.setCardDecal(1)
+
         if font == None:
         if font == None:
             font = DirectGuiGlobals.getDefaultFont()
             font = DirectGuiGlobals.getDefaultFont()
         
         
@@ -231,6 +239,11 @@ class OnscreenText(DirectObject, NodePath):
     # text, and for those rare occasions when you actually want to
     # text, and for those rare occasions when you actually want to
     # change a text's property after it has been created.
     # change a text's property after it has been created.
 
 
+    def setDecal(self, decal):
+        self.textNode.setCardDecal(decal)
+
+    def getDecal(self):
+        return self.textNode.getCardDecal()
 
 
     def setFont(self, font):
     def setFont(self, font):
         self.textNode.setFont(font)
         self.textNode.setFont(font)