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