add tilemap/tilesheet
This commit is contained in:
parent
c18896def0
commit
ff698730f1
13 changed files with 841 additions and 28 deletions
35
src/pxl8_tilesheet.h
Normal file
35
src/pxl8_tilesheet.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include "pxl8_types.h"
|
||||
#include "pxl8_gfx.h"
|
||||
|
||||
typedef struct pxl8_tilesheet {
|
||||
u8* data;
|
||||
bool* tile_valid;
|
||||
u32 width;
|
||||
u32 height;
|
||||
u32 tile_size;
|
||||
u32 tiles_per_row;
|
||||
u32 total_tiles;
|
||||
pxl8_color_mode color_mode;
|
||||
} pxl8_tilesheet;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
pxl8_result pxl8_tilesheet_init(pxl8_tilesheet* tilesheet, u32 tile_size);
|
||||
pxl8_result pxl8_tilesheet_load(pxl8_tilesheet* tilesheet, const char* filepath, pxl8_gfx_ctx* gfx);
|
||||
void pxl8_tilesheet_free(pxl8_tilesheet* tilesheet);
|
||||
|
||||
void pxl8_tilesheet_render_tile(const pxl8_tilesheet* tilesheet, pxl8_gfx_ctx* gfx,
|
||||
u16 tile_id, i32 x, i32 y, u8 flags);
|
||||
|
||||
bool pxl8_tilesheet_is_tile_valid(const pxl8_tilesheet* tilesheet, u16 tile_id);
|
||||
|
||||
pxl8_tilesheet* pxl8_tilesheet_new(u32 tile_size);
|
||||
void pxl8_tilesheet_destroy(pxl8_tilesheet* tilesheet);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue