From c388759ed67b792201b99bf7d73d036c34b47d87 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Wed, 7 Nov 2018 10:09:47 -0800 Subject: Working on some consistency --- Source/Panel.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'Source/Panel.h') 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: class Panel { public: - explicit Panel(int id); + Panel(int id); // explicit Panel(nlohmann::json json); void Write(int id); @@ -109,6 +109,9 @@ public: }; private: + // For testing + Panel(); + void ReadIntersections(int id); void WriteIntersections(int id); void ReadDecorations(int id); @@ -117,6 +120,20 @@ private: // TODO: Reflection data // TODO: Decoration colors + std::tuple loc_to_xy(int location) { + int x = 2 * (location % ((_width + 1) / 2)); + int y = (_height - 1) - 2 * (location / ((_width + 1) / 2)); + return {x, y}; + } + + int xy_to_loc(int x, int y) { + int height2 = (_height - 1) / 2; + int width2 = (_width + 1) / 2; + + int rowsFromBottom = height2 - y/2; + return rowsFromBottom * width2 + x/2; + } + Memory _memory = Memory("witness64_d3d11.exe"); int _width, _height; @@ -125,4 +142,6 @@ private: std::vector _endpoints; std::vector> _startpoints; int _style; + + friend class PanelExtractionTests; }; \ No newline at end of file -- cgit 1.4.1