mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-18 00:00:35 -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;
|
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.
|
// 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;
|
int index = 0;
|
||||||
float rainbowSpeed = CVarGetFloat("gCosmetics.RainbowSpeed", 0.6f);
|
float rainbowSpeed = CVarGetFloat("gCosmetics.RainbowSpeed", 0.6f);
|
||||||
for (auto& [id, cosmeticOption] : cosmeticOptions) {
|
for (auto& [id, cosmeticOption] : cosmeticOptions) {
|
||||||
@ -1800,11 +1800,13 @@ void RegisterOnLoadGameHook() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitCosmeticsEditor() {
|
void RegisterOnGameFrameUpdateHook() {
|
||||||
// There's probably a better way to do this, but leaving as is for historical reasons. Even though there is no
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||||
// real window being rendered here, it calls this every frame allowing us to rotate through the rainbow hue for cosmetics
|
CosmeticsUpdateTick();
|
||||||
LUS::AddWindow("Enhancements", "Cosmetics Update Tick", CosmeticsUpdateTick, true, true);
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitCosmeticsEditor() {
|
||||||
// Draw the bar in the menu.
|
// Draw the bar in the menu.
|
||||||
LUS::AddWindow("Enhancements", "Cosmetics Editor", DrawCosmeticsEditor, CVarGetInteger("gCosmeticsEditorEnabled", 0));
|
LUS::AddWindow("Enhancements", "Cosmetics Editor", DrawCosmeticsEditor, CVarGetInteger("gCosmeticsEditorEnabled", 0));
|
||||||
// Convert the `current color` into the format that the ImGui color picker expects
|
// Convert the `current color` into the format that the ImGui color picker expects
|
||||||
@ -1822,6 +1824,7 @@ void InitCosmeticsEditor() {
|
|||||||
ApplyAuthenticGfxPatches();
|
ApplyAuthenticGfxPatches();
|
||||||
|
|
||||||
RegisterOnLoadGameHook();
|
RegisterOnLoadGameHook();
|
||||||
|
RegisterOnGameFrameUpdateHook();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CosmeticsEditor_RandomizeAll() {
|
void CosmeticsEditor_RandomizeAll() {
|
||||||
|
Loading…
Reference in New Issue
Block a user