I want to create something like a flying widget, and to position it correctly I would need the item's position in "global space" or in the space of the top parent which stretches across the whole resolution. Using the mouse position makes it stick to the cursor, an effect which we don't want.
This is similar to the tooltips I've read some code about but setting the tooltip to NULL and setting it some text didn't do anything. And if the tooltip gets clipped by it's parent or grandparent then it's not such a good idea since we have small packed items.
Is there a way to compute the position of a widget given an ancestor and a child ?
Global Positions
Moderators: CEGUI MVP, CEGUI Team
- scriptkid
- Home away from home

- Posts: 1178
- Joined: Wed Jan 12, 2005 12:06
- Location: The Hague, The Netherlands
- Contact:
Hi,
sorry for not completely understanding your question. About global positioning, widgets have a "getPixelRect()" and "getUnclippedPixelRect" method, which return a rectangle in pixels.
By subtracting values you know absolute positions from other widgets. For example when a parent window has a pixelrect or (20,20,100,100) and its child has (40,40,80,80) that its offset regarding its parent is (20,20), resulting from (40-20, 40-20).
Is that what you are looking for?
HTH.
sorry for not completely understanding your question. About global positioning, widgets have a "getPixelRect()" and "getUnclippedPixelRect" method, which return a rectangle in pixels.
By subtracting values you know absolute positions from other widgets. For example when a parent window has a pixelrect or (20,20,100,100) and its child has (40,40,80,80) that its offset regarding its parent is (20,20), resulting from (40-20, 40-20).
Is that what you are looking for?
HTH.
Check out my released snake game using Cegui!
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 12 guests
