commit
4b836ede1b
@ -29,17 +29,12 @@
|
||||
"brick.clearScreen": "Clears the screen",
|
||||
"brick.lightPattern": "Pattern block.",
|
||||
"brick.lightPattern|param|pattern": "the lights pattern to use. eg: LightsPattern.Green",
|
||||
"brick.print": "Show text on the screen.",
|
||||
"brick.printLine": "Show text on the screen at a specific line.",
|
||||
"brick.printLine|param|line": "the line number to print the text at, eg: 0",
|
||||
"brick.printLine|param|text": "the text to print on the screen, eg: \"Hello world\"",
|
||||
"brick.printPorts": "Prints the port states on the screen",
|
||||
"brick.print|param|text": "the text to print on the screen, eg: \"Hello world\"",
|
||||
"brick.print|param|x": "the starting position's x coordinate, eg: 0",
|
||||
"brick.print|param|y": "the starting position's x coordinate, eg: 0",
|
||||
"brick.setLight": "Set lights.",
|
||||
"brick.setLight|param|pattern": "the lights pattern to use.",
|
||||
"brick.setPixel": "Sets a pixel on or off",
|
||||
"brick.setPixel|param|on": "a value indicating if the pixel should be on or off",
|
||||
"brick.setPixel|param|x": "the starting position's x coordinate, eg: 0",
|
||||
"brick.setPixel|param|y": "the starting position's x coordinate, eg: 0",
|
||||
"brick.showImage": "Shows an image on screen",
|
||||
"brick.showImage|param|image": "image to draw",
|
||||
"console": "Reading and writing data to the console output.\n\nReading and writing data to the console output.",
|
||||
|
@ -35,10 +35,9 @@
|
||||
"brick.buttonUp|block": "up",
|
||||
"brick.clearScreen|block": "clear screen",
|
||||
"brick.lightPattern|block": "%pattern",
|
||||
"brick.printLine|block": "print %text| at line: %line",
|
||||
"brick.printPorts|block": "print ports",
|
||||
"brick.print|block": "print %text| at x: %x| y: %y",
|
||||
"brick.setLight|block": "set light to %pattern=led_pattern",
|
||||
"brick.setPixel|block": "set pixel %on| at x: %x| y: %y",
|
||||
"brick.showImage|block": "show image %image=screen_image_picker",
|
||||
"brick|block": "brick",
|
||||
"console.logValue|block": "console|log value %name|= %value",
|
||||
|
@ -105,7 +105,7 @@ namespace brick {
|
||||
//% blockId=buttonWasPressed
|
||||
//% parts="brick"
|
||||
//% blockNamespace=brick
|
||||
//% weight=80 blockGap=8
|
||||
//% weight=80
|
||||
//% group="Buttons"
|
||||
wasPressed() {
|
||||
const r = this._wasPressed
|
||||
|
@ -80,15 +80,6 @@ namespace brick {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a pixel on or off
|
||||
* @param on a value indicating if the pixel should be on or off
|
||||
* @param x the starting position's x coordinate, eg: 0
|
||||
* @param y the starting position's x coordinate, eg: 0
|
||||
*/
|
||||
//% blockId=screen_setpixel block="set pixel %on| at x: %x| y: %y"
|
||||
//% weight=98 group="Screen"
|
||||
//% x.min=0 x.max=178 y.min=0 y.max=128 on.fieldEditor=toggleonoff
|
||||
export function setPixel(on: boolean, x: number, y: number) {
|
||||
x |= 0
|
||||
y |= 0
|
||||
@ -97,14 +88,20 @@ namespace brick {
|
||||
}
|
||||
|
||||
/**
|
||||
* Show text on the screen.
|
||||
* Show text on the screen at a specific line.
|
||||
* @param text the text to print on the screen, eg: "Hello world"
|
||||
* @param x the starting position's x coordinate, eg: 0
|
||||
* @param y the starting position's x coordinate, eg: 0
|
||||
* @param line the line number to print the text at, eg: 0
|
||||
*/
|
||||
//% blockId=screen_print block="print %text| at x: %x| y: %y"
|
||||
//% weight=99 group="Screen" inlineInputMode="inline" blockGap=8
|
||||
//% x.min=0 x.max=178 y.min=0 y.max=128
|
||||
//% blockId=screen_print block="print %text| at line %line"
|
||||
//% weight=98 group="Screen" inlineInputMode="inline" blockGap=8
|
||||
//% line.min=0 line.max=9
|
||||
export function printLine(text: string, line: number) {
|
||||
const NUM_LINES = 9;
|
||||
const offset = 5;
|
||||
const y = offset + (Math.clamp(0, NUM_LINES, line) / (NUM_LINES + 2)) * DAL.LCD_HEIGHT;
|
||||
brick.print(text, offset, y);
|
||||
}
|
||||
|
||||
export function print(text: string, x: number, y: number, mode = Draw.Normal) {
|
||||
x |= 0
|
||||
y |= 0
|
||||
@ -140,7 +137,7 @@ namespace brick {
|
||||
* @param image image to draw
|
||||
*/
|
||||
//% blockId=screen_show_image block="show image %image=screen_image_picker"
|
||||
//% weight=95 group="Screen" blockGap=8
|
||||
//% weight=100 group="Screen" blockGap=8
|
||||
export function showImage(image: Image, delay: number = 400) {
|
||||
if (!image) return;
|
||||
image.draw(0, 0, Draw.Normal);
|
||||
@ -166,7 +163,7 @@ namespace brick {
|
||||
* Clears the screen
|
||||
*/
|
||||
//% blockId=screen_clear_screen block="clear screen"
|
||||
//% weight=94 group="Screen" blockGap=8
|
||||
//% weight=90 group="Screen"
|
||||
export function clearScreen() {
|
||||
screen.clear();
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ namespace sensors {
|
||||
//% blockId=remotebuttonWasPressed
|
||||
//% parts="remote"
|
||||
//% blockNamespace=sensors
|
||||
//% weight=80 blockGap=8
|
||||
//% weight=80
|
||||
//% group="Remote Infrared Beacon"
|
||||
wasPressed() {
|
||||
return this.button.wasPressed();
|
||||
@ -238,7 +238,7 @@ namespace sensors {
|
||||
//% blockId=infraredGetRemoteCommand
|
||||
//% parts="infrared"
|
||||
//% blockNamespace=sensors
|
||||
//% weight=65 blockGap=8
|
||||
//% weight=65
|
||||
//% group="Infrared Sensor"
|
||||
remoteCommand(): number {
|
||||
this._setMode(IrSensorMode.RemoteControl)
|
||||
|
@ -2,8 +2,6 @@
|
||||
"Sound.buffer": "Returns the underlaying Buffer object.",
|
||||
"Sound.play": "Play sound.",
|
||||
"music": "Generation of music tones.",
|
||||
"music._soundPicker": "A sound",
|
||||
"music._soundPicker|param|sound": "the sound",
|
||||
"music.beat": "Return the duration of a beat in milliseconds (the beat fraction).",
|
||||
"music.beat|param|fraction": "the fraction of the current whole note, eg: BeatFraction.Half",
|
||||
"music.changeTempoBy": "Change the tempo up or down by some amount of beats per minute (bpm).",
|
||||
|
@ -20,7 +20,6 @@
|
||||
"Note.GSharp|block": "G#",
|
||||
"SoundOutputDestination.Pin|block": "pin",
|
||||
"SoundOutputDestination.Speaker|block": "speaker",
|
||||
"music._soundPicker|block": "%sound",
|
||||
"music.beat|block": "%fraction|beat",
|
||||
"music.changeTempoBy|block": "change tempo by %value|(bpm)",
|
||||
"music.noteFrequency|block": "%note",
|
||||
|
@ -170,7 +170,7 @@ void playTone(int frequency, int ms) {
|
||||
//% blockId=music_stop_all_sounds block="stop all sounds"
|
||||
//% parts="headphone"
|
||||
//% blockNamespace=music
|
||||
//% weight=76 blockGap=8
|
||||
//% weight=97
|
||||
void stopAllSounds() {
|
||||
if (currentSample) {
|
||||
samplePtr = currentSample->length;
|
||||
|
2
libs/music/shims.d.ts
vendored
2
libs/music/shims.d.ts
vendored
@ -32,7 +32,7 @@ declare namespace music {
|
||||
//% blockId=music_stop_all_sounds block="stop all sounds"
|
||||
//% parts="headphone"
|
||||
//% blockNamespace=music
|
||||
//% weight=76 blockGap=8 shim=music::stopAllSounds
|
||||
//% weight=97 shim=music::stopAllSounds
|
||||
function stopAllSounds(): void;
|
||||
|
||||
/** Makes a sound bound to a buffer in WAV format. */
|
||||
|
@ -264,7 +264,7 @@ namespace music {
|
||||
* @param sound the sound to play
|
||||
*/
|
||||
//% blockId=music_play_sound_effect_until_done block="play sound effect %sound|until done"
|
||||
//% weight=98
|
||||
//% weight=98 blockGap=8
|
||||
export function playSoundEffectUntilDone(sound: Sound) {
|
||||
if (!sound) return;
|
||||
sound.play();
|
||||
@ -276,7 +276,7 @@ namespace music {
|
||||
*/
|
||||
//% blockId=music_sound_picker block="%sound" shim=TD_ID
|
||||
//% weight=0 blockHidden=1
|
||||
export function _soundPicker(sound: Sound): Sound {
|
||||
export function __soundPicker(sound: Sound): Sound {
|
||||
return sound;
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ namespace music {
|
||||
* @param sound the sound to play
|
||||
*/
|
||||
//% blockId=music_play_sound_effect block="play sound effect %sound"
|
||||
//% weight=99
|
||||
//% weight=99 blockGap=8
|
||||
export function playSoundEffect(sound: Sound) {
|
||||
if (!sound || numSoundsPlaying >= soundsLimit) return;
|
||||
numSoundsPlaying++;
|
||||
|
@ -75,7 +75,7 @@ namespace sensors {
|
||||
//% blockId=touchIsPressed
|
||||
//% parts="touch"
|
||||
//% blockNamespace=sensors
|
||||
//% weight=81 blockGap=8
|
||||
//% weight=81
|
||||
//% group="Touch Sensor"
|
||||
isPressed() {
|
||||
return this.button.isPressed();
|
||||
|
@ -75,7 +75,7 @@ namespace sensors {
|
||||
//% blockId=sonarGetDistance
|
||||
//% parts="ultrasonicsensor"
|
||||
//% blockNamespace=sensors
|
||||
//% weight=65 blockGap=8
|
||||
//% weight=65
|
||||
//% group="Ultrasonic Sensor"
|
||||
distance(): number {
|
||||
// it supposedly also has an inch mode, but we stick to cm
|
||||
|
Loading…
Reference in New Issue
Block a user