mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-17 04:34:44 -07:00
Asset Packs: Optimize icon loader (#164)
* Original pointer can be const * Back to const icons * Missed this one * Simpler string alloc * Single allocation and header struct for static icons * Shared allocation and meta struct for animated icons * Only try to load if dir exists * Restructure momentum lib * Use some internal headers * Swap icons at draw * Properly init and free, no more original in icon struct
This commit is contained in:
21
lib/momentum/asset_packs_i.h
Normal file
21
lib/momentum/asset_packs_i.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "asset_packs.h"
|
||||
|
||||
#include <m-list.h>
|
||||
|
||||
typedef struct {
|
||||
const Icon* original;
|
||||
const Icon* replaced;
|
||||
} IconSwap;
|
||||
|
||||
LIST_DEF(IconSwapList, IconSwap, M_POD_OPLIST)
|
||||
#define M_OPL_IconSwapList_t() LIST_OPLIST(IconSwapList)
|
||||
|
||||
typedef struct {
|
||||
IconSwapList_t icons;
|
||||
uint8_t* fonts[FontTotalNumber];
|
||||
CanvasFontParameters* font_params[FontTotalNumber];
|
||||
} AssetPacks;
|
||||
|
||||
extern AssetPacks* asset_packs;
|
||||
|
||||
const Icon* asset_packs_swap_icon(const Icon* requested);
|
||||
Reference in New Issue
Block a user