|
|
@ -5,36 +5,16 @@ |
|
|
|
#include <array> |
|
|
|
#include <array> |
|
|
|
#include "map.hpp" |
|
|
|
#include "map.hpp" |
|
|
|
#include <iostream> |
|
|
|
#include <iostream> |
|
|
|
|
|
|
|
#include "color.hpp" |
|
|
|
|
|
|
|
|
|
|
|
using namespace fmt; |
|
|
|
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() : |
|
|
|
SFMLRender::SFMLRender() : |
|
|
|
$window(sf::VideoMode(VIDEO_X,VIDEO_Y), "Roguish"), |
|
|
|
$window(sf::VideoMode(VIDEO_X,VIDEO_Y), "Roguish"), |
|
|
|
$map_font_size(0), |
|
|
|
$map_font_size(0), |
|
|
|
$line_spacing(0), |
|
|
|
$line_spacing(0), |
|
|
|
$default_fg(color(Value::LIGHT_MID)), |
|
|
|
$default_fg(color::LIGHT_MID), |
|
|
|
$default_bg(color(Value::BLACK)), |
|
|
|
$default_bg(color::BLACK), |
|
|
|
$ansi($default_fg, $default_bg) |
|
|
|
$ansi($default_fg, $default_bg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// force true color, but maybe I want to support different color sets
|
|
|
|
// force true color, but maybe I want to support different color sets
|
|
|
@ -43,7 +23,7 @@ SFMLRender::SFMLRender() : |
|
|
|
$ui_text.setFont($font); |
|
|
|
$ui_text.setFont($font); |
|
|
|
$ui_text.setPosition(0,0); |
|
|
|
$ui_text.setPosition(0,0); |
|
|
|
$ui_text.setCharacterSize(UI_FONT_SIZE); |
|
|
|
$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); |
|
|
|
sf::Glyph glyph = $font.getGlyph(UI_BASE_CHAR, UI_FONT_SIZE, false); |
|
|
|
$ui_bounds = glyph.bounds; |
|
|
|
$ui_bounds = glyph.bounds; |
|
|
|
} |
|
|
|
} |
|
|
|