otvv/fgui

Unable to close menu.

Opened this issue · 2 comments

Once I open the menu I am unable to close it.

My main function:

std::shared_ptr<fgui::container> window;
window = std::make_shared<fgui::container>();
fgui::element_font font;

ADD_WINDOW(window, 10, 10, "fgui", 1280, 720, VK_INSERT, font, true);
REGISTER_CURSOR(fgui::cursor_type::ARROW, fgui::input_state::UNLOCKED);

fgui::handler::render_window();

My key state function:

return g_InputSystem->IsButtonDown(g_InputSystem->VirtualKeyToButtonCode(key));

I've tried to debug handler.cc but I can't find why the window state won't unset.

otvv commented

This shouldn't happen with your "key state" code.
Also, you don't need to initialize the window, since the macro "ADD_WINDOW" does it for you. I'm 50% sure, that this is the cause of this glitch. Feel free to contact me on Discord if the problem persists.

Solution was to not call the macros every frame.