How would I get the cursor to change if it goes over a GUI button?
I tried this:
if (GetLocationType(mouse.x,mouse.y) == buttonname) {
mouse.Mode = eModePointer;
}
But it says "cannot convert GetLocationType to Button." I can't seem to get this.
GetLocationType(mouse.x,mouse.y) (http://www.adventuregamestudio.co.uk/manual/GetLocationType.htm) only returns whether the mouse is character, hotspot, object or nothing - GUIs are counted as nothing, so obviously you can't get the Control name from that. Instead, use GUIControl.GetAtScreenXY(mouse.x, mouse.y) (http://www.adventuregamestudio.co.uk/manual/GUIControl.GetAtScreenXY.htm). Just substitute it in, the code looks fine otherwise.
Actually Buttons aren't the same as generic GUIControl pointers. ;)
So he would have to do:
GUIControl* controlat = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if ((controlat != null) && (controlat.AsButton == buttonname)) {
mouse.Mode = eModePointer;
}
Or the like.
That's probably better practice, but:
if (GUIControl.GetAtScreenXY(mouse.x,mouse.y) == buttonname) {
mouse.Mode = eModePointer;
}
works.
If you wanted to do something TO the button (e.g. change it's text or graphic) you might have to do it monkey's way.
Hmm...I didn't realize that GUIControl pointers were comparable to derived types. Thanks for the clarification (correction).
Thanks guys. That works.