Simplified (but not oversimplified) show-string docs. Proposed new reference format.

This commit is contained in:
Ron Hale-Evans 2016-05-19 13:49:26 -07:00
commit 21f7ef9b55
13 changed files with 48 additions and 53 deletions

View File

@ -7,7 +7,9 @@ This target allow to program a [BBC micro:bit](https://www.microbit.co.uk/) usin
[![Build Status](https://travis-ci.org/Microsoft/pxt-microbit.svg?branch=master)](https://travis-ci.org/Microsoft/pxt-microbit) [![Build Status](https://travis-ci.org/Microsoft/pxt-microbit.svg?branch=master)](https://travis-ci.org/Microsoft/pxt-microbit)
# Getting started ## Local server
### Setup
The following commands are a 1-time setup after synching the repo on your machine. The following commands are a 1-time setup after synching the repo on your machine.
@ -20,10 +22,16 @@ npm install -g pxt
npm install npm install
``` ```
After you're done, simple run this command to open a local web server: ### Running
Run this command to open a local web server:
``` ```
pxt serve pxt serve
``` ```
To make sure you're running the latest tools, run
```
npm update
```
More instructions at https://github.com/Microsoft/pxt#running-a-target-from-localhost More instructions at https://github.com/Microsoft/pxt#running-a-target-from-localhost

View File

@ -1,6 +1,6 @@
/** /**
* Communicate data using radio packets * Communicate data using radio packets
*/ */
//% color=270 weight=34 //% color=#E3008C weight=34
namespace radio { namespace radio {
} }

View File

@ -4,7 +4,7 @@
/** /**
* Provides access to basic micro:bit functionality. * Provides access to basic micro:bit functionality.
*/ */
//% color=190 weight=100 //% color=#0078D7 weight=100
namespace basic { namespace basic {
/** /**

View File

@ -21,19 +21,19 @@ enum LedSpriteProperty {
/** /**
* A single-LED sprite game engine * A single-LED sprite game engine
*/ */
//% color=176 weight=32 //% color=#008272 weight=32
namespace game { namespace game {
var _score: number = 0; let _score: number = 0;
var _life: number = 3; let _life: number = 3;
var _startTime: number = 0; let _startTime: number = 0;
var _endTime: number = 0; let _endTime: number = 0;
var _isGameOver: boolean = false; let _isGameOver: boolean = false;
var _countdownPause: number = 0; let _countdownPause: number = 0;
var _level: number = 1; let _level: number = 1;
var _gameId: number = 0; let _gameId: number = 0;
var img: Image; let img: Image;
var sprites: LedSprite[]; let sprites: LedSprite[];
/** /**
* Creates a new LED sprite pointing to the right. * Creates a new LED sprite pointing to the right.
* @param x sprite horizontal coordinate, eg: 2 * @param x sprite horizontal coordinate, eg: 2
@ -47,7 +47,7 @@ namespace game {
sprites.push(p); sprites.push(p);
plot(); plot();
return p; return p;
} }
/** /**
* Gets the current score * Gets the current score
@ -394,7 +394,7 @@ namespace game {
} }
plot(); plot();
} }
/** /**
* Turn the sprite * Turn the sprite
* @param this TODO * @param this TODO
@ -403,7 +403,7 @@ namespace game {
*/ */
//% weight=49 //% weight=49
//% blockId=game_turn_sprite block="%sprite|turn %direction|by (°) %degrees" //% blockId=game_turn_sprite block="%sprite|turn %direction|by (°) %degrees"
public turn(direction : Direction, degrees: number) { public turn(direction: Direction, degrees: number) {
if (direction == Direction.Right) if (direction == Direction.Right)
this.setDirection(this._dir + degrees); this.setDirection(this._dir + degrees);
else else
@ -435,8 +435,8 @@ namespace game {
*/ */
//% weight=29 //% weight=29
//% blockId=game_sprite_set_property block="%sprite|set %property|to %value" blockGap=8 //% blockId=game_sprite_set_property block="%sprite|set %property|to %value" blockGap=8
public set(property : LedSpriteProperty, value:number) { public set(property: LedSpriteProperty, value: number) {
switch(property) { switch (property) {
case LedSpriteProperty.X: this.setX(value); break; case LedSpriteProperty.X: this.setX(value); break;
case LedSpriteProperty.Y: this.setY(value); break; case LedSpriteProperty.Y: this.setY(value); break;
case LedSpriteProperty.Direction: this.setDirection(value); break; case LedSpriteProperty.Direction: this.setDirection(value); break;
@ -452,8 +452,8 @@ namespace game {
*/ */
//% weight=30 //% weight=30
//% blockId=game_sprite_change_xy block="%sprite|change %property|by %value" blockGap=8 //% blockId=game_sprite_change_xy block="%sprite|change %property|by %value" blockGap=8
public change(property : LedSpriteProperty, value:number) { public change(property: LedSpriteProperty, value: number) {
switch(property) { switch (property) {
case LedSpriteProperty.X: this.changeXBy(value); break; case LedSpriteProperty.X: this.changeXBy(value); break;
case LedSpriteProperty.Y: this.changeYBy(value); break; case LedSpriteProperty.Y: this.changeYBy(value); break;
case LedSpriteProperty.Direction: this.changeDirectionBy(value); break; case LedSpriteProperty.Direction: this.changeDirectionBy(value); break;
@ -461,15 +461,15 @@ namespace game {
case LedSpriteProperty.Blink: this.changeBlinkBy(value); break; case LedSpriteProperty.Blink: this.changeBlinkBy(value); break;
} }
} }
/** /**
* Gets a property of the sprite * Gets a property of the sprite
* @param property the name of the property to change * @param property the name of the property to change
*/ */
//% weight=28 //% weight=28
//% blockId=game_sprite_property block="%sprite|%property" //% blockId=game_sprite_property block="%sprite|%property"
public get(property : LedSpriteProperty) { public get(property: LedSpriteProperty) {
switch(property) { switch (property) {
case LedSpriteProperty.X: return this.x(); case LedSpriteProperty.X: return this.x();
case LedSpriteProperty.Y: return this.y(); case LedSpriteProperty.Y: return this.y();
case LedSpriteProperty.Direction: return this.direction() case LedSpriteProperty.Direction: return this.direction()
@ -681,7 +681,7 @@ namespace game {
function init(): void { function init(): void {
if (img == null) { if (img == null) {
img = images.createImage( img = images.createImage(
`0 0 0 0 0 `0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0

View File

@ -3,7 +3,7 @@
/** /**
* Creation, manipulation and display of LED images. * Creation, manipulation and display of LED images.
*/ */
//% color=45 weight=31 //% color=#5C2D91 weight=31
namespace images { namespace images {
/** /**
* Creates an image that fits on the LED screen. * Creates an image that fits on the LED screen.

View File

@ -1,7 +1,7 @@
/** /**
* Events and data from sensors * Events and data from sensors
*/ */
//% color=300 weight=99 //% color=#B4009E weight=99
namespace input { namespace input {
/** /**
* Attaches code to run when the screen is facing up. * Attaches code to run when the screen is facing up.

View File

@ -1,8 +1,8 @@
/** /**
* Control of the LED screen. * Control of the LED screen.
*/ */
//% color=3 weight=35 //% color=#5C2D91 weight=35
namespace led { namespace led {
// what's the current high value // what's the current high value
let barGraphHigh = 0; let barGraphHigh = 0;

View File

@ -77,7 +77,7 @@ enum BeatFraction {
/** /**
* Generation of music tones through pin ``P0``. * Generation of music tones through pin ``P0``.
*/ */
//% color=52 weight=98 //% color=#D83B01 weight=98
namespace music { namespace music {
let beatsPerMinute: number = 120; let beatsPerMinute: number = 120;

View File

@ -1,7 +1,7 @@
/** /**
* Control currents in Pins for analog/digital signals, servos, i2c, ... * Control currents in Pins for analog/digital signals, servos, i2c, ...
*/ */
//% color=351 weight=30 //% color=#A80000 weight=30
namespace pins { namespace pins {
/** /**
* Re-maps a number from one range to another. That is, a value of ``from low`` would get mapped to ``to low``, a value of ``from high`` to ``to high``, values in-between to values in-between, etc. * Re-maps a number from one range to another. That is, a value of ``from low`` would get mapped to ``to low``, a value of ``from high`` to ``to high``, values in-between to values in-between, etc.

View File

@ -1,7 +1,7 @@
/** /**
* Reading and writing data over a serial connection. * Reading and writing data over a serial connection.
*/ */
//% weight=2 color=30 //% weight=2 color=#002050
namespace serial { namespace serial {
/** /**
* Prints a line of text to the serial * Prints a line of text to the serial

View File

@ -4,7 +4,7 @@
/** /**
* Creation, manipulation and display of LED images. * Creation, manipulation and display of LED images.
*/ */
//% color=45 weight=31 //% color=#5C2D91 weight=31
declare namespace images { declare namespace images {
/** /**
@ -113,7 +113,7 @@ declare interface Image {
/** /**
* Provides access to basic micro:bit functionality. * Provides access to basic micro:bit functionality.
*/ */
//% color=190 weight=100 //% color=#0078D7 weight=100
declare namespace basic { declare namespace basic {
/** /**

View File

@ -1,6 +1,6 @@
{ {
"name": "pxt-microbit", "name": "pxt-microbit",
"version": "0.2.123", "version": "0.2.124",
"description": "BBC micro:bit target for PXT", "description": "BBC micro:bit target for PXT",
"keywords": [ "keywords": [
"JavaScript", "JavaScript",
@ -29,6 +29,6 @@
"typescript": "^1.8.7" "typescript": "^1.8.7"
}, },
"dependencies": { "dependencies": {
"pxt-core": "0.2.129" "pxt-core": "0.2.130"
} }
} }

View File

@ -72,7 +72,7 @@
"log": true "log": true
}, },
"appTheme": { "appTheme": {
"accentColor": "#5C2D91", "accentColor": "#5C005C",
"logoUrl": "https://m.pxt.io/about", "logoUrl": "https://m.pxt.io/about",
"logo": "./static/microbit.simplified.svg", "logo": "./static/microbit.simplified.svg",
"docsLogo": "./static/microbit.simplified.svg", "docsLogo": "./static/microbit.simplified.svg",
@ -103,19 +103,6 @@
"path": "/device" "path": "/device"
} }
], ],
"sideDocMenu": [ "sideDoc": "getting-started"
{
"name": "Getting started",
"path": "/getting-started"
},
{
"name": "Lessons",
"path": "/lessons"
},
{
"name": "Reference",
"path": "/reference"
}
]
} }
} }