Minor fixes to make initializing the terminal more consistent and to remove a magic number for wall limits.
This commit is contained in:
parent
2d5490131d
commit
ae43dad499
12 changed files with 47 additions and 42 deletions
|
@ -10,12 +10,16 @@
|
|||
#include "ftxui/screen/color.hpp" // for Color, Color::Black, Color::Blue, Color::BlueLight, Color::Cyan, Color::CyanLight, Color::Default, Color::GrayDark, Color::GrayLight, Color::Green, Color::GreenLight, Color::Magenta, Color::MagentaLight, Color::Red, Color::RedLight, Color::White, Color::Yellow, Color::YellowLight, Color::Palette256, ftxui
|
||||
#include <ftxui/screen/color_info.hpp> // for ColorInfo
|
||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||
#include <ftxui/screen/terminal.hpp> // for ColorSupport, Color, Palette16, Palette256, TrueColor
|
||||
#include "render.hpp"
|
||||
|
||||
using namespace fmt;
|
||||
using namespace ftxui;
|
||||
|
||||
std::string generate_colors() {
|
||||
SFMLRender::init_terminal();
|
||||
|
||||
REQUIRE(ftxui::Terminal::ColorSupport() == ftxui::Terminal::Color::TrueColor);
|
||||
|
||||
const int max_value = 255;
|
||||
|
@ -30,8 +34,8 @@ std::string generate_colors() {
|
|||
for (int hue = 0; hue < max_value; hue += hue_increment) {
|
||||
line.push_back(
|
||||
text("#") //
|
||||
| color(Color::HSV(hue, saturation, value)) //
|
||||
| bgcolor(Color::HSV(hue, saturation, value + value_increment)));
|
||||
| ftxui::color(Color::HSV(hue, saturation, value)) //
|
||||
| ftxui::bgcolor(Color::HSV(hue, saturation, value + value_increment)));
|
||||
count++;
|
||||
}
|
||||
array.push_back(hbox(std::move(line)));
|
||||
|
@ -51,6 +55,7 @@ std::string generate_colors() {
|
|||
}
|
||||
|
||||
TEST_CASE("test out ragel parser", "[gui]") {
|
||||
SFMLRender::init_terminal();
|
||||
sf::Color default_fg(0,0,0);
|
||||
sf::Color default_bg(100,100,100);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <ftxui/dom/elements.hpp> // for hflow, paragraph, separator, hbox, vbox, filler, operator|, border, Element
|
||||
#include "panel.hpp"
|
||||
#include "ansi_parser.hpp"
|
||||
#include "render.hpp"
|
||||
|
||||
using namespace ftxui;
|
||||
using namespace fmt;
|
||||
|
@ -27,8 +28,7 @@ void test_ansi_parsing(Panel &panel) {
|
|||
}
|
||||
|
||||
TEST_CASE("can render a simple text panel", "[panel]") {
|
||||
ftxui::Terminal::SetColorSupport(ftxui::Terminal::Color::TrueColor);
|
||||
|
||||
SFMLRender::init_terminal();
|
||||
Panel text_panel(0, 0, 20, 5);
|
||||
|
||||
bool show_modal = false;
|
||||
|
@ -59,7 +59,7 @@ TEST_CASE("can render a simple text panel", "[panel]") {
|
|||
}
|
||||
|
||||
TEST_CASE("can render a simple grid panel", "[panel]") {
|
||||
Terminal::SetColorSupport(Terminal::Color::TrueColor);
|
||||
SFMLRender::init_terminal();
|
||||
|
||||
Panel grid_panel(20, 20, 20, 5, true);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ void run_renderer(SFMLRender &renderer, Panel &panel) {
|
|||
|
||||
TEST_CASE("can render a text panel", "[render]") {
|
||||
SFMLRender renderer;
|
||||
renderer.init_terminal();
|
||||
|
||||
Panel panel(0, 0, 20, 5);
|
||||
|
||||
|
@ -42,6 +43,7 @@ TEST_CASE("can render a text panel", "[render]") {
|
|||
|
||||
TEST_CASE("can render a text", "[render]") {
|
||||
SFMLRender renderer;
|
||||
renderer.init_terminal();
|
||||
DinkyECS::World world;
|
||||
|
||||
save::load_configs(world);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue