ParameterSettingDlg.cpp
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:4k
源码类别:

游戏

开发平台:

Visual C++

  1. // ParameterSettingDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CartonRipple.h"
  5. #include "ParameterSettingDlg.h"
  6. #include "CartonRippleView.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CParameterSettingDlg dialog
  14. CParameterSettingDlg::CParameterSettingDlg(CWnd* pParent /*=NULL*/)
  15. : CDialog(CParameterSettingDlg::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(CParameterSettingDlg)
  18. // NOTE: the ClassWizard will add member initialization here
  19. //}}AFX_DATA_INIT
  20. }
  21. void CParameterSettingDlg::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(CParameterSettingDlg)
  25. // NOTE: the ClassWizard will add DDX and DDV calls here
  26. //}}AFX_DATA_MAP
  27. }
  28. BEGIN_MESSAGE_MAP(CParameterSettingDlg, CDialog)
  29. //{{AFX_MSG_MAP(CParameterSettingDlg)
  30. ON_WM_HSCROLL()
  31. //}}AFX_MSG_MAP
  32. END_MESSAGE_MAP()
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CParameterSettingDlg message handlers
  35. void CParameterSettingDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
  36. {
  37. // TODO: Add your message handler code here and/or call default
  38. int ID=pScrollBar->GetDlgCtrlID();
  39. int value=((CSliderCtrl*)pScrollBar)->GetPos();
  40. int min,max;
  41. ((CSliderCtrl*)pScrollBar)->GetRange(min,max);
  42. switch(ID)
  43. {
  44. case IDC_DAMP_SLIDE:
  45. m_pView->m_myWater.m_density=value;
  46. break;
  47. case IDC_RAIN_DROP_SLIDE:
  48. m_pView->m_iRainFrequency=value;
  49. m_pView->ResetRainEffect();
  50. break;
  51. case IDC_CLICK_WAVE_RADIUS:
  52. m_pView->m_iMouseClickedRadius=value;
  53. break;
  54. case IDC_CLICK_WAVE_AMPLITUDE:
  55. m_pView->m_iMouseClickedHeight=value;
  56. break;
  57. case IDC_MOVE_WAVE_RADIUS:
  58. m_pView->m_iMouseMoveRadius=value;
  59. break;
  60. case IDC_MOVE_WAVE_AMPLITUDE:
  61. m_pView->m_iMouseMoveHeight=value;
  62. break;
  63. case IDC__AB_PROPORTION:
  64. m_pView->m_myWater.m_ABProportion=value/100.0;
  65. break;
  66. case IDC__REFRESH_FREQUENCY:
  67. m_pView->m_iRefreshFrequency=value;
  68. m_pView->ResetRefreshFrequency();
  69. break;
  70. }
  71. CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
  72. }
  73. BOOL CParameterSettingDlg::OnInitDialog() 
  74. {
  75. CDialog::OnInitDialog();
  76. // TODO: Add extra initialization here
  77. //设置阻尼系数滑动条
  78. CSliderCtrl * slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC_DAMP_SLIDE));
  79. slide->SetRange(1,10);
  80. slide->SetPos(5);
  81. //设置新生雨滴的降落时间间隔
  82. slide= static_cast<CSliderCtrl * >(GetDlgItem(IDC_RAIN_DROP_SLIDE));
  83. slide->SetRange(50,500);//
  84. slide->SetPos(100);
  85. //设置鼠标点击后生成的水波的半径
  86. slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC_CLICK_WAVE_RADIUS));
  87. slide->SetRange(20,200);
  88. slide->SetPos(50);
  89. //设置鼠标点击后生成的水波的振幅
  90. slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC_CLICK_WAVE_AMPLITUDE));
  91. slide->SetRange(50,600);
  92. slide->SetPos(100);
  93. //设置鼠标移动后生成的水波的半径
  94. slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC_MOVE_WAVE_RADIUS));
  95. slide->SetRange(3,40);
  96. slide->SetPos(5);
  97. //设置鼠标移动后生成的水波的振幅
  98. slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC_MOVE_WAVE_AMPLITUDE));
  99. slide->SetRange(40,400);
  100. slide->SetPos(50);
  101. slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC__AB_PROPORTION));
  102. slide->SetRange(30,600);
  103. slide->SetPos(100);
  104. slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC__REFRESH_FREQUENCY));
  105. slide->SetRange(10,100);
  106. slide->SetPos(30);
  107. return TRUE;  // return TRUE unless you set the focus to a control
  108.               // EXCEPTION: OCX Property Pages should return FALSE
  109. }