mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-29 12:52:18 -05:00
Use OnGameFrameUpdate for rainbow tick instead of relying on ImGui hidden window (#2872)
This commit is contained in:
parent
d1c930b5e5
commit
85385db099
@ -385,7 +385,7 @@ void ResetPositionAll() {
|
||||
int hue = 0;
|
||||
|
||||
// Runs every frame to update rainbow hue, a potential future optimization is to only run this a once or twice a second and increase the speed of the rainbow hue rotation.
|
||||
void CosmeticsUpdateTick(bool& open) {
|
||||
void CosmeticsUpdateTick() {
|
||||
int index = 0;
|
||||
float rainbowSpeed = CVarGetFloat("gCosmetics.RainbowSpeed", 0.6f);
|
||||
for (auto& [id, cosmeticOption] : cosmeticOptions) {
|
||||
@ -1800,11 +1800,13 @@ void RegisterOnLoadGameHook() {
|
||||
});
|
||||
}
|
||||
|
||||
void InitCosmeticsEditor() {
|
||||
// There's probably a better way to do this, but leaving as is for historical reasons. Even though there is no
|
||||
// real window being rendered here, it calls this every frame allowing us to rotate through the rainbow hue for cosmetics
|
||||
LUS::AddWindow("Enhancements", "Cosmetics Update Tick", CosmeticsUpdateTick, true, true);
|
||||
void RegisterOnGameFrameUpdateHook() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||
CosmeticsUpdateTick();
|
||||
});
|
||||
}
|
||||
|
||||
void InitCosmeticsEditor() {
|
||||
// Draw the bar in the menu.
|
||||
LUS::AddWindow("Enhancements", "Cosmetics Editor", DrawCosmeticsEditor, CVarGetInteger("gCosmeticsEditorEnabled", 0));
|
||||
// Convert the `current color` into the format that the ImGui color picker expects
|
||||
@ -1822,6 +1824,7 @@ void InitCosmeticsEditor() {
|
||||
ApplyAuthenticGfxPatches();
|
||||
|
||||
RegisterOnLoadGameHook();
|
||||
RegisterOnGameFrameUpdateHook();
|
||||
}
|
||||
|
||||
void CosmeticsEditor_RandomizeAll() {
|
||||
|
Loading…
Reference in New Issue
Block a user