Dawn/src/dawn/world/tile.h

49 lines
1.3 KiB
C

// Copyright (c) 2021 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include <stdint.h>
#include <malloc.h>
#include "worldtypes.h"
#include "../../engine/display/tileset.h"
#include "../../engine/display/primitives/quad.h"
#include "../../engine/display/primitives/cube.h"
#define TILE_NULL 0
#define TILE_FLAG_DYNAMIC (tileflag_t)1
/**
* Creates a tilemap from a tileset.
*
* @param columns Count of columns in the tilemap.
* @param rows Count of rows in the tilemap.
* @returns The tilemap.
*/
tilemap_t * tileMapCreate(int32_t columns, int32_t rows);
/**
* Destroys a previously created tilemap.
*
* @param tilemap Tilemap to dispose.
*/
void tileMapDispose(tilemap_t *tilemap);
/**
* Rendedrs a given chunk tile.
*
* @param world The world that the chunk belongs to.
* @param chunk The chunk to render against.
* @param tile The tile to render.
* @param tileDef The tile's definition information.
* @param x The X Coordinate of the tile (chunk space).
* @param y The Y Coordinate of the tile (chunk space).
* @param z The Z Coordinate of the tile (chunk space).
*/
void tileRender(world_t *world, chunk_t *chunk,
tile_t *tile, tiledef_t *tileDef, int32_t x, int32_t y, int32_t z
);