🦊 Easily attach bevy's Handles/Entities statically to types 🐑 Get them in any system, without using Resources. 🦄 See type_cell for any other use case!
[]
= "0.13"
use *;
I. There are 2 valid syntaxes:
🐰 {Type} [name1] [name2] [name3]
🦝 Type: [name1] [name2] [name3];
II. The syntax inside the []
will change the attached type:
🐈 Entity - Just choose a name: [camera]
🦥 Handle - Its type separated by a |
: [Image|cat]
🐹 Raw - Its type separated by a :
: [Image:cat]
🐒 If no type is set, the parent type is used: [|cat]
[:cat]
III. Setting the collection type is also done inside []
:
🦄 Single - Using the syntax as in II.
🐔 Vec - add a <>
after the name: [cameras<>]
🐲 HashMap - add a <KeyType>
after the name: [cameras<usize>]
// Macro Examples
bycell!
IV. Setting Values:
🐑 Use Type::set_..(value)
ONCE on (pre-)startup
🦌 The value can be anything implementing its type!
// Setter Examples
set_main;
set_shots;
set_models;
V. Getting Values: 🐏 Different getters are provided, depending on the collection type!
// Single Getter
main; // Cloned
main_ref; // Static Reference
// Vec Getters
shots; // Cloned
shots_ref; // Static Reference
shots_vec; // Static Reference to Vec
// HashMap Getters
models; // Cloned
models_ref; // Static Reference
models_map; // Static Reference to HashMap
VI. Mutability:
🐝 You can make any of those mutable by adding a mut
before the name
🦞 Only use this if you can avoid race conditions
🦧 One idea is to mutate something on state change!
// Macro Examples
bycell!