Skip to main content

pite_core/nodes/
node2d.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2//! Node2D: 2D transform (position, rotation).
3
4use crate::schema::{DefaultPropVal, NodeTypeSchema, PropHint, PropSchema};
5
6pub static SCHEMA: NodeTypeSchema = NodeTypeSchema {
7    type_name: "Node2D",
8    description: "2D game object with position and rotation.",
9    inherits: Some("Node"),
10    abstract_class: false,
11    props: PROPS,
12};
13
14pub static PROPS: &[PropSchema] = &[
15    PropSchema {
16        key: "position",
17        label: "Position",
18        doc: "Local position in world units, relative to the parent. Global position is this plus every ancestor's.",
19        default_value: DefaultPropVal::Vec2(0.0, 0.0),
20        hint: PropHint::Vec2 { speed: 1.0 },
21        read_only: false,
22    },
23    PropSchema {
24        key: "rotation",
25        label: "Rotation",
26        doc: "Rotation around the node's origin. Stored in radians; the inspector edits degrees.",
27        default_value: DefaultPropVal::Num(0.0),
28        hint: PropHint::AngleDeg,
29        read_only: false,
30    },
31];