From 704002e671e002d48955bd03a05724032fba8987 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Sat, 5 Oct 2024 08:35:36 -0500 Subject: [PATCH] Moved TERM files around --- src/CMakeLists.txt | 2 - src/dawn/CMakeLists.txt | 1 + src/{dawnterm => dawn}/display/CMakeLists.txt | 1 + .../colorgl.c => dawn/display/color.c} | 2 +- src/dawn/display/color.h | 61 ++++++++++++++++- src/{dawnterm => dawn}/display/frame.c | 0 src/{dawnterm => dawn}/display/frame.h | 0 src/{dawnterm => dawn}/display/symbol.c | 0 src/{dawnterm => dawn}/display/symbol.h | 0 src/dawnopengl/display/CMakeLists.txt | 1 - src/dawnopengl/display/colorgl.h | 67 ------------------- src/dawnopengl/display/mesh.h | 2 +- src/dawnopengl/display/shader.h | 2 +- src/dawnterm/CMakeLists.txt | 23 ------- 14 files changed, 65 insertions(+), 97 deletions(-) rename src/{dawnterm => dawn}/display/CMakeLists.txt (94%) rename src/{dawnopengl/display/colorgl.c => dawn/display/color.c} (92%) rename src/{dawnterm => dawn}/display/frame.c (100%) rename src/{dawnterm => dawn}/display/frame.h (100%) rename src/{dawnterm => dawn}/display/symbol.c (100%) rename src/{dawnterm => dawn}/display/symbol.h (100%) delete mode 100644 src/dawnopengl/display/colorgl.h delete mode 100644 src/dawnterm/CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b1b92ae9..062794cb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,11 +12,9 @@ add_subdirectory(dawn) # Compile entries if(DAWN_TARGET STREQUAL "linux-x64-terminal") add_subdirectory(dawnlinux) - add_subdirectory(dawnterm) add_subdirectory(dawntermlinux) elseif(DAWN_TARGET STREQUAL "linux-x64-glfw") add_subdirectory(dawnlinux) - add_subdirectory(dawnterm) add_subdirectory(dawnglfw) add_subdirectory(dawnopengl) else() diff --git a/src/dawn/CMakeLists.txt b/src/dawn/CMakeLists.txt index c1acb380..1568a204 100644 --- a/src/dawn/CMakeLists.txt +++ b/src/dawn/CMakeLists.txt @@ -16,6 +16,7 @@ target_include_directories(${DAWN_TARGET_NAME} # Subdirs add_subdirectory(assert) +add_subdirectory(display) add_subdirectory(rpg) add_subdirectory(ui) diff --git a/src/dawnterm/display/CMakeLists.txt b/src/dawn/display/CMakeLists.txt similarity index 94% rename from src/dawnterm/display/CMakeLists.txt rename to src/dawn/display/CMakeLists.txt index fb39880e..bde9a8a0 100644 --- a/src/dawnterm/display/CMakeLists.txt +++ b/src/dawn/display/CMakeLists.txt @@ -8,6 +8,7 @@ # Sources target_sources(${DAWN_TARGET_NAME} PRIVATE + color.c frame.c symbol.c ) \ No newline at end of file diff --git a/src/dawnopengl/display/colorgl.c b/src/dawn/display/color.c similarity index 92% rename from src/dawnopengl/display/colorgl.c rename to src/dawn/display/color.c index 744064f8..8bf34415 100644 --- a/src/dawnopengl/display/colorgl.c +++ b/src/dawn/display/color.c @@ -5,7 +5,7 @@ * https://opensource.org/licenses/MIT */ -#include "colorgl.h" +#include "color.h" #include "assert/assert.h" void color4fCopy(const color4f_t src, color4f_t dest) { diff --git a/src/dawn/display/color.h b/src/dawn/display/color.h index 1cff50a2..aa18f9bc 100644 --- a/src/dawn/display/color.h +++ b/src/dawn/display/color.h @@ -8,6 +8,7 @@ #pragma once #include "dawn.h" +// Simple colors, used by the frame system. #define COLOR_BLACK 0x00 #define COLOR_WHITE 0x01 #define COLOR_RED 0x02 @@ -15,4 +16,62 @@ #define COLOR_BLUE 0x04 #define COLOR_YELLOW 0x05 #define COLOR_MAGENTA 0x06 -#define COLOR_CYAN 0x07 \ No newline at end of file +#define COLOR_CYAN 0x07 + +typedef float_t color3f_t[3]; +typedef float_t color4f_t[4]; + +typedef color4f_t color_t; + +#define COLOR3F(r,g,b) ((color3f_t){ r, g, b }) +#define COLOR3F_RED COLOR3F(1, 0, 0) +#define COLOR3F_GREEN COLOR3F(0, 1, 0) +#define COLOR3F_BLUE COLOR3F(0, 0, 1) +#define COLOR3F_BLACK COLOR3F(0, 0, 0) +#define COLOR3F_WHITE COLOR3F(1, 1, 1) +#define COLOR3F_MAGENTA COLOR3F(1, 0, 1) +#define COLOR3F_YELLOW COLOR3F(1, 1, 0) +#define COLOR3F_CYAN COLOR3F(0, 1, 1) +#define COLOR3F_GRAY COLOR3F(0.5f, 0.5f, 0.5f) +#define COLOR3F_DARKGRAY COLOR3F(0.25f, 0.25f, 0.25f) +#define COLOR3F_LIGHTGRAY COLOR3F(0.75f, 0.75f, 0.75f) +#define COLOR3F_ORANGE COLOR3F(1, 0.5f, 0) +#define COLOR3F_PURPLE COLOR3F(0.5f, 0, 1) +#define COLOR3F_PINK COLOR3F(1, 0, 0.5f) +#define COLOR3F_BROWN COLOR3F(0.5f, 0.25f, 0) +#define COLOR3F_GOLD COLOR3F(1, 0.75f, 0) +#define COLOR3F_SILVER COLOR3F(0.75f, 0.75f, 0.75f) +#define COLOR3F_BRONZE COLOR3F(0.75f, 0.5f, 0.25f) +#define COLOR3F_CORNFLOWERBLUE COLOR3F(0.4f, 0.6f, 0.9f) + +#define COLOR4F(r,g,b,a) ((color4f_t){ r, g, b, a }) +#define COLOR4F_RED COLOR4F(1, 0, 0, 1) +#define COLOR4F_GREEN COLOR4F(0, 1, 0, 1) +#define COLOR4F_BLUE COLOR4F(0, 0, 1, 1) +#define COLOR4F_BLACK COLOR4F(0, 0, 0, 1) +#define COLOR4F_WHITE COLOR4F(1, 1, 1, 1) +#define COLOR4F_MAGENTA COLOR4F(1, 0, 1, 1) +#define COLOR4F_YELLOW COLOR4F(1, 1, 0, 1) +#define COLOR4F_CYAN COLOR4F(0, 1, 1, 1) +#define COLOR4F_GRAY COLOR4F(0.5f, 0.5f, 0.5f, 1) +#define COLOR4F_DARKGRAY COLOR4F(0.25f, 0.25f, 0.25f, 1) +#define COLOR4F_LIGHTGRAY COLOR4F(0.75f, 0.75f, 0.75f, 1) +#define COLOR4F_ORANGE COLOR4F(1, 0.5f, 0, 1) +#define COLOR4F_PURPLE COLOR4F(0.5f, 0, 1, 1) +#define COLOR4F_PINK COLOR4F(1, 0, 0.5f, 1) +#define COLOR4F_BROWN COLOR4F(0.5f, 0.25f, 0, 1) +#define COLOR4F_GOLD COLOR4F(1, 0.75f, 0, 1) +#define COLOR4F_SILVER COLOR4F(0.75f, 0.75f, 0.75f, 1) +#define COLOR4F_BRONZE COLOR4F(0.75f, 0.5f, 0.25f, 1) +#define COLOR4F_CORNFLOWERBLUE COLOR4F(0.4f, 0.6f, 0.9f, 1) +#define COLOR4F_TRANSPARENT_BLACK COLOR4F(0, 0, 0, 0) +#define COLOR4F_TRANSPARENT_WHITE COLOR4F(1, 1, 1, 0) +#define COLOR4F_TRANSPARENT COLOR4F_TRANSPARENT_BLACK + +/** + * Copies a color. + * + * @param src Source color. + * @param dest Destination color. + */ +void color4fCopy(const color4f_t src, color4f_t dest); \ No newline at end of file diff --git a/src/dawnterm/display/frame.c b/src/dawn/display/frame.c similarity index 100% rename from src/dawnterm/display/frame.c rename to src/dawn/display/frame.c diff --git a/src/dawnterm/display/frame.h b/src/dawn/display/frame.h similarity index 100% rename from src/dawnterm/display/frame.h rename to src/dawn/display/frame.h diff --git a/src/dawnterm/display/symbol.c b/src/dawn/display/symbol.c similarity index 100% rename from src/dawnterm/display/symbol.c rename to src/dawn/display/symbol.c diff --git a/src/dawnterm/display/symbol.h b/src/dawn/display/symbol.h similarity index 100% rename from src/dawnterm/display/symbol.h rename to src/dawn/display/symbol.h diff --git a/src/dawnopengl/display/CMakeLists.txt b/src/dawnopengl/display/CMakeLists.txt index fac3b24b..2afbb0ab 100644 --- a/src/dawnopengl/display/CMakeLists.txt +++ b/src/dawnopengl/display/CMakeLists.txt @@ -17,5 +17,4 @@ target_sources(${DAWN_TARGET_NAME} font.c texture.c textureframebuffer.c - colorgl.c ) \ No newline at end of file diff --git a/src/dawnopengl/display/colorgl.h b/src/dawnopengl/display/colorgl.h deleted file mode 100644 index e8a2701d..00000000 --- a/src/dawnopengl/display/colorgl.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (c) 2024 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#pragma once -#include "dawn.h" - -typedef float_t color3f_t[3]; -typedef float_t color4f_t[4]; - -typedef color4f_t color_t; - -#define COLOR3F(r,g,b) ((color3f_t){ r, g, b }) -#define COLOR3F_RED COLOR3F(1, 0, 0) -#define COLOR3F_GREEN COLOR3F(0, 1, 0) -#define COLOR3F_BLUE COLOR3F(0, 0, 1) -#define COLOR3F_BLACK COLOR3F(0, 0, 0) -#define COLOR3F_WHITE COLOR3F(1, 1, 1) -#define COLOR3F_MAGENTA COLOR3F(1, 0, 1) -#define COLOR3F_YELLOW COLOR3F(1, 1, 0) -#define COLOR3F_CYAN COLOR3F(0, 1, 1) -#define COLOR3F_GRAY COLOR3F(0.5f, 0.5f, 0.5f) -#define COLOR3F_DARKGRAY COLOR3F(0.25f, 0.25f, 0.25f) -#define COLOR3F_LIGHTGRAY COLOR3F(0.75f, 0.75f, 0.75f) -#define COLOR3F_ORANGE COLOR3F(1, 0.5f, 0) -#define COLOR3F_PURPLE COLOR3F(0.5f, 0, 1) -#define COLOR3F_PINK COLOR3F(1, 0, 0.5f) -#define COLOR3F_BROWN COLOR3F(0.5f, 0.25f, 0) -#define COLOR3F_GOLD COLOR3F(1, 0.75f, 0) -#define COLOR3F_SILVER COLOR3F(0.75f, 0.75f, 0.75f) -#define COLOR3F_BRONZE COLOR3F(0.75f, 0.5f, 0.25f) -#define COLOR3F_CORNFLOWERBLUE COLOR3F(0.4f, 0.6f, 0.9f) - -#define COLOR4F(r,g,b,a) ((color4f_t){ r, g, b, a }) -#define COLOR4F_RED COLOR4F(1, 0, 0, 1) -#define COLOR4F_GREEN COLOR4F(0, 1, 0, 1) -#define COLOR4F_BLUE COLOR4F(0, 0, 1, 1) -#define COLOR4F_BLACK COLOR4F(0, 0, 0, 1) -#define COLOR4F_WHITE COLOR4F(1, 1, 1, 1) -#define COLOR4F_MAGENTA COLOR4F(1, 0, 1, 1) -#define COLOR4F_YELLOW COLOR4F(1, 1, 0, 1) -#define COLOR4F_CYAN COLOR4F(0, 1, 1, 1) -#define COLOR4F_GRAY COLOR4F(0.5f, 0.5f, 0.5f, 1) -#define COLOR4F_DARKGRAY COLOR4F(0.25f, 0.25f, 0.25f, 1) -#define COLOR4F_LIGHTGRAY COLOR4F(0.75f, 0.75f, 0.75f, 1) -#define COLOR4F_ORANGE COLOR4F(1, 0.5f, 0, 1) -#define COLOR4F_PURPLE COLOR4F(0.5f, 0, 1, 1) -#define COLOR4F_PINK COLOR4F(1, 0, 0.5f, 1) -#define COLOR4F_BROWN COLOR4F(0.5f, 0.25f, 0, 1) -#define COLOR4F_GOLD COLOR4F(1, 0.75f, 0, 1) -#define COLOR4F_SILVER COLOR4F(0.75f, 0.75f, 0.75f, 1) -#define COLOR4F_BRONZE COLOR4F(0.75f, 0.5f, 0.25f, 1) -#define COLOR4F_CORNFLOWERBLUE COLOR4F(0.4f, 0.6f, 0.9f, 1) -#define COLOR4F_TRANSPARENT_BLACK COLOR4F(0, 0, 0, 0) -#define COLOR4F_TRANSPARENT_WHITE COLOR4F(1, 1, 1, 0) -#define COLOR4F_TRANSPARENT COLOR4F_TRANSPARENT_BLACK - -/** - * Copies a color. - * - * @param src Source color. - * @param dest Destination color. - */ -void color4fCopy(const color4f_t src, color4f_t dest); \ No newline at end of file diff --git a/src/dawnopengl/display/mesh.h b/src/dawnopengl/display/mesh.h index 77c4716a..adc192dc 100644 --- a/src/dawnopengl/display/mesh.h +++ b/src/dawnopengl/display/mesh.h @@ -8,7 +8,7 @@ #pragma once #include "dawn.h" #include "dawnopengl.h" -#include "colorgl.h" +#include "display/color.h" extern int32_t MESH_ACTIVE_COUNT; diff --git a/src/dawnopengl/display/shader.h b/src/dawnopengl/display/shader.h index b1f8d4b0..bdec0eca 100644 --- a/src/dawnopengl/display/shader.h +++ b/src/dawnopengl/display/shader.h @@ -8,7 +8,7 @@ #pragma once #include "dawn.h" #include "dawnopengl.h" -#include "display/colorgl.h" +#include "display/color.h" #include "display/texture.h" typedef GLuint shaderparameter_t; diff --git a/src/dawnterm/CMakeLists.txt b/src/dawnterm/CMakeLists.txt deleted file mode 100644 index d330dbf6..00000000 --- a/src/dawnterm/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2024 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Libraries -target_link_libraries(${DAWN_TARGET_NAME} - PUBLIC -) - -# Includes -target_include_directories(${DAWN_TARGET_NAME} - PUBLIC - ${CMAKE_CURRENT_LIST_DIR} -) - -# Subdirs -add_subdirectory(display) - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE -) \ No newline at end of file