Skip to content

Commit

Permalink
ctrl s
Browse files Browse the repository at this point in the history
  • Loading branch information
4sval committed Sep 1, 2022
1 parent bb7eaf3 commit 4194052
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
35 changes: 17 additions & 18 deletions FModel/Extensions/ImGuiExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,29 @@ public static void DrawDockSpace(Vector2D<int> size)
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()
Expand Down
2 changes: 1 addition & 1 deletion FModel/Settings/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public bool IsLoggerExpanded
set => SetProperty(ref _isLoggerExpanded, value);
}

private GridLength _avalonImageSize = GridLength.Auto;
private GridLength _avalonImageSize = new (200, GridUnitType.Pixel);
public GridLength AvalonImageSize
{
get => _avalonImageSize;
Expand Down
6 changes: 5 additions & 1 deletion FModel/Views/Snooper/Snooper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ private void OnLoad()
_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();

Expand Down Expand Up @@ -205,6 +208,7 @@ private void ClearWhatHasBeenDrawn()

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))
Expand Down

0 comments on commit 4194052

Please sign in to comment.