Struct let_engine::Layer
source · pub struct Layer {
pub root: Arc<Mutex<Node<Box<dyn GameObject>>>>,
pub camera: Arc<Mutex<Option<Box<dyn CameraObject>>>>,
/* private fields */
}
Fields§
§root: Arc<Mutex<Node<Box<dyn GameObject>>>>
§camera: Arc<Mutex<Option<Box<dyn CameraObject>>>>
Implementations§
source§impl Layer
impl Layer
pub fn new(root: Arc<Mutex<Node<Box<dyn GameObject>>>>) -> Self
pub fn set_camera<T: CameraObject + 'static>(&self, camera: T)
sourcepub fn camera_position(&self) -> Vec2
pub fn camera_position(&self) -> Vec2
Be careful! Don’t use this when the camera is already locked. Read from the locked camera instead.
sourcepub fn camera_scaling(&self) -> CameraScaling
pub fn camera_scaling(&self) -> CameraScaling
Be careful! Don’t use this when the camera is already locked. Read from the locked camera instead.
sourcepub fn zoom(&self) -> f32
pub fn zoom(&self) -> f32
Be careful! Don’t use this when the camera is already locked. Read from the locked camera instead.
sourcepub fn side_to_world(&self, direction: [f32; 2], dimensions: (f32, f32)) -> Vec2
pub fn side_to_world(&self, direction: [f32; 2], dimensions: (f32, f32)) -> Vec2
Be careful! Don’t use this when the camera is locked.
pub fn contains_object(&self, object: &Box<dyn GameObject>) -> bool
pub fn update<T: GameObject + Clone + 'static>(&self, object: &T)
pub fn fetch(&self, id: usize) -> Object
pub fn add_object<T: GameObject + Clone + 'static>( &self, parent: Option<&Box<dyn GameObject>>, object: &mut T ) -> Result<(), NoParentError>
pub fn remove_object( &self, object: &Box<dyn GameObject> ) -> Result<(), NoObjectError>
pub fn move_to( &self, object: &Box<dyn GameObject>, index: usize ) -> Result<(), Box<dyn Error>>
pub fn move_down( &self, object: &Box<dyn GameObject> ) -> Result<(), Box<dyn Error>>
pub fn move_up( &self, object: &Box<dyn GameObject> ) -> Result<(), Box<dyn Error>>
pub fn move_to_bottom( &self, object: &Box<dyn GameObject> ) -> Result<(), NoObjectError>
pub fn move_to_top( &self, object: &Box<dyn GameObject> ) -> Result<(), NoObjectError>
pub fn children_count( &self, parent: &Box<dyn GameObject> ) -> Result<usize, NoObjectError>
Trait Implementations§
source§impl PartialEq for Layer
impl PartialEq for Layer
impl Eq for Layer
Auto Trait Implementations§
impl !RefUnwindSafe for Layer
impl Send for Layer
impl Sync for Layer
impl Unpin for Layer
impl !UnwindSafe for Layer
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.