I've been fighting this for an hour, and it's getting me... irritated. All I want is relative coordinates, relative to the window - that is, 0.0 at left side, 1.0 at right side. Totally, 100% standard thing for a GUI, no?
It seems that you've totally removed window metrics, any Window methods that can convert between relative and absolute, AND made the mouse position ALWAYS return absolute? How is that sane?
I can't even get absolute width/height data on the window to convert the mouse pos into relative? The CoordConverter craps out (ie. returns NAN on precisely one out of the four values I need consistently - the lower right X coord if it matters) trying to convert window coords to screen when I set 1.0, 1.0 as the scale in the UVector (which is me trying to find the lower righthand corner in screen/absolute coords). Brilliant!
Surely I'm missing something?
CVS head - how do I get window-rel mouse pos?
Moderators: CEGUI MVP, CEGUI Team
CVS head - how do I get window-rel mouse pos?
Last edited by shalinor on Fri May 05, 2006 14:26, edited 1 time in total.
- vinny_the_true
- Just popping in
- Posts: 7
- Joined: Wed Aug 10, 2005 10:11
Once you have the mouse absolute screen position, do some screenToWindow() Window method with that point, so you'll have the position relative to your window.
The result will be automatically in the Window Metrics mode. I used this method succesfully with param in absolute and windows either in absolute or relative metrics modes.
The result will be automatically in the Window Metrics mode. I used this method succesfully with param in absolute and windows either in absolute or relative metrics modes.
vinny_the_true wrote:Once you have the mouse absolute screen position, do some screenToWindow() Window method with that point, so you'll have the position relative to your window.
The result will be automatically in the Window Metrics mode. I used this method succesfully with param in absolute and windows either in absolute or relative metrics modes.
That's my problem. I can't see any setting for windows metric mode in CVS head. The window itself (CEGUI::Window) no longer has that method, and I can't find anything likely-looking in the properties for the Window either. Thus, the mouse cursor always returns absolute, as far as I can tell.
Furthermore, without a metrics mode settings to change it, the getWindowPosition/Size methods are always going to give me whatever I specified to them originally - which is, typically, scale, but at times I use offset instead. The only way to convert that 100% consistently to absolute appears to be UDim::asAbsolute(), but that requires a "base" value (screen size) which I may or may not have available - where is that data located in CEGUI?
I have a bit of a "hack" I can use, since this code can see my engine's renderer and get the width/height of the render window (which I can use as the base in UDim::asAbsolute()), but that won't always be the case. I need an entirely in-GUI way of doing it.
Who is online
Users browsing this forum: No registered users and 7 guests