thecaptain
04-02-2008 06:27:27
Hey I've noticed some strange behavior with the latest SVN version with the mouse over detection. For example, in the demo, when the mouse is over the dropdown box arrow button, it doesn't light up, while it does when the mouse is slightly to the left of it.
Also, occasionally, there is a crash on the getColourAt(actualX,actualY,0) line because this code sometimes produces an X or Y that is outside of the 1024x1024 skinset image:
Are you aware of these issues/is this still a work in progress? Either way, here are a couple things that might help. For example, I think that code that checks to see if the mouse is within a parent widget calls this:
The problem is that this code should return whether the mouse is within bounds of the widget, not whether it is over a transparent pixel or not. So the last if statement should probably be replaced by a more straight-forward rectangular position check.
I'll look more into this and see what I can find, but let me know if you're aware of these problems as well.
Thanks!
Also, occasionally, there is a crash on the getColourAt(actualX,actualY,0) line because this code sometimes produces an X or Y that is outside of the 1024x1024 skinset image:
bool SkinSet::overTransparentPixel(const std::string& skinComponent, int xPos, int yPos)
{
Vector4 UVCoords = getTextureCoordinates(mSkinName + skinComponent + getImageExtension());
int actualX = (mTextureWidth * UVCoords.x) + xPos;
int actualY = (mTextureHeight * UVCoords.y) + yPos;
Ogre::ColourValue cv = mSkinSetImage->getColourAt(actualX,actualY,0);
return (cv.a < 0.01);
}
Are you aware of these issues/is this still a work in progress? Either way, here are a couple things that might help. For example, I think that code that checks to see if the mouse is within a parent widget calls this:
bool Widget::isPointWithinBounds(const Point& pixelPosition)
{
if(!mQuad->visible())
return false;
if(!mQuad->isPointWithinBounds(pixelPosition))
return false;
if(overTransparentPixel(pixelPosition))
return false;
return true;
}
The problem is that this code should return whether the mouse is within bounds of the widget, not whether it is over a transparent pixel or not. So the last if statement should probably be replaced by a more straight-forward rectangular position check.
I'll look more into this and see what I can find, but let me know if you're aware of these problems as well.
Thanks!