-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated blockly learning object rendering using the simulator readonl…
…y endpoint (work in progress)
- Loading branch information
1 parent
8e58f5e
commit 6109b27
Showing
303 changed files
with
58,553 additions
and
3,806 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/** | ||
* @license | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @fileoverview Dwenguino blocks for Blockly. | ||
* @author [email protected] | ||
*/ | ||
'use strict'; | ||
|
||
// goog.provide('Blockly.Blocks.arduino'); | ||
|
||
// goog.require('Blockly.Blocks'); | ||
|
||
var ArduinoHelpUrl = "http://www.arduino.cc"; | ||
|
||
// Blockly.Blocks.arduino.HUE = 100; | ||
|
||
var setup_loop_arduino_json = { | ||
"type": "setup_loop_structure_arduino", | ||
"message0": MSG.setup + " %1 %2 " + MSG.loop + "%3 %4", | ||
"args0": [ | ||
{ | ||
"type": "input_dummy" | ||
}, | ||
{ | ||
"type": "input_statement", | ||
"name": "SETUP" | ||
}, | ||
{ | ||
"type": "input_dummy" | ||
}, | ||
{ | ||
"type": "input_statement", | ||
"name": "LOOP" | ||
} | ||
], | ||
"colour": 100, | ||
"tooltip": MSG.dwenguino_main_program_structure, | ||
"helpUrl": ArduinoHelpUrl, | ||
"data": "testdatastring" | ||
}; | ||
|
||
Blockly.Blocks['setup_loop_structure_arduino'] = { | ||
init: function () { | ||
this.jsonInit(setup_loop_arduino_json); | ||
} | ||
}; | ||
|
||
Blockly.Blocks['inout_digital_read'] = { | ||
helpUrl: 'http://arduino.cc/en/Reference/DigitalRead', | ||
init: function () { | ||
this.setColour(230); | ||
this.appendDummyInput() | ||
.appendField("DigitalRead PIN#") | ||
.appendField(new Blockly.FieldDropdown(profile.default.digital), "PIN"); | ||
this.setOutput(true, 'Number'); | ||
this.setTooltip(''); | ||
} | ||
}; | ||
|
||
Blockly.Blocks['inout_digital_write'] = { | ||
helpUrl: 'http://arduino.cc/en/Reference/DigitalWrite', | ||
init: function () { | ||
this.setColour(230); | ||
this.appendDummyInput() | ||
.appendField("DigitalWrite PIN#") | ||
.appendField(new Blockly.FieldDropdown(profile.default.digital), "PIN") | ||
.appendField("Stat") | ||
.appendField(new Blockly.FieldDropdown([["HIGH", "HIGH"], ["LOW", "LOW"]]), "STAT"); | ||
this.setPreviousStatement(true, null); | ||
this.setNextStatement(true, null); | ||
this.setTooltip('Write digital value to a specific Port'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/** | ||
* @license | ||
* Copyright 2012 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @fileoverview Colour blocks for Blockly. | ||
* | ||
* This file is scraped to extract a .json file of block definitions. The array | ||
* passed to defineBlocksWithJsonArray(..) must be strict JSON: double quotes | ||
* only, no outside references, no functions, no trailing commas, etc. The one | ||
* exception is end-of-line comments, which the scraper will remove. | ||
* @author [email protected] (Neil Fraser) | ||
*/ | ||
|
||
|
||
|
||
/** | ||
* Unused constant for the common HSV hue for all blocks in this category. | ||
* @deprecated Use Blockly.Msg['COLOUR_HUE']. (2018 April 5) | ||
*/ | ||
let colorHue = 20; | ||
|
||
Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT | ||
// Block for colour picker. | ||
{ | ||
"type": "colour_picker", | ||
"message0": "%1", | ||
"args0": [ | ||
{ | ||
"type": "field_colour", | ||
"name": "COLOUR", | ||
"colour": "#ff0000" | ||
} | ||
], | ||
"output": "Colour", | ||
"helpUrl": "%{BKY_COLOUR_PICKER_HELPURL}", | ||
"style": "colour_blocks", | ||
"tooltip": "%{BKY_COLOUR_PICKER_TOOLTIP}", | ||
"extensions": ["parent_tooltip_when_inline"] | ||
}, | ||
|
||
// Block for random colour. | ||
{ | ||
"type": "colour_random", | ||
"message0": "%{BKY_COLOUR_RANDOM_TITLE}", | ||
"output": "Colour", | ||
"helpUrl": "%{BKY_COLOUR_RANDOM_HELPURL}", | ||
"style": "colour_blocks", | ||
"tooltip": "%{BKY_COLOUR_RANDOM_TOOLTIP}" | ||
}, | ||
|
||
// Block for composing a colour from RGB components. | ||
{ | ||
"type": "colour_rgb", | ||
"message0": "%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3", | ||
"args0": [ | ||
{ | ||
"type": "input_value", | ||
"name": "RED", | ||
"check": "Number", | ||
"align": "RIGHT" | ||
}, | ||
{ | ||
"type": "input_value", | ||
"name": "GREEN", | ||
"check": "Number", | ||
"align": "RIGHT" | ||
}, | ||
{ | ||
"type": "input_value", | ||
"name": "BLUE", | ||
"check": "Number", | ||
"align": "RIGHT" | ||
} | ||
], | ||
"output": "Colour", | ||
"helpUrl": "%{BKY_COLOUR_RGB_HELPURL}", | ||
"style": "colour_blocks", | ||
"tooltip": "%{BKY_COLOUR_RGB_TOOLTIP}" | ||
}, | ||
|
||
// Block for blending two colours together. | ||
{ | ||
"type": "colour_blend", | ||
"message0": "%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} " + | ||
"%1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3", | ||
"args0": [ | ||
{ | ||
"type": "input_value", | ||
"name": "COLOUR1", | ||
"check": "Colour", | ||
"align": "RIGHT" | ||
}, | ||
{ | ||
"type": "input_value", | ||
"name": "COLOUR2", | ||
"check": "Colour", | ||
"align": "RIGHT" | ||
}, | ||
{ | ||
"type": "input_value", | ||
"name": "RATIO", | ||
"check": "Number", | ||
"align": "RIGHT" | ||
} | ||
], | ||
"output": "Colour", | ||
"helpUrl": "%{BKY_COLOUR_BLEND_HELPURL}", | ||
"style": "colour_blocks", | ||
"tooltip": "%{BKY_COLOUR_BLEND_TOOLTIP}" | ||
} | ||
]); // END JSON EXTRACT (Do not delete this comment.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* @license | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @fileoverview Dwenguino blocks for Blockly. | ||
* @author [email protected] | ||
*/ | ||
'use strict'; | ||
|
||
// goog.provide('Blockly.Blocks.comments'); | ||
|
||
// goog.require('Blockly.Blocks'); | ||
|
||
Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT | ||
// Block for text value | ||
{ | ||
"type": "line_comment", | ||
"message0": "// %1", | ||
"args0": [{ | ||
"type": "field_input", | ||
"name": "TEXT", | ||
"text": "" | ||
}], | ||
"colour": 10, | ||
"previousStatement": null, | ||
"nextStatement": null, | ||
"helpUrl": "", | ||
"tooltip": "", | ||
}, | ||
]); |
Oops, something went wrong.