Director

Struct Director 

Source
pub struct Director {}
Expand description

A struct manages the game scene trees and provides access to root scene nodes for different game uses.

Implementations§

Source§

impl Director

Source

pub fn set_clear_color(val: &Color)

Sets the background color for the game world.

Source

pub fn get_clear_color() -> Color

Gets the background color for the game world.

Source

pub fn get_ui() -> Node

Gets the root node for 2D user interface elements like buttons and labels.

Source

pub fn get_ui_3d() -> Node

Gets the root node for 3D user interface elements with 3D projection effect.

Source

pub fn get_entry() -> Node

Gets the root node for the starting point of a game.

Source

pub fn get_post_node() -> Node

Gets the root node for post-rendering scene tree.

Source

pub fn get_current_camera() -> Camera

Gets the current active camera in Director’s camera stack.

Source

pub fn set_frustum_culling(val: bool)

Sets whether or not to enable frustum culling.

Source

pub fn is_frustum_culling() -> bool

Gets whether or not to enable frustum culling.

Source

pub fn schedule(update_func: Box<dyn FnMut(f64) -> bool>)

Schedule a function to be called every frame.

§Arguments
  • updateFunc - The function to call every frame.
Source

pub fn schedule_posted(update_func: Box<dyn FnMut(f64) -> bool>)

Schedule a function to be called every frame for processing post game logic.

§Arguments
  • func - The function to call every frame.
Source

pub fn push_camera(camera: &dyn ICamera)

Adds a new camera to Director’s camera stack and sets it to the current camera.

§Arguments
  • camera - The camera to add.
Source

pub fn pop_camera()

Removes the current camera from Director’s camera stack.

Source

pub fn remove_camera(camera: &dyn ICamera) -> bool

Removes a specified camera from Director’s camera stack.

§Arguments
  • camera - The camera to remove.
§Returns
  • bool - true if the camera was removed, false otherwise.
Source

pub fn clear_camera()

Removes all cameras from Director’s camera stack.

Source

pub fn cleanup()

Cleans up all resources managed by the Director, including scene trees and cameras.

Source§

impl Director

Source

pub fn get_scheduler() -> Scheduler

Gets the scheduler for the director. The scheduler is used for scheduling tasks to run for the main game logic.

§Returns
  • Scheduler - The scheduler for the director.
Source

pub fn get_post_scheduler() -> Scheduler

Gets the post scheduler for the director. The post scheduler is used for scheduling tasks that should run after the main scheduler has finished.

§Returns
  • Scheduler - The post scheduler for the director.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.