Macro mold2d::block
[−]
[src]
macro_rules! block { ( actor_type: $actor_type:ident, actor_message: $actor_message:ident, blocks: { $( block { name: $name:ident, path: $path:expr, index: $index:expr, width: $width:expr, height: $height:expr, sprites_in_row: $sprites_in_row:expr, size: $size:expr, collision_filter: $filter:expr } )* } ) => { ... }; }
Macro for easily creating block classes
NOTE:
The Type enum must have a Block subtype like this:
enum Type { ...., Block, }
and the Message must have a None subtype like this:
enum Message { ...., None, }
Example:
block! { actor_type: ActorType, actor_message: ActorMessage, blocks: { block { name: GrassBlock, // the name of the block path: "assets/spritesheet.png", // the path of the spritesheet index: 20, // the sprite index inside the spritesheet width: 5, // width of block height: 5, // height of block sprites_in_row: 10, // number of blocks in the spritesheet in a row size: 20, // size of the rendered block } block { .... } } }