diff --git a/core/src/avm2/globals.rs b/core/src/avm2/globals.rs index 932a0bf89..80d13b9cd 100644 --- a/core/src/avm2/globals.rs +++ b/core/src/avm2/globals.rs @@ -682,6 +682,13 @@ pub fn load_player_globals<'gc>( domain, script, )?; + class( + activation, + flash::display::jointstyle::create_class(mc), + implicit_deriver, + domain, + script, + )?; // package `flash.geom` activation diff --git a/core/src/avm2/globals/flash/display.rs b/core/src/avm2/globals/flash/display.rs index 3b9f6454d..2d3ffea6a 100644 --- a/core/src/avm2/globals/flash/display.rs +++ b/core/src/avm2/globals/flash/display.rs @@ -5,6 +5,7 @@ pub mod displayobjectcontainer; pub mod framelabel; pub mod graphics; pub mod interactiveobject; +pub mod jointstyle; pub mod movieclip; pub mod scene; pub mod shape; diff --git a/core/src/avm2/globals/flash/display/jointstyle.rs b/core/src/avm2/globals/flash/display/jointstyle.rs new file mode 100644 index 000000000..4f02f1876 --- /dev/null +++ b/core/src/avm2/globals/flash/display/jointstyle.rs @@ -0,0 +1,66 @@ +//! `flash.display.JointStyle` builtin/prototype + +use crate::avm2::activation::Activation; +use crate::avm2::class::{Class, ClassAttributes}; +use crate::avm2::method::Method; +use crate::avm2::names::{Namespace, QName}; +use crate::avm2::object::Object; +use crate::avm2::traits::Trait; +use crate::avm2::value::Value; +use crate::avm2::Error; +use gc_arena::{GcCell, MutationContext}; + +/// Implements `flash.display.JointStyle`'s instance constructor. +pub fn instance_init<'gc>( + activation: &mut Activation<'_, 'gc, '_>, + this: Option>, + _args: &[Value<'gc>], +) -> Result, Error> { + if let Some(this) = this { + activation.super_init(this, &[])?; + } + + Ok(Value::Undefined) +} + +/// Implements `flash.display.JointStyle`'s class constructor. +pub fn class_init<'gc>( + _activation: &mut Activation<'_, 'gc, '_>, + _this: Option>, + _args: &[Value<'gc>], +) -> Result, Error> { + Ok(Value::Undefined) +} + +/// Construct `JointStyle`'s class. +pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>> { + let class = Class::new( + QName::new(Namespace::package("flash.display"), "JointStyle"), + Some(QName::new(Namespace::public(), "Object").into()), + Method::from_builtin(instance_init), + Method::from_builtin(class_init), + mc, + ); + + let mut write = class.write(mc); + + write.set_attributes(ClassAttributes::SEALED); + + write.define_class_trait(Trait::from_const( + QName::new(Namespace::public(), "BEVEL"), + QName::new(Namespace::public(), "String").into(), + Some("bevel".into()), + )); + write.define_class_trait(Trait::from_const( + QName::new(Namespace::public(), "MITER"), + QName::new(Namespace::public(), "String").into(), + Some("miter".into()), + )); + write.define_class_trait(Trait::from_const( + QName::new(Namespace::public(), "ROUND"), + QName::new(Namespace::public(), "String").into(), + Some("round".into()), + )); + + class +}