about summary refs log tree commit diff stats
path: root/App/Main.cpp
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2019-11-19 09:59:59 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2019-11-19 09:59:59 -0800
commitab5652329d3e6bbaaf338e47fb3d84d89bf9b7b1 (patch)
tree352bbf485dee4cc8f465d928b131524ca7329d5e /App/Main.cpp
parent52b01775c2c94f08786696cae7836ca56f683739 (diff)
downloadwitness-tutorializer-ab5652329d3e6bbaaf338e47fb3d84d89bf9b7b1.tar.gz
witness-tutorializer-ab5652329d3e6bbaaf338e47fb3d84d89bf9b7b1.tar.bz2
witness-tutorializer-ab5652329d3e6bbaaf338e47fb3d84d89bf9b7b1.zip
shrug
Diffstat (limited to 'App/Main.cpp')
-rw-r--r--App/Main.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/App/Main.cpp b/App/Main.cpp index f780069..f5409ff 100644 --- a/App/Main.cpp +++ b/App/Main.cpp
@@ -10,6 +10,7 @@
10#include "Memory.h" 10#include "Memory.h"
11#include "Random.h" 11#include "Random.h"
12#include "Randomizer.h" 12#include "Randomizer.h"
13#include "Randomizer2.h"
13 14
14// Heartbeat is defined to 0x401 by Memory.h 15// Heartbeat is defined to 0x401 by Memory.h
15#define RANDOMIZE_READY 0x402 16#define RANDOMIZE_READY 0x402
@@ -23,7 +24,6 @@
23/* ------- Temp ------- */ 24/* ------- Temp ------- */
24#include "Puzzle.h" 25#include "Puzzle.h"
25#include "Solver.h" 26#include "Solver.h"
26#include "Randomizer2.h"
27#include "PuzzleSerializer.h" 27#include "PuzzleSerializer.h"
28#include <sstream> 28#include <sstream>
29 29
@@ -34,7 +34,9 @@
34 34
35HWND g_panelId; 35HWND g_panelId;
36Puzzle g_puzzle; 36Puzzle g_puzzle;
37std::shared_ptr<Randomizer2> g_randomizer2; 37
38HWND g_rngDebug;
39#define TMP5 0x505
38/* ------- Temp ------- */ 40/* ------- Temp ------- */
39 41
40// Globals 42// Globals
@@ -44,6 +46,7 @@ HWND g_randomizerStatus;
44HINSTANCE g_hInstance; 46HINSTANCE g_hInstance;
45auto g_witnessProc = std::make_shared<Memory>(L"witness64_d3d11.exe"); 47auto g_witnessProc = std::make_shared<Memory>(L"witness64_d3d11.exe");
46std::shared_ptr<Randomizer> g_randomizer; 48std::shared_ptr<Randomizer> g_randomizer;
49std::shared_ptr<Randomizer2> g_randomizer2;
47void SetRandomSeed(); 50void SetRandomSeed();
48 51
49LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { 52LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
@@ -168,6 +171,16 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
168 case TMP4: 171 case TMP4:
169 SetRandomSeed(); 172 SetRandomSeed();
170 g_randomizer2->Randomize(); 173 g_randomizer2->Randomize();
174 case TMP5:
175 {
176 std::wstring text;
177 for (int i=0; i<10; i++) {
178 Random::SetSeed(i);
179 int rng = Random::RandInt(0, 999999);
180 text += std::to_wstring(rng) + L"\n";
181 }
182 SetWindowText(g_rngDebug, text.c_str());
183 }
171 } 184 }
172 } 185 }
173 return DefWindowProc(hwnd, message, wParam, lParam); 186 return DefWindowProc(hwnd, message, wParam, lParam);
@@ -250,11 +263,16 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
250 CreateCheckbox(10, 340, SPEED_UP_AUTOSCROLLERS); 263 CreateCheckbox(10, 340, SPEED_UP_AUTOSCROLLERS);
251 CreateLabel(30, 340, 205, L"Speed up various autoscrollers"); 264 CreateLabel(30, 340, 205, L"Speed up various autoscrollers");
252 265
253 g_panelId = CreateText(200, 100, 100, L"A3B2"); 266 CreateButton(200, 50, 200, L"Test RNG", TMP5);
254 CreateButton(200, 130, 100, L"Read", TMP1); 267 g_rngDebug = CreateWindow(L"STATIC", L"",
255 CreateButton(200, 160, 100, L"Write", TMP2); 268 WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT,
256 CreateButton(200, 190, 100, L"Solve", TMP3); 269 200, 80, 200, 200, g_hwnd, NULL, g_hInstance, NULL);
257 CreateButton(200, 220, 100, L"Randomize2", TMP4); 270
271 // g_panelId = CreateText(200, 100, 100, L"A3B2");
272 // CreateButton(200, 130, 100, L"Read", TMP1);
273 // CreateButton(200, 160, 100, L"Write", TMP2);
274 // CreateButton(200, 190, 100, L"Solve", TMP3);
275 // CreateButton(200, 220, 100, L"Randomize2", TMP4);
258 276
259 g_witnessProc->StartHeartbeat(g_hwnd); 277 g_witnessProc->StartHeartbeat(g_hwnd);
260 278