win32: Shaders: Save parameters and restore on cancel.

Also, change "Parameters" button to "Parameters..." to indicate
it opens a dialog box.
This commit is contained in:
Brandon Wright 2019-02-02 16:50:24 -06:00
parent e678ad558d
commit 93a4cdea96
3 changed files with 7 additions and 1 deletions

View File

@ -164,11 +164,16 @@ CShaderParamDlg::~CShaderParamDlg()
bool CShaderParamDlg::show() bool CShaderParamDlg::show()
{ {
saved_parameters = shader.param;
if(DialogBoxParam(GUI.hInstance, MAKEINTRESOURCE(IDD_DIALOG_SHADER_PARAMS), GUI.hWnd, DlgShaderParams, (LPARAM)this) == IDOK) if(DialogBoxParam(GUI.hInstance, MAKEINTRESOURCE(IDD_DIALOG_SHADER_PARAMS), GUI.hWnd, DlgShaderParams, (LPARAM)this) == IDOK)
{ {
save_custom_shader(); save_custom_shader();
return true; return true;
} }
shader.param = saved_parameters;
WinRefreshDisplay();
return false; return false;
} }

View File

@ -20,6 +20,7 @@ private:
unsigned int avgCharWidth; unsigned int avgCharWidth;
unsigned int avgCharHeight; unsigned int avgCharHeight;
int scrollpos; int scrollpos;
std::vector<GLSLParam> saved_parameters;
WNDPROC oldStaticProc; WNDPROC oldStaticProc;

View File

@ -222,7 +222,7 @@ BEGIN
CONTROL "Reduce Input Lag",IDC_REDUCEINPUTLAG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,118,76,10 CONTROL "Reduce Input Lag",IDC_REDUCEINPUTLAG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,118,76,10
CONTROL "Scale messages with EPX if possible",IDC_MESSAGES_SCALE, CONTROL "Scale messages with EPX if possible",IDC_MESSAGES_SCALE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,162,153,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,162,153,10
PUSHBUTTON "Parameters",IDC_SHADER_GLSL_PARAMETERS,112,222,49,12,WS_DISABLED PUSHBUTTON "Parameters...",IDC_SHADER_GLSL_PARAMETERS,112,222,60,12,WS_DISABLED
END END
IDD_CHEATER DIALOGEX 0, 0, 375, 194 IDD_CHEATER DIALOGEX 0, 0, 375, 194