[][src]Struct gdnative::api::Node2D

pub struct Node2D { /* fields omitted */ }

core class Node2D inherits CanvasItem (unsafe).

Official documentation

See the documentation of this class in the Godot engine's official documentation.

Memory management

Non reference counted objects such as the ones of this type are usually owned by the engine.

Node2D is a reference-only type. Persistent references can only exist in the unsafe Ref<Node2D> form.

In the cases where Rust code owns an object of this type, for example if the object was just created on the Rust side and not passed to the engine yet, ownership should be either given to the engine or the object must be manually destroyed using Ptr::free, or Ptr::queue_free if it is a Node.

Class hierarchy

Node2D inherits methods from:

Safety

All types in the Godot API have "interior mutability" in Rust parlance. To enforce that the official thread-safety guidelines are followed, the typestate pattern is used in the Ref and TRef smart pointers, and the Instance API. The typestate Access in these types tracks whether the access is unique, shared, or exclusive to the current thread. For more information, see the type-level documentation on Ref.

Implementations

impl Node2D[src]

pub fn new() -> Ref<Node2D, Unique>[src]

Creates a new instance of this object.

Because this type is not reference counted, the lifetime of the returned object is not automatically managed.

Immediately after creation, the object is owned by the caller, and can be passed to the engine (in which case the engine will be responsible for destroying the object) or destroyed manually using Ptr::free, or preferably Ptr::queue_free if it is a Node.

pub fn apply_scale(&self, ratio: Vector2D<f32, UnknownUnit>)[src]

pub fn get_angle_to(&self, point: Vector2D<f32, UnknownUnit>) -> f64[src]

pub fn global_position(&self) -> Vector2D<f32, UnknownUnit>[src]

pub fn global_rotation(&self) -> f64[src]

pub fn global_rotation_degrees(&self) -> f64[src]

pub fn global_scale(&self) -> Vector2D<f32, UnknownUnit>[src]

pub fn position(&self) -> Vector2D<f32, UnknownUnit>[src]

pub fn get_relative_transform_to_parent(
    &self,
    parent: impl AsArg<Node>
) -> Transform2D<f32, UnknownUnit, UnknownUnit>
[src]

pub fn rotation(&self) -> f64[src]

pub fn rotation_degrees(&self) -> f64[src]

pub fn scale(&self) -> Vector2D<f32, UnknownUnit>[src]

pub fn z_index(&self) -> i64[src]

pub fn global_translate(&self, offset: Vector2D<f32, UnknownUnit>)[src]

pub fn is_z_relative(&self) -> bool[src]

pub fn look_at(&self, point: Vector2D<f32, UnknownUnit>)[src]

pub fn move_local_x(&self, delta: f64, scaled: bool)[src]

pub fn move_local_y(&self, delta: f64, scaled: bool)[src]

pub fn rotate(&self, radians: f64)[src]

pub fn set_global_position(&self, position: Vector2D<f32, UnknownUnit>)[src]

pub fn set_global_rotation(&self, radians: f64)[src]

pub fn set_global_rotation_degrees(&self, degrees: f64)[src]

pub fn set_global_scale(&self, scale: Vector2D<f32, UnknownUnit>)[src]

pub fn set_global_transform(
    &self,
    xform: Transform2D<f32, UnknownUnit, UnknownUnit>
)
[src]

pub fn set_position(&self, position: Vector2D<f32, UnknownUnit>)[src]

pub fn set_rotation(&self, radians: f64)[src]

pub fn set_rotation_degrees(&self, degrees: f64)[src]

pub fn set_scale(&self, scale: Vector2D<f32, UnknownUnit>)[src]

pub fn set_transform(&self, xform: Transform2D<f32, UnknownUnit, UnknownUnit>)[src]

pub fn set_z_as_relative(&self, enable: bool)[src]

pub fn set_z_index(&self, z_index: i64)[src]

pub fn to_global(
    &self,
    local_point: Vector2D<f32, UnknownUnit>
) -> Vector2D<f32, UnknownUnit>
[src]

pub fn to_local(
    &self,
    global_point: Vector2D<f32, UnknownUnit>
) -> Vector2D<f32, UnknownUnit>
[src]

pub fn translate(&self, offset: Vector2D<f32, UnknownUnit>)[src]

Methods from Deref<Target = CanvasItem>

pub fn draw_arc(
    &self,
    center: Vector2D<f32, UnknownUnit>,
    radius: f64,
    start_angle: f64,
    end_angle: f64,
    point_count: i64,
    color: Color,
    width: f64,
    antialiased: bool
)
[src]

pub fn draw_char(
    &self,
    font: impl AsArg<Font>,
    position: Vector2D<f32, UnknownUnit>,
    char: impl Into<GodotString>,
    next: impl Into<GodotString>,
    modulate: Color
) -> f64
[src]

pub fn draw_circle(
    &self,
    position: Vector2D<f32, UnknownUnit>,
    radius: f64,
    color: Color
)
[src]

pub fn draw_colored_polygon(
    &self,
    points: TypedArray<Vector2D<f32, UnknownUnit>>,
    color: Color,
    uvs: TypedArray<Vector2D<f32, UnknownUnit>>,
    texture: impl AsArg<Texture>,
    normal_map: impl AsArg<Texture>,
    antialiased: bool
)
[src]

pub fn draw_line(
    &self,
    from: Vector2D<f32, UnknownUnit>,
    to: Vector2D<f32, UnknownUnit>,
    color: Color,
    width: f64,
    antialiased: bool
)
[src]

pub fn draw_mesh(
    &self,
    mesh: impl AsArg<Mesh>,
    texture: impl AsArg<Texture>,
    normal_map: impl AsArg<Texture>,
    transform: Transform2D<f32, UnknownUnit, UnknownUnit>,
    modulate: Color
)
[src]

pub fn draw_multiline(
    &self,
    points: TypedArray<Vector2D<f32, UnknownUnit>>,
    color: Color,
    width: f64,
    antialiased: bool
)
[src]

pub fn draw_multiline_colors(
    &self,
    points: TypedArray<Vector2D<f32, UnknownUnit>>,
    colors: TypedArray<Color>,
    width: f64,
    antialiased: bool
)
[src]

pub fn draw_multimesh(
    &self,
    multimesh: impl AsArg<MultiMesh>,
    texture: impl AsArg<Texture>,
    normal_map: impl AsArg<Texture>
)
[src]

pub fn draw_polygon(
    &self,
    points: TypedArray<Vector2D<f32, UnknownUnit>>,
    colors: TypedArray<Color>,
    uvs: TypedArray<Vector2D<f32, UnknownUnit>>,
    texture: impl AsArg<Texture>,
    normal_map: impl AsArg<Texture>,
    antialiased: bool
)
[src]

pub fn draw_polyline(
    &self,
    points: TypedArray<Vector2D<f32, UnknownUnit>>,
    color: Color,
    width: f64,
    antialiased: bool
)
[src]

pub fn draw_polyline_colors(
    &self,
    points: TypedArray<Vector2D<f32, UnknownUnit>>,
    colors: TypedArray<Color>,
    width: f64,
    antialiased: bool
)
[src]

pub fn draw_primitive(
    &self,
    points: TypedArray<Vector2D<f32, UnknownUnit>>,
    colors: TypedArray<Color>,
    uvs: TypedArray<Vector2D<f32, UnknownUnit>>,
    texture: impl AsArg<Texture>,
    width: f64,
    normal_map: impl AsArg<Texture>
)
[src]

pub fn draw_rect(
    &self,
    rect: Rect<f32, UnknownUnit>,
    color: Color,
    filled: bool,
    width: f64,
    antialiased: bool
)
[src]

pub fn draw_set_transform(
    &self,
    position: Vector2D<f32, UnknownUnit>,
    rotation: f64,
    scale: Vector2D<f32, UnknownUnit>
)
[src]

pub fn draw_set_transform_matrix(
    &self,
    xform: Transform2D<f32, UnknownUnit, UnknownUnit>
)
[src]

pub fn draw_string(
    &self,
    font: impl AsArg<Font>,
    position: Vector2D<f32, UnknownUnit>,
    text: impl Into<GodotString>,
    modulate: Color,
    clip_w: i64
)
[src]

pub fn draw_style_box(
    &self,
    style_box: impl AsArg<StyleBox>,
    rect: Rect<f32, UnknownUnit>
)
[src]

pub fn draw_texture(
    &self,
    texture: impl AsArg<Texture>,
    position: Vector2D<f32, UnknownUnit>,
    modulate: Color,
    normal_map: impl AsArg<Texture>
)
[src]

pub fn draw_texture_rect(
    &self,
    texture: impl AsArg<Texture>,
    rect: Rect<f32, UnknownUnit>,
    tile: bool,
    modulate: Color,
    transpose: bool,
    normal_map: impl AsArg<Texture>
)
[src]

pub fn draw_texture_rect_region(
    &self,
    texture: impl AsArg<Texture>,
    rect: Rect<f32, UnknownUnit>,
    src_rect: Rect<f32, UnknownUnit>,
    modulate: Color,
    transpose: bool,
    normal_map: impl AsArg<Texture>,
    clip_uv: bool
)
[src]

pub fn force_update_transform(&self)[src]

pub fn get_canvas(&self) -> Rid[src]

pub fn get_canvas_item(&self) -> Rid[src]

pub fn get_canvas_transform(&self) -> Transform2D<f32, UnknownUnit, UnknownUnit>[src]

pub fn get_global_mouse_position(&self) -> Vector2D<f32, UnknownUnit>[src]

pub fn get_global_transform(&self) -> Transform2D<f32, UnknownUnit, UnknownUnit>[src]

pub fn get_global_transform_with_canvas(
    &self
) -> Transform2D<f32, UnknownUnit, UnknownUnit>
[src]

pub fn light_mask(&self) -> i64[src]

pub fn get_local_mouse_position(&self) -> Vector2D<f32, UnknownUnit>[src]

pub fn material(&self) -> Option<Ref<Material, Shared>>[src]

pub fn modulate(&self) -> Color[src]

pub fn self_modulate(&self) -> Color[src]

pub fn get_transform(&self) -> Transform2D<f32, UnknownUnit, UnknownUnit>[src]

pub fn use_parent_material(&self) -> bool[src]

pub fn get_viewport_rect(&self) -> Rect<f32, UnknownUnit>[src]

pub fn get_viewport_transform(
    &self
) -> Transform2D<f32, UnknownUnit, UnknownUnit>
[src]

pub fn get_world_2d(&self) -> Option<Ref<World2D, Shared>>[src]

pub fn hide(&self)[src]

pub fn is_draw_behind_parent_enabled(&self) -> bool[src]

pub fn is_local_transform_notification_enabled(&self) -> bool[src]

pub fn is_set_as_toplevel(&self) -> bool[src]

pub fn is_transform_notification_enabled(&self) -> bool[src]

pub fn is_visible(&self) -> bool[src]

pub fn is_visible_in_tree(&self) -> bool[src]

pub fn make_canvas_position_local(
    &self,
    screen_point: Vector2D<f32, UnknownUnit>
) -> Vector2D<f32, UnknownUnit>
[src]

pub fn make_input_local(
    &self,
    event: impl AsArg<InputEvent>
) -> Option<Ref<InputEvent, Shared>>
[src]

pub fn set_as_toplevel(&self, enable: bool)[src]

pub fn set_draw_behind_parent(&self, enable: bool)[src]

pub fn set_light_mask(&self, light_mask: i64)[src]

pub fn set_material(&self, material: impl AsArg<Material>)[src]

pub fn set_modulate(&self, modulate: Color)[src]

pub fn set_notify_local_transform(&self, enable: bool)[src]

pub fn set_notify_transform(&self, enable: bool)[src]

pub fn set_self_modulate(&self, self_modulate: Color)[src]

pub fn set_use_parent_material(&self, enable: bool)[src]

pub fn set_visible(&self, visible: bool)[src]

pub fn show(&self)[src]

pub fn update(&self)[src]

Trait Implementations

impl Debug for Node2D[src]

impl Deref for Node2D[src]

type Target = CanvasItem

The resulting type after dereferencing.

impl DerefMut for Node2D[src]

impl GodotObject for Node2D[src]

type RefKind = ManuallyManaged

The memory management kind of this type. This modifies the behavior of the Ref smart pointer. See its type-level documentation for more information. Read more

impl Instanciable for Node2D[src]

impl QueueFree for Node2D[src]

impl SubClass<CanvasItem> for Node2D[src]

impl SubClass<Node> for Node2D[src]

impl SubClass<Node2D> for DampedSpringJoint2D[src]

impl SubClass<Node2D> for TouchScreenButton[src]

impl SubClass<Node2D> for NavigationPolygonInstance[src]

impl SubClass<Node2D> for Line2D[src]

impl SubClass<Node2D> for PinJoint2D[src]

impl SubClass<Node2D> for Bone2D[src]

impl SubClass<Node2D> for CPUParticles2D[src]

impl SubClass<Node2D> for CollisionShape2D[src]

impl SubClass<Node2D> for AudioStreamPlayer2D[src]

impl SubClass<Node2D> for BackBufferCopy[src]

impl SubClass<Node2D> for RemoteTransform2D[src]

impl SubClass<Node2D> for ParallaxLayer[src]

impl SubClass<Node2D> for AnimatedSprite[src]

impl SubClass<Node2D> for Camera2D[src]

impl SubClass<Node2D> for Skeleton2D[src]

impl SubClass<Node2D> for TileMap[src]

impl SubClass<Node2D> for CollisionObject2D[src]

impl SubClass<Node2D> for Joint2D[src]

impl SubClass<Node2D> for PhysicsBody2D[src]

impl SubClass<Node2D> for GrooveJoint2D[src]

impl SubClass<Node2D> for Path2D[src]

impl SubClass<Node2D> for RayCast2D[src]

impl SubClass<Node2D> for CollisionPolygon2D[src]

impl SubClass<Node2D> for YSort[src]

impl SubClass<Node2D> for KinematicBody2D[src]

impl SubClass<Node2D> for Particles2D[src]

impl SubClass<Node2D> for Sprite[src]

impl SubClass<Node2D> for VisibilityNotifier2D[src]

impl SubClass<Node2D> for Light2D[src]

impl SubClass<Node2D> for LightOccluder2D[src]

impl SubClass<Node2D> for Navigation2D[src]

impl SubClass<Node2D> for CanvasModulate[src]

impl SubClass<Node2D> for Position2D[src]

impl SubClass<Node2D> for VisibilityEnabler2D[src]

impl SubClass<Node2D> for StaticBody2D[src]

impl SubClass<Node2D> for Polygon2D[src]

impl SubClass<Node2D> for RigidBody2D[src]

impl SubClass<Node2D> for PathFollow2D[src]

impl SubClass<Node2D> for MeshInstance2D[src]

impl SubClass<Node2D> for MultiMeshInstance2D[src]

impl SubClass<Node2D> for Area2D[src]

impl SubClass<Object> for Node2D[src]

Auto Trait Implementations

impl RefUnwindSafe for Node2D

impl !Send for Node2D

impl !Sync for Node2D

impl Unpin for Node2D

impl UnwindSafe for Node2D

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SubClass<T> for T where
    T: GodotObject
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.