Thread: Re: [Plib-users] Question re PUI sizes & frames
Brought to you by:
sjbaker
From: John F. F. <joh...@cy...> - 2008-05-11 19:33:45
|
James, If I remember correctly, PUI uses pixels as its units of distance. The origin is the lower left-hand corner of the screen (or group), the x-axis extends to the right, and the y-axis extends upwards. Yes, you do have to create the frame first, before creating the buttons. It is possible, though, to resize the frame after the buttons have been created. - John -----Original Message----- From: James Frye Sent: Sunday, May 11, 2008 11:45 AM To: PLIB Users Subject: [Plib-users] Question re PUI sizes & frames Hi, I'm making some progress on modifying PUI to work with VR, but have a couple more questions. After a few modifications (such as replacing the bitmapped text with GLUT vector fonts), I've got groups containing buttons and such that I can move around & rotate at will. Now I want to add a nice frame around a group, but it seems that I have to create the frame before creating the objects that go in it. IOW the code needs to look something like group = new puGroup (size...) frame = new puFrame (x1, y1, x2, y2); button1 = new puButton (x, y, label); button2 = new puButton (x, y, label); group->close (); The problem is how to know the dimensions for frame before I create at least one button, and find its size? That leads to a larger question: what does PUI use as its internal coordinate system? At some point I'll need to add scaling of the PUI coordinate system to the VR one, so that the menus appear at virtual world sizes. I'd rather not do this by trial & error, but I don't understand the internal coordinates from the code. Thanks, James ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/j avaone _______________________________________________ plib-users mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-users |
From: Steve B. <st...@sj...> - 2008-05-12 00:33:17
|
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. John F. Fay wrote: > James, > > If I remember correctly, PUI uses pixels as its units of distance. The > origin is the lower left-hand corner of the screen (or group), the x-axis > extends to the right, and the y-axis extends upwards. > > Yes, you do have to create the frame first, before creating the buttons. > It is possible, though, to resize the frame after the buttons have been > created. |
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 |