Commit graph

619 commits

Author SHA1 Message Date
griffpatch
76c9c993f2 Optimisation - Remove redunant lookups
It's surprising how much time it takes to do an object member lookup, so
reducing these is a great idea.
2017-01-28 16:33:20 +00:00
Andrew Sliwinski
824628220c Merge pull request #406 from griffpatch/bugfix/end-warp-bug
Runtime does not exit warp mode if at end of loop #398
2017-01-28 09:56:04 -05:00
griffpatch
c6a872ef4a Fix whitespace issues 2017-01-28 14:11:48 +00:00
griffpatch
5f100129b6 Fix for ending warp bug
When popping down the stack frame it is assumed that you keep using the
previous warp state rather than looking at the warp state of the level
you just popped out to. This causes the loss of screen updates if the
warping block was the last statement in a loop as the loop does not obey
it's 'non warp' status.
2017-01-28 14:03:29 +00:00
Andrew Sliwinski
de4035055b Merge pull request #403 from griffpatch/feature/Support-ARGB-for-pen
Fix for Support ARGB for pen #393
2017-01-27 17:07:43 -05:00
griffpatch
0dcaa46107 Fix lint issues
Had to update the test scripts to handle the alpha channel, also I note
that all the hex tests are using CSS notation, not scratch notation
(which is 0x not #)
2017-01-27 17:05:17 +00:00
Andrew Sliwinski
eb3b7bfd40 Merge pull request #401 from griffpatch/Effect-not-correctly-copied-to-clones
Effect not correctly copied to clones #337
2017-01-27 10:52:24 -05:00
Andrew Sliwinski
8989dd31ae Merge pull request #402 from griffpatch/adjust-block-coordinate-calculation
Importers: adjust block coordinate calculation so blocks overlap less. #326
2017-01-27 10:50:36 -05:00
griffpatch
b856041d9a Fix for Support ARGB for pen #393
Requires fix to scratch-render before this will work (see:
6f5acfee7b961d71237f1fd50bb3d5a5139c527e)
2017-01-27 13:45:16 +00:00
griffpatch
2ac4b73a1f Importers: adjust block coordinate calculation so blocks overlap less. #326
This change imports the scratch blocks much closer to the Scratch 2
spacing.
2017-01-27 13:39:21 +00:00
griffpatch
cf43efe3ee Effect not correctly copied to clones #337
Fixes Effect not correctly copied to clones #337
2017-01-27 13:11:17 +00:00
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
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
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
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
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
Andrew Sliwinski
4709cae4b7 Basic integration (end-to-end) testing for default project 2016-12-23 10:39:19 -05:00
Andrew Sliwinski
48721dd336 If not hat fields are not found, check inputs before continuing. Resolves GH-360 2016-12-23 09:38:18 -05:00