56 lines
1.3 KiB
C
56 lines
1.3 KiB
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "error/error.h"
|
|
#include "display/texture/palette.h"
|
|
#include "display/texture/textureplatform.h"
|
|
|
|
#ifndef textureInitPlatform
|
|
#error "textureInitPlatform should not be defined."
|
|
#endif
|
|
#ifndef textureDisposePlatform
|
|
#error "textureDisposePlatform should not be defined."
|
|
#endif
|
|
|
|
typedef textureformatplatform_t textureformat_t;
|
|
typedef textureplatform_t texture_t;
|
|
|
|
typedef union texturedata_u {
|
|
struct {
|
|
uint8_t *indices;
|
|
palette_t *palette;
|
|
} paletted;
|
|
color_t *rgbaColors;
|
|
} texturedata_t;
|
|
|
|
extern texture_t TEXTURE_WHITE;
|
|
extern color_t TEXTURE_WHITE_PIXELS[4*4];
|
|
|
|
/**
|
|
* Initializes a texture.
|
|
*
|
|
* @param texture The texture to initialize.
|
|
* @param width The width of the texture.
|
|
* @param height The height of the texture.
|
|
* @param format The format of the texture (e.g., GL_RGBA, GL_ALPHA).
|
|
* @param data The data for the texture, the format changes per format.
|
|
*/
|
|
errorret_t textureInit(
|
|
texture_t *texture,
|
|
const int32_t width,
|
|
const int32_t height,
|
|
const textureformat_t format,
|
|
const texturedata_t data
|
|
);
|
|
|
|
/**
|
|
* Disposes a texture.
|
|
*
|
|
* @param texture The texture to dispose.
|
|
*/
|
|
errorret_t textureDispose(texture_t *texture); |