JustAnotherDnDGame 0.1.0
Jeu de rôle tactique au d20, vue de dessus, en C++/Qt
Loading...
Searching...
No Matches
AssetMarker.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Valentin Eloy
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#pragma once
5
11
12#include <cstdint>
13#include <string_view>
14#include <vector>
15
16namespace core {
17
20 std::uint8_t r = 0;
21 std::uint8_t g = 0;
22 std::uint8_t b = 0;
23 std::uint8_t a = 255;
24
25 [[nodiscard]] friend bool operator==(const MarkerColor&, const MarkerColor&) noexcept = default;
26};
27
32 int width = 0;
33 int height = 0;
35 std::vector<MarkerColor> pixels;
36
37 [[nodiscard]] bool isEmpty() const noexcept {
38 return width <= 0 || height <= 0 || pixels.empty();
39 }
40 [[nodiscard]] MarkerColor at(int x, int y) const {
41 return pixels[static_cast<std::size_t>((y * width) + x)];
42 }
43};
44
72[[nodiscard]] MarkerImage assetMarker(std::string_view key, int width, int height);
73
76[[nodiscard]] std::uint32_t stableAssetHash(std::string_view key);
77
78} // namespace core
Espace de noms du moteur et de la logique de jeu.
Definition Bootstrap.h:9
std::uint32_t stableAssetHash(std::string_view key)
Le hachage stable dont assetMarker tire sa teinte.
Definition AssetMarker.cpp:67
MarkerImage assetMarker(std::string_view key, int width, int height)
Peint le marqueur d'une clé d'asset.
Definition AssetMarker.cpp:76
Une couleur RVBA, sans dépendance au rendu — Core ne connaît ni Qt ni GPU (EX-ARCH-001).
Definition AssetMarker.h:19
std::uint8_t g
Definition AssetMarker.h:21
std::uint8_t b
Definition AssetMarker.h:22
friend bool operator==(const MarkerColor &, const MarkerColor &) noexcept=default
std::uint8_t a
Definition AssetMarker.h:23
std::uint8_t r
Definition AssetMarker.h:20
Les pixels d'un marqueur, en RVBA, ligne par ligne depuis le haut.
Definition AssetMarker.h:31
std::vector< MarkerColor > pixels
width * height pixels.
Definition AssetMarker.h:35
int height
Definition AssetMarker.h:33
int width
Definition AssetMarker.h:32
bool isEmpty() const noexcept
Definition AssetMarker.h:37
MarkerColor at(int x, int y) const
Definition AssetMarker.h:40