No need for asset batching on text.c
This commit is contained in:
@@ -10,37 +10,33 @@
|
||||
#include "util/memory.h"
|
||||
#include "display/spritebatch/spritebatch.h"
|
||||
#include "asset/asset.h"
|
||||
#include "asset/assetbatch.h"
|
||||
#include "asset/loader/display/assettextureloader.h"
|
||||
#include "asset/loader/display/assettilesetloader.h"
|
||||
#include "display/shader/shaderunlit.h"
|
||||
|
||||
font_t FONT_DEFAULT;
|
||||
assetbatch_t TEXT_BATCH;
|
||||
|
||||
errorret_t textInit(void) {
|
||||
assetBatchInit(&TEXT_BATCH, 2, (assetbatchdesc_t[]){
|
||||
{
|
||||
.path = "ui/minogram.png",
|
||||
.type = ASSET_LOADER_TYPE_TEXTURE,
|
||||
.input = { .texture = TEXTURE_FORMAT_RGBA }
|
||||
},
|
||||
{
|
||||
.path = "ui/minogram.dtf",
|
||||
.type = ASSET_LOADER_TYPE_TILESET
|
||||
},
|
||||
});
|
||||
errorChain(assetBatchRequireLoaded(&TEXT_BATCH));
|
||||
assetloaderinput_t input = { .texture = TEXTURE_FORMAT_RGBA };
|
||||
assetentry_t *entryTexture = assetLock(
|
||||
"ui/minogram.png", ASSET_LOADER_TYPE_TEXTURE, &input
|
||||
);
|
||||
assetentry_t *entryTileset = assetLock(
|
||||
"ui/minogram.dtf", ASSET_LOADER_TYPE_TILESET, NULL
|
||||
);
|
||||
errorChain(assetRequireLoaded(entryTexture));
|
||||
errorChain(assetRequireLoaded(entryTileset));
|
||||
|
||||
FONT_DEFAULT.texture = &TEXT_BATCH.entries[0]->data.texture;
|
||||
FONT_DEFAULT.tileset = &TEXT_BATCH.entries[1]->data.tileset;
|
||||
FONT_DEFAULT.texture = &entryTexture->data.texture;
|
||||
FONT_DEFAULT.tileset = &entryTileset->data.tileset;
|
||||
errorOk();
|
||||
}
|
||||
|
||||
errorret_t textDispose(void) {
|
||||
FONT_DEFAULT.texture = NULL;
|
||||
FONT_DEFAULT.tileset = NULL;
|
||||
assetBatchDispose(&TEXT_BATCH);
|
||||
assetUnlock("ui/minogram.png");
|
||||
assetUnlock("ui/minogram.dtf");
|
||||
errorOk();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user