more debugging

This commit is contained in:
Cary Sandvig 2001-02-23 22:37:30 +00:00
parent f01972731f
commit 883b614db1
6 changed files with 34 additions and 12 deletions

View File

@ -7,7 +7,8 @@ INLINE GuiLabel::GuiLabel(void) : _type(GuiLabel::NONE),
_arc((RenderRelation*)0L),
_tex((Texture*)0L),
_internal((RenderRelation*)0L),
_gset((Geom*)0L), _scale(1.),
_gset((Geom*)0L), _model_width(1.),
_model_height(1.), _scale(1.),
_pos(0., 0., 0.),
_foreground(1., 1., 1., 1.),
_have_background(false),

View File

@ -226,10 +226,12 @@ GuiLabel* GuiLabel::make_simple_card_label(void) {
return ret;
}
GuiLabel* GuiLabel::make_model_label(Node* geom) {
GuiLabel* GuiLabel::make_model_label(Node* geom, float w, float h) {
GuiLabel* ret = new GuiLabel();
ret->_type = MODEL;
ret->_geom = new NamedNode("GUI label");
ret->_model_width = w;
ret->_model_height = h;
ret->_internal = new RenderRelation(ret->_geom, geom);
ret->_internal->set_transition(
new ColorTransition(Colorf(ret->_foreground)));
@ -320,10 +322,7 @@ void GuiLabel::get_extents(float& l, float& r, float& b, float& t) {
}
break;
case SIMPLE_CARD:
case MODEL:
{
// this really isn't correct for model, but will do until there is time
// or need for more
float x = _pos.dot(LVector3f::rfu(1., 0., 0.));
float y = _pos.dot(LVector3f::rfu(0., 0., 1.));
l = _have_width?-(_width*0.5):-0.5;
@ -336,6 +335,20 @@ void GuiLabel::get_extents(float& l, float& r, float& b, float& t) {
t += y;
}
break;
case MODEL:
{
float x = _pos.dot(LVector3f::rfu(1., 0., 0.));
float y = _pos.dot(LVector3f::rfu(0., 0., 1.));
l = _have_width?-(_width*_model_width*0.5):-(_model_width*0.5);
r = _have_width?(_width*_model_width*0.5):(_model_width*0.5);
l += x;
r += x;
b = _have_height?-(_height*_model_height*0.5):-(_model_height*0.5);
t = _have_height?(_height*_model_height*0.5):(_model_height*0.5);
b += y;
t += y;
}
break;
default:
gui_cat->warning()
<< "trying to get extents from something I don't know how to" << endl;

View File

@ -33,6 +33,7 @@ private:
PT(Texture) _tex;
RenderRelation* _internal;
Geom* _gset;
float _model_width, _model_height;
float _scale;
LVector3f _pos;
@ -65,7 +66,7 @@ PUBLISHED:
static GuiLabel* make_simple_text_label(const string&, Node*,
Texture* = (Texture*)0L);
static GuiLabel* make_simple_card_label(void);
static GuiLabel* make_model_label(Node*);
static GuiLabel* make_model_label(Node*, float, float);
int freeze();
int thaw();

View File

@ -10,6 +10,8 @@ INLINE GuiRegion::GuiRegion(const string& name, float l, float r, float b,
float t, bool buttons) : Namable(name), _left(l),
_right(r), _bottom(b),
_top(t) {
gui_cat->spam() << "region '" << name << "' constructed with (" << l
<< ", " << r << ", " << b << ", " << t << ")" << endl;
_region = new MouseWatcherRegion(name, l, r, b, t);
_region->set_suppress_below(buttons);
}
@ -35,6 +37,9 @@ INLINE void GuiRegion::set_region(float left, float right, float bottom,
_right = right;
_bottom = bottom;
_top = top;
gui_cat->spam() << "reset region '" << this->get_name() << " to (" << left
<< ", " << right << ", " << bottom << ", " << top << ")"
<< endl;
}
INLINE LVector4f GuiRegion::get_frame(void) const {

View File

@ -11,6 +11,8 @@
#include <pointerTo.h>
#include <typedReferenceCount.h>
#include "config_gui.h"
// container for active regions of a GUI
class GuiManager;

View File

@ -661,11 +661,11 @@ static void test12(GuiManager* mgr, Node* font) {
GuiLabel* l5 = GuiLabel::make_simple_text_label("none", font);
*/
PT_Node smile = ModelPool::load_model("smiley");
GuiLabel* l1 = GuiLabel::make_model_label(smile);
GuiLabel* l2 = GuiLabel::make_model_label(smile);
GuiLabel* l3 = GuiLabel::make_model_label(smile);
GuiLabel* l4 = GuiLabel::make_model_label(smile);
GuiLabel* l5 = GuiLabel::make_model_label(smile);
GuiLabel* l1 = GuiLabel::make_model_label(smile, 0.25, 0.25);
GuiLabel* l2 = GuiLabel::make_model_label(smile, 0.25, 0.25);
GuiLabel* l3 = GuiLabel::make_model_label(smile, 0.25, 0.25);
GuiLabel* l4 = GuiLabel::make_model_label(smile, 0.25, 0.25);
GuiLabel* l5 = GuiLabel::make_model_label(smile, 0.25, 0.25);
gb1 = new GuiButton("test12", l1, l2, l3, l4, l5);
gb1->set_scale(0.1);
gb1->set_pos(LVector3f::rfu(-0.25, 0., 0.25));
@ -1034,7 +1034,7 @@ static void test17(GuiManager* mgr, Node* font) {
ch1->add_item(s4);
ch1->add_item(s5);
PT_Node panel = ModelPool::load_model("phase_3/models/props/panel");
GuiLabel* bgl = GuiLabel::make_model_label(panel);
GuiLabel* bgl = GuiLabel::make_model_label(panel, 0.1, 0.1);
GuiBackground *bg = new GuiBackground("bg", ch1, bgl);
bg->set_color(1., 0., 1., 1.);
bg->thaw();