MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / DialogProc

Function DialogProc

TombEngine/Specific/configuration.cpp:62–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62BOOL CALLBACK DialogProc(HWND handle, UINT msg, WPARAM wParam, LPARAM lParam)
63{
64 Vector2i mode;
65 int selectedMode;
66
67 switch (msg)
68 {
69 case WM_INITDIALOG:
70 //DB_Log(6, "WM_INITDIALOG");
71
72 SendMessageW(GetDlgItem(handle, IDC_GROUP_OUTPUT_SETTINGS), WM_SETTEXT, 0, (LPARAM)ToWString(std::string(g_GameFlow->GetString(STRING_OUTPUT_SETTINGS))).c_str());
73 SendMessageW(GetDlgItem(handle, IDOK), WM_SETTEXT, 0, (LPARAM)ToWString(std::string(g_GameFlow->GetString(STRING_OK))).c_str());
74 SendMessageW(GetDlgItem(handle, IDCANCEL), WM_SETTEXT, 0, (LPARAM)ToWString(std::string(g_GameFlow->GetString(STRING_CANCEL))).c_str());
75 SendMessageW(GetDlgItem(handle, IDC_GROUP_RESOLUTION), WM_SETTEXT, 0, (LPARAM)ToWString(std::string(g_GameFlow->GetString(STRING_SCREEN_RESOLUTION))).c_str());
76 SendMessageW(GetDlgItem(handle, IDC_GROUP_SOUND), WM_SETTEXT, 0, (LPARAM)ToWString(std::string(g_GameFlow->GetString(STRING_SOUND))).c_str());
77 SendMessageW(GetDlgItem(handle, IDC_ENABLE_SOUNDS), WM_SETTEXT, 0, (LPARAM)ToWString(std::string(g_GameFlow->GetString(STRING_ENABLE_SOUND))).c_str());
78 SendMessageW(GetDlgItem(handle, IDC_WINDOWED), WM_SETTEXT, 0, (LPARAM)ToWString(std::string(g_GameFlow->GetString(STRING_WINDOWED))).c_str());
79 SendMessageW(GetDlgItem(handle, IDC_GROUP_RENDER_OPTIONS), WM_SETTEXT, 0, (LPARAM)ToWString(std::string(g_GameFlow->GetString(STRING_RENDER_OPTIONS))).c_str());
80 SendMessageW(GetDlgItem(handle, IDC_SHADOWS), WM_SETTEXT, 0, (LPARAM)ToWString(std::string(g_GameFlow->GetString(STRING_SHADOWS))).c_str());
81 SendMessageW(GetDlgItem(handle, IDC_CAUSTICS), WM_SETTEXT, 0, (LPARAM)ToWString(std::string(g_GameFlow->GetString(STRING_CAUSTICS))).c_str());
82 SendMessageW(GetDlgItem(handle, IDC_ANTIALIASING), WM_SETTEXT, 0, (LPARAM)ToWString(std::string(g_GameFlow->GetString(STRING_ANTIALIASING))).c_str());
83
84 LoadResolutionsInCombobox(handle);
85 LoadSoundDevicesInCombobox(handle);
86
87 // Set some default values.
88 g_Configuration.EnableAutoTargeting = true;
89
90 g_Configuration.AntialiasingMode = AntialiasingMode::Low;
91 SendDlgItemMessage(handle, IDC_ANTIALIASING, BM_SETCHECK, 1, 0);
92
93 g_Configuration.ShadowType = ShadowMode::Player;
94 SendDlgItemMessage(handle, IDC_SHADOWS, BM_SETCHECK, 1, 0);
95
96 g_Configuration.EnableCaustics = true;
97 SendDlgItemMessage(handle, IDC_CAUSTICS, BM_SETCHECK, 1, 0);
98
99 g_Configuration.EnableWindowedMode = true;
100 SendDlgItemMessage(handle, IDC_WINDOWED, BM_SETCHECK, 1, 0);
101
102 g_Configuration.EnableSound = true;
103 SendDlgItemMessage(handle, IDC_ENABLE_SOUNDS, BM_SETCHECK, 1, 0);
104
105 break;
106
107 case WM_COMMAND:
108 //DB_Log(6, "WM_COMMAND");
109
110 // Checkboxes
111 if (HIWORD(wParam) == BN_CLICKED)
112 {
113 switch (LOWORD(wParam))
114 {
115 case IDOK:
116 // Get values from dialog components.
117 g_Configuration.EnableWindowedMode = (SendDlgItemMessage(handle, IDC_WINDOWED, BM_GETCHECK, 0, 0));
118 g_Configuration.ShadowType = (ShadowMode)(SendDlgItemMessage(handle, IDC_SHADOWS, BM_GETCHECK, 0, 0));
119 g_Configuration.EnableCaustics = (SendDlgItemMessage(handle, IDC_CAUSTICS, BM_GETCHECK, 0, 0));

Callers

nothing calls this directly

Calls 6

ToWStringFunction · 0.85
SaveConfigurationFunction · 0.85
GetStringMethod · 0.80
c_strMethod · 0.45

Tested by

no test coverage detected