refactor: reorganize pxl8 into client/src/ module structure

- core/: main entry, types, logging, I/O, RNG
- asset/: ase loader, cart, save, embed
- gfx/: graphics, animation, atlas, fonts, tilemap, transitions
- sfx/: audio
- script/: lua/fennel runtime, REPL
- hal/: platform abstraction (SDL3)
- world/: BSP, world, procedural gen
- math/: math utilities
- game/: GUI, replay
- lua/: Lua API modules
This commit is contained in:
asrael 2026-01-12 21:46:31 -06:00
parent 272e0bc615
commit 49256db1bd
107 changed files with 6678 additions and 3715 deletions

View file

@ -0,0 +1,56 @@
#pragma once
#include "pxl8_gfx.h"
#include "pxl8_types.h"
typedef struct pxl8_anim_state_machine pxl8_anim_state_machine;
typedef struct pxl8_anim {
u32* frame_ids;
u16* frame_durations;
u16 frame_count;
u16 current_frame;
f32 time_accumulator;
bool loop;
bool playing;
bool reverse;
f32 speed;
pxl8_anim_state_machine* state_machine;
void (*on_complete)(void* userdata);
void (*on_frame_change)(u16 frame, void* userdata);
void* userdata;
} pxl8_anim;
#ifdef __cplusplus
extern "C" {
#endif
pxl8_anim* pxl8_anim_create(const u32* frame_ids, const u16* frame_durations, u16 frame_count);
pxl8_anim* pxl8_anim_create_from_ase(pxl8_gfx* gfx, const char* path);
void pxl8_anim_destroy(pxl8_anim* anim);
pxl8_result pxl8_anim_add_state(pxl8_anim* anim, const char* name, pxl8_anim* state_anim);
u16 pxl8_anim_get_current_frame(const pxl8_anim* anim);
u32 pxl8_anim_get_current_frame_id(const pxl8_anim* anim);
const char* pxl8_anim_get_state(const pxl8_anim* anim);
bool pxl8_anim_has_state_machine(const pxl8_anim* anim);
bool pxl8_anim_is_complete(const pxl8_anim* anim);
bool pxl8_anim_is_playing(const pxl8_anim* anim);
void pxl8_anim_pause(pxl8_anim* anim);
void pxl8_anim_play(pxl8_anim* anim);
void pxl8_anim_render_sprite(const pxl8_anim* anim, pxl8_gfx* gfx, i32 x, i32 y, i32 w, i32 h, bool flip_x, bool flip_y);
void pxl8_anim_reset(pxl8_anim* anim);
void pxl8_anim_set_frame(pxl8_anim* anim, u16 frame);
void pxl8_anim_set_loop(pxl8_anim* anim, bool loop);
void pxl8_anim_set_reverse(pxl8_anim* anim, bool reverse);
void pxl8_anim_set_speed(pxl8_anim* anim, f32 speed);
pxl8_result pxl8_anim_set_state(pxl8_anim* anim, const char* name);
void pxl8_anim_stop(pxl8_anim* anim);
void pxl8_anim_update(pxl8_anim* anim, f32 dt);
#ifdef __cplusplus
}
#endif