Global Positions

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
cippyboy
Quite a regular
Quite a regular
Posts: 51
Joined: Wed Jul 30, 2008 13:23

Global Positions

Postby cippyboy » Fri Sep 26, 2008 13:17

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 ?

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Sat Sep 27, 2008 17:53

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.
Check out my released snake game using Cegui!

User avatar
cippyboy
Quite a regular
Quite a regular
Posts: 51
Joined: Wed Jul 30, 2008 13:23

Postby cippyboy » Wed Oct 01, 2008 10:18

Yap, that's exactly what I wanted. Thanks, works great :D


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 12 guests