diff options
| author | DrNuget <drnuget@outlook.com> | 2026-01-07 04:58:54 +0200 |
|---|---|---|
| committer | DrNuget <drnuget@outlook.com> | 2026-01-07 04:58:54 +0200 |
| commit | 7f3aa1cff755d21d972457b05c140cf465b9fa19 (patch) | |
| tree | 748b74a65d71ead9d0d7ade533074c5a643076d7 /src/engine/M_block.c | |
| parent | 67592a66dd9bcc4d79d23624a9abfd8f2c6e92ff (diff) | |
| download | mnm-7f3aa1cff755d21d972457b05c140cf465b9fa19.tar.gz | |
some basic 3D rendering and the base for chunk generation etc.
Diffstat (limited to 'src/engine/M_block.c')
| -rw-r--r-- | src/engine/M_block.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/engine/M_block.c b/src/engine/M_block.c new file mode 100644 index 0000000..0f3fb27 --- /dev/null +++ b/src/engine/M_block.c @@ -0,0 +1,33 @@ +#include "M_block.h" + +void M_createBlock(M_Block *block, unsigned short type) +{ + block->type = type; +} + +unsigned short M_createBlockType(M_Object obj, M_BlockAtlas *atl) +{ + M_BlockType block_type; + block_type.obj = obj; + + if (atl->block_amount >= atl->size) { + atl->size += 10; + atl->blocks = realloc(atl->blocks, atl->size*sizeof(M_BlockType)); + } + atl->blocks[atl->block_amount++] = block_type; + return atl->block_amount; +} + +M_BlockAtlas M_createBlockAtlas() +{ + return (M_BlockAtlas){ + .blocks = malloc(10*sizeof(M_BlockType)), + .block_amount = 0, + .size = 10 + }; +} + +void M_killBlockAtlas(M_BlockAtlas *atl) +{ + free(atl->blocks); +} |
