about summary refs log tree commit diff stats
path: root/App
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2019-11-09 14:23:42 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2019-11-09 14:23:42 -0800
commit98db209c9008492baec6bb482b047d386fbdd42b (patch)
tree9f4a932ed1ff2367a98fe02908fee4c884a2d4ed /App
parent36be1ed32ac9a554f0b11fcc13b5699e717b81f2 (diff)
downloadwitness-tutorializer-98db209c9008492baec6bb482b047d386fbdd42b.tar.gz
witness-tutorializer-98db209c9008492baec6bb482b047d386fbdd42b.tar.bz2
witness-tutorializer-98db209c9008492baec6bb482b047d386fbdd42b.zip
One down, 522 to go.
Diffstat (limited to 'App')
-rw-r--r--App/Main.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/App/Main.cpp b/App/Main.cpp index 5213a79..3fb9df4 100644 --- a/App/Main.cpp +++ b/App/Main.cpp
@@ -23,14 +23,17 @@
23/* ------- Temp ------- */ 23/* ------- Temp ------- */
24#include "Puzzle.h" 24#include "Puzzle.h"
25#include "Solver.h" 25#include "Solver.h"
26#include "Randomizer2.h"
26#include <sstream> 27#include <sstream>
27 28
28#define TMP1 0x501 29#define TMP1 0x501
29#define TMP2 0x502 30#define TMP2 0x502
30#define TMP3 0x503 31#define TMP3 0x503
32#define TMP4 0x504
31 33
32HWND g_panelId; 34HWND g_panelId;
33Puzzle g_puzzle; 35Puzzle g_puzzle;
36std::shared_ptr<Randomizer2> g_randomizer2;
34/* ------- Temp ------- */ 37/* ------- Temp ------- */
35 38
36// Globals 39// Globals
@@ -61,12 +64,14 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
61 // Shut down randomizer, wait for startup 64 // Shut down randomizer, wait for startup
62 if (g_randomizer) { 65 if (g_randomizer) {
63 g_randomizer = nullptr; 66 g_randomizer = nullptr;
67 g_randomizer2 = nullptr;
64 EnableWindow(g_randomizerStatus, FALSE); 68 EnableWindow(g_randomizerStatus, FALSE);
65 } 69 }
66 break; 70 break;
67 case ProcStatus::Running: 71 case ProcStatus::Running:
68 if (!g_randomizer) { 72 if (!g_randomizer) {
69 g_randomizer = std::make_shared<Randomizer>(g_witnessProc); 73 g_randomizer = std::make_shared<Randomizer>(g_witnessProc);
74 g_randomizer2 = std::make_shared<Randomizer2>(g_witnessProc);
70 PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_READY, NULL); 75 PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_READY, NULL);
71 } 76 }
72 break; 77 break;
@@ -159,6 +164,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
159 case TMP3: 164 case TMP3:
160 Solver::Solve(g_puzzle); 165 Solver::Solve(g_puzzle);
161 break; 166 break;
167 case TMP4:
168 g_randomizer2->Randomize();
162 } 169 }
163 } 170 }
164 return DefWindowProc(hwnd, message, wParam, lParam); 171 return DefWindowProc(hwnd, message, wParam, lParam);
@@ -244,7 +251,8 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
244 g_panelId = CreateText(200, 100, 100, L"A3B2"); 251 g_panelId = CreateText(200, 100, 100, L"A3B2");
245 CreateButton(200, 130, 100, L"Read", TMP1); 252 CreateButton(200, 130, 100, L"Read", TMP1);
246 CreateButton(200, 160, 100, L"Write", TMP2); 253 CreateButton(200, 160, 100, L"Write", TMP2);
247 CreateButton(200, 190, 100, L"Validate", TMP3); 254 CreateButton(200, 190, 100, L"Solve", TMP3);
255 CreateButton(200, 220, 100, L"Randomize2", TMP4);
248 256
249 g_witnessProc->StartHeartbeat(g_hwnd); 257 g_witnessProc->StartHeartbeat(g_hwnd);
250 258