'use strict'; goog.provide('Blockly.Blocks.hci'); goog.require('Blockly.Blocks'); /* * HID * setup */ Blockly.Blocks['HID_setup'] = { init: function() { this.appendDummyInput() .appendField(new Blockly.FieldImage("./../blockly/media/computer.png", 50, 40, "15")); this.appendDummyInput() .appendField(Blockly.Msg.HID_SETUP); this.setColour("#ff8b2c"); this.setTooltip(""); this.setHelpUrl(""); }, } /* * HID * Mouse move */ Blockly.Blocks['HID_mouse_move'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.HID_MOUSE_MOVE) .appendField(new Blockly.FieldDropdown([ ["↑", "KEYPAD_UP"], ["↓", "KEYPAD_DOWN"], ["←", "KEYPAD_LEFT"], ["→", "KEYPAD_RIGHT"] ]), "mouse_towards") .appendField(Blockly.Msg.HID_MOUSE_MOVE_FOR) .appendField(new Blockly.FieldTextInput("10"), "mouse_distance") .appendField(Blockly.Msg.HID_MOUSE_MOVE_DISTANCE) this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour("#ff8b2c"); this.setTooltip(""); this.setHelpUrl(""); }, } /* * HID * mouse click */ Blockly.Blocks['HID_mouse_click'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.HID_MOUSE_CLICK) .appendField(new Blockly.FieldDropdown([ [Blockly.Msg.HID_MOUSE_CLICK_LEFT, "MOUSE_LEFT"], [Blockly.Msg.HID_MOUSE_CLICK_RIGHT, "MOUSE_RIGHT"] ]), "CLICK"); this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour("#ff8b2c"); this.setTooltip(""); this.setHelpUrl(""); }, } /* * HID * mouse press */ Blockly.Blocks['HID_mouse_press'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.HID_MOUSE_PRESS) .appendField(new Blockly.FieldDropdown([ [Blockly.Msg.HID_MOUSE_CLICK_LEFT, "MOUSE_LEFT"], [Blockly.Msg.HID_MOUSE_CLICK_RIGHT, "MOUSE_RIGHT"] ]), "CLICK"); this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour("#ff8b2c"); this.setTooltip(""); this.setHelpUrl(""); }, } /* * HID * mouse press */ Blockly.Blocks['HID_mouse_release'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.HID_MOUSE_RELEASE) .appendField(new Blockly.FieldDropdown([ [Blockly.Msg.HID_MOUSE_CLICK_LEFT, "MOUSE_LEFT"], [Blockly.Msg.HID_MOUSE_CLICK_RIGHT, "MOUSE_RIGHT"] ]), "CLICK"); this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour("#ff8b2c"); this.setTooltip(""); this.setHelpUrl(""); }, } /* * HID * keyboard press * Dropdown for special KEY {KEY_LEFT_CTRL , KEY_LEFT_SHIFT ,KEY_LEFT_ALT, * KEY_UP_ARROW,KEY_DOWN_ARROW,KEY_LEFT_ARROW,KEY_RIGHT_ARROW, * KEY_BACKSPACE,KEY_ESC } */ Blockly.Blocks['HID_keyboard_press'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.HID_KEYBOARD_PRESS) .appendField(new Blockly.FieldDropdown([ ["Space", "32"], ["Enter", "KEY_RETURN"], ["UP", "KEY_UP_ARROW"], ["DOWN", "KEY_DOWN_ARROW"], ["LEFT", "KEY_LEFT_ARROW"], ["RIGHT", "KEY_RIGHT_ARROW"], ["DELETE", "KEY_DELETE"], ["0", "'0'"], ["1", "'1'"], ["2", "'2'"], ["3", "'3'"], ["4", "'4'"], ["5", "'5'"], ["6", "'6'"], ["7", "'7'"], ["8", "'8'"], ["9", "'9'"], ["A", "'A'"], ["B", "'B'"], ["C", "'C'"], ["D", "'D'"], ["E", "'E'"], ["F", "'F'"], ["G", "'G'"], ["H", "'H'"], ["I", "'I'"], ["J", "'J'"], ["K", "'K'"], ["L", "'L'"], ["M", "'M'"], ["N", "'N'"], ["O", "'O'"], ["P", "'P'"], ["Q", "'Q'"], ["R", "'R'"], ["S", "'S'"], ["T", "'T'"], ["U", "'U'"], ["V", "'V'"], ["W", "'W'"], ["X", "'X'"], ["Y", "'Y'"], ["Z", "'Z'"], ]), "keyboard_press"); this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour("#ff8b2c"); this.setTooltip(""); this.setHelpUrl(""); }, } /* * HID * keyboard release * Dropdown for special KEY {KEY_LEFT_CTRL , KEY_LEFT_SHIFT ,KEY_LEFT_ALT, * KEY_UP_ARROW,KEY_DOWN_ARROW,KEY_LEFT_ARROW,KEY_RIGHT_ARROW, * KEY_BACKSPACE,KEY_ESC } */ Blockly.Blocks['HID_keyboard_release'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.HID_KEYBOARD_RELEASE) .appendField(new Blockly.FieldDropdown([ ["Space", "32"], ["Enter", "KEY_RETURN"], ["UP", "KEY_UP_ARROW"], ["DOWN", "KEY_DOWN_ARROW"], ["LEFT", "KEY_LEFT_ARROW"], ["RIGHT", "KEY_RIGHT_ARROW"], ["DELETE", "KEY_DELETE"], ["0", "'0'"], ["1", "'1'"], ["2", "'2'"], ["3", "'3'"], ["4", "'4'"], ["5", "'5'"], ["6", "'6'"], ["7", "'7'"], ["8", "'8'"], ["9", "'9'"], ["A", "'A'"], ["B", "'B'"], ["C", "'C'"], ["D", "'D'"], ["E", "'E'"], ["F", "'F'"], ["G", "'G'"], ["H", "'H'"], ["I", "'I'"], ["J", "'J'"], ["K", "'K'"], ["L", "'L'"], ["M", "'M'"], ["N", "'N'"], ["O", "'O'"], ["P", "'P'"], ["Q", "'Q'"], ["R", "'R'"], ["S", "'S'"], ["T", "'T'"], ["U", "'U'"], ["V", "'V'"], ["W", "'W'"], ["X", "'X'"], ["Y", "'Y'"], ["Z", "'Z'"], ]), "keyboard_press"); this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour("#ff8b2c"); this.setTooltip(""); this.setHelpUrl(""); }, } /* * HID * keyboard releaseAll * release all keyboard */ Blockly.Blocks['HID_keyboard_releaseAll'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.HID_KEYBOARD_RELEASEALL) this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour("#ff8b2c"); this.setTooltip(""); this.setHelpUrl(""); }, }