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
12
World.cpp
12
World.cpp
|
@ -287,13 +287,13 @@ void World::step(const float& stepTime) {
|
|||
ImVec4 hoverColor;
|
||||
switch ((BlockType)blockToPlace) {
|
||||
case BlockType::WALL:
|
||||
hoverColor = (ImVec4)ImColor(84, 56, 34);
|
||||
hoverColor = (ImVec4)Colors::Wall;
|
||||
break;
|
||||
case BlockType::DOOR:
|
||||
hoverColor = (ImVec4)ImColor(186, 152, 107);
|
||||
hoverColor = (ImVec4)Colors::Door;
|
||||
break;
|
||||
case BlockType::WINDOW:
|
||||
hoverColor = (ImVec4)ImColor(104, 123, 165);
|
||||
hoverColor = (ImVec4)Colors::Window;
|
||||
break;
|
||||
default:
|
||||
/* Default header color, it seems ? */
|
||||
|
@ -305,13 +305,13 @@ void World::step(const float& stepTime) {
|
|||
ImVec4 blockColor;
|
||||
switch (currentBlock) {
|
||||
case BlockType::WALL:
|
||||
blockColor = (ImVec4)ImColor(84, 56, 34);
|
||||
blockColor = (ImVec4)Colors::Wall;
|
||||
break;
|
||||
case BlockType::DOOR:
|
||||
blockColor = (ImVec4)ImColor(186, 152, 107);
|
||||
blockColor = (ImVec4)Colors::Door;
|
||||
break;
|
||||
case BlockType::WINDOW:
|
||||
blockColor = (ImVec4)ImColor(104, 123, 165);
|
||||
blockColor = (ImVec4)Colors::Window;
|
||||
break;
|
||||
default:
|
||||
blockColor = (ImVec4)ImColor(188, 120, 32);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue