This commit is contained in:
JacobTech 2024-11-18 23:24:43 -05:00
parent 5c0ea7cc90
commit a1e3d4cf12
7 changed files with 67 additions and 7 deletions

View File

@ -382,6 +382,9 @@ public class FPSWindow : GameWindow , IWindow
private int frame = 0;
public bool UseLiveView { get; set; } = false;
public bool CollectUpperFiles { get; set; }
public void ReportSizeUpdate(IRenderObject Control)
{

View File

@ -10,7 +10,7 @@
<IncludeSymbols>False</IncludeSymbols>
<RepositoryUrl>https://git.jacobtech.com/JacobTech.com/GraphicsManager</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>1.1.1-alpha29</Version>
<Version>1.1.1-alpha35</Version>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">

View File

@ -28,4 +28,6 @@ public interface IParent
public void ResizeDraw(int x, int y, int sx, int sy, int sw, int sh);
public int OldWidth { get; }
public int OldHeight { get; }
public bool CollectUpperFiles { get; set; }
}

View File

@ -16,6 +16,8 @@ public interface IWindow : IParent
public bool LastFrameIsResize { get; }
public bool UseSubFrames { get; set; }
public bool UseLiveView { get; set; }
public void CheckParent(IParent p, IRenderObject c, int xx, Vector2i di);
public void CheckParent(IParent p);

View File

@ -88,6 +88,15 @@ public abstract class ParentBase : Rectangle, IParent
BaseParentResize();
}
public override void UpdateOpenGLCords(bool draw = false)
{
base.UpdateOpenGLCords(draw);
for (int i = 0; i < Controls.Length; i++)
{
Controls[i].UpdateOpenGLCords();
}
}
public override void SetLocation(int x, int y)
{
base.SetLocation(x, y);
@ -115,8 +124,7 @@ public abstract class ParentBase : Rectangle, IParent
{
DrawBase();
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, sh);
for (int i = 0; i < Controls.Length; i++)
{
if (!Controls[i].Loaded)
@ -136,9 +144,10 @@ public abstract class ParentBase : Rectangle, IParent
}
}
public bool CollectUpperFiles { get; set; }
public virtual bool UpdateScissorBox(ref int x, ref int y, ref int sx, ref int sy, ref int sw, ref int sh, int xx = 0, int xy = 0, int lw = 0, int lh = 0, bool UpdateBoxInfo = true)
{
int nw = Size.X - xx - lw,
nh = Size.Y - xy - lh,
nx = Location.X + xx,

View File

@ -350,12 +350,12 @@ public class Rectangle : ITextureObject
public bool BlendOverride;
public void TryDraw(int deapth = 0)
public virtual void TryDraw(int deapth = 0)
{
if (BlockDraw) return;
if (Parent is null) return;
if (!IsVisible) return;
if (Window is null) return;
if (Window.UseLiveView && !IsVisible) return;
if (!Window.UseSubFrames)
{
Parent.TryDraw();
@ -555,6 +555,7 @@ public class Rectangle : ITextureObject
size_.Y = h;
UpdateOpenGLCords(true);
if (SizeChanged is not null) SizeChanged.Invoke(this);
if (Parent is not null) Parent.ReportSizeUpdate(this);
}
public virtual void SetLocation(int xy)

View File

@ -82,7 +82,50 @@ public class Window : NativeWindow , IWindow
GL.Enable(EnableCap.ScissorTest);
}
protected virtual void OnFileDrop(FileDropEventArgs obj)
{
void CheckFileDrop(IParent p, Vector2i diff)
{
bool found = false;
for (int i = p.Controls.Length - 1; i >= 0; i--)
{
if ((p.Controls[i].Location + diff).X <= (int)MousePosition.X &&
(p.Controls[i].Location + diff).Y <= (int)MousePosition.Y &&
(p.Controls[i].Location + p.Controls[i].Size + diff).X >= (int)MousePosition.X &&
(p.Controls[i].Location + p.Controls[i].Size + diff).Y >= (int)MousePosition.Y)
{
if (p.Controls[i] is IParent pp)
{
if (pp.CollectUpperFiles)
{
found = true;
p.Controls[i].SendFilesEvent(obj.FileNames);
}
else
{
CheckFileDrop(pp, pp.Controls[i].Location + diff);
}
}
else
{
found = true;
p.Controls[i].SendFilesEvent(obj.FileNames);
}
}
}
if (!found && p is IRenderObject renderObject)
{
renderObject.SendFilesEvent(obj.FileNames);
}
}
CheckFileDrop(this, new(0));
}
public bool CollectUpperFiles { get; set; }
public bool UseSubFrames { get; set; } = false;
public bool UseLiveView { get; set; } = false;
private void OnTextInputEvent(TextInputEventArgs obj)
{