pub struct VideoNode { /* private fields */ }Implementations§
Source§impl VideoNode
impl VideoNode
Sourcepub fn new(filename: &str, looped: bool) -> Option<VideoNode>
pub fn new(filename: &str, looped: bool) -> Option<VideoNode>
Creates a new VideoNode object for playing a video.
§Arguments
filename- The path to the video file. It should be a valid video file path with.h264suffix. H.264 format requirements: - Video codec: H.264 / AVC only (no H.265/HEVC, VP9, AV1, etc.). - Bitstream format: Annex-B byte stream is required (NAL units separated by 0x000001 / 0x00000001 start codes). MP4/FLV-style AVCC (length-prefixed NAL units) is NOT supported unless converted to Annex-B beforehand. - Stream type: video-only elementary stream is recommended. Audio tracks (if any) are ignored. - Profile/level constraints (recommended for maximum compatibility and performance): * Baseline / Constrained Baseline profile is recommended. * Progressive frames only (no interlaced/field-coded content). * No B-frames is recommended (e.g., baseline) to avoid output reordering costs. - Color format: YUV 4:2:0 (8-bit) is recommended; other chroma formats may be unsupported. - Frame rate: Constant frame rate (CFR) is recommended. Variable frame rate streams may play with unstable timing. - Resolution/performance notes: * 4K and high-bitrate streams may be CPU intensive for software decoding. * For smooth playback on mid-range devices, 720p/1080p and moderate bitrates are recommended. - It is recommended to use theffmpegtool to convert the video file to H.264 format before using it.looped- (optional) Whether the video should loop. Default is false.
§Returns
VideoNode- The created VideoNode instance. Returnsnilif creation fails.
Trait Implementations§
Source§impl INode for VideoNode
impl INode for VideoNode
Source§fn set_angle_x(&mut self, val: f32)
fn set_angle_x(&mut self, val: f32)
Sets the X-axis rotation angle of the node in degrees.
Source§fn get_angle_x(&self) -> f32
fn get_angle_x(&self) -> f32
Gets the X-axis rotation angle of the node in degrees.
Source§fn set_angle_y(&mut self, val: f32)
fn set_angle_y(&mut self, val: f32)
Sets the Y-axis rotation angle of the node in degrees.
Source§fn get_angle_y(&self) -> f32
fn get_angle_y(&self) -> f32
Gets the Y-axis rotation angle of the node in degrees.
Source§fn set_scale_x(&mut self, val: f32)
fn set_scale_x(&mut self, val: f32)
Sets the X-axis scale factor of the node.
Source§fn get_scale_x(&self) -> f32
fn get_scale_x(&self) -> f32
Gets the X-axis scale factor of the node.
Source§fn set_scale_y(&mut self, val: f32)
fn set_scale_y(&mut self, val: f32)
Sets the Y-axis scale factor of the node.
Source§fn get_scale_y(&self) -> f32
fn get_scale_y(&self) -> f32
Gets the Y-axis scale factor of the node.
Source§fn set_position(&mut self, val: &Vec2)
fn set_position(&mut self, val: &Vec2)
Sets the position of the node as a Vec2 object.
Source§fn get_position(&self) -> Vec2
fn get_position(&self) -> Vec2
Gets the position of the node as a Vec2 object.
Source§fn set_skew_x(&mut self, val: f32)
fn set_skew_x(&mut self, val: f32)
Sets the X-axis skew angle of the node in degrees.
Source§fn get_skew_x(&self) -> f32
fn get_skew_x(&self) -> f32
Gets the X-axis skew angle of the node in degrees.
Source§fn set_skew_y(&mut self, val: f32)
fn set_skew_y(&mut self, val: f32)
Sets the Y-axis skew angle of the node in degrees.
Source§fn get_skew_y(&self) -> f32
fn get_skew_y(&self) -> f32
Gets the Y-axis skew angle of the node in degrees.
Source§fn set_visible(&mut self, val: bool)
fn set_visible(&mut self, val: bool)
Sets whether the node is visible.
Source§fn is_visible(&self) -> bool
fn is_visible(&self) -> bool
Gets whether the node is visible.
Source§fn set_anchor(&mut self, val: &Vec2)
fn set_anchor(&mut self, val: &Vec2)
Sets the anchor point of the node as a Vec2 object.
Source§fn get_anchor(&self) -> Vec2
fn get_anchor(&self) -> Vec2
Gets the anchor point of the node as a Vec2 object.
Source§fn set_height(&mut self, val: f32)
fn set_height(&mut self, val: f32)
Sets the height of the node.
Source§fn get_height(&self) -> f32
fn get_height(&self) -> f32
Gets the height of the node.
Source§fn set_opacity(&mut self, val: f32)
fn set_opacity(&mut self, val: f32)
Sets the opacity of the node, should be 0 to 1.0.
Source§fn get_opacity(&self) -> f32
fn get_opacity(&self) -> f32
Gets the opacity of the node, should be 0 to 1.0.
Source§fn set_color3(&mut self, val: &Color3)
fn set_color3(&mut self, val: &Color3)
Sets the color of the node as a Color3 object.
Source§fn get_color3(&self) -> Color3
fn get_color3(&self) -> Color3
Gets the color of the node as a Color3 object.
Source§fn set_pass_opacity(&mut self, val: bool)
fn set_pass_opacity(&mut self, val: bool)
Sets whether to pass the opacity value to child nodes.
Source§fn is_pass_opacity(&self) -> bool
fn is_pass_opacity(&self) -> bool
Gets whether to pass the opacity value to child nodes.
Source§fn set_pass_color3(&mut self, val: bool)
fn set_pass_color3(&mut self, val: bool)
Sets whether to pass the color value to child nodes.
Source§fn is_pass_color3(&self) -> bool
fn is_pass_color3(&self) -> bool
Gets whether to pass the color value to child nodes.
Source§fn set_transform_target(&mut self, val: &dyn INode)
fn set_transform_target(&mut self, val: &dyn INode)
Sets the target node acts as a parent node for transforming this node.
Source§fn get_transform_target(&self) -> Option<Node>
fn get_transform_target(&self) -> Option<Node>
Gets the target node acts as a parent node for transforming this node.
Source§fn set_scheduler(&mut self, val: &Scheduler)
fn set_scheduler(&mut self, val: &Scheduler)
Sets the scheduler used for scheduling update and action callbacks.
Source§fn get_scheduler(&self) -> Scheduler
fn get_scheduler(&self) -> Scheduler
Gets the scheduler used for scheduling update and action callbacks.
Source§fn get_children(&self) -> Option<Array>
fn get_children(&self) -> Option<Array>
Gets the children of the node as an Array object, could be None.
Source§fn get_parent(&self) -> Option<Node>
fn get_parent(&self) -> Option<Node>
Gets the parent of the node, could be None.
Source§fn is_running(&self) -> bool
fn is_running(&self) -> bool
Gets whether the node is currently running in a scene tree.
Source§fn is_scheduled(&self) -> bool
fn is_scheduled(&self) -> bool
Gets whether the node is currently scheduling a function for updates.
Source§fn get_action_count(&self) -> i32
fn get_action_count(&self) -> i32
Gets the number of actions currently running on the node.
Source§fn get_data(&self) -> Dictionary
fn get_data(&self) -> Dictionary
Gets additional data stored on the node as a Dictionary object.
Source§fn set_touch_enabled(&mut self, val: bool)
fn set_touch_enabled(&mut self, val: bool)
Sets whether touch events are enabled on the node.
Source§fn is_touch_enabled(&self) -> bool
fn is_touch_enabled(&self) -> bool
Gets whether touch events are enabled on the node.
Source§fn set_swallow_touches(&mut self, val: bool)
fn set_swallow_touches(&mut self, val: bool)
Sets whether the node should swallow touch events.
Source§fn is_swallow_touches(&self) -> bool
fn is_swallow_touches(&self) -> bool
Gets whether the node should swallow touch events.
Source§fn set_swallow_mouse_wheel(&mut self, val: bool)
fn set_swallow_mouse_wheel(&mut self, val: bool)
Sets whether the node should swallow mouse wheel events.
Source§fn is_swallow_mouse_wheel(&self) -> bool
fn is_swallow_mouse_wheel(&self) -> bool
Gets whether the node should swallow mouse wheel events.
Source§fn set_keyboard_enabled(&mut self, val: bool)
fn set_keyboard_enabled(&mut self, val: bool)
Sets whether keyboard events are enabled on the node.
Source§fn is_keyboard_enabled(&self) -> bool
fn is_keyboard_enabled(&self) -> bool
Gets whether keyboard events are enabled on the node.
Source§fn set_controller_enabled(&mut self, val: bool)
fn set_controller_enabled(&mut self, val: bool)
Sets whether controller events are enabled on the node.
Source§fn is_controller_enabled(&self) -> bool
fn is_controller_enabled(&self) -> bool
Gets whether controller events are enabled on the node.
Source§fn set_render_group(&mut self, val: bool)
fn set_render_group(&mut self, val: bool)
Sets whether to group the node’s rendering with all its recursive children.
Source§fn is_render_group(&self) -> bool
fn is_render_group(&self) -> bool
Gets whether to group the node’s rendering with all its recursive children.
Source§fn set_show_debug(&mut self, val: bool)
fn set_show_debug(&mut self, val: bool)
Sets whether debug graphic should be displayed for the node.
Source§fn is_show_debug(&self) -> bool
fn is_show_debug(&self) -> bool
Gets whether debug graphic should be displayed for the node.
Source§fn set_render_order(&mut self, val: i32)
fn set_render_order(&mut self, val: i32)
Sets the rendering order number for group rendering. Nodes with lower rendering orders are rendered earlier.
Source§fn get_render_order(&self) -> i32
fn get_render_order(&self) -> i32
Gets the rendering order number for group rendering. Nodes with lower rendering orders are rendered earlier.
Source§fn add_child_with_order_tag(&mut self, child: &dyn INode, order: i32, tag: &str)
fn add_child_with_order_tag(&mut self, child: &dyn INode, order: i32, tag: &str)
Adds a child node to the current node. Read more
Source§fn add_child_with_order(&mut self, child: &dyn INode, order: i32)
fn add_child_with_order(&mut self, child: &dyn INode, order: i32)
Adds a child node to the current node. Read more
Source§fn add_to_with_order_tag(
&mut self,
parent: &dyn INode,
order: i32,
tag: &str,
) -> Node
fn add_to_with_order_tag( &mut self, parent: &dyn INode, order: i32, tag: &str, ) -> Node
Adds the current node to a parent node. Read more
Source§fn add_to_with_order(&mut self, parent: &dyn INode, order: i32) -> Node
fn add_to_with_order(&mut self, parent: &dyn INode, order: i32) -> Node
Adds the current node to a parent node. Read more
Source§fn add_to(&mut self, parent: &dyn INode) -> Node
fn add_to(&mut self, parent: &dyn INode) -> Node
Adds the current node to a parent node. Read more
Source§fn remove_child(&mut self, child: &dyn INode, cleanup: bool)
fn remove_child(&mut self, child: &dyn INode, cleanup: bool)
Removes a child node from the current node. Read more
Source§fn remove_child_by_tag(&mut self, tag: &str, cleanup: bool)
fn remove_child_by_tag(&mut self, tag: &str, cleanup: bool)
Removes a child node from the current node by tag. Read more
Source§fn remove_all_children(&mut self, cleanup: bool)
fn remove_all_children(&mut self, cleanup: bool)
Removes all child nodes from the current node. Read more
Source§fn remove_from_parent(&mut self, cleanup: bool)
fn remove_from_parent(&mut self, cleanup: bool)
Removes the current node from its parent node. Read more
Source§fn move_to_parent(&mut self, parent: &dyn INode)
fn move_to_parent(&mut self, parent: &dyn INode)
Moves the current node to a new parent node without triggering node events. Read more
Source§fn schedule(&mut self, update_func: Box<dyn FnMut(f64) -> bool>)
fn schedule(&mut self, update_func: Box<dyn FnMut(f64) -> bool>)
Schedules a main function to run every frame. Call this function again to replace the previous scheduled main function or coroutine. Read more
Source§fn unschedule(&mut self)
fn unschedule(&mut self)
Unschedules the current node’s scheduled main function.
Source§fn convert_to_node_space(&mut self, world_point: &Vec2) -> Vec2
fn convert_to_node_space(&mut self, world_point: &Vec2) -> Vec2
Converts a point from world space to node space. Read more
Source§fn convert_to_world_space(&mut self, node_point: &Vec2) -> Vec2
fn convert_to_world_space(&mut self, node_point: &Vec2) -> Vec2
Converts a point from node space to world space. Read more
Source§fn convert_to_window_space(
&mut self,
node_point: &Vec2,
callback: Box<dyn FnMut(&Vec2)>,
)
fn convert_to_window_space( &mut self, node_point: &Vec2, callback: Box<dyn FnMut(&Vec2)>, )
Converts a point from node space to world space. Read more
Source§fn each_child(
&mut self,
visitor_func: Box<dyn FnMut(&dyn INode) -> bool>,
) -> bool
fn each_child( &mut self, visitor_func: Box<dyn FnMut(&dyn INode) -> bool>, ) -> bool
Calls the given function for each child node of this node. Read more
Source§fn traverse(&mut self, visitor_func: Box<dyn FnMut(&dyn INode) -> bool>) -> bool
fn traverse(&mut self, visitor_func: Box<dyn FnMut(&dyn INode) -> bool>) -> bool
Traverses the node hierarchy starting from this node and calls the given function for each visited node. The nodes without
TraverseEnabled flag are not visited. Read moreSource§fn traverse_all(
&mut self,
visitor_func: Box<dyn FnMut(&dyn INode) -> bool>,
) -> bool
fn traverse_all( &mut self, visitor_func: Box<dyn FnMut(&dyn INode) -> bool>, ) -> bool
Traverses the entire node hierarchy starting from this node and calls the given function for each visited node. Read more
Source§fn run_action_def(&mut self, def: ActionDef, looped: bool) -> f32
fn run_action_def(&mut self, def: ActionDef, looped: bool) -> f32
Runs an action defined by the given action definition on this node. Read more
Source§fn run_action(&mut self, action: &Action, looped: bool) -> f32
fn run_action(&mut self, action: &Action, looped: bool) -> f32
Runs an action on this node. Read more
Source§fn stop_all_actions(&mut self)
fn stop_all_actions(&mut self)
Stops all actions running on this node.
Source§fn perform_def(&mut self, action_def: ActionDef, looped: bool) -> f32
fn perform_def(&mut self, action_def: ActionDef, looped: bool) -> f32
Runs an action defined by the given action definition right after clearing all the previous running actions. Read more
Source§fn perform(&mut self, action: &Action, looped: bool) -> f32
fn perform(&mut self, action: &Action, looped: bool) -> f32
Runs an action on this node right after clearing all the previous running actions. Read more
Source§fn stop_action(&mut self, action: &Action)
fn stop_action(&mut self, action: &Action)
Stops the given action running on this node. Read more
Source§fn align_items_vertically(&mut self, padding: f32) -> Size
fn align_items_vertically(&mut self, padding: f32) -> Size
Vertically aligns all child nodes within the node using the given size and padding. Read more
Source§fn align_items_vertically_with_size(
&mut self,
size: &Size,
padding: f32,
) -> Size
fn align_items_vertically_with_size( &mut self, size: &Size, padding: f32, ) -> Size
Vertically aligns all child nodes within the node using the given size and padding. Read more
Source§fn align_items_horizontally(&mut self, padding: f32) -> Size
fn align_items_horizontally(&mut self, padding: f32) -> Size
Horizontally aligns all child nodes within the node using the given size and padding. Read more
Source§fn align_items_horizontally_with_size(
&mut self,
size: &Size,
padding: f32,
) -> Size
fn align_items_horizontally_with_size( &mut self, size: &Size, padding: f32, ) -> Size
Horizontally aligns all child nodes within the node using the given size and padding. Read more
Source§fn align_items(&mut self, padding: f32) -> Size
fn align_items(&mut self, padding: f32) -> Size
Aligns all child nodes within the node using the given size and padding. Read more
Source§fn align_items_with_size(&mut self, size: &Size, padding: f32) -> Size
fn align_items_with_size(&mut self, size: &Size, padding: f32) -> Size
Aligns all child nodes within the node using the given size and padding. Read more
Source§fn move_and_cull_items(&mut self, delta: &Vec2)
fn move_and_cull_items(&mut self, delta: &Vec2)
Moves and changes child nodes’ visibility based on their position in parent’s area. Read more
Source§fn attach_ime(&mut self)
fn attach_ime(&mut self)
Attaches the input method editor (IME) to the node.
Makes node recieving “AttachIME”, “DetachIME”, “TextInput”, “TextEditing” events.
Source§fn detach_ime(&mut self)
fn detach_ime(&mut self)
Detaches the input method editor (IME) from the node.
Source§fn grab_with_size(&mut self, grid_x: i32, grid_y: i32) -> Grabber
fn grab_with_size(&mut self, grid_x: i32, grid_y: i32) -> Grabber
Creates a texture grabber for the specified node with a specified grid size. Read more
Source§fn set_transform_target_null(&mut self)
fn set_transform_target_null(&mut self)
Removes the transform target for the specified node.
Source§fn slot(&mut self, event_name: &str, handler: Box<dyn FnMut(&mut CallStack)>)
fn slot(&mut self, event_name: &str, handler: Box<dyn FnMut(&mut CallStack)>)
Associates the given handler function with the node event. Read more
Source§fn gslot(&mut self, event_name: &str, handler: Box<dyn FnMut(&mut CallStack)>)
fn gslot(&mut self, event_name: &str, handler: Box<dyn FnMut(&mut CallStack)>)
Associates the given handler function with a global event. Read more
Source§fn emit(&mut self, name: &str, stack: &CallStack)
fn emit(&mut self, name: &str, stack: &CallStack)
Emits an event to a node, triggering the event handler associated with the event name. Read more
Source§fn on_update(&mut self, update_func: Box<dyn FnMut(f64) -> bool>)
fn on_update(&mut self, update_func: Box<dyn FnMut(f64) -> bool>)
Schedules a function to run every frame. Call this function again to schedule multiple functions. Read more
Source§fn on_render(&mut self, render_func: Box<dyn FnMut(f64) -> bool>)
fn on_render(&mut self, render_func: Box<dyn FnMut(f64) -> bool>)
Registers a callback for event triggered when the node is entering the rendering phase. The callback is called every frame, and ensures that its call order is consistent with the rendering order of the scene tree, such as rendering child nodes after their parent nodes. Recommended for calling vector drawing functions. Read more
Source§impl ISprite for VideoNode
impl ISprite for VideoNode
Source§fn set_depth_write(&mut self, val: bool)
fn set_depth_write(&mut self, val: bool)
Sets whether the depth buffer should be written to when rendering the sprite.
Source§fn is_depth_write(&self) -> bool
fn is_depth_write(&self) -> bool
Gets whether the depth buffer should be written to when rendering the sprite.
Source§fn set_alpha_ref(&mut self, val: f32)
fn set_alpha_ref(&mut self, val: f32)
Sets the alpha reference value for alpha testing. Pixels with alpha values less than or equal to this value will be discarded.
Only works with
sprite.effect = SpriteEffect::new("builtin:vs_sprite", "builtin:fs_spritealphatest");.Source§fn get_alpha_ref(&self) -> f32
fn get_alpha_ref(&self) -> f32
Gets the alpha reference value for alpha testing. Pixels with alpha values less than or equal to this value will be discarded.
Only works with
sprite.effect = SpriteEffect::new("builtin:vs_sprite", "builtin:fs_spritealphatest");.Source§fn set_texture_rect(&mut self, val: &Rect)
fn set_texture_rect(&mut self, val: &Rect)
Sets the texture rectangle for the sprite.
Source§fn get_texture_rect(&self) -> Rect
fn get_texture_rect(&self) -> Rect
Gets the texture rectangle for the sprite.
Source§fn get_texture(&self) -> Option<Texture2D>
fn get_texture(&self) -> Option<Texture2D>
Gets the texture for the sprite.
Source§fn set_blend_func(&mut self, val: BlendFunc)
fn set_blend_func(&mut self, val: BlendFunc)
Sets the blend function for the sprite.
Source§fn get_blend_func(&self) -> BlendFunc
fn get_blend_func(&self) -> BlendFunc
Gets the blend function for the sprite.
Source§fn set_effect(&mut self, val: &SpriteEffect)
fn set_effect(&mut self, val: &SpriteEffect)
Sets the sprite shader effect.
Source§fn get_effect(&self) -> SpriteEffect
fn get_effect(&self) -> SpriteEffect
Gets the sprite shader effect.
Source§fn set_uwrap(&mut self, val: TextureWrap)
fn set_uwrap(&mut self, val: TextureWrap)
Sets the texture wrapping mode for the U (horizontal) axis.
Source§fn get_uwrap(&self) -> TextureWrap
fn get_uwrap(&self) -> TextureWrap
Gets the texture wrapping mode for the U (horizontal) axis.
Source§fn set_vwrap(&mut self, val: TextureWrap)
fn set_vwrap(&mut self, val: TextureWrap)
Sets the texture wrapping mode for the V (vertical) axis.
Source§fn get_vwrap(&self) -> TextureWrap
fn get_vwrap(&self) -> TextureWrap
Gets the texture wrapping mode for the V (vertical) axis.
Source§fn set_filter(&mut self, val: TextureFilter)
fn set_filter(&mut self, val: TextureFilter)
Sets the texture filtering mode for the sprite.
Source§fn get_filter(&self) -> TextureFilter
fn get_filter(&self) -> TextureFilter
Gets the texture filtering mode for the sprite.
Source§fn set_effect_as_default(&mut self)
fn set_effect_as_default(&mut self)
Removes the sprite effect and sets the default effect.
Auto Trait Implementations§
impl Freeze for VideoNode
impl RefUnwindSafe for VideoNode
impl Send for VideoNode
impl Sync for VideoNode
impl Unpin for VideoNode
impl UnsafeUnpin for VideoNode
impl UnwindSafe for VideoNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more