Panda3D
textGraphic.I
1 // Filename: textGraphic.I
2 // Created by: drose (18Aug06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: TextGraphic::Constructor
18 // Access: Published
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE TextGraphic::
22 TextGraphic() {
23  _frame = LVecBase4::zero();
24  _instance_flag = false;
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: TextGraphic::Constructor
29 // Access: Published
30 // Description:
31 ////////////////////////////////////////////////////////////////////
32 INLINE TextGraphic::
33 TextGraphic(const NodePath &model, const LVecBase4 &frame) :
34  _model(model),
35  _frame(frame),
36  _instance_flag(false)
37 {
38 }
39 
40 ////////////////////////////////////////////////////////////////////
41 // Function: TextGraphic::Constructor
42 // Access: Published
43 // Description:
44 ////////////////////////////////////////////////////////////////////
45 INLINE TextGraphic::
46 TextGraphic(const NodePath &model, PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) :
47  _model(model),
48  _frame(left, right, bottom, top),
49  _instance_flag(false)
50 {
51 }
52 
53 ////////////////////////////////////////////////////////////////////
54 // Function: TextGraphic::get_model
55 // Access: Published
56 // Description: Returns the NodePath associated with the graphic,
57 // that renders the desired image.
58 ////////////////////////////////////////////////////////////////////
60 get_model() const {
61  return _model;
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: TextGraphic::set_model
66 // Access: Published
67 // Description: Changes the NodePath associated with the graphic.
68 // This NodePath should contain geometry that will
69 // render the desired graphic image.
70 ////////////////////////////////////////////////////////////////////
71 INLINE void TextGraphic::
72 set_model(const NodePath &model) {
73  _model = model;
74 }
75 
76 ////////////////////////////////////////////////////////////////////
77 // Function: TextGraphic::get_frame
78 // Access: Published
79 // Description: Returns the frame specified for the graphic. This is
80 // the amount of space that will be reserved for the
81 // graphic when it is embedded in a text paragraph, in
82 // the form (left, right, bottom, top).
83 //
84 // The actual graphic, as rendered by the NodePath
85 // specified via set_model(), should more or less fit
86 // within this rectangle. It is not required to fit
87 // completely within it, but if it does not, it may
88 // visually overlap with nearby text.
89 ////////////////////////////////////////////////////////////////////
91 get_frame() const {
92  return _frame;
93 }
94 
95 ////////////////////////////////////////////////////////////////////
96 // Function: TextGraphic::set_frame
97 // Access: Published
98 // Description: Specifies the (left, right, bottom, top) bounding
99 // frame for the graphic. See get_frame().
100 ////////////////////////////////////////////////////////////////////
101 INLINE void TextGraphic::
102 set_frame(const LVecBase4 &frame) {
103  _frame = frame;
104 }
105 
106 ////////////////////////////////////////////////////////////////////
107 // Function: TextGraphic::set_frame
108 // Access: Published
109 // Description: Specifies the (left, right, bottom, top) bounding
110 // frame for the graphic. See get_frame().
111 ////////////////////////////////////////////////////////////////////
112 INLINE void TextGraphic::
113 set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
114  _frame.set(left, right, bottom, top);
115 }
116 
117 ////////////////////////////////////////////////////////////////////
118 // Function: TextGraphic::get_instance_flag
119 // Access: Published
120 // Description: Returns the instance_flag. See set_instance_flag().
121 ////////////////////////////////////////////////////////////////////
122 INLINE bool TextGraphic::
124  return _instance_flag;
125 }
126 
127 ////////////////////////////////////////////////////////////////////
128 // Function: TextGraphic::set_instance_flag
129 // Access: Published
130 // Description: Sets the instance_flag. When this is true, the
131 // graphic is directly instanced to the scene graph
132 // whenever it appears; when it is false, the graphic is
133 // copied. The default is false, which is best for most
134 // applications. You might need to set it true for
135 // special kinds of "graphics" like interactive
136 // elements, for instance a PGEntry.
137 ////////////////////////////////////////////////////////////////////
138 INLINE void TextGraphic::
139 set_instance_flag(bool instance_flag) {
140  _instance_flag = instance_flag;
141 }
void set_model(const NodePath &model)
Changes the NodePath associated with the graphic.
Definition: textGraphic.I:72
bool get_instance_flag() const
Returns the instance_flag.
Definition: textGraphic.I:123
LVecBase4 get_frame() const
Returns the frame specified for the graphic.
Definition: textGraphic.I:91
void set_instance_flag(bool instance_flag)
Sets the instance_flag.
Definition: textGraphic.I:139
void set_frame(const LVecBase4 &frame)
Specifies the (left, right, bottom, top) bounding frame for the graphic.
Definition: textGraphic.I:102
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
NodePath get_model() const
Returns the NodePath associated with the graphic, that renders the desired image. ...
Definition: textGraphic.I:60
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165
static const LVecBase4f & zero()
Returns a zero-length vector.
Definition: lvecBase4.h:493