Re: [Plib-users] Question re PUI sizes & frames
Brought to you by:
sjbaker
From: James F. <fr...@cs...> - 2008-05-12 00:53:24
|
On Sun, 11 May 2008, Steve Baker wrote: > Units (like in all of 3D graphics) are arbitary until you define your > viewport and transformation stack. > > By default, PUI sets up the window such that one unit == one pixel. But > as soon as you override PUI's initial transform stack, you're setting > what the units "mean" and your question becomes meaningless. OK, maybe I'm asking the wrong question. Let me make it more general: when I'm creating a menu from individual objects, how do I position them within the group? To illustrate, Here's a snippet of code from a test program, in which I'm trying to create a menu group with a few items. Added functions should allow 3D position, rotation, and scaling. I'm trying to position the items in the group so they pack vertically. (getStringSize is a function added to get the size of a string in the vector font.) G1 = new puGroup (0, 0); G1->Add3DLocation (x, y, z, 0.0, 0.0, 0.0); G1->getStringSize (&ww, &hh, "Say Hello"); printf ("ww = %d, hh = %d\n", ww, hh); w = ww; h = hh; G1->getStringSize (&ww, &hh, "Say Goodbye"); printf ("ww = %d, hh = %d\n", ww, hh); if (ww > w) w = ww; if (hh > h) h = hh; w += 16; h += 8; b1 = new puOneShot (0, 0, w, h); b2 = new puOneShot (0, -2 * h, w, -h); bx = new puButtonBox (0, -7 * h, w, -3 * h, bxLabels, 1); //G1->recalc_bbox (); G1->setSize (w, 7 * h); G1->close (); So I run this, and it gives me the items, but with a vertical space between each about equal to the height. With different parameters, I might get boxes on top of one another. Also, when I use the recalc_bbox function, it doesn't seem to calculate the bounding box of all the items, just the first, as the rotation &c are all around the center of the "Say Hello" box rather than around the center of G1. I must be missing something important here, but what? Thanks, James |