Bomberman Multiplayer
Authoritative multiplayer networking layer for Bomberman.
Loading...
Searching...
No Matches
PlayerColors.h
1#ifndef BOMBERMAN_UTIL_PLAYERCOLORS_H
2#define BOMBERMAN_UTIL_PLAYERCOLORS_H
3
4#include <array>
5#include <cstddef>
6#include <cstdint>
7
12{
14 {
15 uint8_t r = 0xFF;
16 uint8_t g = 0xFF;
17 uint8_t b = 0xFF;
18 };
19
20 constexpr std::array<PlayerColor, 8> kPlayerColors = {{
21 {0xFF, 0x22, 0x22},
22 {0x22, 0xFF, 0x22},
23 {0x22, 0x88, 0xFF},
24 {0xFF, 0xFF, 0x22},
25 {0xFF, 0x88, 0x22},
26 {0xD4, 0x4D, 0xFF},
27 {0x22, 0xFF, 0xD5},
28 {0xFF, 0x66, 0xB3},
29 }};
30
31 constexpr std::size_t kPlayerColorCount = kPlayerColors.size();
32
33 [[nodiscard]]
34 constexpr PlayerColor colorForPlayerId(const uint8_t playerId)
35 {
36 return kPlayerColors[static_cast<std::size_t>(playerId) % kPlayerColorCount];
37 }
38} // namespace bomberman::util
39
40#endif // BOMBERMAN_UTIL_PLAYERCOLORS_H
Small shared utility helpers that do not belong to the networking, simulation, or scene subsystems.
Definition PlayerColors.h:12
Definition PlayerColors.h:14