avm1: Implement Key constants
This commit is contained in:
parent
8cb4278903
commit
cef7d3eba2
|
@ -1,6 +1,6 @@
|
||||||
use crate::avm1::property::Attribute;
|
use crate::avm1::property::Attribute;
|
||||||
use crate::avm1::return_value::ReturnValue;
|
use crate::avm1::return_value::ReturnValue;
|
||||||
use crate::avm1::{Avm1, Error, Object, ScriptObject, UpdateContext, Value};
|
use crate::avm1::{Avm1, Error, Object, ScriptObject, TObject, UpdateContext, Value};
|
||||||
|
|
||||||
use crate::events::KeyCode;
|
use crate::events::KeyCode;
|
||||||
use gc_arena::MutationContext;
|
use gc_arena::MutationContext;
|
||||||
|
@ -30,6 +30,121 @@ pub fn create_key_object<'gc>(
|
||||||
) -> Object<'gc> {
|
) -> Object<'gc> {
|
||||||
let mut key = ScriptObject::object(gc_context, proto);
|
let mut key = ScriptObject::object(gc_context, proto);
|
||||||
|
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"ALT",
|
||||||
|
18.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"BACKSPACE",
|
||||||
|
8.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"CAPSLOCK",
|
||||||
|
20.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"CONTROL",
|
||||||
|
17.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"DELETEKEY",
|
||||||
|
46.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"DOWN",
|
||||||
|
40.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"END",
|
||||||
|
35.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"ENTER",
|
||||||
|
13.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"ESCAPE",
|
||||||
|
27.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"HOME",
|
||||||
|
36.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"INSERT",
|
||||||
|
45.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"LEFT",
|
||||||
|
37.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"PGDN",
|
||||||
|
34.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"PGUP",
|
||||||
|
33.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"RIGHT",
|
||||||
|
39.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"SHIFT",
|
||||||
|
16.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"SPACE",
|
||||||
|
32.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"TAB",
|
||||||
|
9.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
key.define_value(
|
||||||
|
gc_context,
|
||||||
|
"UP",
|
||||||
|
38.into(),
|
||||||
|
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||||
|
);
|
||||||
|
|
||||||
key.force_set_function(
|
key.force_set_function(
|
||||||
"isDown",
|
"isDown",
|
||||||
is_down,
|
is_down,
|
||||||
|
|
Loading…
Reference in New Issue