Skip to content

Commit

Permalink
avm2: Convert flash.geom.Matrix to ActionScript
Browse files Browse the repository at this point in the history
I've kept the rust `flash.geom` module, even though it's now empty,
since we'll need to add things like `flash.geom.Transform` native
methods in the future.
  • Loading branch information
Aaron1011 committed Jun 24, 2022
1 parent 48e4d80 commit 53cdba9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 194 deletions.
1 change: 0 additions & 1 deletion core/src/avm2/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,6 @@ pub fn load_player_globals<'gc>(
)?;

// package `flash.geom`
class(activation, flash::geom::matrix::create_class(mc), script)?;

// package `flash.media`
avm2_system_class!(
Expand Down
2 changes: 0 additions & 2 deletions core/src/avm2/globals/flash/geom.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
//! `flash.geom` namespace
pub mod matrix;
33 changes: 33 additions & 0 deletions core/src/avm2/globals/flash/geom/Matrix.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package flash.geom {
public class Matrix {
public var a:Number;
public var b:Number;
public var c:Number;
public var d:Number;
public var tx:Number;
public var ty:Number;

public function Matrix(a:Number = 1, b:Number = 0, c:Number = 0, d:Number = 1, tx:Number = 0, ty:Number = 0) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
this.tx = tx;
this.ty = ty;
}

public function identity():void {
this.a = 1;
this.b = 0;
this.c = 0;
this.d = 1;
this.tx = 0;
this.ty = 0;
}

public function scale(sx:Number, sy:Number):void {
this.a *= sx;
this.d *= sy;
}
}
}
191 changes: 0 additions & 191 deletions core/src/avm2/globals/flash/geom/matrix.rs

This file was deleted.

1 change: 1 addition & 0 deletions core/src/avm2/globals/globals.as
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ include "flash/display/SWFVersion.as"
include "flash/display/TriangleCulling.as"
include "flash/geom/ColorTransform.as"
include "flash/geom/Orientation3D.as"
include "flash/geom/Matrix.as"
include "flash/geom/Point.as"
include "flash/geom/Rectangle.as"
include "flash/net/SharedObjectFlushStatus.as"
Expand Down

0 comments on commit 53cdba9

Please sign in to comment.