var t = setTimeout(function() { var pos = machid.mouseGetCurrentPosition(); dimensions = { width: pos.x, height: pos.y }; console.log("Detected screen resolution: " + (pos.x + 1) + " x " + (pos.y + 1)); machid.mouseMoveABS(stored.x, stored.y); }, 600);
/** * Trigger mouse pointer jump events. * * These are used to set the absolute mouse pointer position on the screen. This * is very useful as the Civ V UI otherwise forces extremely long mouse travel * paths. * * @param {object} hidData * HID data. */ function triggerMouseJumps(hidData) { var jumps = options.mouse.jumps; for (var i in jumps) { if (jumps.hasOwnProperty(i) && hidData[i]) { var pos = { x: Math.round(jumps[i].x * dimensions.width), y: Math.round(jumps[i].y * dimensions.height) }; machid.mouseMoveABS(pos.x, pos.y); } } }
/** * Trigger screen dimension detection. * * @param {object} hidData * HID data. */ function triggerDimensionDetection(hidData) { if (hidData[options.detectDimensions] && !previous[options.detectDimensions]) { var stored = machid.mouseGetCurrentPosition(); machid.mouseMoveABS(Number.MAX_VALUE, Number.MAX_VALUE); var t = setTimeout(function() { var pos = machid.mouseGetCurrentPosition(); dimensions = { width: pos.x, height: pos.y }; console.log("Detected screen resolution: " + (pos.x + 1) + " x " + (pos.y + 1)); machid.mouseMoveABS(stored.x, stored.y); }, 600); } }