I have a bit of an odd problem - which is perhaps appropriate, as my current use for DirectButtons is perhaps a little odd itself.
I’m currently attempting to set up a first-person perspective adventure game system (real-time, not slideshow or panoramic), and part of that involves allowing the user to perform actions with objects, each such action being represented by a DirectButton, more or less.
When there is more than one such action, I have a special button appear that, when clicked, causes the buttons for the actions themselves to appear, and another that causes them to again disappear. To this end I keep a small number of DirectButtons, each tied to an “act” method, and passing an index as a parameter.
A special case occurs when there is only one action, however. In this case the first DirectButton - which should pass ‘0’ as its parameter - appears directly, in the centre of the screen, without an intervening step.
Movement is handled via the more-or-less standard system of moving the mouse about to look and the W-A-S-D keys to move around, with the mouse being warped to the centre of the screen to produce relative movement.
Despite the cursor being invisible (albeit being made to appear when there is more than one button), this system seems to work. However, under some conditions - which I have not yet properly nailed down, I’m afraid - the case involving a single action seems to fail: the button is visible, but the “act” method doesn’t seem to be called. This seems to be related to going through the standard case, of producing and then dismissing multiple buttons, before the single-button case is invoked, but doesn’t always happen. The issue seems to disappear again if the multi-button case is invoked, but again doesn’t seem to do so consistently.
At the moment I’m fairly confident that I’m no longer disabling any of the buttons, just hiding them.
My best idea at the moment is that the mouse-clicks are, for some reason, not reaching the buttons in some cases. Perhaps they’re being fielded by another button, which is somehow intercepting the clicks (although I would expect that, being hidden, they should not, surely?). Alas, I’m not sure of how to test for this at the moment, I don’t think.
Does anyone have any suggestions, and if so, what are they, please?
My thanks for any help given.