Add Hotkeys and OSD manager libs

This commit is contained in:
2026-01-04 21:28:36 +01:00
parent 526028dcc2
commit 2ae5d4462f
2 changed files with 65 additions and 0 deletions

33
libs/OSDManager.cpp Normal file
View File

@@ -0,0 +1,33 @@
#include "OSDManager.h"
static float g_timer = 0.0f;
static OSDUpdateFn g_onUpdate;
static OSDEndFn g_onEnd;
void ShowOSD(float duration, OSDUpdateFn onUpdate, OSDEndFn onEnd) {
g_timer = duration;
g_onUpdate = std::move(onUpdate);
g_onEnd = std::move(onEnd);
}
void UpdateOSD(reshade::api::effect_runtime* runtime, float deltaTime) {
if (g_timer <= 0.0f) return;
g_timer -= deltaTime;
if (g_onUpdate) g_onUpdate(runtime);
if (g_timer <= 0.0f) {
if (g_onEnd) g_onEnd(runtime);
g_onUpdate = nullptr;
g_onEnd = nullptr;
}
}
void ResetAllUniformVariables(reshade::api::effect_runtime* runtime, const char* effect_name) {
runtime->enumerate_uniform_variables(effect_name, [runtime](reshade::api::effect_runtime* rt, reshade::api::effect_uniform_variable OSDvar) {
runtime->reset_uniform_value(OSDvar);
});
}