This repository was archived by the owner on Jan 14, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Preprocessing macros #20
Copy link
Copy link
Open
Description
First of all, I would like to thank you for this fantastic crate. I think the Cobweb format is really great, especially all the little features that make it so handy.
I would like to know if you had planned to make a preprocessing system with a macro system or a system to quickly define a large number of data?
Here's my use case. I have a large spritesheet and I defined the relation between the index of the atlas and the (composite) enum:
LightAtlas<ComplexLightIcon>{
off: 0
on_index:{
Full(Off): 0
Full(Green): 1
Full(Yellow): 2
Full(Red): 3
Id(Off): 4
....
Heart(Green): 29
Heart(Yellow): 30
Heart(Red): 31
}
}
It's particularly long and a macro or data definition system could be useful. This could look like this (here inspired by Python):
#defs
$atlas_map = \
$icon.value($color.value):$icon.idx*4 + $color.idx
for icon, color in combination(
[Full, Id, Sun, Key, Lever, Hashtag, Corner, Heart],
[Off, Green, Yellow, Red]
)
\
...
LightAtlas<ComplexLightIcon>{
off: 0
on_index:{$atlas_map}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels