Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
updateMouse() {
// periodically poll the system for mouse coordinates
// console.log('updateMouse');
var mouse = robot.getMousePos();
this.mouse = {
x: mouse.x,
y: mouse.y
};
this.screenSize = robot.getScreenSize();
}
using Socket.io version 1.0 or later (http://socket.io/)
using robot.js to control mouse
see ~/0/2015/p5/configSensact v1 for example of talking to serial port
https://github.com/voodootikigod/node-serialport
*/
//Move the mouse across the screen as a sine wave.
var robot = require("robotjs");
//Speed up the mouse.
robot.setMouseDelay(2);
var twoPI = Math.PI * 2.0;
var screenSize = robot.getScreenSize();
var height = (screenSize.height / 2) - 10;
var width = screenSize.width;
for (var x = 0; x < width; x++)
{
y = height * Math.sin((twoPI * x) / width) + height;
robot.moveMouse(x, y);
}
var express = require('express'); // include express.js
var io = require('socket.io'), // include socket.io
app = express(), // make an instance of express.js
server = app.listen(1871), // start a server with the express instance
socketServer = io(server); // make a socket server using the express server
var robot = require('robotjs');
// Cache screen size
var screenSize = robot.getScreenSize();
var Scanner = require ('./Scanner');
// COLOR DEFINITIONS
// This is the Dino's colour, also used by Obstacles.
var COLOR_DINOSAUR = '535353';
var DARK_COLOR_DINO = 'ACACAC';
var GameManipulator = {
// Stores the game position (Globally)
offset: null,
width: null,
// Stores points (jumps)
points: 0,
var dialog = require('dialog');
var robot = require('robotjs');
var DEBUG_MODE = require('./Enums').DEBUG_MODE;
var gui = window.require('nw.gui');
var w = robot.getScreenSize().width;
var h = robot.getScreenSize().height;
var resolution = w + 'x' + h;
var aspect = w / h;
var basePosition = {
x: w / 2,
y: h * 0.44
};
function showAllDevTools() {
for (var i in global.__nwWindowsStore) {
global.__nwWindowsStore[i].showDevTools();
}
}
const handleMouse = (eventItem) => {
const x = eventItem.data.x;
const y = eventItem.data.y;
const screenSize = robot.getScreenSize();
if (x > 0 && x < screenSize.width && y > 0 && y < screenSize.height) {
robot.moveMouse(x, y);
}
};
setTimeout(function () {
length = length * 100;
var screen = robot.getScreenSize();
var x = screen.width / 2;
var y = screen.height / 2;
var n = 0;
var intervalId = setInterval(function () {
robot.moveMouse(x, y);
if (++n == length)
clearInterval(intervalId);
}, 1);
}, wait * 1000);
var dialog = require('dialog');
var robot = require('robotjs');
var DEBUG_MODE = require('./Enums').DEBUG_MODE;
var gui = window.require('nw.gui');
var w = robot.getScreenSize().width;
var h = robot.getScreenSize().height;
var resolution = w + 'x' + h;
var aspect = w / h;
var basePosition = {
x: w / 2,
y: h * 0.44
};
function showAllDevTools() {
for (var i in global.__nwWindowsStore) {
global.__nwWindowsStore[i].showDevTools();
}
}
function hideAllGUIWindows() {