guiLabel.I 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // Filename: guiLabel.I
  2. // Created by: cary (26Oct00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. INLINE GuiLabel::GuiLabel(void) : _type(GuiLabel::NONE),
  6. _arc((RenderRelation*)0L),
  7. _tex((Texture*)0L),
  8. _internal((RenderRelation*)0L), _scale(1.),
  9. _pos(0., 0., 0.),
  10. _foreground(1., 1., 1., 1.),
  11. _have_background(false),
  12. _background(0., 0., 0., 0.),
  13. _have_width(false), _width(0.),
  14. _have_height(false), _height(0.) {
  15. }
  16. INLINE Node* GuiLabel::get_geometry(void) const {
  17. return _geom;
  18. }
  19. INLINE void GuiLabel::set_arc(RenderRelation* r) {
  20. _arc = r;
  21. }
  22. INLINE RenderRelation* GuiLabel::get_arc(void) const {
  23. return _arc;
  24. }
  25. INLINE void GuiLabel::set_width(float f) {
  26. if (f <= 0.) {
  27. _have_width = false;
  28. _width = 0.;
  29. } else {
  30. _have_width = true;
  31. _width = f;
  32. }
  33. this->set_properties();
  34. }
  35. INLINE void GuiLabel::set_height(float f) {
  36. if (f <= 0.) {
  37. _have_height = false;
  38. _height = 0.;
  39. } else {
  40. _have_height = true;
  41. _height = f;
  42. }
  43. this->set_properties();
  44. }
  45. INLINE void GuiLabel::set_scale(float f) {
  46. _scale = f;
  47. recompute_transform();
  48. }
  49. INLINE void GuiLabel::set_pos(float x, float y, float z) {
  50. this->set_pos(LVector3f(x, y, z));
  51. }
  52. INLINE void GuiLabel::set_pos(const LVector3f& p) {
  53. _pos = p;
  54. recompute_transform();
  55. }
  56. INLINE float GuiLabel::get_scale(void) const {
  57. return _scale;
  58. }
  59. INLINE LVector3f GuiLabel::get_pos(void) const {
  60. return _pos;
  61. }
  62. INLINE void GuiLabel::set_foreground_color(float r, float g, float b,
  63. float a) {
  64. this->set_foreground_color(Colorf(r, g, b, a));
  65. }
  66. INLINE void GuiLabel::set_background_color(float r, float g, float b,
  67. float a) {
  68. this->set_background_color(Colorf(r, g, b, a));
  69. }
  70. INLINE Colorf GuiLabel::get_foreground_color(void) const {
  71. return _foreground;
  72. }
  73. INLINE Colorf GuiLabel::get_background_color(void) const {
  74. return _background;
  75. }
  76. INLINE void GuiLabel::recompute(void) {
  77. this->recompute_transform();
  78. }