Page 1 of 1

Alpha testing and getting textures

Posted: Fri Nov 10, 2006 02:18
by SamBarham
OK, so I require alpha tested buttons, so that I can have non-square buttons. I'm quite happy to fluff around in the source and hack in the bits that I want (at least for now), and I've written my own renderer, so the platform specific parts of accessing a texture and figuring out an alpha value under the mouse will be fine, but I do have a problem that is getting in the way.

In my buttons isHit() method that I am overriding, I need to get access to the CEGUI texture that will be used when the button is rendered. How on earth do I do that? The texture access seems to be buried under layers of image sets and looknfeels and schemes and falagard and everything, and I'm slightly lost as to how to figure out which actual texture will be used on render

Any ideas?

Posted: Mon Nov 13, 2006 10:01
by CrazyEddie
You are correct that the Windows do not have access to that level of information, and that was by design.

What you need to do is to set the user data or some user string to an appropriate data which allows you to obtain access to the mask (which you must provide your own means to access - but you've already done that, so no problem!).

So, you could use Window::setUserData (void *user_data) or Window::setUserString (const String &name, const String &value) and then within the isHit method you get that data and use it to access the texture (whether that data be a pointer or a name of a texture you could look up or whatever).

Hope this gives a few hints :)

CE.