Teo-CD
e234dda860
SFML and Dear ImGui have incompatible color types, abstract them through a new Color class which has conversions. Centralize color constants in a namespace as well.
37 lines
765 B
C++
37 lines
765 B
C++
//
|
|
// Created by trotfunky on 26/01/24.
|
|
//
|
|
|
|
#ifndef RAYCASTING_COLOR_H
|
|
#define RAYCASTING_COLOR_H
|
|
|
|
#include <SFML/Graphics.hpp>
|
|
#ifdef IMGUI
|
|
#include <imgui.h>
|
|
#endif
|
|
|
|
|
|
class Color {
|
|
public:
|
|
uint8_t r;
|
|
uint8_t g;
|
|
uint8_t b;
|
|
uint8_t alpha;
|
|
|
|
constexpr Color(uint8_t r, uint8_t g, uint8_t b, uint8_t alpha = 255) :
|
|
r(r), g(g), b(b), alpha(alpha) {};
|
|
|
|
operator sf::Color() const { return {r, g, b, alpha}; }
|
|
#ifdef IMGUI
|
|
operator ImColor() const { return {r, g, b, alpha}; }
|
|
#endif
|
|
};
|
|
|
|
namespace Colors {
|
|
static constexpr Color Ground{67, 137, 39};
|
|
static constexpr Color Ceiling{39, 69, 137};
|
|
static constexpr Color Wall{84, 56, 34};
|
|
static constexpr Color Door{186, 152, 107};
|
|
static constexpr Color Window{104, 123, 165};
|
|
}
|
|
#endif //RAYCASTING_COLOR_H
|