This change adds more event actions to the "anim_event_action" option
for clickable global animations, this time adding simulated keyboard
input by specifying a key symbol for the key to be simulated.
For example, you can now use:
global.anim_1.part_1.MAIN.anim_event: click
global.anim_1.part_1.MAIN.anim_event_action: XK_Return
When clicking this global animation (on the main menu screen), the
currently selected/highlighted menu item will be chosen/executed.
To get the key symbol/name for the key to be simulated, just choose
the desired key as a keyboard shortcut in the setup menu (temporarily
only) and look at the resulting entry in the file "setup.conf" in the
game's configuration and personal data directory.
#include "anim.h"
#include "main.h"
#include "tools.h"
+#include "events.h"
#include "screens.h"
return FALSE;
boolean action_executed = (DoGadgetAction(anim_event_action) ||
- DoScreenAction(anim_event_action));
+ DoScreenAction(anim_event_action) ||
+ DoKeysymAction(anim_event_action));
// check if further actions are allowed to be executed
if (part->control_info.style & STYLE_MULTIPLE_ACTIONS)
#endif
#endif
}
+
+boolean DoKeysymAction(int keysym)
+{
+ if (keysym < 0)
+ {
+ Key key = (Key)(-keysym);
+
+ HandleKey(key, KEY_PRESSED);
+ HandleKey(key, KEY_RELEASED);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
void HandleSpecialGameControllerButtons(Event *);
void HandleSpecialGameControllerKeys(Key, int);
+boolean DoKeysymAction(int);
+
#endif
checked_free(gfx_token);
}
+ if (result == -1)
+ {
+ Key key = getKeyFromX11KeyName(token);
+
+ if (key != KSYM_UNDEFINED)
+ result = -(int)key;
+ }
+
if (result == -1)
result = ANIM_EVENT_ACTION_NONE;
else if (strEqual(suffix, ".init_event_action") ||
strEqual(suffix, ".anim_event_action"))
{
- result = get_anim_action_parameter_value(value);
+ result = get_anim_action_parameter_value(value_raw);
}
else if (strEqual(suffix, ".class"))
{