camera.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /**
  2. * @license
  3. * Visual Blocks Editor
  4. *
  5. * Copyright 2012 Google Inc.
  6. * https://developers.google.com/blockly/
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. /**
  21. * @fileoverview Colour blocks for Blockly.
  22. * @author fraser@google.com (Neil Fraser)
  23. */
  24. 'use strict';
  25. goog.provide('Blockly.Blocks.camera');
  26. goog.require('Blockly.Blocks');
  27. /**
  28. * Common HSV hue for all blocks in this category.
  29. */
  30. Blockly.Blocks.camera.HUE = "#ff6381";
  31. Blockly.Blocks['camera_import'] = {
  32. /**
  33. * @this Blockly.Block
  34. */
  35. init: function() {
  36. this.setColour(Blockly.Blocks.camera.HUE);
  37. this.appendDummyInput()
  38. .appendField(Blockly.Msg.CAMERA_IMPORT);
  39. // this.setInputsInline(false);
  40. // this.setOutput(true);
  41. this.setPreviousStatement(true);
  42. this.setNextStatement(true);
  43. },
  44. };
  45. Blockly.Blocks['camera_use'] = {
  46. /**
  47. * @this Blockly.Block
  48. */
  49. init: function() {
  50. this.setColour(Blockly.Blocks.camera.HUE);
  51. this.appendDummyInput()
  52. .appendField(Blockly.Msg.CAMERA_USE_AS)
  53. .appendField(new Blockly.FieldTextInput("camera"),"CAMERA")
  54. this.appendDummyInput()
  55. .appendField(Blockly.Msg.CAMERA_SENSOR_MODE)
  56. .appendField(new Blockly.FieldNumber('4'),"SENSOR")
  57. this.appendDummyInput()
  58. .appendField(Blockly.Msg.CAMERA_RESOLUTION)
  59. .appendField(new Blockly.FieldNumber('1640'),"X")
  60. .appendField(",")
  61. .appendField(new Blockly.FieldNumber('1232'),"Y")
  62. this.appendDummyInput()
  63. .appendField(Blockly.Msg.CAMERA_FRAME_RATE)
  64. .appendField(new Blockly.FieldNumber('20'),"FPS")
  65. .appendField(Blockly.Msg.CAMERA_FPS)
  66. this.appendStatementInput("STACK")
  67. .appendField(Blockly.Msg.CAMERA_DO);
  68. // this.setInputsInline(false);
  69. // this.setOutput(true);
  70. this.setPreviousStatement(true);
  71. this.setNextStatement(true);
  72. },
  73. };
  74. Blockly.Blocks['camera_enable'] = {
  75. /**
  76. * @this Blockly.Block
  77. */
  78. init: function() {
  79. this.setColour(Blockly.Blocks.camera.HUE);
  80. this.appendDummyInput()
  81. .appendField(new Blockly.FieldDropdown([
  82. ["Enable","start"],
  83. ["Disable","stop"]
  84. ]),"MODE")
  85. .appendField(Blockly.Msg.CAMERA_CAMERA)
  86. .appendField(new Blockly.FieldTextInput("camera"),"CAMERA")
  87. // this.setInputsInline(false);
  88. // this.setOutput(true);
  89. this.setPreviousStatement(true);
  90. this.setNextStatement(true);
  91. },
  92. };
  93. Blockly.Blocks['camera_set_bounding'] = {
  94. /**
  95. * @this Blockly.Block
  96. */
  97. init: function() {
  98. this.setColour(Blockly.Blocks.camera.HUE);
  99. this.appendDummyInput()
  100. .appendField(Blockly.Msg.CAMERA_SET_BOUNDING)
  101. .appendField(new Blockly.FieldTextInput("x"),"X")
  102. .appendField(new Blockly.FieldTextInput("y"),"Y")
  103. .appendField(new Blockly.FieldTextInput("width"),"WIDTH")
  104. .appendField(new Blockly.FieldTextInput("height"),"HEIGHT")
  105. // this.setInputsInline(false);
  106. // this.setOutput(true);
  107. this.setPreviousStatement(true);
  108. this.setNextStatement(true);
  109. },
  110. };