Byte Engine
  • welcome
  • Design
    • Rendering
      • material_assets
      • Render Models
        • Visibility
    • Resource Management
      • assets
  • Testing
  • References
    • Byte Engine Shader Language
    • JSON Shader Program Description
  • Sample Project
    • Creating Components
    • input
    • Project Setup
  • Setup
    • Environment Setup
    • installation
Powered by GitBook
On this page
  1. Sample Project

Creating Components


Weapon

We are going to create our weapon component.

#[derive(component_derive::Component)]
pub struct Weapon {
	pub resource_id: &'static str,
	#[field] pub transform: maths_rs::Mat4f,
}

impl Weapon {
	fn new(application: &mut Application) -> ComponentHandle<Self> {
		let mesh = Mesh::new(application, "weapon.obj");
		let weapon = Self {
			mesh,
		};
		application.add_component(weapon)
	}

	fn fire(&self) {
		// TODO: firing logic
	}
}
PreviousSample ProjectNextinput

Last updated 10 months ago