From d3727cb8d2ba959a4bf3387c9aa8848f233cfcab Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 27 Oct 2023 19:00:29 -0400 Subject: Symmetry works --- ext/wittle_generator/Generate.cpp | 24 ++++++++++++++++++++++-- ext/wittle_generator/Panel.cpp | 4 ++-- ext/wittle_generator/Test.cpp | 7 +++---- 3 files changed, 27 insertions(+), 8 deletions(-) (limited to 'ext') diff --git a/ext/wittle_generator/Generate.cpp b/ext/wittle_generator/Generate.cpp index 49ffe96..4cc3ce9 100644 --- a/ext/wittle_generator/Generate.cpp +++ b/ext/wittle_generator/Generate.cpp @@ -55,8 +55,28 @@ void Generate::initPanel() { init_treehouse_layout(); } if (hasFlag(Config::RegularStartEnd)) { - setSymbol(Decoration::Start, 0, _panel->height() - 1); - setSymbol(Decoration::Exit, _panel->width() - 1, 0); + if (_symmetry == Panel::Rotational) { + setSymbol(Decoration::Start, 0, 0); + setSymbol(Decoration::Exit, 0, _panel->height() - 1); + + setSymbol(Decoration::Start, _panel->width() - 1, _panel->height() - 1); + setSymbol(Decoration::Exit, _panel->width() - 1, 0); + } else if (_symmetry == Panel::Vertical) { + setSymbol(Decoration::Exit, 0, 0); + setSymbol(Decoration::Start, 0, _panel->height() - 1); + + setSymbol(Decoration::Start, _panel->width() - 1, _panel->height() - 1); + setSymbol(Decoration::Exit, _panel->width() - 1, 0); + } else if (_symmetry == Panel::Horizontal) { + setSymbol(Decoration::Start, 0, 0); + setSymbol(Decoration::Start, 0, _panel->height() - 1); + + setSymbol(Decoration::Exit, _panel->width() - 1, _panel->height() - 1); + setSymbol(Decoration::Exit, _panel->width() - 1, 0); + } else { + setSymbol(Decoration::Start, 0, _panel->height() - 1); + setSymbol(Decoration::Exit, _panel->width() - 1, 0); + } } if (_custom_grid.size() > diff --git a/ext/wittle_generator/Panel.cpp b/ext/wittle_generator/Panel.cpp index 125636f..4bf4be7 100644 --- a/ext/wittle_generator/Panel.cpp +++ b/ext/wittle_generator/Panel.cpp @@ -127,10 +127,10 @@ std::string Panel::Write() { int genericFlags = 0; if (symmetry != Symmetry::None) { genericFlags |= Serializer::Symmetrical; - if (symmetry == Symmetry::Horizontal) { + if (symmetry == Symmetry::Vertical || symmetry == Symmetry::Rotational) { genericFlags |= Serializer::SymmetryX; } - if (symmetry == Symmetry::Vertical) { + if (symmetry == Symmetry::Horizontal || symmetry == Symmetry::Rotational) { genericFlags |= Serializer::SymmetryY; } } diff --git a/ext/wittle_generator/Test.cpp b/ext/wittle_generator/Test.cpp index 5eaef5a..ecd2a37 100644 --- a/ext/wittle_generator/Test.cpp +++ b/ext/wittle_generator/Test.cpp @@ -5,11 +5,10 @@ int main(int, char**) { generator.setFlag(Generate::RegularStartEnd); /*generator.generate(4 * 2 + 1, 4 * 2 + 1, {{{Decoration::Triangle | Decoration::Orange, 6}}});*/ + generator.setSymmetry(Panel::Vertical); generator.generate( - 4 * 2 + 1, 4 * 2 + 1, - {{{Decoration::Poly | Decoration::Can_Rotate | Decoration::Yellow, 1}, - {Decoration::Poly | Decoration::Yellow, 1}, - {Decoration::Gap, 6}}}); + 5 * 2 + 1, 5 * 2 + 1, + {{{Decoration::Triangle | Decoration::Color::Orange, 6}}}); return 0; } -- cgit 1.4.1