Disable input white QuickMenu is open

This commit is contained in:
Stone_Red
2023-10-05 12:30:06 +02:00
parent ea6445a4ea
commit ee081cbcf9
2 changed files with 13 additions and 0 deletions
+1
View File
@@ -24,6 +24,7 @@ internal class Srls : Game
private SrlsWindow? currentSrlsWindow = null;
private SrlsScreen? currentSrlsScreen = null;
public float Scale { get; private set; }
public bool WindowOpen => currentSrlsWindow is not null;
public GraphicsDeviceManager Graphics { get; }
public Desktop Desktop { get; private set; } = null!;
@@ -36,8 +36,11 @@ internal class WorldScreen : SrlsScreen<Grid>
private SpinButton frequency = null!;
private CheckBox highPerformance = null!;
private ListBox nativeComponentsListBox = null!;
private float fps;
private bool blockInput;
private MouseStateExtended previousMouseState;
private ConnectionContext? connectionContext = null;
@@ -183,6 +186,12 @@ internal class WorldScreen : SrlsScreen<Grid>
upsLabel.Font = srls.FontSystem.GetFont(10 * srls.Scale);
positionLabel.Font = srls.FontSystem.GetFont(10 * srls.Scale);
if (blockInput)
{
blockInput = srls.WindowOpen;
return;
}
MouseStateExtended mouseState = MouseExtended.GetState();
KeyboardStateExtended keyboardState = KeyboardExtended.GetState();
@@ -248,8 +257,11 @@ internal class WorldScreen : SrlsScreen<Grid>
if (keyboardState.IsKeyDown(Keys.Q))
{
blockInput = true;
UnSelectLogicGate();
worldData.LogicGates = simulator.GetLogicGates();
srls.ShowWindow(new QuickMenu(worldData));
}