50 lines
2.2 KiB
C
50 lines
2.2 KiB
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <reshade.hpp>
|
||
|
|
#include <functional>
|
||
|
|
|
||
|
|
using OSDUpdateFn = std::function<void(reshade::api::effect_runtime*)>;
|
||
|
|
using OSDEndFn = std::function<void(reshade::api::effect_runtime*)>;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Displays an On-Screen Display (OSD) for a specified duration.
|
||
|
|
*
|
||
|
|
* This function triggers an OSD that lasts for `duration` seconds.
|
||
|
|
* During the OSD display, the `onUpdate` callback will be called every frame
|
||
|
|
* with the current `reshade::api::effect_runtime` pointer, allowing shader updates
|
||
|
|
* or other visual effects. When the OSD duration ends, the `onEnd` callback
|
||
|
|
* is executed to perform any cleanup or final state updates.
|
||
|
|
* @param duration Duration in seconds for which the OSD should be visible.
|
||
|
|
* @param onUpdate Callback executed each frame while the OSD is visible.
|
||
|
|
* @param onEnd Callback executed once when the OSD ends or expires.
|
||
|
|
* @note This function only schedules the OSD. The actual frame updates occur
|
||
|
|
* during `UpdateOSD`, which must be called once per frame.
|
||
|
|
* @note Callbacks should be fast and non-blocking.
|
||
|
|
*/
|
||
|
|
void ShowOSD(float duration, OSDUpdateFn onUpdate, OSDEndFn onEnd);
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Updates the OSD system each frame and executes callbacks if needed.
|
||
|
|
*
|
||
|
|
* This function must be called once per frame, typically in `on_reshade_present`,
|
||
|
|
* to update any active OSDs, decrement their timers, and call the
|
||
|
|
* `onUpdate` and `onEnd` callbacks as necessary.
|
||
|
|
* @param runtime Pointer to the current `reshade::api::effect_runtime` object.
|
||
|
|
* @param deltaTime Time elapsed (in seconds) since the last frame.
|
||
|
|
* @note If no OSD is active, this function does nothing.
|
||
|
|
* @note Always call this function after processing hotkeys to ensure proper
|
||
|
|
* timing of OSDs.
|
||
|
|
*/
|
||
|
|
void UpdateOSD(reshade::api::effect_runtime* runtime, float deltaTime);
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Reset all uniform variables enumerated.
|
||
|
|
*
|
||
|
|
* This function must be called once, typically in `on_reshade_begin_effects`,
|
||
|
|
* using an atomic compare-and-exchange operation
|
||
|
|
* @param runtime Pointer to the current `reshade::api::effect_runtime` object.
|
||
|
|
* @param effect_name File name of the effect file to enumerate uniform variables from (eg. myfile.fx)
|
||
|
|
*/
|
||
|
|
void ResetAllUniformVariables(reshade::api::effect_runtime* runtime, const char* effect_name);
|