Home   Help Search Login Register  

Author Topic: displayEventHandlers, KeyDown and KeyUp events  (Read 4009 times)

0 Members and 1 Guest are viewing this topic.

Offline shole

  • Members
  • *
displayEventHandlers, KeyDown and KeyUp events
« on: 27 Apr 2008, 19:24:06 »
S_displayEventHandlers v0.1

yes boys and girls, sharing keys hasn't been this much fun since the seventies;  the extended displayEventHandler key-events addon
as XEH crew gave no response to PM and spooner had no plans for an addon of his implementation, i cooked up this myself
at current it comprises of two parts; KeyDown, which handles all keydown events, and KeyUp, which handles all keyup events
their functionality and code is identical, apart from their purpose

previously your code looked probably something like this;
Code: [Select]
(findDisplay 46) displaySetEventHandler ["KeyDown","_this call AddonGlobalFunction"];this reserved the entire displayEventHandler for your purposes only
you should replace that line with this;
Code: [Select]
["AddonIdentifierString","_this call AddonGlobalFunction;"] call S_displayEventHandler_KeyDown_add;functionally this is identical to how it was
to remove your key from the pool simply enter this;
Code: [Select]
["AddonIdentifierString"] call S_displayEventHandler_KeyDown_remove;
i have included two example addons;
S_NVG.pbo - a version 0.6 of my nightvision mod, now requires this addon to function
S_QuickMap.pbo - a VERY simple example of a press-and-hold ingame map (from the Tab key) - just to get an idea of the implementation and functionality

and two fixes for third party addons;
S_KeyDown_SightAdjustmentFix.pbo - wraps GMJ's SightAdjustment addon's keydown events
S_KeyDown_Chicago_SATCOMFix.pbo - wraps chicago's satcom keydown events - not thoroughly play-tested

as you might notice, this is functionally still identical to the original event handler in that it sends every key to every function, leaving the parsing job for the addon function
this is to be built upon in 0.2 with a third parameter where the addon makers can assign and externalize specific keys for their functions

release history;
v0.1 - 080427 - initial beta release
*   has basic keydown and keyup event handling, function adding and removal

plans for future;
*   three stage objective;
   1.   bring key parsing out from external addon code
      meaning, specific keys could be assigned directly to specific functions
   2.   externalise these keys into a setup file
   3.   add a menu inside the game to edit this setup file
*   create fixes for more addons, if their creators won't fix them themselves
*   make deleting keys more foolproof
*   make threadsafe
*   what else?


below is a generic summary of all functional globals that these addons spout out
note that you should not meddle with the global variables

S_KeyDown 0.1

global vars;
   S_displayEventHandler_KeyDown_List
      the plaintext array of names and functions for KeyDown events
      not to be used externally
   S_KeyDown_Private_KeyDown
      the compiled function array generated from the key database
      not to be used externally

global functions;
   S_displayEventHandler_KeyDown_hintlist
      debug database dump
      use anywhere
      syntax: _this call S_displayEventHandler_KeyDown_hintlist;
   S_displayEventHandler_KeyDown_Refresh
      force database refresh
      use anywhere
      you should never need this
      syntax: _this call S_displayEventHandler_KeyDown_Refresh;
   S_displayEventHandler_KeyDown_add
      add keys to database
      use anywhere
      identically named keys are overwritten
      syntax: ["AddonIdentifierString","_this call AddonGlobalFunction;"] call S_displayEventHandler_KeyDown_add;
   S_displayEventHandler_KeyDown_remove
      remove keys from database
      use anywhere
      syntax: ["AddonIdentifierString"] call S_displayEventHandler_KeyDown_remove;

S_KeyUp 0.1

identical to KeyDown -  just replace all KeyDown with KeyUp
« Last Edit: 09 May 2008, 20:36:17 by shole »

Offline shole

  • Members
  • *
Re: displayEventHandlers, KeyDown and KeyUp events
« Reply #1 on: 28 Apr 2008, 06:51:38 »
btw, this is more to gather thoughts and comments at this point rather than thorough testing until i add all the features
i guess posting it in discussion would have made more sense then

Offline Loyalguard

  • Former Staff
  • ****
Re: displayEventHandlers, KeyDown and KeyUp events
« Reply #2 on: 28 Apr 2008, 08:50:42 »
Overview looks promising!  This is something that has been needed for along time.  I am looking forward to checking it out.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: displayEventHandlers, KeyDown and KeyUp events
« Reply #3 on: 28 Apr 2008, 19:52:11 »
Welcome to OFPEC shole :welcome:

Straight to the point: do not post consecutively.
If you have something to add after a short period of time modify your post instead of 'replying to yourself'. :)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline ViperMaul

  • Members
  • *
    • Theatre Of War (Team PvP Campaign)
Re: displayEventHandlers, KeyDown and KeyUp events
« Reply #4 on: 03 Sep 2008, 19:41:17 »
Wow I cannot believe I missed this great contribution.
This is what this communities needs. Thank You Shole! In truth I ran into the same responses in my requests as well. But I had no time. Thanks again!
How come this didn't make Armaholic.com or did it?
Any updates?
ViperMaul
Theatre of War (Co-Lead Dev)
ACE (Jr Project Manager)