Commit Graph

90 Commits

Author SHA1 Message Date
Mike Welsh 6a5c5ab1df chore: Add rustfmt.toml and rustfmt pass 2019-08-26 16:38:48 -07:00
Nathan Adams 06d9f39c0e More verbose avm1 value conversion errors 2019-08-26 14:45:35 -05:00
Mike Welsh d9f70ddde8 core: GC trace through DisplayObject base 2019-08-22 23:28:51 -07:00
Mike Welsh 5998876271 core: Don't panic on missing characters in button 2019-08-22 21:54:00 -07:00
Mike Welsh 0214b3e447 core: Use matrix in DefineText (fix #34)
Text was not rendered in the correct position because it did not
use the matrix specified in the DefineText tag. I think this is an
extra Matrix used to adjust text alignment.

Fixes #34.
2019-08-22 18:40:47 -07:00
Mike Welsh 324a410cb1 render: Properly render premultiplied alpha bitmaps 2019-08-22 15:24:50 -07:00
Mike Welsh c1b8978555 core: Add max frames-per-tick as sanity
Avoid running too many frames at once.
2019-08-22 13:31:24 -07:00
Mike Welsh 8117b0cfdc avm1: Remove some debug spew 2019-08-22 10:24:38 -07:00
Mike Welsh 7b6a3d525a core: Single frame movieclips should stop 2019-08-22 09:54:40 -07:00
Mike Welsh a220a98c5b tests: Add looping clip test 2019-08-22 09:54:40 -07:00
Mike Welsh b0eff353a9 tests: Add initial SWF tests 2019-08-22 09:54:40 -07:00
Mike Welsh dd3748a520 core: GC collect_debt each frame 2019-08-19 22:34:49 -07:00
Mike Welsh 9cbeacd7b2 core: Transform mouse coordinates from viewport to stage 2019-08-19 22:27:38 -07:00
Mike Welsh 637588fae5 core: Store view matrix in player
Player is now in charge of scaling/cropping/translating the content
to fit the viewport size supplied by the frontend.

Added backend::render::Letterbox, which stores the margin sizes
for letter/pillarboxing.
2019-08-19 22:27:38 -07:00
Mike Welsh f3f4fa6179 web: Add mouse up/down/move handlers 2019-08-19 22:27:38 -07:00
Mike Welsh 8be9b9089b avm1: Stub out StartDrag/EndDrag 2019-08-19 22:27:38 -07:00
Mike Welsh ff74409d20 core: Tick audio backend each frame 2019-08-19 22:27:38 -07:00
Mike Welsh 7922aca921 core: Mouse pick in top-to-bottom order 2019-08-19 22:27:38 -07:00
Mike Welsh 59c9385cb7 core: Collect GC debt at the end of each frame 2019-08-19 22:27:38 -07:00
Mike Welsh 0143d9716e core: Button work 2019-08-19 22:27:38 -07:00
Mike Welsh 91a0272773 avm1: Log errors/unimplemented actions 2019-08-19 22:27:38 -07:00
Mike Welsh 9d962fd634 core: Improve button support 2019-08-19 22:27:38 -07:00
Mike Welsh d8ddf78bdc avm1: Implement _rotation and improve SetProperty
Implement _rotation and add SetProperty/GetProperty for these
values.
2019-08-19 22:27:38 -07:00
Mike Welsh 017cd563dc avm1: Implement ActionPush for constant pool vals 2019-08-19 22:27:38 -07:00
Mike Welsh e890ad33e6 avm1: Allow String for ActionGotoFrame2 2019-08-19 22:27:38 -07:00
Mike Welsh fe086c11ff core: Store clip frame labels
Bump swf-rs revision to allow for read_frame_label calls.
Also fix read_place_object to take an explicit length.
2019-08-19 22:27:38 -07:00
Mike Welsh 7e1b1e0357 avm1: Adjust for Twips in GetProperty/SetProperty 2019-08-19 22:27:38 -07:00
Mike Welsh 6c923930e6 avm1: Stub out ActionSetProperty
Rough impl of ActionSetProperty action. Not all properties
implemented. Add DisplayObject::matrix_mut.
2019-08-19 22:27:38 -07:00
Mike Welsh 0ab20e01c1 Add dyn 2019-08-19 22:27:38 -07:00
Mike Welsh 20ec170552 avm1: Implement GetVariable/SetVariable 2019-08-19 22:27:38 -07:00
Mike Welsh ecd9b18e90 core: Squelch warning in Button 2019-08-19 22:27:37 -07:00
Mike Welsh 1b86162bf1 avm1: Fix warning in SetTarget 2019-08-19 22:27:37 -07:00
Mike Welsh 49cc48d2d1 core: Run actions after a goto 2019-08-19 22:27:37 -07:00
Mike Welsh ce606cece8 core: Re-enable AVM1 2019-08-19 22:27:37 -07:00
Mike Welsh 5bba546a53 core: Add BoundingBox calculations
TODO: Add dirty flag and cache matrices.
2019-08-19 17:29:55 -07:00
Mike Welsh 2c4639eb6c core: Add BoundingBox and static data to Graphic
Add BoundingBox, which will store the AABB of dispaly objects.
Added static_data to Graphic, which is a reference to constant data
shared between each instance of a specific graphic. Currently
holds the render handle, bounding box, and character ID.
2019-08-19 17:29:55 -07:00
Mike Welsh 2c7e3c835f core: Add parent to DisplayObjectBase 2019-08-19 17:29:55 -07:00
Mike Welsh 39f1853440 core: Bump swf-rs revision to support ProductInfo
swf-rs now reads ProductInfo and DebugId SWF tags. These are not
documented by SWF19.

See: http://wahlers.com.br/claus/blog/undocumented-swf-tags-written-by-mxmlc/

Fixes #20.
2019-08-16 10:03:16 -07:00
Mike Welsh 4666d211a7 core: Add dyn to fix Rust 1.37 warnings
Omitting dyn on trait objects now emits a warning, so add missing
dyn where necessary.
2019-08-15 13:54:20 -07:00
Mike Welsh 4c6395bd83 core: Use latest git branch for jpeg-decoder
The current version of jpeg-decoder on crates.io (0.1.15) panics
when encountering a valid JPEG marker of length 2. Some SWF files
contained JPEGs with a COM segment of length 2. This is fixed
on the master branch of jpeg-decoder.
2019-08-14 23:19:10 -07:00
Mike Welsh 746b9d8518 core: Support for DefineBitsJPEG3/4
TODO: Pull out all JPEG decoding into core, remove jpeg-decoder
dependency from backend crates.
2019-08-12 16:44:49 -07:00
Mike Welsh a3998b657b core: Remove invalid JPEG data from DefineBitsJPEG
DefineBitsJPEG tags can have some extraneous bytes inside the
stream. Splice these out when decoding the JPEG.

TODO: Docs say this should only happen for SWF versions before 8?
2019-08-12 15:45:40 -07:00
Mike Welsh 23db688e6f core: Add DefineBitsLossless decoding function
Pulled out the code for decoding DefinieBitsLossless tags into
backend::render::define_bits_lossless_to_rgba. Switch to libflate
for zlib decoding.
2019-08-12 15:45:40 -07:00
Mike Welsh f3a746de21 core: Improve morph shape
Morph shapes where move_to was not in a matching pair would crash.
Now the previous pen position is used to generate the matching
move_to.

The ratio was backwards, causing the shape tween to run in
reverse. Morph shapes should now animate in the proper direction.
2019-08-11 23:58:06 -07:00
Mike Welsh af2287a658 desktop: Add letterbox to viewport
Add getters to Player to allow access to the type Renderer.
Letter/pillarboxes added as window resized.
2019-08-10 10:18:32 -07:00
Mike Welsh 24fc403e06 core: Make player generic over backend 2019-08-09 22:34:15 -07:00
Mike Welsh 2accd5bdd4 core: Remove audio struct 2019-08-09 16:03:13 -07:00
Mike Welsh 3edc3c3d3e web: Disable auto-play, add click-to-play 2019-08-09 14:50:20 -07:00
Mike Welsh e64e306137 Rework audio to allow for streaming decoding 2019-08-08 15:59:32 -07:00
Mike Welsh 725cdae6c5 Begin AVM1 cleanup 2019-08-08 15:58:45 -07:00