Add asset, resource system, mesh formats, color, SDL3 display and example game

Asset directory with CMake add_asset (extension dispatched), plain file asset
access, resource/resource manager with async load thread and text loader,
URI utilities, mesh format helpers, generated color header, and example game
hooks wired through the engine.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
YourWishesandClaude Sonnet 5.5 committed 2026-11-07 20:12:40 -06:00
1 parent 65c4a9c051
commit cad41e456b
47 files changed
+2335 -7

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
# Copyright (c) 2026 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
add_subdirectory(run_python)
+70
View File
@@ -0,0 +1,70 @@
# Copyright (c) 2026 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
import argparse
import csv
import os
parser = argparse.ArgumentParser(description="Color CSV to .h defines")
parser.add_argument("--csv", required=True, help="Path to color CSV file")
parser.add_argument("--output", required=True, help="Path to output .h file")
args = parser.parse_args()
# Load colors
colors = {}
with open(args.csv, newline="", encoding="utf-8") as f:
reader = csv.DictReader(f)
if "name" not in reader.fieldnames:
raise ValueError("CSV must have a 'name' column")
for row in reader:
name = row["name"]
r, g, b = row["r"], row["g"], row["b"]
a = row["a"] if "a" in row and row["a"] != "" else "1.0"
for ch in (r, g, b, a):
if not (0.0 <= float(ch) <= 1.0):
raise ValueError(f"Color channel {ch!r} for '{name}' out of range [0.0, 1.0]")
colors[name] = (r, g, b, a)
# Build output
out = [
"#pragma once",
'#include "dusk.h"',
"",
"typedef float_t colorchannelf_t;",
"typedef uint8_t colorchannel8_t;",
"",
"typedef struct { colorchannelf_t r, g, b; } color3f_t;",
"typedef struct { colorchannelf_t r, g, b, a; } color4f_t;",
"typedef struct { colorchannel8_t r, g, b; } color3b_t;",
"typedef struct { colorchannel8_t r, g, b, a; } color4b_t;",
"typedef color4b_t color_t;",
"",
"#define color3f(r, g, b) ((color3f_t){ r, g, b })",
"#define color4f(r, g, b, a) ((color4f_t){ r, g, b, a })",
"#define color3b(r, g, b) ((color3b_t){ r, g, b })",
"#define color4b(r, g, b, a) ((color4b_t){ r, g, b, a })",
"#define color(r, g, b, a) color4b(r, g, b, a)",
"#define colorHex(hex) color4b(((hex >> 24) & 0xFF), ((hex >> 16) & 0xFF), ((hex >> 8) & 0xFF), (hex & 0xFF))",
"",
]
for name, (r, g, b, a) in colors.items():
r8, g8, b8, a8 = (int(float(ch) * 255) for ch in (r, g, b, a))
macro = "COLOR_" + name.upper()
camel = "".join(p[0].upper() + p[1:].lower() for p in name.split("_"))
out += [
f"// {name}",
f"#define {macro}_4B color4b({r8}, {g8}, {b8}, {a8})",
f"#define {macro}_3B color3b({r8}, {g8}, {b8})",
f"#define {macro}_3F color3f({float(r)}f, {float(g)}f, {float(b)}f)",
f"#define {macro}_4F color4f({float(r)}f, {float(g)}f, {float(b)}f, {float(a)}f)",
f"#define {macro} {macro}_4B",
"",
]
os.makedirs(os.path.dirname(args.output), exist_ok=True)
with open(args.output, "w", encoding="utf-8") as f:
f.write("\n".join(out))
+14
View File
@@ -0,0 +1,14 @@
# Copyright (c) 2026 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
function(dusk_run_python CMAKE_TARGET_NAME PYTHON_MODULE)
find_package(Python3 COMPONENTS Interpreter REQUIRED)
add_custom_target(${CMAKE_TARGET_NAME} ALL
WORKING_DIRECTORY ${DUSK_ROOT_DIR}
COMMAND
${Python3_EXECUTABLE} -m ${PYTHON_MODULE} ${ARGN}
)
endfunction()