about summary refs log tree commit diff stats
path: root/ext
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-10-27 19:00:29 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-10-27 19:00:29 -0400
commitd3727cb8d2ba959a4bf3387c9aa8848f233cfcab (patch)
tree918e0d95dc516bbd927c7254f9e52a6ad94f2aa8 /ext
parente7eacdde9dc5a99636cda74c91384a4ec0752547 (diff)
downloadwittle-d3727cb8d2ba959a4bf3387c9aa8848f233cfcab.tar.gz
wittle-d3727cb8d2ba959a4bf3387c9aa8848f233cfcab.tar.bz2
wittle-d3727cb8d2ba959a4bf3387c9aa8848f233cfcab.zip
Symmetry works
Diffstat (limited to 'ext')
-rw-r--r--ext/wittle_generator/Generate.cpp24
-rw-r--r--ext/wittle_generator/Panel.cpp4
-rw-r--r--ext/wittle_generator/Test.cpp7
3 files changed, 27 insertions, 8 deletions
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() {
55 init_treehouse_layout(); 55 init_treehouse_layout();
56 } 56 }
57 if (hasFlag(Config::RegularStartEnd)) { 57 if (hasFlag(Config::RegularStartEnd)) {
58 setSymbol(Decoration::Start, 0, _panel->height() - 1); 58 if (_symmetry == Panel::Rotational) {
59 setSymbol(Decoration::Exit, _panel->width() - 1, 0); 59 setSymbol(Decoration::Start, 0, 0);
60 setSymbol(Decoration::Exit, 0, _panel->height() - 1);
61
62 setSymbol(Decoration::Start, _panel->width() - 1, _panel->height() - 1);
63 setSymbol(Decoration::Exit, _panel->width() - 1, 0);
64 } else if (_symmetry == Panel::Vertical) {
65 setSymbol(Decoration::Exit, 0, 0);
66 setSymbol(Decoration::Start, 0, _panel->height() - 1);
67
68 setSymbol(Decoration::Start, _panel->width() - 1, _panel->height() - 1);
69 setSymbol(Decoration::Exit, _panel->width() - 1, 0);
70 } else if (_symmetry == Panel::Horizontal) {
71 setSymbol(Decoration::Start, 0, 0);
72 setSymbol(Decoration::Start, 0, _panel->height() - 1);
73
74 setSymbol(Decoration::Exit, _panel->width() - 1, _panel->height() - 1);
75 setSymbol(Decoration::Exit, _panel->width() - 1, 0);
76 } else {
77 setSymbol(Decoration::Start, 0, _panel->height() - 1);
78 setSymbol(Decoration::Exit, _panel->width() - 1, 0);
79 }
60 } 80 }
61 81
62 if (_custom_grid.size() > 82 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() {
127 int genericFlags = 0; 127 int genericFlags = 0;
128 if (symmetry != Symmetry::None) { 128 if (symmetry != Symmetry::None) {
129 genericFlags |= Serializer::Symmetrical; 129 genericFlags |= Serializer::Symmetrical;
130 if (symmetry == Symmetry::Horizontal) { 130 if (symmetry == Symmetry::Vertical || symmetry == Symmetry::Rotational) {
131 genericFlags |= Serializer::SymmetryX; 131 genericFlags |= Serializer::SymmetryX;
132 } 132 }
133 if (symmetry == Symmetry::Vertical) { 133 if (symmetry == Symmetry::Horizontal || symmetry == Symmetry::Rotational) {
134 genericFlags |= Serializer::SymmetryY; 134 genericFlags |= Serializer::SymmetryY;
135 } 135 }
136 } 136 }
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**) {
5 generator.setFlag(Generate::RegularStartEnd); 5 generator.setFlag(Generate::RegularStartEnd);
6 /*generator.generate(4 * 2 + 1, 4 * 2 + 1, 6 /*generator.generate(4 * 2 + 1, 4 * 2 + 1,
7 {{{Decoration::Triangle | Decoration::Orange, 6}}});*/ 7 {{{Decoration::Triangle | Decoration::Orange, 6}}});*/
8 generator.setSymmetry(Panel::Vertical);
8 generator.generate( 9 generator.generate(
9 4 * 2 + 1, 4 * 2 + 1, 10 5 * 2 + 1, 5 * 2 + 1,
10 {{{Decoration::Poly | Decoration::Can_Rotate | Decoration::Yellow, 1}, 11 {{{Decoration::Triangle | Decoration::Color::Orange, 6}}});
11 {Decoration::Poly | Decoration::Yellow, 1},
12 {Decoration::Gap, 6}}});
13 12
14 return 0; 13 return 0;
15} 14}