Palette assets improved.

This commit is contained in:
2025-09-01 20:07:12 -05:00
parent 4541d5219b
commit 3e61d6f84d
18 changed files with 161 additions and 120 deletions

View File

@@ -8,12 +8,12 @@ target_sources(${DUSK_TARGET_NAME}
PRIVATE
display.c
camera.c
palette.c
)
# Subdirectories
add_subdirectory(framebuffer)
add_subdirectory(mesh)
add_subdirectory(palette)
add_subdirectory(texture)
add_subdirectory(scene)
add_subdirectory(spritebatch)

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "palette.h"
#include "assert/assert.h"
palette_t PALETTE[PALETTE_COUNT_MAX];
uint8_t PALETTE_COUNT = 0;
void paletteAssetLoadCallback(void *data) {
assertNotNull(data, "Data cannot be NULL.");
uint8_t index = *((uint8_t*)data);
assertTrue(index < PALETTE_COUNT_MAX, "Palette index out of bounds.");
}

View File

@@ -1,26 +0,0 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "dusk.h"
typedef struct {
} palette_t;
#define PALETTE_COUNT_MAX 8
extern palette_t PALETTE[PALETTE_COUNT_MAX];
extern uint8_t PALETTE_COUNT;
/**
* Palette asset load callback.
*
* @param data The data passed to the callback, should be a uint8_t* index
* into the PALETTE array.
*/
void paletteAssetLoadCallback(void *data);

View File

@@ -0,0 +1,9 @@
# Copyright (c) 2025 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Sources
target_sources(${DUSK_TARGET_NAME}
PRIVATE
)

View File

@@ -0,0 +1,14 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "display/color.h"
typedef struct {
const uint8_t colorCount;
const color_t *colors;
} palette_t;