Color is now in one nice location.
This commit is contained in:
parent
c8fa68815b
commit
b7002917c1
4 changed files with 21 additions and 34 deletions
28
render.cpp
28
render.cpp
|
@ -5,36 +5,16 @@
|
|||
#include <array>
|
||||
#include "map.hpp"
|
||||
#include <iostream>
|
||||
#include "color.hpp"
|
||||
|
||||
using namespace fmt;
|
||||
|
||||
std::array<sf::Color, 10> VALUES{
|
||||
sf::Color{1, 4, 2}, // black
|
||||
sf::Color{9, 29, 16}, // dark dark
|
||||
sf::Color{14, 50, 26}, // dark mid
|
||||
sf::Color{0, 109, 44}, // dark light
|
||||
sf::Color{63, 171, 92}, // mid
|
||||
sf::Color{161, 217, 155}, // light dark
|
||||
sf::Color{199, 233, 192}, // light mid
|
||||
sf::Color{229, 245, 224}, // light light
|
||||
sf::Color{255, 255, 255}, // white
|
||||
sf::Color::Transparent, // white
|
||||
};
|
||||
|
||||
sf::Color SFMLRender::color(int val) {
|
||||
return VALUES[size_t(val)];
|
||||
}
|
||||
|
||||
sf::Color SFMLRender::color(Value val) {
|
||||
return VALUES[size_t(val)];
|
||||
}
|
||||
|
||||
SFMLRender::SFMLRender() :
|
||||
$window(sf::VideoMode(VIDEO_X,VIDEO_Y), "Roguish"),
|
||||
$map_font_size(0),
|
||||
$line_spacing(0),
|
||||
$default_fg(color(Value::LIGHT_MID)),
|
||||
$default_bg(color(Value::BLACK)),
|
||||
$default_fg(color::LIGHT_MID),
|
||||
$default_bg(color::BLACK),
|
||||
$ansi($default_fg, $default_bg)
|
||||
{
|
||||
// force true color, but maybe I want to support different color sets
|
||||
|
@ -43,7 +23,7 @@ SFMLRender::SFMLRender() :
|
|||
$ui_text.setFont($font);
|
||||
$ui_text.setPosition(0,0);
|
||||
$ui_text.setCharacterSize(UI_FONT_SIZE);
|
||||
$ui_text.setFillColor(color(Value::LIGHT_MID));
|
||||
$ui_text.setFillColor(color::LIGHT_MID);
|
||||
sf::Glyph glyph = $font.getGlyph(UI_BASE_CHAR, UI_FONT_SIZE, false);
|
||||
$ui_bounds = glyph.bounds;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue