Răsfoiți Sursa

text_wrap_mode

David Rose 20 ani în urmă
părinte
comite
5bf5ffb1fb

+ 38 - 0
panda/src/gobj/texture.cxx

@@ -2008,3 +2008,41 @@ operator >> (istream &in, Texture::FilterType &ft) {
   ft = Texture::string_filter_type(word);
   ft = Texture::string_filter_type(word);
   return in;
   return in;
 }
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: Texture::WrapMode output operator
+//  Description:
+////////////////////////////////////////////////////////////////////
+ostream &
+operator << (ostream &out, Texture::WrapMode wm) {
+  switch (wm) {
+  case Texture::WM_clamp:
+    return out << "clamp";
+  case Texture::WM_repeat:
+    return out << "repeat";
+  case Texture::WM_mirror:
+    return out << "mirror";
+  case Texture::WM_mirror_once:
+    return out << "mirror_once";
+  case Texture::WM_border_color:
+    return out << "border_color";
+
+  case Texture::WM_invalid:
+    return out << "invalid";
+  }
+
+  return out << "(**invalid Texture::WrapMode(" << (int)wm << ")**)";
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: Texture::WrapMode input operator
+//  Description:
+////////////////////////////////////////////////////////////////////
+istream &
+operator >> (istream &in, Texture::WrapMode &wm) {
+  string word;
+  in >> word;
+
+  wm = Texture::string_wrap_mode(word);
+  return in;
+}

+ 3 - 0
panda/src/gobj/texture.h

@@ -414,6 +414,9 @@ private:
 EXPCL_PANDA ostream &operator << (ostream &out, Texture::FilterType ft);
 EXPCL_PANDA ostream &operator << (ostream &out, Texture::FilterType ft);
 EXPCL_PANDA istream &operator >> (istream &in, Texture::FilterType &ft);
 EXPCL_PANDA istream &operator >> (istream &in, Texture::FilterType &ft);
 
 
+EXPCL_PANDA ostream &operator << (ostream &out, Texture::WrapMode wm);
+EXPCL_PANDA istream &operator >> (istream &in, Texture::WrapMode &wm);
+
 #include "texture.I"
 #include "texture.I"
 
 
 #endif
 #endif

+ 3 - 0
panda/src/text/config_text.cxx

@@ -171,6 +171,9 @@ ConfigVariableEnum<Texture::FilterType> text_minfilter
 ConfigVariableEnum<Texture::FilterType> text_magfilter
 ConfigVariableEnum<Texture::FilterType> text_magfilter
 ("text-magfilter", Texture::FT_linear,
 ("text-magfilter", Texture::FT_linear,
  PRC_DESC("The default texture magfilter type for dynamic text fonts"));
  PRC_DESC("The default texture magfilter type for dynamic text fonts"));
+ConfigVariableEnum<Texture::WrapMode> text_wrap_mode
+("text-wrap-mode", Texture::WM_border_color,
+ PRC_DESC("The default wrap mode for dynamic text fonts"));
 
 
 
 
 
 

+ 1 - 0
panda/src/text/config_text.h

@@ -52,6 +52,7 @@ extern ConfigVariableInt text_max_never_break;
 
 
 extern ConfigVariableEnum<Texture::FilterType> text_minfilter;
 extern ConfigVariableEnum<Texture::FilterType> text_minfilter;
 extern ConfigVariableEnum<Texture::FilterType> text_magfilter;
 extern ConfigVariableEnum<Texture::FilterType> text_magfilter;
+extern ConfigVariableEnum<Texture::WrapMode> text_wrap_mode;
 
 
 extern EXPCL_PANDA void init_libtext();
 extern EXPCL_PANDA void init_libtext();
 
 

+ 2 - 2
panda/src/text/dynamicTextPage.cxx

@@ -53,8 +53,8 @@ DynamicTextPage(DynamicTextFont *font, int page_number) :
 
 
   // Clamp to an explicit invisible border, so we don't get bleeding
   // Clamp to an explicit invisible border, so we don't get bleeding
   // at the edges at all.
   // at the edges at all.
-  set_wrap_u(WM_border_color);
-  set_wrap_v(WM_border_color);
+  set_wrap_u(text_wrap_mode);
+  set_wrap_v(text_wrap_mode);
   set_border_color(Colorf(0.0f, 0.0f, 0.0f, 0.0f));
   set_border_color(Colorf(0.0f, 0.0f, 0.0f, 0.0f));
 }
 }