mirror of
https://codeberg.org/icewind/vbsp.git
synced 2026-06-03 18:54:05 +02:00
derive macros for entity parsing
This commit is contained in:
parent
db9ca18975
commit
6ced393424
7 changed files with 384 additions and 158 deletions
27
derive/tests/expand.rs
Normal file
27
derive/tests/expand.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
use vbsp::RawEntity;
|
||||
use vbsp_derive::Entity;
|
||||
|
||||
#[derive(Entity)]
|
||||
pub struct SpotLight {
|
||||
pub angles: [f32; 3],
|
||||
#[entity(name = "render_color")]
|
||||
pub color: [u8; 3],
|
||||
pub cone: u8,
|
||||
#[entity(default)]
|
||||
pub optional: bool,
|
||||
}
|
||||
|
||||
#[derive(Entity)]
|
||||
pub struct Lifetime<'a> {
|
||||
pub model: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Entity)]
|
||||
pub enum Entity<'a> {
|
||||
// #[entity(name = "spot")]
|
||||
// SpotLight(SpotLight),
|
||||
#[entity(name = "bar")]
|
||||
Foo(Lifetime<'a>),
|
||||
#[entity(default)]
|
||||
Unknown(RawEntity<'a>),
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue