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);
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);
DemoInputGeomProvider geom = LoadInputMesh(Loader.ToBytes("nav_test.obj"));

View File

@ -63,19 +63,24 @@ public class RcLogView : IRcView
public void Draw(double dt)
{
int otherWidth1 = 350;
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))
if (!ImGui.Begin("Log"))
{
ImGui.End();
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))
{

View File

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

View File

@ -55,10 +55,17 @@ public class RcToolsetView : IRcView
public void Draw(double dt)
{
int width = 350;
ImGui.SetNextWindowPos(new Vector2(0, 0));
ImGui.SetNextWindowSize(new Vector2(width, _canvas.Size.Y));
ImGui.Begin("Tools", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize);
ImGui.Begin("Tools");
// size reset
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);
for (int i = 0; i < tools.Length; ++i)