about summary refs log tree commit diff stats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Main.cpp30
-rw-r--r--Source/Resource.h38
-rw-r--r--Source/Source.rc84
-rw-r--r--Source/Source.vcxproj16
-rw-r--r--Source/Source.vcxproj.filters6
5 files changed, 64 insertions, 110 deletions
diff --git a/Source/Main.cpp b/Source/Main.cpp index 5c7cefa..8a7a5bb 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp
@@ -16,7 +16,6 @@
16HINSTANCE hInst; 16HINSTANCE hInst;
17WCHAR szWindowClass[MAX_LOADSTRING]; 17WCHAR szWindowClass[MAX_LOADSTRING];
18HWND hwndSeed; 18HWND hwndSeed;
19std::shared_ptr<Randomizer> randomizer;
20 19
21// Forward declares 20// Forward declares
22ATOM MyRegisterClass(HINSTANCE hInstance); 21ATOM MyRegisterClass(HINSTANCE hInstance);
@@ -31,10 +30,6 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd
31 if (!InitInstance(hInstance, nCmdShow)) { 30 if (!InitInstance(hInstance, nCmdShow)) {
32 return FALSE; 31 return FALSE;
33 } 32 }
34 randomizer = std::make_shared<Randomizer>();
35 if (randomizer == nullptr) {
36 return FALSE;
37 }
38 33
39 MSG msg; 34 MSG msg;
40 while (!GetMessage(&msg, nullptr, 0, 0) == 0) 35 while (!GetMessage(&msg, nullptr, 0, 0) == 0)
@@ -107,18 +102,12 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
107 102
108LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 103LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
109{ 104{
110 if (WM_COMMAND == WM_DESTROY) { 105 if (message == WM_DESTROY) {
111 PostQuitMessage(0); 106 PostQuitMessage(0);
112 } else { 107 } else if (message == WM_COMMAND) {
113 int wmId = LOWORD(wParam); 108 int wmId = LOWORD(wParam);
114 // Parse the menu selections: 109 // Parse the menu selections:
115 switch (wmId) 110 if (wmId == IDC_RANDOMIZE) {
116 {
117 case IDM_ABOUT:
118 DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
119 break;
120 case IDC_RANDOMIZE:
121 {
122 std::wstring text(100, '\0'); 111 std::wstring text(100, '\0');
123 GetWindowText(hwndSeed, &text[0], 100); 112 GetWindowText(hwndSeed, &text[0], 100);
124 int seed = 0; 113 int seed = 0;
@@ -131,15 +120,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
131 } else { 120 } else {
132 seed = _wtoi(text.c_str()); 121 seed = _wtoi(text.c_str());
133 } 122 }
134 randomizer->Randomize(seed); 123 srand(seed);
135 124 Randomizer().Randomize();
136 break;
137 }
138 case IDM_EXIT:
139 DestroyWindow(hWnd);
140 break;
141 default:
142 return DefWindowProc(hWnd, message, wParam, lParam);
143 } 125 }
144 } 126 }
145 return DefWindowProc(hWnd, message, wParam, lParam); 127 return DefWindowProc(hWnd, message, wParam, lParam);
diff --git a/Source/Resource.h b/Source/Resource.h index d5c5cef..426abc1 100644 --- a/Source/Resource.h +++ b/Source/Resource.h
@@ -1,30 +1,26 @@
1//{{NO_DEPENDENCIES}} 1//{{NO_DEPENDENCIES}}
2// Microsoft Visual C++ generated include file. 2// Microsoft Visual C++ generated include file.
3// Used by Source.rc 3// Used by Source.rc
4//
5#define IDC_MYICON 2
6#define IDD_SOURCE_DIALOG 102
7#define IDS_APP_TITLE 103
8#define IDM_ABOUT 104
9#define IDM_EXIT 105
10#define IDI_SOURCE 107
11#define IDI_SMALL 108
12#define IDC_SOURCE 109
13#define IDR_MAINFRAME 128
14#define IDC_STATIC -1
4 15
5#define IDS_APP_TITLE 103
6
7#define IDR_MAINFRAME 128
8#define IDD_SOURCE_DIALOG 102
9#define IDD_ABOUTBOX 103
10#define IDM_ABOUT 104
11#define IDM_EXIT 105
12#define IDI_SOURCE 107
13#define IDI_SMALL 108
14#define IDC_SOURCE 109
15#define IDC_MYICON 2
16#ifndef IDC_STATIC
17#define IDC_STATIC -1
18#endif
19// Next default values for new objects 16// Next default values for new objects
20// 17//
21#ifdef APSTUDIO_INVOKED 18#ifdef APSTUDIO_INVOKED
22#ifndef APSTUDIO_READONLY_SYMBOLS 19#ifndef APSTUDIO_READONLY_SYMBOLS
23 20#define _APS_NO_MFC 1
24#define _APS_NO_MFC 130 21#define _APS_NEXT_RESOURCE_VALUE 129
25#define _APS_NEXT_RESOURCE_VALUE 129 22#define _APS_NEXT_COMMAND_VALUE 32771
26#define _APS_NEXT_COMMAND_VALUE 32771 23#define _APS_NEXT_CONTROL_VALUE 1000
27#define _APS_NEXT_CONTROL_VALUE 1000 24#define _APS_NEXT_SYMED_VALUE 110
28#define _APS_NEXT_SYMED_VALUE 110
29#endif 25#endif
30#endif 26#endif
diff --git a/Source/Source.rc b/Source/Source.rc index 92f755d..7e2ce4e 100644 --- a/Source/Source.rc +++ b/Source/Source.rc
@@ -1,11 +1,11 @@
1//Microsoft Visual C++ generated resource script. 1// Microsoft Visual C++ generated resource script.
2// 2//
3#include "resource.h" 3#include "resource.h"
4 4
5#define APSTUDIO_READONLY_SYMBOLS 5#define APSTUDIO_READONLY_SYMBOLS
6///////////////////////////////////////////////////////////////////////////// 6/////////////////////////////////////////////////////////////////////////////
7// 7//
8// Generated from the TEXTINCLUDE resource. 8// Generated from the TEXTINCLUDE 2 resource.
9// 9//
10#ifndef APSTUDIO_INVOKED 10#ifndef APSTUDIO_INVOKED
11#include "targetver.h" 11#include "targetver.h"
@@ -13,11 +13,16 @@
13#define APSTUDIO_HIDDEN_SYMBOLS 13#define APSTUDIO_HIDDEN_SYMBOLS
14#include "windows.h" 14#include "windows.h"
15#undef APSTUDIO_HIDDEN_SYMBOLS 15#undef APSTUDIO_HIDDEN_SYMBOLS
16
16///////////////////////////////////////////////////////////////////////////// 17/////////////////////////////////////////////////////////////////////////////
17#undef APSTUDIO_READONLY_SYMBOLS 18#undef APSTUDIO_READONLY_SYMBOLS
18 19
20/////////////////////////////////////////////////////////////////////////////
21// English (United States) resources
22
19#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 23#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
20LANGUAGE 9, 1 24LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
25#pragma code_page(1252)
21 26
22///////////////////////////////////////////////////////////////////////////// 27/////////////////////////////////////////////////////////////////////////////
23// 28//
@@ -26,26 +31,16 @@ LANGUAGE 9, 1
26 31
27// Icon with lowest ID value placed first to ensure application icon 32// Icon with lowest ID value placed first to ensure application icon
28// remains consistent on all systems. 33// remains consistent on all systems.
34IDI_SOURCE ICON "Source.ico"
35
36IDI_SMALL ICON "small.ico"
29 37
30IDI_SOURCE ICON "Source.ico"
31IDI_SMALL ICON "small.ico"
32 38
33///////////////////////////////////////////////////////////////////////////// 39/////////////////////////////////////////////////////////////////////////////
34// 40//
35// Menu 41// Menu
36// 42//
37 43
38IDC_SOURCE MENU
39BEGIN
40 POPUP "&File"
41 BEGIN
42 MENUITEM "E&xit", IDM_EXIT
43 END
44 POPUP "&Help"
45 BEGIN
46 MENUITEM "&About ...", IDM_ABOUT
47 END
48END
49 44
50 45
51///////////////////////////////////////////////////////////////////////////// 46/////////////////////////////////////////////////////////////////////////////
@@ -53,58 +48,20 @@ END
53// Accelerator 48// Accelerator
54// 49//
55 50
56IDC_SOURCE ACCELERATORS
57BEGIN
58 "?", IDM_ABOUT, ASCII, ALT
59 "/", IDM_ABOUT, ASCII, ALT
60END
61 51
62 52
63/////////////////////////////////////////////////////////////////////////////
64//
65// Dialog
66//
67
68IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62
69STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
70CAPTION "About Source"
71FONT 8, "MS Shell Dlg"
72BEGIN
73 ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20
74 LTEXT "Source, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX
75 LTEXT "Copyright (c) 2018",IDC_STATIC,42,26,114,8
76 DEFPUSHBUTTON "OK",IDOK,113,41,50,14,WS_GROUP
77END
78
79/////////////////////////////////////////////////////////////////////////////
80//
81// DESIGNINFO
82//
83
84#ifdef APSTUDIO_INVOKED
85GUIDELINES DESIGNINFO
86BEGIN
87 IDD_ABOUTBOX, DIALOG
88 BEGIN
89 LEFTMARGIN, 7
90 RIGHTMARGIN, 163
91 TOPMARGIN, 7
92 BOTTOMMARGIN, 55
93 END
94END
95#endif // APSTUDIO_INVOKED
96
97#ifdef APSTUDIO_INVOKED 53#ifdef APSTUDIO_INVOKED
98///////////////////////////////////////////////////////////////////////////// 54/////////////////////////////////////////////////////////////////////////////
99// 55//
100// TEXTINCLUDE 56// TEXTINCLUDE
101// 57//
1021 TEXTINCLUDE 58
591 TEXTINCLUDE
103BEGIN 60BEGIN
104 "resource.h\0" 61 "resource.h\0"
105END 62END
106 63
1072 TEXTINCLUDE 642 TEXTINCLUDE
108BEGIN 65BEGIN
109 "#ifndef APSTUDIO_INVOKED\r\n" 66 "#ifndef APSTUDIO_INVOKED\r\n"
110 "#include ""targetver.h""\r\n" 67 "#include ""targetver.h""\r\n"
@@ -115,7 +72,7 @@ BEGIN
115 "\0" 72 "\0"
116END 73END
117 74
1183 TEXTINCLUDE 753 TEXTINCLUDE
119BEGIN 76BEGIN
120 "\r\n" 77 "\r\n"
121 "\0" 78 "\0"
@@ -123,6 +80,7 @@ END
123 80
124#endif // APSTUDIO_INVOKED 81#endif // APSTUDIO_INVOKED
125 82
83
126///////////////////////////////////////////////////////////////////////////// 84/////////////////////////////////////////////////////////////////////////////
127// 85//
128// String Table 86// String Table
@@ -130,11 +88,11 @@ END
130 88
131STRINGTABLE 89STRINGTABLE
132BEGIN 90BEGIN
133 IDC_SOURCE "SOURCE" 91 IDS_APP_TITLE "Witness Randomizer"
134 IDS_APP_TITLE "Source" 92 IDC_SOURCE "SOURCE"
135END 93END
136 94
137#endif 95#endif // English (United States) resources
138///////////////////////////////////////////////////////////////////////////// 96/////////////////////////////////////////////////////////////////////////////
139 97
140 98
@@ -142,8 +100,10 @@ END
142#ifndef APSTUDIO_INVOKED 100#ifndef APSTUDIO_INVOKED
143///////////////////////////////////////////////////////////////////////////// 101/////////////////////////////////////////////////////////////////////////////
144// 102//
145// Generated from the TEXTINCLUDE resource. 103// Generated from the TEXTINCLUDE 3 resource.
146// 104//
147 105
106
148///////////////////////////////////////////////////////////////////////////// 107/////////////////////////////////////////////////////////////////////////////
149#endif // not APSTUDIO_INVOKED 108#endif // not APSTUDIO_INVOKED
109
diff --git a/Source/Source.vcxproj b/Source/Source.vcxproj index 55d54d9..12d0270 100644 --- a/Source/Source.vcxproj +++ b/Source/Source.vcxproj
@@ -84,12 +84,14 @@
84 </PropertyGroup> 84 </PropertyGroup>
85 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> 85 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
86 <ClCompile> 86 <ClCompile>
87 <PrecompiledHeader>Use</PrecompiledHeader> 87 <PrecompiledHeader>NotUsing</PrecompiledHeader>
88 <WarningLevel>Level3</WarningLevel> 88 <WarningLevel>Level3</WarningLevel>
89 <Optimization>Disabled</Optimization> 89 <Optimization>Disabled</Optimization>
90 <SDLCheck>true</SDLCheck> 90 <SDLCheck>true</SDLCheck>
91 <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> 91 <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92 <ConformanceMode>true</ConformanceMode> 92 <ConformanceMode>true</ConformanceMode>
93 <TreatWarningAsError>true</TreatWarningAsError>
94 <LanguageStandard>stdcpp17</LanguageStandard>
93 </ClCompile> 95 </ClCompile>
94 <Link> 96 <Link>
95 <SubSystem>Windows</SubSystem> 97 <SubSystem>Windows</SubSystem>
@@ -98,12 +100,14 @@
98 </ItemDefinitionGroup> 100 </ItemDefinitionGroup>
99 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> 101 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
100 <ClCompile> 102 <ClCompile>
101 <PrecompiledHeader>Use</PrecompiledHeader> 103 <PrecompiledHeader>NotUsing</PrecompiledHeader>
102 <WarningLevel>Level3</WarningLevel> 104 <WarningLevel>Level3</WarningLevel>
103 <Optimization>Disabled</Optimization> 105 <Optimization>Disabled</Optimization>
104 <SDLCheck>true</SDLCheck> 106 <SDLCheck>true</SDLCheck>
105 <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> 107 <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
106 <ConformanceMode>true</ConformanceMode> 108 <ConformanceMode>true</ConformanceMode>
109 <TreatWarningAsError>true</TreatWarningAsError>
110 <LanguageStandard>stdcpp17</LanguageStandard>
107 </ClCompile> 111 </ClCompile>
108 <Link> 112 <Link>
109 <SubSystem>Windows</SubSystem> 113 <SubSystem>Windows</SubSystem>
@@ -112,7 +116,7 @@
112 </ItemDefinitionGroup> 116 </ItemDefinitionGroup>
113 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 117 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
114 <ClCompile> 118 <ClCompile>
115 <PrecompiledHeader>Use</PrecompiledHeader> 119 <PrecompiledHeader>NotUsing</PrecompiledHeader>
116 <WarningLevel>Level3</WarningLevel> 120 <WarningLevel>Level3</WarningLevel>
117 <Optimization>MaxSpeed</Optimization> 121 <Optimization>MaxSpeed</Optimization>
118 <FunctionLevelLinking>true</FunctionLevelLinking> 122 <FunctionLevelLinking>true</FunctionLevelLinking>
@@ -120,6 +124,9 @@
120 <SDLCheck>true</SDLCheck> 124 <SDLCheck>true</SDLCheck>
121 <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> 125 <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
122 <ConformanceMode>true</ConformanceMode> 126 <ConformanceMode>true</ConformanceMode>
127 <TreatWarningAsError>true</TreatWarningAsError>
128 <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
129 <LanguageStandard>stdcpp17</LanguageStandard>
123 </ClCompile> 130 </ClCompile>
124 <Link> 131 <Link>
125 <SubSystem>Windows</SubSystem> 132 <SubSystem>Windows</SubSystem>
@@ -140,6 +147,7 @@
140 <ConformanceMode>true</ConformanceMode> 147 <ConformanceMode>true</ConformanceMode>
141 <TreatWarningAsError>true</TreatWarningAsError> 148 <TreatWarningAsError>true</TreatWarningAsError>
142 <LanguageStandard>stdcpp17</LanguageStandard> 149 <LanguageStandard>stdcpp17</LanguageStandard>
150 <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
143 </ClCompile> 151 </ClCompile>
144 <Link> 152 <Link>
145 <SubSystem>Windows</SubSystem> 153 <SubSystem>Windows</SubSystem>
@@ -152,6 +160,7 @@
152 <ClInclude Include="Memory.h" /> 160 <ClInclude Include="Memory.h" />
153 <ClInclude Include="Panels.h" /> 161 <ClInclude Include="Panels.h" />
154 <ClInclude Include="Randomizer.h" /> 162 <ClInclude Include="Randomizer.h" />
163 <ClInclude Include="RandomizerCore.h" />
155 <ClInclude Include="Resource.h" /> 164 <ClInclude Include="Resource.h" />
156 <ClInclude Include="stdafx.h" /> 165 <ClInclude Include="stdafx.h" />
157 <ClInclude Include="targetver.h" /> 166 <ClInclude Include="targetver.h" />
@@ -160,6 +169,7 @@
160 <ClCompile Include="Main.cpp" /> 169 <ClCompile Include="Main.cpp" />
161 <ClCompile Include="Memory.cpp" /> 170 <ClCompile Include="Memory.cpp" />
162 <ClCompile Include="Randomizer.cpp" /> 171 <ClCompile Include="Randomizer.cpp" />
172 <ClCompile Include="RandomizerCore.cpp" />
163 <ClCompile Include="stdafx.cpp"> 173 <ClCompile Include="stdafx.cpp">
164 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> 174 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
165 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> 175 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
diff --git a/Source/Source.vcxproj.filters b/Source/Source.vcxproj.filters index b650d44..7e15255 100644 --- a/Source/Source.vcxproj.filters +++ b/Source/Source.vcxproj.filters
@@ -33,6 +33,9 @@
33 <ClInclude Include="Randomizer.h"> 33 <ClInclude Include="Randomizer.h">
34 <Filter>Header Files</Filter> 34 <Filter>Header Files</Filter>
35 </ClInclude> 35 </ClInclude>
36 <ClInclude Include="RandomizerCore.h">
37 <Filter>Header Files</Filter>
38 </ClInclude>
36 </ItemGroup> 39 </ItemGroup>
37 <ItemGroup> 40 <ItemGroup>
38 <ClCompile Include="stdafx.cpp"> 41 <ClCompile Include="stdafx.cpp">
@@ -47,6 +50,9 @@
47 <ClCompile Include="Randomizer.cpp"> 50 <ClCompile Include="Randomizer.cpp">
48 <Filter>Source Files</Filter> 51 <Filter>Source Files</Filter>
49 </ClCompile> 52 </ClCompile>
53 <ClCompile Include="RandomizerCore.cpp">
54 <Filter>Source Files</Filter>
55 </ClCompile>
50 </ItemGroup> 56 </ItemGroup>
51 <ItemGroup> 57 <ItemGroup>
52 <ResourceCompile Include="Source.rc"> 58 <ResourceCompile Include="Source.rc">