diff options
| author | Gubolin <gubolin@fantasymail.de> | 2014-11-01 14:40:34 +0100 |
|---|---|---|
| committer | Gubolin <gubolin@fantasymail.de> | 2014-11-01 14:40:34 +0100 |
| commit | 89b1bdb53ff49148f7757a932bfd393b9248fd2c (patch) | |
| tree | 4263a0e6ff5f7494eeebd587a83deb5ff8442d7b /objects.js | |
| parent | 228178f968a1f99f58a36fa2b6480fa0ec8228fc (diff) | |
| parent | d3be78cbedce2d9990c1efe6abf304dde69ba19a (diff) | |
| download | snap-89b1bdb53ff49148f7757a932bfd393b9248fd2c.tar.gz snap-89b1bdb53ff49148f7757a932bfd393b9248fd2c.zip | |
add camera blocks (#562)
Diffstat (limited to 'objects.js')
| -rw-r--r-- | objects.js | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -574,6 +574,16 @@ SpriteMorph.prototype.initBlocks = function () { category: 'pen', spec: 'stamp' }, + doStreamCamera: { + type: 'command', + category: 'pen', + spec: 'start streaming from the camera' + }, + doStopCamera: { + type: 'command', + category: 'pen', + spec: 'stop streaming from the camera' + }, // Control receiveGo: { @@ -780,6 +790,23 @@ SpriteMorph.prototype.initBlocks = function () { category: 'sensing', spec: 'color %clr is touching %clr ?' }, + reportCameraMotion: { + only: SpriteMorph, + type: 'predicate', + category: 'sensing', + spec: 'camera motion at my position?' + }, + reportCameraDirection: { + only: SpriteMorph, + type: 'reporter', + category: 'sensing', + spec: 'camera motion direction' + }, + reportStreamingCamera: { + type: 'predicate', + category: 'sensing', + spec: 'streaming from the camera?' + }, colorFiltered: { dev: true, type: 'reporter', @@ -1930,6 +1957,10 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push(block('reportTouchingColor')); blocks.push(block('reportColorIsTouchingColor')); blocks.push('-'); + blocks.push(block('reportCameraMotion')); + blocks.push(block('reportCameraDirection')); + blocks.push(block('reportStreamingCamera')); + blocks.push('-'); blocks.push(block('doAsk')); blocks.push(watcherToggle('getLastAnswer')); blocks.push(block('getLastAnswer')); @@ -4350,6 +4381,9 @@ StageMorph.prototype.init = function (globals) { this.activeSounds = []; // do not persist this.acceleration = null; // do not persist this.compassHeading = null; // do not persist + this.streamingCamera = false; + this.lastCameraCanvas = null; + this.lastCameraMotion = new Point(0, 0); this.trailsCanvas = null; this.isThreadSafe = false; @@ -5005,6 +5039,9 @@ StageMorph.prototype.blockTemplates = function (category) { } else if (cat === 'pen') { blocks.push(block('clear')); + blocks.push('-'); + blocks.push(block('doStreamCamera')); + blocks.push(block('doStopCamera')); } else if (cat === 'control') { @@ -5061,6 +5098,8 @@ StageMorph.prototype.blockTemplates = function (category) { } else if (cat === 'sensing') { + blocks.push(block('reportStreamingCamera')); + blocks.push('-'); blocks.push(block('doAsk')); blocks.push(watcherToggle('getLastAnswer')); blocks.push(block('getLastAnswer')); |
