123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- '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("");
- },
- }
|