Colors: Introduce color type abstraction
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.
This commit is contained in:
parent
f25a649144
commit
a0bdfce61a
3 changed files with 47 additions and 9 deletions
7
World.h
7
World.h
|
@ -10,6 +10,7 @@
|
|||
#include <SFML/Graphics.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include "Color.h"
|
||||
#include "Player.h"
|
||||
|
||||
enum class BlockType {
|
||||
|
@ -24,8 +25,8 @@ public:
|
|||
Player player;
|
||||
|
||||
World(int w, int h,
|
||||
sf::Color groundColor = sf::Color{67, 137, 39},
|
||||
sf::Color ceilingColor = sf::Color{39, 69, 137},
|
||||
sf::Color groundColor = Colors::Ground,
|
||||
sf::Color ceilingColor = Colors::Ceiling,
|
||||
std::vector<BlockType> worldMap = {});
|
||||
int getW() const;
|
||||
int getH() const;
|
||||
|
@ -52,7 +53,7 @@ private:
|
|||
sf::Color ceilingColor;
|
||||
|
||||
void fillColumn(sf::RenderWindow&, unsigned int column, float scale,
|
||||
sf::Color fillColor = sf::Color(84,56,34)) const;
|
||||
sf::Color fillColor = Colors::Wall) const;
|
||||
/**
|
||||
* Cast a ray from a given position and return its distance to the origin.
|
||||
* @param originX Ray X origin, strictly positive
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue