vec2<C extends Component> static method
A Vector2 property.
Implementation
static ComponentField<C> vec2<C extends Component>(
String name, {
required Vector2 Function() defaultValue,
Vector2 Function(C component)? get,
void Function(C component, Vector2 value)? set,
String? doc,
String? group,
List<PropertyConstraint<Object>> constraints = const [],
List<String> formerNames = const [],
bool transient = false,
}) => ComponentField(
ComponentPropertyDef(
name,
ComponentPropertyKind.vec2,
defaultValue: Vec2Value(defaultValue()),
doc: doc,
group: group,
constraints: constraints,
formerNames: formerNames,
transient: transient,
),
read: get == null ? null : (c, _) => Vec2Value(get(c).clone()),
write: set == null
? null
: (c, v, _) {
if (v is Vec2Value) set(c, v.value.clone());
},
);