pub struct Grid { /* private fields */ }Expand description
A struct used to render a texture as a grid of sprites, where each sprite can be positioned, colored, and have its UV coordinates manipulated.
Implementations§
Source§impl Grid
impl Grid
Sourcepub fn get_grid_x(&self) -> i32
pub fn get_grid_x(&self) -> i32
Gets the number of columns in the grid. And there are gridX + 1 vertices horizontally for rendering.
Sourcepub fn get_grid_y(&self) -> i32
pub fn get_grid_y(&self) -> i32
Gets the number of rows in the grid. And there are gridY + 1 vertices vertically for rendering.
Sourcepub fn set_depth_write(&mut self, val: bool)
pub fn set_depth_write(&mut self, val: bool)
Sets whether depth writes are enabled.
Sourcepub fn is_depth_write(&self) -> bool
pub fn is_depth_write(&self) -> bool
Gets whether depth writes are enabled.
Sourcepub fn set_blend_func(&mut self, val: BlendFunc)
pub fn set_blend_func(&mut self, val: BlendFunc)
Sets the blend function for the grid.
Sourcepub fn get_blend_func(&self) -> BlendFunc
pub fn get_blend_func(&self) -> BlendFunc
Gets the blend function for the grid.
Sourcepub fn set_effect(&mut self, val: &SpriteEffect)
pub fn set_effect(&mut self, val: &SpriteEffect)
Sets the sprite effect applied to the grid.
Default is SpriteEffect::new("builtin:vs_sprite", "builtin:fs_sprite").
Sourcepub fn get_effect(&self) -> SpriteEffect
pub fn get_effect(&self) -> SpriteEffect
Gets the sprite effect applied to the grid.
Default is SpriteEffect::new("builtin:vs_sprite", "builtin:fs_sprite").
Sourcepub fn set_texture_rect(&mut self, val: &Rect)
pub fn set_texture_rect(&mut self, val: &Rect)
Sets the rectangle within the texture that is used for the grid.
Sourcepub fn get_texture_rect(&self) -> Rect
pub fn get_texture_rect(&self) -> Rect
Gets the rectangle within the texture that is used for the grid.
Sourcepub fn set_texture(&mut self, val: &Texture2D)
pub fn set_texture(&mut self, val: &Texture2D)
Sets the texture used for the grid.
Sourcepub fn get_texture(&self) -> Option<Texture2D>
pub fn get_texture(&self) -> Option<Texture2D>
Gets the texture used for the grid.
Sourcepub fn set_pos(&mut self, x: i32, y: i32, pos: &Vec2, z: f32)
pub fn set_pos(&mut self, x: i32, y: i32, pos: &Vec2, z: f32)
Sets the position of a vertex in the grid.
§Arguments
x- The x-coordinate of the vertex in the grid.y- The y-coordinate of the vertex in the grid.pos- The new position of the vertex, represented by a Vec2 object.z- The new z-coordinate of the vertex.
Sourcepub fn set_color(&mut self, x: i32, y: i32, color: &Color)
pub fn set_color(&mut self, x: i32, y: i32, color: &Color)
Sets the color of a vertex in the grid.
§Arguments
x- The x-coordinate of the vertex in the grid.y- The y-coordinate of the vertex in the grid.color- The new color of the vertex, represented by a Color object.
Sourcepub fn move_uv(&mut self, x: i32, y: i32, offset: &Vec2)
pub fn move_uv(&mut self, x: i32, y: i32, offset: &Vec2)
Moves the UV coordinates of a vertex in the grid.
§Arguments
x- The x-coordinate of the vertex in the grid.y- The y-coordinate of the vertex in the grid.offset- The offset by which to move the UV coordinates, represented by a Vec2 object.
Sourcepub fn with_texture_rect(
texture: &Texture2D,
texture_rect: &Rect,
grid_x: i32,
grid_y: i32,
) -> Grid
pub fn with_texture_rect( texture: &Texture2D, texture_rect: &Rect, grid_x: i32, grid_y: i32, ) -> Grid
Creates a new Grid with the specified texture, texture rectangle, and grid size.
§Arguments
texture- The texture to use for the grid.texture_rect- The rectangle within the texture to use for the grid.grid_x- The number of columns in the grid.grid_y- The number of rows in the grid.
§Returns
Grid- The new Grid instance.
Sourcepub fn with_file(clip_str: &str, grid_x: i32, grid_y: i32) -> Option<Grid>
pub fn with_file(clip_str: &str, grid_x: i32, grid_y: i32) -> Option<Grid>
Creates a new Grid with the specified clip string and grid size.
§Arguments
clip_str- The clip string to use for the grid. Can be “Image/file.png” and “Image/items.clip|itemA”.grid_x- The number of columns in the grid.grid_y- The number of rows in the grid.
§Returns
Grid- The new Grid instance.
Trait Implementations§
Source§impl INode for Grid
impl INode for Grid
Source§fn set_angle_x(&mut self, val: f32)
fn set_angle_x(&mut self, val: f32)
Source§fn get_angle_x(&self) -> f32
fn get_angle_x(&self) -> f32
Source§fn set_angle_y(&mut self, val: f32)
fn set_angle_y(&mut self, val: f32)
Source§fn get_angle_y(&self) -> f32
fn get_angle_y(&self) -> f32
Source§fn set_scale_x(&mut self, val: f32)
fn set_scale_x(&mut self, val: f32)
Source§fn get_scale_x(&self) -> f32
fn get_scale_x(&self) -> f32
Source§fn set_scale_y(&mut self, val: f32)
fn set_scale_y(&mut self, val: f32)
Source§fn get_scale_y(&self) -> f32
fn get_scale_y(&self) -> f32
Source§fn set_position(&mut self, val: &Vec2)
fn set_position(&mut self, val: &Vec2)
Source§fn get_position(&self) -> Vec2
fn get_position(&self) -> Vec2
Source§fn set_skew_x(&mut self, val: f32)
fn set_skew_x(&mut self, val: f32)
Source§fn get_skew_x(&self) -> f32
fn get_skew_x(&self) -> f32
Source§fn set_skew_y(&mut self, val: f32)
fn set_skew_y(&mut self, val: f32)
Source§fn get_skew_y(&self) -> f32
fn get_skew_y(&self) -> f32
Source§fn set_visible(&mut self, val: bool)
fn set_visible(&mut self, val: bool)
Source§fn is_visible(&self) -> bool
fn is_visible(&self) -> bool
Source§fn set_anchor(&mut self, val: &Vec2)
fn set_anchor(&mut self, val: &Vec2)
Source§fn get_anchor(&self) -> Vec2
fn get_anchor(&self) -> Vec2
Source§fn set_height(&mut self, val: f32)
fn set_height(&mut self, val: f32)
Source§fn get_height(&self) -> f32
fn get_height(&self) -> f32
Source§fn set_opacity(&mut self, val: f32)
fn set_opacity(&mut self, val: f32)
Source§fn get_opacity(&self) -> f32
fn get_opacity(&self) -> f32
Source§fn set_color3(&mut self, val: &Color3)
fn set_color3(&mut self, val: &Color3)
Source§fn get_color3(&self) -> Color3
fn get_color3(&self) -> Color3
Source§fn set_pass_opacity(&mut self, val: bool)
fn set_pass_opacity(&mut self, val: bool)
Source§fn is_pass_opacity(&self) -> bool
fn is_pass_opacity(&self) -> bool
Source§fn set_pass_color3(&mut self, val: bool)
fn set_pass_color3(&mut self, val: bool)
Source§fn is_pass_color3(&self) -> bool
fn is_pass_color3(&self) -> bool
Source§fn set_transform_target(&mut self, val: &dyn INode)
fn set_transform_target(&mut self, val: &dyn INode)
Source§fn get_transform_target(&self) -> Option<Node>
fn get_transform_target(&self) -> Option<Node>
Source§fn set_scheduler(&mut self, val: &Scheduler)
fn set_scheduler(&mut self, val: &Scheduler)
Source§fn get_scheduler(&self) -> Scheduler
fn get_scheduler(&self) -> Scheduler
Source§fn get_children(&self) -> Option<Array>
fn get_children(&self) -> Option<Array>
Source§fn get_parent(&self) -> Option<Node>
fn get_parent(&self) -> Option<Node>
Source§fn is_running(&self) -> bool
fn is_running(&self) -> bool
Source§fn is_scheduled(&self) -> bool
fn is_scheduled(&self) -> bool
Source§fn get_action_count(&self) -> i32
fn get_action_count(&self) -> i32
Source§fn get_data(&self) -> Dictionary
fn get_data(&self) -> Dictionary
Source§fn set_touch_enabled(&mut self, val: bool)
fn set_touch_enabled(&mut self, val: bool)
Source§fn is_touch_enabled(&self) -> bool
fn is_touch_enabled(&self) -> bool
Source§fn set_swallow_touches(&mut self, val: bool)
fn set_swallow_touches(&mut self, val: bool)
Source§fn is_swallow_touches(&self) -> bool
fn is_swallow_touches(&self) -> bool
Source§fn set_swallow_mouse_wheel(&mut self, val: bool)
fn set_swallow_mouse_wheel(&mut self, val: bool)
Source§fn is_swallow_mouse_wheel(&self) -> bool
fn is_swallow_mouse_wheel(&self) -> bool
Source§fn set_keyboard_enabled(&mut self, val: bool)
fn set_keyboard_enabled(&mut self, val: bool)
Source§fn is_keyboard_enabled(&self) -> bool
fn is_keyboard_enabled(&self) -> bool
Source§fn set_controller_enabled(&mut self, val: bool)
fn set_controller_enabled(&mut self, val: bool)
Source§fn is_controller_enabled(&self) -> bool
fn is_controller_enabled(&self) -> bool
Source§fn set_render_group(&mut self, val: bool)
fn set_render_group(&mut self, val: bool)
Source§fn is_render_group(&self) -> bool
fn is_render_group(&self) -> bool
Source§fn set_show_debug(&mut self, val: bool)
fn set_show_debug(&mut self, val: bool)
Source§fn is_show_debug(&self) -> bool
fn is_show_debug(&self) -> bool
Source§fn set_render_order(&mut self, val: i32)
fn set_render_order(&mut self, val: i32)
Source§fn get_render_order(&self) -> i32
fn get_render_order(&self) -> i32
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)
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)
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
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
Source§fn add_to(&mut self, parent: &dyn INode) -> Node
fn add_to(&mut self, parent: &dyn INode) -> Node
Source§fn remove_child(&mut self, child: &dyn INode, cleanup: bool)
fn remove_child(&mut self, child: &dyn INode, cleanup: bool)
Source§fn remove_child_by_tag(&mut self, tag: &str, cleanup: bool)
fn remove_child_by_tag(&mut self, tag: &str, cleanup: bool)
Source§fn remove_all_children(&mut self, cleanup: bool)
fn remove_all_children(&mut self, cleanup: bool)
Source§fn remove_from_parent(&mut self, cleanup: bool)
fn remove_from_parent(&mut self, cleanup: bool)
Source§fn move_to_parent(&mut self, parent: &dyn INode)
fn move_to_parent(&mut self, parent: &dyn INode)
Source§fn schedule(&mut self, update_func: Box<dyn FnMut(f64) -> bool>)
fn schedule(&mut self, update_func: Box<dyn FnMut(f64) -> bool>)
Source§fn unschedule(&mut self)
fn unschedule(&mut self)
Source§fn convert_to_node_space(&mut self, world_point: &Vec2) -> Vec2
fn convert_to_node_space(&mut self, world_point: &Vec2) -> Vec2
Source§fn convert_to_world_space(&mut self, node_point: &Vec2) -> Vec2
fn convert_to_world_space(&mut self, node_point: &Vec2) -> Vec2
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)>, )
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
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
TraverseEnabled flag are not visited. Read more