Clicking on non-transparent part of a window

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

genergabasa
Just popping in
Just popping in
Posts: 2
Joined: Wed Oct 17, 2007 02:36
Location: muntinglupa city, philippines
Contact:

Clicking on non-transparent part of a window

Postby genergabasa » Wed Nov 28, 2007 10:31

Hello everyone, I'm new here in the forum. I just want to suggest that there should be a flag if a user wants to click the visible part of the window only, what I mean is that a window shouldn't be clicked when the user is clicking the one visible behind it. For example, I have a window with a StaticImage that looks like a ring and has a hole inside it and I was able to see another window behind it, lets say there's a flag behind it and I want to click it from the hole. Hope you'll make this a priority. Thanks!

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Wed Nov 28, 2007 14:58

This is not the first time this has been asked. But it's not a trivial thing to code.

I think there are private functions to find the window at a given (x,y) coordinate. If a Z-ordered list was created then we could go through each and test the pixel colour until a non-transparent one is found. Hrm, maybe these pixel colours can be found by querying the widget's imagery.

It's been a long long time since I contributed anything. Maybe this could be it. And there's also that drag and drop stuff I was working on a long time ago.

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 » Wed Nov 28, 2007 16:30

Rackle wrote:Hrm, maybe these pixel colours can be found by querying the widget's imagery.


I did a quick search in the API but didn't find a way to actually look at pixels. If it's possible, then there is still an issue when an image is scaled, which should be taken care of.
Check out my released snake game using Cegui!

genergabasa
Just popping in
Just popping in
Posts: 2
Joined: Wed Oct 17, 2007 02:36
Location: muntinglupa city, philippines
Contact:

Postby genergabasa » Thu Nov 29, 2007 02:12

Yeah, I also downloaded the source and tried to look for some code that might be able to help me manipulate the window click event but I didn't find anything helpful at all. I added a code to retrieve colours from a part of the window:

Code: Select all

bool Tool::mouseMoveHandler(const CEGUI::EventArgs& e)
{
   using namespace CEGUI;
   WindowManager& winMgr = WindowManager::getSingleton();
   Window* win = static_cast<const WindowEventArgs&>(e).window;
   const MouseEventArgs mouseEventArgs = static_cast<const MouseEventArgs&>(e);
   CEGUI::Vector2 localMousePos = CoordConverter::screenToWindow(*win, mouseEventArgs.position);
   UVector2 mouseMoveOffset(cegui_absdim(localMousePos.d_x), cegui_absdim(localMousePos.d_y));
   UVector2 mouseOffsetInWindow(cegui_absdim(mMousePosInWindow.d_x), cegui_absdim(mMousePosInWindow.d_y));
   win->setPosition(win->getPosition() + mouseMoveOffset - mouseOffsetInWindow);

   ColourRect crect = PropertyHelper::stringToColourRect(win->getProperty("ImageColours"));
   colour c = crect.getColourAtPoint(localMousePos.d_x, localMousePos.d_y);
   char text[50];
   sprintf_s(text, "RGB: %f:%f:%f", c.getRed(), c.getGreen(), c.getBlue());
   winMgr.getWindow("TextWindow")->setText(text);
   return true;
}

But it only returns the colors that will manipulate the orginal window's ARGB. :cry:


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 15 guests