Clicking on non-transparent part of a window
Moderators: CEGUI MVP, CEGUI Team
-
- 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
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!
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.
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.
- scriptkid
- Home away from home
- Posts: 1178
- Joined: Wed Jan 12, 2005 12:06
- Location: The Hague, The Netherlands
- Contact:
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!
-
- Just popping in
- Posts: 2
- Joined: Wed Oct 17, 2007 02:36
- Location: muntinglupa city, philippines
- Contact:
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:
But it only returns the colors that will manipulate the orginal window's ARGB.
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.
Return to “Bug Reports, Suggestions, Feature Requests”
Who is online
Users browsing this forum: No registered users and 15 guests