eco2d/code/foundation/src/world/blocks.h

36 lines
997 B
C
Raw Normal View History

2021-05-04 17:41:30 +00:00
#pragma once
#include "platform/system.h"
2022-09-29 18:11:47 +00:00
#include "models/assets.h"
2021-05-04 17:41:30 +00:00
typedef enum {
2021-07-27 16:34:31 +00:00
BLOCK_FLAG_COLLISION = (1 << 1),
BLOCK_FLAG_HAZARD = (1 << 2),
BLOCK_FLAG_ESSENTIAL = (1 << 3),
2022-09-14 13:12:12 +00:00
BLOCK_FLAG_DESTROY_ON_COLLISION = (1 << 4),
2022-09-29 18:49:00 +00:00
BLOCK_FLAG_ENTITY = (1 << 5),
2021-05-04 17:41:30 +00:00
} block_flags;
2021-11-03 18:09:19 +00:00
typedef uint16_t block_id;
2021-11-03 18:04:34 +00:00
int32_t blocks_setup(void);
void blocks_destroy(void);
2021-05-12 16:28:39 +00:00
2021-11-03 18:04:34 +00:00
block_id blocks_find(asset_id kind);
2022-09-29 17:28:56 +00:00
block_id blocks_find_by_symbol(char symbol);
2021-05-04 17:41:30 +00:00
2021-11-03 18:04:34 +00:00
asset_id blocks_get_asset(block_id id);
char blocks_get_symbol(block_id id);
uint32_t blocks_get_flags(block_id id);
float blocks_get_drag(block_id id);
float blocks_get_friction(block_id id);
float blocks_get_bounce(block_id id);
float blocks_get_velx(block_id id);
float blocks_get_vely(block_id id);
2021-05-12 16:28:39 +00:00
// NOTE(zaklaus): viewer-related functions
2021-11-03 18:04:34 +00:00
void *blocks_get_img(block_id id);
2021-07-18 18:30:27 +00:00
2021-11-03 18:04:34 +00:00
void blocks_build_chunk_tex(uint64_t id, block_id *blocks, void *view);
2021-07-18 18:30:27 +00:00
void *blocks_get_chunk_tex(uint64_t id);
2022-09-14 13:12:12 +00:00
void blocks_remove_chunk_tex(uint64_t id);