mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-02-08 00:12:00 +00:00
trying to sort out input madness.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4570 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
d4e312b398
commit
2a030268c5
2 changed files with 633 additions and 625 deletions
|
@ -88,11 +88,10 @@ mergeInto(LibraryManager.library,
|
|||
//we don't steal that because its impossible to leave it again once used.
|
||||
if (FTEC.evcb.key != 0 && event.keyCode != 122)
|
||||
{
|
||||
Runtime.dynCall('viiii', FTEC.evcb.key, [0, event.type=='keydown', event.keyCode, 0]);
|
||||
if (Runtime.dynCall('iiiii', FTEC.evcb.key, [0, event.type=='keydown', event.keyCode, 0]))
|
||||
event.preventDefault();
|
||||
}
|
||||
break;
|
||||
case 'keydown':
|
||||
default:
|
||||
console.log(event);
|
||||
}
|
||||
|
@ -108,7 +107,7 @@ mergeInto(LibraryManager.library,
|
|||
if (!FTEC.donecb)
|
||||
{
|
||||
FTEC.donecb = 1;
|
||||
['mousedown', 'mouseup', 'mousemove', 'wheel', 'mousewheel', 'mouseout', 'keydown', 'keyup'].forEach(function(event)
|
||||
['mousedown', 'mouseup', 'mousemove', 'wheel', 'mousewheel', 'mouseout', 'keypress', 'keydown', 'keyup'].forEach(function(event)
|
||||
{
|
||||
Module['canvas'].addEventListener(event, FTEC.handleevent, true);
|
||||
});
|
||||
|
|
|
@ -63,9 +63,18 @@ static unsigned int domkeytoquake(unsigned int code)
|
|||
Con_DPrintf("You just pressed dom key %u, which is quake key %u\n", code, tab[code]);
|
||||
return tab[code];
|
||||
}
|
||||
static void DOM_KeyEvent(int devid, int down, int scan, int uni)
|
||||
static int DOM_KeyEvent(int devid, int down, int scan, int uni)
|
||||
{
|
||||
IN_KeyEvent(0, down, domkeytoquake(scan), uni);
|
||||
//Chars which don't map to some printable ascii value get preventDefaulted.
|
||||
//This is to stop fucking annoying fucking things like backspace randomly destroying the page and thus game.
|
||||
//And it has to be conditional, or we don't get any unicode chars at all.
|
||||
//The behaviour browsers seem to give is retardedly unhelpful, and just results in hacks to detect keys that appear to map to ascii...
|
||||
//Preventing the browser from leaving the page etc should NOT mean I can no longer get ascii/unicode values, only that the browser stops trying to do something random due to the event.
|
||||
//If you are the person that decreed that this is the holy way, then please castrate yourself now.
|
||||
if (scan < ' ' || scan >= 127)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
static void DOM_ButtonEvent(int devid, int down, int button)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue