Document not visually becoming hidden after calling Hide() #530
-
|
I encountered an issue where the document doesn't become hidden after calling Hide() it seems to be a visual issue though because when checking with IsVisible() it does seem to be changing the weird thing though is it only occurs from a specific part of my code. I've created a state manager and the idea was to change the visibility of the document when entering and leaving the state, but when I call Hide() in the leave function it doesn't visually become hidden, but if I were to do it from the enter or init function it does. void init() override {
std::cout << "Menu Initialized.\n";
GameState::init();
document = Game::Instance().GetRmlContext().LoadDocument("Resources/Documents/MainMenu.rml");
}
void enter(GameState* prevState) override {
std::cout << "Entered Menu. Previous state: " << (prevState ? "Exists" : "None") << '\n';
document->Show();
document->Hide(); // Works here
}
void leave() override {
std::cout << "Left Menu.\n";
document->Hide(); // Doesn't work here
}The only potential cause I've been able to find is with the way I wrote my code the rml context isn't updated and rendered after leaving a state here's my output I did a quick hack to be able to update and render the context from the leave function after calling Hide() but that still didn't work so I don't think I'm right about the cause. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Hm, are you saying that after calling And just in general, make sure that Context::Update is called before Context::Render, although I'm not sure if this makes a difference in this case. |
Beta Was this translation helpful? Give feedback.
Hm, are you saying that after calling
leave(), the context is no longer updated or rendered? And yet the document is being rendered? The only reason I can think of is that you keep the framebuffer somewhere that you don't clear, yet keep rendering. RmlUi will not make any render calls if you don't call Context::Render.And just in general, make sure that Context::Update is called before Context::Render, although I'm not sure if this makes a difference in this case.