mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
feat: add Window.IsFocused
This commit is contained in:
parent
d2597f7520
commit
d5d18e1712
1 changed files with 8 additions and 1 deletions
|
|
@ -43,6 +43,11 @@ namespace Dalamud.Interface.Windowing
|
|||
/// </summary>
|
||||
public string WindowName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the window is focused.
|
||||
/// </summary>
|
||||
public bool IsFocused { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the position of this window.
|
||||
/// </summary>
|
||||
|
|
@ -188,8 +193,10 @@ namespace Dalamud.Interface.Windowing
|
|||
// Draw the actual window contents
|
||||
this.Draw();
|
||||
|
||||
this.IsFocused = ImGui.IsWindowFocused();
|
||||
|
||||
var escapeDown = Service<KeyState>.Get()[VirtualKey.ESCAPE];
|
||||
if (escapeDown && ImGui.IsWindowFocused() && !wasEscPressedLastFrame)
|
||||
if (escapeDown && this.IsFocused && !wasEscPressedLastFrame)
|
||||
{
|
||||
this.IsOpen = false;
|
||||
wasEscPressedLastFrame = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue