15 #include "eventHandler.h"
18 #include "eggLoader.h"
20 #include "pt_NamedNode.h"
22 extern PT_NamedNode render;
23 extern PT_NamedNode egg_root;
26 extern int framework_main(
int argc,
char *argv[]);
33 text_node->
set_text(
"I'm a woo woo woo!");
35 nout <<
"text is " << text_node->
get_width() <<
" by "
39 void event_s(CPT_Event) {
42 nout <<
"text is " << text_node->
get_width() <<
" by "
50 text_node =
new TextNode(
"text_node");
51 PT_NamedNode font = loader.load_sync(
"cmr12");
56 tex->set_name("genericButton.rgb");
59 tex->read("/beta/toons/textures/smGreyButtonUp.rgb");
60 text_node->set_card_texture( tex );
61 text_node->set_card_border(0.1, 0.1);
62 text_node->set_text( textStr );
63 text_node->set_text_color( 0.0, 0.0, 0.0, 1.0 );
64 if (text_node->has_card_texture())
65 nout << "I've got a texture!" << "\n";
67 nout << "I don't have a texture..." << "\n";
68 nout << "text is " << text_node->get_width() << " by "
69 << text_node->get_height() << "\n";
71 new RenderRelation(egg_root, text_node);
74 int main(
int argc,
char *argv[]) {
75 define_keys = &text_keys;
80 return framework_main(argc, argv);
void set_wordwrap(PN_stdfloat wordwrap)
Sets the text up to automatically wordwrap when it exceeds the indicated width.
PN_stdfloat get_height() const
Returns the net height of the text in local 2-d coordinates.
A class to monitor events from the C++ side of things.
void set_text(const string &text)
Changes the text that is displayed under the TextNode.
void set_font(TextFont *font)
Sets the font that will be used when making text.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
bool add_hook(const string &event_name, EventFunction *function)
Adds the indicated function to the list of those that will be called when the named event is thrown...
PN_stdfloat get_width() const
Returns the net width of the text in local 2-d coordinates.
void set_card_as_margin(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Specifies that a (possibly opaque or semitransparent) card will be held behind the text when it is ne...
Represents a set of settings that indicate how a texture is sampled.
The primary interface to this module.
A ConstPointerTo is similar to a PointerTo, except it keeps a const pointer to the thing...