This commit is contained in:
4sval
2022-09-01 20:53:05 +02:00
parent bb7eaf3e15
commit 4194052eed
3 changed files with 23 additions and 20 deletions

View File

@@ -23,30 +23,29 @@ public static class ImGuiExtensions
ImGui.SetNextWindowPos(new Vector2(0, 0));
ImGui.SetNextWindowSize(new Vector2(size.X, size.Y));
ImGui.Begin("Snooper", flags);
ImGui.DockSpace(ImGui.GetID("Snooper"));
ImGui.DockSpace(0);
}
public static void DrawNavbar()
{
if (ImGui.BeginMainMenuBar())
if (!ImGui.BeginMainMenuBar()) return;
if (ImGui.BeginMenu("Edit"))
{
if (ImGui.BeginMenu("Edit"))
{
if (ImGui.MenuItem("Undo", "CTRL+Z")) {}
if (ImGui.MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item
ImGui.Separator();
if (ImGui.MenuItem("Cut", "CTRL+X")) {}
if (ImGui.MenuItem("Copy", "CTRL+C")) {}
if (ImGui.MenuItem("Paste", "CTRL+V")) {}
ImGui.EndMenu();
}
const string text = "Press ESC to Exit...";
ImGui.SetCursorPosX(ImGui.GetWindowViewport().WorkSize.X - ImGui.CalcTextSize(text).X - 5);
ImGui.TextColored(new Vector4(0.36f, 0.42f, 0.47f, 1.00f), text); // ImGuiCol.TextDisabled
ImGui.EndMainMenuBar();
if (ImGui.MenuItem("Undo", "CTRL+Z")) {}
if (ImGui.MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item
ImGui.Separator();
if (ImGui.MenuItem("Cut", "CTRL+X")) {}
if (ImGui.MenuItem("Copy", "CTRL+C")) {}
if (ImGui.MenuItem("Paste", "CTRL+V")) {}
ImGui.EndMenu();
}
const string text = "Press ESC to Exit...";
ImGui.SetCursorPosX(ImGui.GetWindowViewport().WorkSize.X - ImGui.CalcTextSize(text).X - 5);
ImGui.TextColored(new Vector4(0.36f, 0.42f, 0.47f, 1.00f), text); // ImGuiCol.TextDisabled
ImGui.EndMainMenuBar();
}
public static void DrawFPS()

View File

@@ -140,7 +140,7 @@ namespace FModel.Settings
set => SetProperty(ref _isLoggerExpanded, value);
}
private GridLength _avalonImageSize = GridLength.Auto;
private GridLength _avalonImageSize = new (200, GridUnitType.Pixel);
public GridLength AvalonImageSize
{
get => _avalonImageSize;

View File

@@ -127,7 +127,10 @@ public class Snooper
_gl = GL.GetApi(_window);
_gl.Enable(EnableCap.Multisample);
_controller = new ImGuiController(_gl, _window, input);
// we don't need to bother with file check
// but keep an eye on font size for different monitors
var fontConfig = new ImGuiFontConfig("C:\\Windows\\Fonts\\segoeui.ttf", 16);
_controller = new ImGuiController(_gl, _window, input, fontConfig);
ImGuiExtensions.Theme();
@@ -205,6 +208,7 @@ public class Snooper
private void OnUpdate(double deltaTime)
{
if (ImGui.GetIO().WantTextInput) return;
var multiplier = _keyboard.IsKeyPressed(Key.ShiftLeft) ? 2f : 1f;
var moveSpeed = _camera.Speed * multiplier * (float) deltaTime;
if (_keyboard.IsKeyPressed(Key.W))