bevy_entitiles 0.3.0

A 2d tilemap library for bevy. With many useful algorithms/tools built in.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#define_import_path bevy_entitiles::hexagonal

#import bevy_entitiles::common::{VertexInput, tilemap}

fn get_mesh_origin(input: VertexInput) -> vec2<f32> {
    /*
     * ANOTHER MATHEMATICAL MAGIC!!!!!!!
     */
    let index = vec2<f32>(input.index.xy);

    return vec2<f32>(
        tilemap.slot_size.x * (index.x - 0.5 * index.y),
        (tilemap.slot_size.y + tilemap.hex_legs) / 2. * index.y,
    );
}