use bevy_ecs::{component::Component, system::Resource}; use nalgebra::{Matrix4, Rotation3, Scale3, Translation3}; #[derive(Component)] pub struct Texture { pub name: String, } #[derive(Component, Debug)] pub struct Transform { pub translation: Translation3, pub rotation: Rotation3, pub scale: Scale3, } impl Transform { pub fn to_matrix(&self) -> Matrix4 { self.translation.to_homogeneous() * self.rotation.to_homogeneous() * self.scale.to_homogeneous() } } #[derive(Resource, Debug)] pub struct Camera { pub x: f32, pub y: f32, pub zoom: f32, pub width: u32, // screen width (these are for aspect ratio) pub height: u32, // screen height }