*** empty log message ***

This commit is contained in:
gregw 2001-02-24 00:53:32 +00:00
parent 883b614db1
commit 2db4225255
4 changed files with 64 additions and 4 deletions

View File

@ -2,15 +2,30 @@ from ShowBaseGlobal import *
from DirectObject import * from DirectObject import *
import GuiSign import GuiSign
import GuiManager import GuiManager
import GuiLabel
guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.node()) guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.node())
font = (loader.loadModelOnce("phase_3/models/fonts/ttf-comic")).node()
class Sign(DirectObject): class Sign(DirectObject):
def __init__(self, name, label): def __init__(self, name, label=None):
self.name = name self.name = name
# label in this case means GuiLabel
if not label:
self.label = GuiLabel.GuiLabel.makeSimpleTextLabel(self.name, font)
self.label.setForegroundColor(1., 0., 0., 1.)
self.label.setBackgroundColor(1., 1., 1., 0.)
self.label.thaw()
elif (type(label) == type('')):
self.label = GuiLabel.GuiLabel.makeSimpleTextLabel(label, font)
self.label.setForegroundColor(1., 0., 0., 1.)
self.label.setBackgroundColor(1., 1., 1., 0.)
self.label.thaw()
else:
self.label = label self.label = label
self.sign = GuiSign.GuiSign(name, label) self.sign = GuiSign.GuiSign(self.name, self.label)
self.setScale(0.1) self.setScale(0.1)
self.managed = 0 self.managed = 0
return None return None

View File

@ -17,4 +17,4 @@ __builtin__.tkroot = base.tkroot
__builtin__.taskMgr = base.taskMgr __builtin__.taskMgr = base.taskMgr
__builtin__.eventMgr = base.eventMgr __builtin__.eventMgr = base.eventMgr
__builtin__.messenger = base.messenger __builtin__.messenger = base.messenger
__builtin__.config = base.config

View File

@ -235,6 +235,10 @@ GuiLabel* GuiLabel::make_model_label(Node* geom, float w, float h) {
ret->_internal = new RenderRelation(ret->_geom, geom); ret->_internal = new RenderRelation(ret->_geom, geom);
ret->_internal->set_transition( ret->_internal->set_transition(
new ColorTransition(Colorf(ret->_foreground))); new ColorTransition(Colorf(ret->_foreground)));
gui_cat->debug() << "created model label 0x" << (void*)ret
<< " from node 0x" << (void*)geom
<< ", set _type(" << (int)(ret->_type) << ") to MODEL("
<< (int)MODEL << ")" << endl;
return ret; return ret;
} }
@ -468,3 +472,42 @@ int GuiLabel::set_draw_order(int order) {
this->thaw(); this->thaw();
return ret; return ret;
} }
void GuiLabel::write(ostream& os) const {
os << "GuiLabel: (0x" << (void*)this << ")" << endl;
os << " refcount = " << this->get_ref_count() << endl;
os << " _type = ";
switch (this->_type) {
case NONE:
os << "NONE";
break;
case SIMPLE_TEXTURE:
os << "SIMPLE_TEXTURE";
break;
case SIMPLE_TEXT:
os << "SIMPLE_TEXT";
break;
case SIMPLE_CARD:
os << "SIMPLE_CARD";
break;
case MODEL:
os << "MODEL";
break;
default:
os << "bad";
}
os << endl << " _geom = 0x" << (void*)(this->_geom.p()) << endl;
os << " _arc = 0x" << (void*)(this->_arc) << endl;
os << " _tex = 0x" << (void*)(this->_tex.p()) << endl;
os << " _internal = 0x" << (void*)(this->_internal) << endl;
os << " _gset = 0x" << (void*)(this->_gset) << endl;
os << " _scale = " << this->_scale << endl;
os << " _pos = " << this->_pos << endl;
os << " _foreground = " << this->_foreground << endl;
if (_have_background)
os << " _background = " << this->_background << endl;
if (_have_width)
os << " _width = " << this->_width << endl;
if (_have_height)
os << " _height = " << this->_height << endl;
}

View File

@ -102,6 +102,8 @@ PUBLISHED:
INLINE void set_priority(GuiLabel*, const PriorityType); INLINE void set_priority(GuiLabel*, const PriorityType);
int set_draw_order(int); int set_draw_order(int);
void write(ostream&) const;
public: public:
// type interface // type interface
static TypeHandle get_class_type(void) { static TypeHandle get_class_type(void) {