added method for requesting imgui focus
This commit is contained in:
parent
01ef5c4e1c
commit
bd1031139f
@ -13,6 +13,7 @@
|
||||
Input::Input(sf::Window *w) :
|
||||
m_window(w),
|
||||
m_closeRequested(false),
|
||||
m_imgui_requested_focus(false),
|
||||
m_mouseGrabbed(false),
|
||||
m_mouseWasGrabbed(false)
|
||||
{
|
||||
@ -71,9 +72,9 @@ void Input::updateEvents(){
|
||||
m_actions.clear();
|
||||
|
||||
Action action;
|
||||
|
||||
|
||||
bool focus_on_imgui = ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow);
|
||||
bool focus_on_imgui = false;
|
||||
if(m_imgui_requested_focus)
|
||||
focus_on_imgui = ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow);
|
||||
if(focus_on_imgui)
|
||||
std::cout << "focused" << std::endl;
|
||||
|
||||
@ -258,6 +259,14 @@ bool Input::isResized() const
|
||||
return m_hasBeenResized;
|
||||
}
|
||||
|
||||
void Input::ImguiRequestFocus(){
|
||||
m_imgui_requested_focus = true;
|
||||
}
|
||||
|
||||
void Input::ImguiReleaseFocus(){
|
||||
m_imgui_requested_focus = false;
|
||||
}
|
||||
|
||||
/* keyboard-related functions */
|
||||
|
||||
bool Input::isKeyPressed(int key) const
|
||||
|
@ -18,6 +18,7 @@ private:
|
||||
sf::Window* m_window;
|
||||
bool m_closeRequested;
|
||||
bool m_hasBeenResized;
|
||||
bool m_imgui_requested_focus;
|
||||
|
||||
/* general action-mapping variables */
|
||||
IKeysMap m_keysmap;
|
||||
@ -69,6 +70,8 @@ public:
|
||||
/* window-related function */
|
||||
bool isCloseRequested() const;
|
||||
bool isResized() const;
|
||||
void ImguiRequestFocus();
|
||||
void ImguiReleaseFocus();
|
||||
|
||||
/* keyboard-related functions */
|
||||
bool isKeyPressed(int key) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user