50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "asset/asset.h"
|
|
#include "display/texture/texture.h"
|
|
|
|
typedef struct {
|
|
textureformat_t format;
|
|
} assettextureloaderparams_t;
|
|
|
|
/**
|
|
* STB image read callback for asset files.
|
|
*
|
|
* @param user User data passed to the callback, should be an assetfile_t*.
|
|
* @param data Buffer to read the file data into.
|
|
* @param size Size of the buffer to read into.
|
|
* @return Number of bytes read, or -1 on error.
|
|
*/
|
|
int assetTextureReader(void *user, char *data, int size);
|
|
|
|
void assetTextureSkipper(void *user, int n);
|
|
|
|
int assetTextureEOF(void *user);
|
|
|
|
/**
|
|
* Handler for texture assets.
|
|
*
|
|
* @param file Asset file to load the texture from.
|
|
* @return Any error that occurs during loading.
|
|
*/
|
|
errorret_t assetTextureLoader(assetfile_t *file);
|
|
|
|
/**
|
|
* Loads a texture from the specified path.
|
|
*
|
|
* @param path Path to the texture asset.
|
|
* @param out Output texture to load into.
|
|
* @param format Format of the texture to load.
|
|
* @return Any error that occurs during loading.
|
|
*/
|
|
errorret_t assetTextureLoad(
|
|
const char_t *path,
|
|
texture_t *out,
|
|
const textureformat_t format
|
|
); |