about summary refs log tree commit diff stats
path: root/Source/Panel.h
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2018-11-07 10:09:47 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2018-11-07 10:09:47 -0800
commitc388759ed67b792201b99bf7d73d036c34b47d87 (patch)
treed16e7bdba8e1f226bd97b9a774fcb519c2bebd42 /Source/Panel.h
parent5ad08f6611c8c777c43cfa0d2380b6ad6554a54d (diff)
downloadwitness-tutorializer-c388759ed67b792201b99bf7d73d036c34b47d87.tar.gz
witness-tutorializer-c388759ed67b792201b99bf7d73d036c34b47d87.tar.bz2
witness-tutorializer-c388759ed67b792201b99bf7d73d036c34b47d87.zip
Working on some consistency
Diffstat (limited to 'Source/Panel.h')
-rw-r--r--Source/Panel.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/Source/Panel.h b/Source/Panel.h index c9b4910..565b4c3 100644 --- a/Source/Panel.h +++ b/Source/Panel.h
@@ -90,7 +90,7 @@ private:
90class Panel 90class Panel
91{ 91{
92public: 92public:
93 explicit Panel(int id); 93 Panel(int id);
94 // explicit Panel(nlohmann::json json); 94 // explicit Panel(nlohmann::json json);
95 95
96 void Write(int id); 96 void Write(int id);
@@ -109,6 +109,9 @@ public:
109 }; 109 };
110 110
111private: 111private:
112 // For testing
113 Panel();
114
112 void ReadIntersections(int id); 115 void ReadIntersections(int id);
113 void WriteIntersections(int id); 116 void WriteIntersections(int id);
114 void ReadDecorations(int id); 117 void ReadDecorations(int id);
@@ -117,6 +120,20 @@ private:
117 // TODO: Reflection data 120 // TODO: Reflection data
118 // TODO: Decoration colors 121 // TODO: Decoration colors
119 122
123 std::tuple<int, int> loc_to_xy(int location) {
124 int x = 2 * (location % ((_width + 1) / 2));
125 int y = (_height - 1) - 2 * (location / ((_width + 1) / 2));
126 return {x, y};
127 }
128
129 int xy_to_loc(int x, int y) {
130 int height2 = (_height - 1) / 2;
131 int width2 = (_width + 1) / 2;
132
133 int rowsFromBottom = height2 - y/2;
134 return rowsFromBottom * width2 + x/2;
135 }
136
120 Memory _memory = Memory("witness64_d3d11.exe"); 137 Memory _memory = Memory("witness64_d3d11.exe");
121 138
122 int _width, _height; 139 int _width, _height;
@@ -125,4 +142,6 @@ private:
125 std::vector<Endpoint> _endpoints; 142 std::vector<Endpoint> _endpoints;
126 std::vector<std::pair<int ,int>> _startpoints; 143 std::vector<std::pair<int ,int>> _startpoints;
127 int _style; 144 int _style;
145
146 friend class PanelExtractionTests;
128}; \ No newline at end of file 147}; \ No newline at end of file