mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-21 16:09:19 +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>
|
/// </summary>
|
||||||
public string WindowName { get; set; }
|
public string WindowName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether the window is focused.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFocused { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the position of this window.
|
/// Gets or sets the position of this window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -188,8 +193,10 @@ namespace Dalamud.Interface.Windowing
|
||||||
// Draw the actual window contents
|
// Draw the actual window contents
|
||||||
this.Draw();
|
this.Draw();
|
||||||
|
|
||||||
|
this.IsFocused = ImGui.IsWindowFocused();
|
||||||
|
|
||||||
var escapeDown = Service<KeyState>.Get()[VirtualKey.ESCAPE];
|
var escapeDown = Service<KeyState>.Get()[VirtualKey.ESCAPE];
|
||||||
if (escapeDown && ImGui.IsWindowFocused() && !wasEscPressedLastFrame)
|
if (escapeDown && this.IsFocused && !wasEscPressedLastFrame)
|
||||||
{
|
{
|
||||||
this.IsOpen = false;
|
this.IsOpen = false;
|
||||||
wasEscPressedLastFrame = true;
|
wasEscPressedLastFrame = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue