KTech 1.1.0
C++ 2D terminal game engine library
Loading...
Searching...
No Matches
cella.hpp
1/*
2 KTech, Kaup's C++ 2D terminal game engine library.
3 Copyright (C) 2023-2025 Ethan Kaufman (AKA Kaup)
4
5 This file is part of KTech.
6
7 KTech is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 any later version.
11
12 KTech is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with KTech. If not, see <https://www.gnu.org/licenses/>.
19*/
20
21#pragma once
22
23#define KTECH_DEFINITION
24#include "../ktech.hpp"
25#undef KTECH_DEFINITION
26#include "cell.hpp"
27#include "rgba.hpp"
28#include "../utility/rgbacolors.hpp"
29
32{
35 char c;
36
43 constexpr CellA(char character = ' ', RGBA foreground = RGBAColors::transparent, RGBA background = RGBAColors::transparent)
44 : c(character), f(foreground), b(background) {}
45
52 constexpr CellA(Cell cell, uint8_t foregroundAlpha, uint8_t backgroundAlpha)
53 : c(cell.c), f(cell.f, foregroundAlpha), b(cell.b, backgroundAlpha) {}
54
60 constexpr auto operator==(const CellA& cellA) const -> bool
61 {
62 return (c == cellA.c) && (f == cellA.f) && (b == cellA.b);
63 }
64};
Like Cell, but with RGBA foreground and background colors, instead of RGB.
Definition cella.hpp:32
constexpr CellA(Cell cell, uint8_t foregroundAlpha, uint8_t backgroundAlpha)
Construct a CellA from a Cell.
Definition cella.hpp:52
constexpr CellA(char character=' ', RGBA foreground=RGBAColors::transparent, RGBA background=RGBAColors::transparent)
Construct a CellA.
Definition cella.hpp:43
RGBA f
Foreground (character) color.
Definition cella.hpp:33
RGBA b
Background color.
Definition cella.hpp:34
constexpr auto operator==(const CellA &cellA) const -> bool
Compare 2 CellAs.
Definition cella.hpp:60
char c
ASCII character.
Definition cella.hpp:35
Terminal cell comprising RGB foreground (character) color, RGB background color, and an ASCII charact...
Definition cell.hpp:31
Like RGB, but also has an alpha channel representing transparency.
Definition rgba.hpp:30
uint8_t b
Blue primary color.
Definition rgb.hpp:32