mirror of
https://github.com/danbulant/console-hub
synced 2026-06-19 06:21:06 +00:00
Testing keybinds (gamepad to keyboard)
Not currently working
This commit is contained in:
parent
59db56981b
commit
cabd300089
3 changed files with 8 additions and 8 deletions
|
|
@ -24,7 +24,7 @@ $(document).keypress((event) => {
|
|||
}
|
||||
})
|
||||
var keyBinds = new Map();
|
||||
keyBinds.set('button_1', '~')//set button_1 (A) as enter
|
||||
keyBinds.set('button_1', 'enter')//set button_1 (A) as enter
|
||||
var pressed = [];
|
||||
var gameLooper = 0;
|
||||
//Sending keys from gamepad
|
||||
|
|
@ -39,7 +39,7 @@ function changeToGame(){
|
|||
//add custom ones
|
||||
keyBinds.forEach((val, key) => {
|
||||
gamepad.on('press', key, () => {
|
||||
sendKeys(val);
|
||||
sendKeys([], val);
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ if(typeof require !== typeof undefined){
|
|||
files = arg;
|
||||
refreshFiles();
|
||||
})
|
||||
function sendKeys(arg){
|
||||
ipcRenderer.send('sendKeys', arg);
|
||||
function sendKeys(arg, arg2){
|
||||
ipcRenderer.send('sendKeys', arg, arg2);
|
||||
return true;
|
||||
}
|
||||
var loc = window.location.pathname;
|
||||
|
|
|
|||
8
main.js
8
main.js
|
|
@ -176,13 +176,13 @@ ipcMain.on('fullscreen', (event, arg) => {
|
|||
})
|
||||
|
||||
function sendKeybinding (win, modifiers, keyCode) {
|
||||
win.webContents.sendInputEvent({ type: 'keyDown', modifiers, keyCode })
|
||||
win.webContents.sendInputEvent({ type: 'char', modifiers, keyCode })
|
||||
win.webContents.sendInputEvent({ type: 'keyUp', modifiers, keyCode })
|
||||
win.webContents.sendInputEvent({ type: 'keyDown', modifiers: modifiers, keyCode: keyCode })
|
||||
win.webContents.sendInputEvent({ type: 'char', modifiers: modifiers, keyCode: keyCode })
|
||||
win.webContents.sendInputEvent({ type: 'keyUp', modifiers: modifiers, keyCode: keyCode })
|
||||
}
|
||||
|
||||
ipcMain.on('sendKeys', (event, modifiers, keyCode) => {
|
||||
console.log('Sending keys: '+arg);
|
||||
console.log('Sending keys: '+keyCode + " with modifiers " + modifiers);
|
||||
sendKeybinding(win, modifiers, keyCode);
|
||||
})
|
||||
ipcMain.on('listFiles', (event, arg) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue