Commit graph

3099 commits

Author SHA1 Message Date
Chris Willis-Ford
bdabe2efa3 Merge pull request #384 from cwillisf/pen
Implement pen blocks
2017-01-20 13:22:05 -08:00
Christopher Willis-Ford
f8088be127 Undo accidental harmless but unnecessary change 2017-01-20 11:37:54 -08:00
Christopher Willis-Ford
88cc50aa18 Code review: more docs, move constants, clone util
Changes include:
- Added missing JSDoc for items in `scratch3_pen.js` and `target.js`.
- Moved constants used by `Scratch3PenBlocks` into the class.
- Created a constant for minimum and maximum pen size.
- Added `util/clone.js` to host cloning functionality.
- Pen blocks now check for the renderer before trying to use it.
- The pen integration test covers all blocks, though `clear`, `stamp`,
  and `pen down` will skip some of their functionality when there is no
  renderer.
2017-01-20 11:26:18 -08:00
Christopher Willis-Ford
72f17d6dc4 Add pen integration test
See `pen.sb2` for details
2017-01-19 15:58:00 -08:00
Christopher Willis-Ford
d0845728ee Add unit tests for new color-related functionality
Also, fix a math error in `Color.rgbToHsv`.

Newly covered functions:
- `toRbgColorObject` from `util/cast.js`
- `hsvToRgb` from `util/colors.js`
- `rgbToHsv` from `util/colors.js`
- `mixRgb` from `util/colors.js`
2017-01-19 15:24:45 -08:00
Christopher Willis-Ford
a6190da774 Lint fixes and related cleanup 2017-01-19 12:50:46 -08:00
Christopher Willis-Ford
369c02b5d5 Implement pen blocks
These blocks implement pen features as found in Scratch 2.0

Supporting changes include:
- `Target` is now an event emitter
- `RenderedTarget` now emits an event when it moves
- `Target` can now store arbitrary "extra" data, called "custom state"
  in the code, using a `Target`'s `setCustomState` and `getCustomState`
  methods. This is used to store per-target pen state without requiring
  `Target` or `RenderedTarget` to know anything about the pen.
- `Cast` can now cast to an RGB color object.
- `Color` now has functions to convert between RGB and HSV, constants
  for for black & white, and a `mixRgb` function to lerp between two
  colors.
2017-01-19 11:51:22 -08:00
Andrew Sliwinski
d33af47a87 Merge pull request #381 from thisandagain/bugfix/oss
Improve Contribution Guidelines and Issue / PR Templates
2017-01-18 08:23:51 -05:00
Andrew Sliwinski
aa820b18d8 Improve contribution guidelines and issue/pr templates 2017-01-17 16:57:01 -05:00
Ray Schamp
c6c4c4c00c Merge pull request #379 from rschamp/bugfix/empty-rotation-center
Only update costume rotationCenter if it exists
2017-01-13 16:55:39 -05:00
Chris Willis-Ford
9b04392211 Move build outputs into a dist/ subdirectory (#375)
* Move Node output: /dist.js => /dist/node/scratch-vm.js
* Move web output: /vm{.js,.min.js} => /dist/web/scratch-vm{.js,.min.js}
* Update build output references in package.json and the playground's index.html
* Move the VirtualMachine class out of index.js into its own file, referenced by index.js. The VirtualMachine class is otherwise unchanged.
* Add .gitattributes rules for new file types which were added to this repository without specifying their text/binary attributes
* Turn on source maps in webpack and add corresponding .gitignore rule
2017-01-13 13:34:26 -08:00
Ray Schamp
a56346d0a9 Only update costume rotationCenter if it exists
This prevents sending `NaN`s to the renderer as the rotation center, which prevents the initial render of the costume/backdrop.

Towards LLK/scratch-gui#18
2017-01-13 13:05:06 -05:00
Ray Schamp
b2777aced1 Merge pull request #378 from rschamp/bugfix/svg-costume-add
Fix adding SVG costumes
2017-01-12 15:38:11 -05:00
Ray Schamp
4ba76bbdbd Fix adding SVG costumes
Previously it assumed every costume to have a `bitmapResolution` property which doesn't apply to vector costumes. This caused the renderer to not render added SVG costumes when they were added with setCostume.
2017-01-12 15:34:05 -05:00
Eric Rosenbaum
4022703537 move audio state vars into rendered target 2017-01-11 15:42:07 -05:00
Eric Rosenbaum
9cc1c316d6 wrapclamp drum and instrument to num available 2017-01-11 11:41:21 -05:00
Eric Rosenbaum
5110360e3e Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound 2017-01-11 11:24:18 -05:00
Eric Rosenbaum
f2ad364b90 vm converts one-indexing of drums and instruments to zero-indexing 2017-01-11 11:23:39 -05:00
Eric Rosenbaum
71339874de fix name of DRUM arg 2017-01-11 11:22:58 -05:00
Andrew Sliwinski
eef463b821 Merge pull request #369 from thisandagain/bugfix/coverage
Improve integration test coverage
2017-01-11 10:42:43 -05:00
Eric Rosenbaum
76a475c31c cast args to numbers 2017-01-10 18:00:33 -05:00
Eric Rosenbaum
3344c92f7e change ‘drumtype’ to ‘drum’ in specmap 2017-01-10 18:00:02 -05:00
Eric Rosenbaum
f034564603 Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound 2017-01-09 15:51:47 -05:00
Eric Rosenbaum
4d7ff97011 instrument number is zero-indexed inside audio engine 2017-01-09 15:48:31 -05:00
Eric Rosenbaum
ce8b069140 include volume reporter 2017-01-09 15:48:02 -05:00
Eric Rosenbaum
2d7cfd128a use a single global tempo owned by audioengine 2017-01-09 15:47:29 -05:00
Eric Rosenbaum
dc9126e067 Merge pull request #373 from ericrosenbaum/sound
Integrate audio engine
2017-01-06 16:28:09 -05:00
Eric Rosenbaum
bd8fdad1d4 add check for audioengine 2017-01-06 16:24:16 -05:00
Eric Rosenbaum
18c88c8ee0 fix stop for audio 2017-01-06 16:14:41 -05:00
Eric Rosenbaum
b88c6c96e2 initialize audio player once per sprite (not for clones) 2017-01-06 16:14:27 -05:00
Eric Rosenbaum
9980f4da3f lint 2017-01-06 16:13:43 -05:00
Eric Rosenbaum
e1b6479e67 fix name of scratch-audio dependency 2017-01-06 15:18:30 -05:00
Eric Rosenbaum
fec9e5b91a add audio to playground 2017-01-06 11:49:25 -05:00
Eric Rosenbaum
9350baef3b add current volume block 2017-01-06 10:31:11 -05:00
Eric Rosenbaum
dbe2cef93c move promise into audio engine
changes to play note, play drum and rest blocks so their promises to wait are returned by the audio engine
2017-01-06 10:31:01 -05:00
Eric Rosenbaum
4298f4865f remove outdated audio from playground 2017-01-06 10:27:59 -05:00
Andrew Sliwinski
6ee8959100 Improve integration test coverage 2017-01-05 16:58:31 -05:00
Eric Rosenbaum
c0d57b4b6b separate out main audioengine from audioplayer for each clone 2017-01-04 18:37:55 -05:00
Eric Rosenbaum
5a1386f727 remove redundant type check 2017-01-04 14:42:00 -05:00
Eric Rosenbaum
3bf9238e0c treat numeric input to sound name as 1-indexed 2017-01-04 14:41:14 -05:00
Eric Rosenbaum
7a49a3ae43 lint 2017-01-03 23:41:49 -05:00
Andrew Sliwinski
5daaaa4438 Merge pull request #362 from thisandagain/bugfix/coverage
Add integration test coverage
2017-01-03 09:38:14 -05:00
Andrew Sliwinski
bc60fa13ce Merge pull request #361 from thisandagain/bugfix/360
Fix hat blocks in horizontal grammar
2017-01-03 09:37:42 -05:00
Andrew Sliwinski
6d83931341 WIP clean-up 2016-12-30 10:19:58 -05:00
Andrew Sliwinski
f90827d5f1 Merge pull request #363 from geppy/remove-vestigial-instructions
Removed reference to `StartServerWindows.bat`
2016-12-27 21:25:10 -05:00
geppy
4eb7ed6809 Removed reference to StartServerWindows.bat 2016-12-26 23:03:55 -06:00
Andrew Sliwinski
04d9620631 Merge branch 'patch-24' of https://github.com/TheBrokenRail/scratch-vm into feature/194 2016-12-24 08:46:50 -05:00
Andrew Sliwinski
7d5820585b Resolve lint issues 2016-12-23 21:31:00 -05:00
Andrew Sliwinski
dfc6614a5b Build out integration test SB2 files 2016-12-23 21:08:13 -05:00
Andrew Sliwinski
b8af7c0723 Add minimal integration tests 2016-12-23 14:09:35 -05:00