Skip to content

Commit 77c6a0f

Browse files
authored
Refactor gamma command and UI slider integration
Refactor gamma command to use optional value and update UI slider.
1 parent 4fab338 commit 77c6a0f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

game_patch/graphics/gr.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
#include "legacy/gr_d3d.h"
3636
#include "d3d11/gr_d3d11_hooks.h"
3737

38+
namespace rf {
39+
struct UiSlider;
40+
}
41+
3842
namespace df::gr::d3d11
3943
{
4044
bool set_render_target(int bm_handle);
@@ -221,12 +225,16 @@ ConsoleCommand2 gamma_cmd{
221225
"r_gamma",
222226
[](std::optional<float> value_opt) {
223227
if (value_opt) {
224-
rf::gr::set_gamma(value_opt.value());
228+
rf::gr::set_gamma(*value_opt);
229+
auto& UiSlider_set_value =
230+
addr_as_ref<void __thiscall(rf::UiSlider&, float)>(0x00457EB0);
231+
rf::UiSlider& ui_gamma_slider = addr_as_ref<rf::UiSlider>(0x00640C10);
232+
UiSlider_set_value(ui_gamma_slider, rf::gr::gamma);
225233
}
226234
rf::console::print("Gamma: {:.2f}", rf::gr::gamma);
227235
},
228236
"Sets gamma.",
229-
"gamma [value]",
237+
"gamma [value]",`
230238
};
231239

232240
ConsoleCommand2 colorblind_cmd{

0 commit comments

Comments
 (0)