dlgconfigvideotab.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : commando *
  23. * *
  24. * $Archive:: /Commando/Code/Commando/dlgconfigvideotab.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 12/21/01 5:52p $*
  29. * *
  30. * $Revision:: 5 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __DLGCONFIGVIDEOTAB_H
  39. #define __DLGCONFIGVIDEOTAB_H
  40. // Includes.
  41. #include "childdialog.h"
  42. #include "dx8wrapper.h"
  43. // Defines.
  44. #define GAMMA_SLIDER_MIN 60
  45. #define GAMMA_SLIDER_DEFAULT 90
  46. #define GAMMA_SLIDER_MAX 210
  47. #define BRIGHTNESS_SLIDER_MIN -45
  48. #define BRIGHTNESS_SLIDER_DEFAULT 0
  49. #define BRIGHTNESS_SLIDER_MAX 45
  50. #define CONTRAST_SLIDER_MIN 50
  51. #define CONTRAST_SLIDER_DEFAULT 130
  52. #define CONTRAST_SLIDER_MAX 200
  53. //////////////////////////////////////////////////////////////////////
  54. //
  55. // DlgConfigVideoTabClass
  56. //
  57. //////////////////////////////////////////////////////////////////////
  58. class DlgConfigVideoTabClass : public ChildDialogClass
  59. {
  60. public:
  61. ///////////////////////////////////////////////////////////////////
  62. // Public constructors/destructors
  63. ///////////////////////////////////////////////////////////////////
  64. DlgConfigVideoTabClass (void);
  65. ~DlgConfigVideoTabClass (void);
  66. ///////////////////////////////////////////////////////////////////
  67. // Public methods
  68. ///////////////////////////////////////////////////////////////////
  69. //
  70. // Inherited
  71. //
  72. void On_Init_Dialog (void);
  73. void On_Destroy (void);
  74. void On_SliderCtrl_Pos_Changed (SliderCtrlClass *slider_ctrl, int ctrl_id, int new_pos);
  75. //
  76. // Gamma adjustments
  77. //
  78. static int Get_Gamma (void) { return GammaLevel; }
  79. static void Set_Gamma (int level) { GammaLevel = level; Update_Gamma();}
  80. static int Get_Brightness (void) { return BrightnessLevel; }
  81. static void Set_Brightness (int level) { BrightnessLevel = level; Update_Gamma();}
  82. static int Get_Contrast (void) { return ContrastLevel; }
  83. static void Set_Contrast (int level) { ContrastLevel = level; Update_Gamma();}
  84. protected:
  85. bool UpdateGamma;
  86. ///////////////////////////////////////////////////////////////////
  87. // Protected methods
  88. ///////////////////////////////////////////////////////////////////
  89. static float Gamma_Scale (int level);
  90. static void Update_Gamma();
  91. static void Update_Gamma (int g, int b, int c);
  92. ///////////////////////////////////////////////////////////////////
  93. // Protected member data
  94. ///////////////////////////////////////////////////////////////////
  95. static int GammaLevel;
  96. static int BrightnessLevel;
  97. static int ContrastLevel;
  98. };
  99. inline float DlgConfigVideoTabClass::Gamma_Scale (int level)
  100. {
  101. return (level * 0.01f);
  102. }
  103. inline void DlgConfigVideoTabClass::Update_Gamma()
  104. {
  105. DX8Wrapper::Set_Gamma (Gamma_Scale (GammaLevel), Gamma_Scale (BrightnessLevel), Gamma_Scale (ContrastLevel), true, false);
  106. }
  107. inline void DlgConfigVideoTabClass::Update_Gamma (int g, int b, int c)
  108. {
  109. DX8Wrapper::Set_Gamma (Gamma_Scale (g), Gamma_Scale (b), Gamma_Scale (c), true, false);
  110. }
  111. #endif //__DLGCONFIGVIDEOTAB_H