Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
player_style.hpp
Go to the documentation of this file.
1
3#pragma once
4
6#include <aegis2d/render/export.hpp>
7
8#include <array>
9#include <cstddef>
10#include <cstdint>
11#include <vector>
12
13namespace aegis2d::render {
14
16inline constexpr std::size_t max_players = 4;
17
19enum class MarkerShape : std::uint8_t {
21 Circle,
25 Square,
27 Diamond,
28};
29
38
46inline constexpr std::array<PlayerStyle, max_players> player_styles{{
47 {.color = rgb(0x0072B2), .marker = MarkerShape::Circle},
48 {.color = rgb(0xEE6677), .marker = MarkerShape::Triangle},
49 {.color = rgb(0xF0E442), .marker = MarkerShape::Square},
50 {.color = rgb(0x66CCEE), .marker = MarkerShape::Diamond},
51}};
52
57[[nodiscard]] AEGIS2D_RENDER_EXPORT PlayerStyle player_style(std::size_t player);
58
68[[nodiscard]] AEGIS2D_RENDER_EXPORT std::vector<std::uint8_t> marker_image(MarkerShape shape,
69 int size);
70
71} // namespace aegis2d::render
RGBA color used by the renderer.
OpenGL renderer: sprites, text and camera (client only).
Definition bitmap_font.hpp:16
constexpr std::array< PlayerStyle, max_players > player_styles
Style of each player, the first player first.
Definition player_style.hpp:46
PlayerStyle player_style(std::size_t player)
Style of one player.
constexpr std::size_t max_players
Number of players a game can tell apart with player_styles.
Definition player_style.hpp:16
constexpr Color rgb(std::uint32_t hex, float alpha=1.0F) noexcept
Color from its hexadecimal sRGB code, as design tools and palettes give it.
Definition color.hpp:25
MarkerShape
Shape drawn next to a player, so players are told apart without color.
Definition player_style.hpp:19
@ Triangle
Triangle pointing up.
@ Diamond
Square standing on a corner.
std::vector< std::uint8_t > marker_image(MarkerShape shape, int size)
Image of a marker, to load as a texture and draw tinted with the player's color.
RGBA color with components in [0, 1].
Definition color.hpp:10
How one player is drawn: the tint of their sprites (their character and shots), and their marker.
Definition player_style.hpp:32
Color color
Tint of the player's sprites.
Definition player_style.hpp:34
MarkerShape marker
Shape drawn next to the player.
Definition player_style.hpp:36