fixed - flexible ui

This commit is contained in:
ikpil 2023-06-23 00:00:21 +09:00
parent e6da1bbb7d
commit 828ada3ea4
4 changed files with 36 additions and 18 deletions

View File

@ -362,7 +362,7 @@ public class RecastDemo
dd.Init(camr); dd.Init(camr);
ImGuiFontConfig imGuiFontConfig = new(Path.Combine("resources\\fonts", "DroidSans.ttf"), 24, null); ImGuiFontConfig imGuiFontConfig = new(Path.Combine("resources\\fonts", "DroidSans.ttf"), 16, null);
_imgui = new ImGuiController(_gl, window, _input, imGuiFontConfig); _imgui = new ImGuiController(_gl, window, _input, imGuiFontConfig);
DemoInputGeomProvider geom = LoadInputMesh(Loader.ToBytes("nav_test.obj")); DemoInputGeomProvider geom = LoadInputMesh(Loader.ToBytes("nav_test.obj"));

View File

@ -63,18 +63,23 @@ public class RcLogView : IRcView
public void Draw(double dt) public void Draw(double dt)
{ {
int otherWidth1 = 350; if (!ImGui.Begin("Log"))
int otherWidth2 = 620;
int height = 234;
var width = _canvas.Size.X - (otherWidth1 + otherWidth2);
//var posX = _canvas.Size.X - width;
ImGui.SetNextWindowPos(new Vector2(otherWidth1, _canvas.Size.Y - height));
ImGui.SetNextWindowSize(new Vector2(width, height));
if (!ImGui.Begin("Log", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize))
{ {
ImGui.End(); ImGui.End();
return; return;
} }
// size reset
var size = ImGui.GetItemRectSize();
if (32 >= size.X && 32 >= size.Y)
{
int otherWidth = 310;
int height = 234;
var width = _canvas.Size.X - (otherWidth * 2);
//var posX = _canvas.Size.X - width;
// ImGui.SetNextWindowPos(new Vector2(otherWidth1, _canvas.Size.Y - height));
ImGui.SetWindowSize(new Vector2(width, height));
}
if (ImGui.BeginChild("scrolling", Vector2.Zero, false, ImGuiWindowFlags.HorizontalScrollbar)) if (ImGui.BeginChild("scrolling", Vector2.Zero, false, ImGuiWindowFlags.HorizontalScrollbar))

View File

@ -75,11 +75,17 @@ public class RcSettingsView : IRcView
{ {
var settings = _sample.GetSettings(); var settings = _sample.GetSettings();
int width = 620; ImGui.Begin("Properties");
var posX = _canvas.Size.X - width;
ImGui.SetNextWindowPos(new Vector2(posX, 0)); // size reset
ImGui.SetNextWindowSize(new Vector2(width, _canvas.Size.Y)); var size = ImGui.GetItemRectSize();
ImGui.Begin("Properties", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize); if (32 >= size.X && 32 >= size.Y)
{
int width = 310;
var posX = _canvas.Size.X - width;
//ImGui.SetWindowPos(new Vector2(posX, 0));
ImGui.SetWindowSize(new Vector2(width, _canvas.Size.Y));
}
_isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows); _isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows);

View File

@ -55,10 +55,17 @@ public class RcToolsetView : IRcView
public void Draw(double dt) public void Draw(double dt)
{ {
int width = 350; ImGui.Begin("Tools");
ImGui.SetNextWindowPos(new Vector2(0, 0));
ImGui.SetNextWindowSize(new Vector2(width, _canvas.Size.Y)); // size reset
ImGui.Begin("Tools", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize); var size = ImGui.GetItemRectSize();
if (32 >= size.X && 32 >= size.Y)
{
int width = 310;
//ImGui.SetWindowPos(new Vector2(0, 0));
ImGui.SetWindowSize(new Vector2(width, _canvas.Size.Y));
}
_isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows); _isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows);
for (int i = 0; i < tools.Length; ++i) for (int i = 0; i < tools.Length; ++i)