mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Moved play buttons into main menu
This commit is contained in:
@@ -1157,15 +1157,12 @@ namespace GlitchyEditor
|
|||||||
_settingsWindow.Show();
|
_settingsWindow.Show();
|
||||||
ShowCreateNewProjectModal();
|
ShowCreateNewProjectModal();
|
||||||
|
|
||||||
ShowPlayControls();
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Shows the window with Play/Pause, etc. buttons
|
/// Shows the window with Play/Pause, etc. buttons
|
||||||
private void ShowPlayControls()
|
private void ShowPlayControls()
|
||||||
{
|
{
|
||||||
ImGui.PushStyleVar(.WindowPadding, ImGui.Vec2(0, 2));
|
|
||||||
ImGui.PushStyleVar(.ItemInnerSpacing, ImGui.Vec2(0, 0));
|
ImGui.PushStyleVar(.ItemInnerSpacing, ImGui.Vec2(0, 0));
|
||||||
ImGui.PushStyleColor(.Button, ImGui.Vec4(0, 0, 0, 0));
|
ImGui.PushStyleColor(.Button, ImGui.Vec4(0, 0, 0, 0));
|
||||||
|
|
||||||
@@ -1180,8 +1177,6 @@ namespace GlitchyEditor
|
|||||||
ImGui.PushStyleColor(.ButtonHovered, hoveredColor);
|
ImGui.PushStyleColor(.ButtonHovered, hoveredColor);
|
||||||
ImGui.PushStyleColor(.ButtonActive, activeColor);
|
ImGui.PushStyleColor(.ButtonActive, activeColor);
|
||||||
|
|
||||||
ImGui.Begin("##toolbar", null, .NoDecoration | .NoScrollbar | .NoScrollWithMouse);
|
|
||||||
|
|
||||||
float padding = 2.0f;
|
float padding = 2.0f;
|
||||||
|
|
||||||
float size = ImGui.GetWindowHeight() - 2 * padding;
|
float size = ImGui.GetWindowHeight() - 2 * padding;
|
||||||
@@ -1247,8 +1242,6 @@ namespace GlitchyEditor
|
|||||||
totalWidth = size * 3 + padding * 4;
|
totalWidth = size * 3 + padding * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display the buttons for play/simulation state
|
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.SetCursorPosX(centerX - totalWidth / 2.0f);
|
ImGui.SetCursorPosX(centerX - totalWidth / 2.0f);
|
||||||
|
|
||||||
@@ -1279,17 +1272,38 @@ namespace GlitchyEditor
|
|||||||
|
|
||||||
if (ImGui.BeginPopupContextItem())
|
if (ImGui.BeginPopupContextItem())
|
||||||
{
|
{
|
||||||
ImGui.TextUnformatted("Time step:");
|
if (ImGui.BeginTable("time_step_table", 2))
|
||||||
ImGui.SameLine();
|
|
||||||
ImGui.DragFloat("##timestep", &_fixedTimestep, 0.001f, 0.001f, 1000.0f, "%.4fs");
|
|
||||||
|
|
||||||
float fps = 1.0f / _fixedTimestep;
|
|
||||||
|
|
||||||
ImGui.TextUnformatted("Frame rate:");
|
|
||||||
ImGui.SameLine();
|
|
||||||
if (ImGui.DragFloat("##fps", &fps, 1.0f, 0.001f, 1000.0f, "%.3f FPS"))
|
|
||||||
{
|
{
|
||||||
_fixedTimestep = 1.0f / fps;
|
ImGui.TableNextRow();
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
|
||||||
|
ImGui.TextUnformatted("Time step:");
|
||||||
|
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
|
||||||
|
float itemWidth = ImGui.CalcTextSize("1000.000 FPS").x;
|
||||||
|
|
||||||
|
ImGui.SetNextItemWidth(itemWidth);
|
||||||
|
|
||||||
|
ImGui.DragFloat("##timestep", &_fixedTimestep, 0.001f, 0.001f, 1000.0f, "%.4fs");
|
||||||
|
|
||||||
|
ImGui.TableNextRow();
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
|
||||||
|
float fps = 1.0f / _fixedTimestep;
|
||||||
|
|
||||||
|
ImGui.TextUnformatted("Frame rate:");
|
||||||
|
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
|
||||||
|
ImGui.SetNextItemWidth(itemWidth);
|
||||||
|
|
||||||
|
if (ImGui.DragFloat("##fps", &fps, 1.0f, 0.001f, 1000.0f, "%.3f FPS"))
|
||||||
|
{
|
||||||
|
_fixedTimestep = 1.0f / fps;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndPopup();
|
ImGui.EndPopup();
|
||||||
@@ -1311,10 +1325,8 @@ namespace GlitchyEditor
|
|||||||
ImGui.AttachTooltip("Stop");
|
ImGui.AttachTooltip("Stop");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.End();
|
|
||||||
|
|
||||||
ImGui.PopStyleColor(3);
|
ImGui.PopStyleColor(3);
|
||||||
ImGui.PopStyleVar(2);
|
ImGui.PopStyleVar(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowOpenRecentSceneMenu()
|
private void ShowOpenRecentSceneMenu()
|
||||||
@@ -1431,7 +1443,7 @@ namespace GlitchyEditor
|
|||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
if (ImGui.MenuItem("Exit"))
|
if (ImGui.MenuItem("Exit"))
|
||||||
Application.Get().Close();
|
Application.Instance.Close();
|
||||||
|
|
||||||
ImGui.EndMenu();
|
ImGui.EndMenu();
|
||||||
}
|
}
|
||||||
@@ -1477,6 +1489,8 @@ namespace GlitchyEditor
|
|||||||
ImGui.EndMenu();
|
ImGui.EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ShowPlayControls();
|
||||||
|
|
||||||
ImGui.EndMainMenuBar();
|
ImGui.EndMainMenuBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user