forked from mirror/DotRecast
fixed - flexible ui
This commit is contained in:
parent
e6da1bbb7d
commit
828ada3ea4
|
@ -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"));
|
||||||
|
|
|
@ -63,19 +63,24 @@ 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))
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,11 +75,17 @@ public class RcSettingsView : IRcView
|
||||||
{
|
{
|
||||||
var settings = _sample.GetSettings();
|
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;
|
var posX = _canvas.Size.X - width;
|
||||||
ImGui.SetNextWindowPos(new Vector2(posX, 0));
|
//ImGui.SetWindowPos(new Vector2(posX, 0));
|
||||||
ImGui.SetNextWindowSize(new Vector2(width, _canvas.Size.Y));
|
ImGui.SetWindowSize(new Vector2(width, _canvas.Size.Y));
|
||||||
ImGui.Begin("Properties", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize);
|
}
|
||||||
|
|
||||||
_isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows);
|
_isHovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.RectOnly | ImGuiHoveredFlags.RootAndChildWindows);
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue