Prep for project
This commit is contained in:
parent
dff9100cf0
commit
dc4d86ce26
@ -15,22 +15,11 @@ public class UpdaterSettings
|
||||
[SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)]
|
||||
public bool SelfContained { get; set; } = false;
|
||||
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("updater")]
|
||||
[SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)]
|
||||
public string? Updater { get; set; } = null;
|
||||
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("platform")]
|
||||
[SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)]
|
||||
public string Platform { get; set; } = "linux-x64";
|
||||
|
||||
[JsonInclude]
|
||||
[Shared.GlobalAttributes.DisplayName("Auto Launch")]
|
||||
[Description("Tells the updater to relaunch the app after the update is complete.")]
|
||||
[JsonPropertyName("auto_launch")]
|
||||
[SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)]
|
||||
public bool AutoLaunch { get; set; } = true;
|
||||
[JsonInclude]
|
||||
[Description("If the app can check for updates and an update is available, then the app will start the update process automatically.")]
|
||||
[Shared.GlobalAttributes.DisplayName("Auto Update")]
|
||||
|
@ -12,7 +12,7 @@ public static class SettingsPage
|
||||
new SettingPageStruct()
|
||||
{
|
||||
Name = "Updater Config",
|
||||
Page = new Updater()
|
||||
Page = new GUI.MainScreen.UI.LuskiSettings.Pages.AdvancedSettings.Updater()
|
||||
},
|
||||
new SettingPageStruct()
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ public class AddServerIcon : UserControl
|
||||
{
|
||||
Button = new(Globals.ms.TextureManager.GetTextureResource("add.png"))
|
||||
{
|
||||
Location = new(18.ScaleInt(), 8.ScaleInt(), 0),
|
||||
Location = new(18.ScaleInt(), 8.ScaleInt()),
|
||||
Size = new(32.ScaleInt()),
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
BackgroundColor = Color4.White,
|
||||
|
@ -48,7 +48,7 @@ public class AddServerOverlayForm : UserControl
|
||||
TextureDisplay = TextureDisplay.Center;
|
||||
Label t;
|
||||
Controls.Add(t=new Label(Globals.DefaultFont) { Scale = 1.6f, Text = "Add Server", Color = Globals.DodgerBlue });
|
||||
t.Location = new((base.Size.X / 2) - (t.Size.X / 2), t.Location.Y, 0);
|
||||
t.Location = new((base.Size.X / 2) - (t.Size.X / 2), t.Location.Y);
|
||||
|
||||
Label? ll = new Label(Globals.DefaultFont)
|
||||
{
|
||||
@ -69,7 +69,7 @@ public class AddServerOverlayForm : UserControl
|
||||
|
||||
tb = new("BadTextbox.png")
|
||||
{
|
||||
Location = new(ten,50.ScaleInt(), 0),
|
||||
Location = new(ten,50.ScaleInt()),
|
||||
Size = (base.Size.X - ten - ten - ten - s.X, s.Y),
|
||||
WatermarkText = "Server Address",
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
@ -126,7 +126,7 @@ public class AddServerOverlayForm : UserControl
|
||||
BackgroundColor = new(255,20,20,255),
|
||||
TextureDisplay = TextureDisplay.HorizontalCenter,
|
||||
Shader = Shader,
|
||||
Location = new(tb.Location.X + tb.Size.X + tb.Location.X, tb.Location.Y, 0)
|
||||
Location = new(tb.Location.X + tb.Size.X + tb.Location.X, tb.Location.Y)
|
||||
};
|
||||
|
||||
foreach (string v in Globals.Luski.SupportedVersions)
|
||||
@ -145,8 +145,7 @@ public class AddServerOverlayForm : UserControl
|
||||
|
||||
};
|
||||
ll2.Location = new((version.Size.X / 2) - (ll2.Size.X / 2),
|
||||
((version.Size.Y - ll2.Size.Y) / 2)
|
||||
, 0);
|
||||
((version.Size.Y - ll2.Size.Y) / 2));
|
||||
version.Controls.Add(ll2);
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -189,7 +188,7 @@ public class AddServerOverlayForm : UserControl
|
||||
|
||||
btn = new(Globals.ms.TextureManager.GetTextureResource("BadTextbox.png"))
|
||||
{
|
||||
Location = new(tb.Location.X, tb.Location.Y + tb.Size.Y + tb.Location.X, 0),
|
||||
Location = new(tb.Location.X, tb.Location.Y + tb.Size.Y + tb.Location.X),
|
||||
Size = new(tb.Size.X, tb.Size.Y),
|
||||
TextureDisplay = TextureDisplay.Center
|
||||
};
|
||||
@ -199,8 +198,7 @@ public class AddServerOverlayForm : UserControl
|
||||
IgnoreHover = true
|
||||
};
|
||||
sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2),
|
||||
((btn.Size.Y - sub.Size.Y) / 2)
|
||||
, 0);
|
||||
((btn.Size.Y - sub.Size.Y) / 2));
|
||||
sub.ForceDistanceUpdate(btn);
|
||||
btn.Controls.Add(sub);
|
||||
Controls.Add(btn);
|
||||
|
@ -39,7 +39,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
};
|
||||
Label t;
|
||||
Form.Controls.Add(t=new Label(Globals.DefaultFont) { Scale = 1.6f, Text = "Add Server", Color = Globals.DodgerBlue });
|
||||
t.Location = new((Form.Size.X / 2) - (t.Size.X / 2), t.Location.Y, 0);
|
||||
t.Location = new((Form.Size.X / 2) - (t.Size.X / 2), t.Location.Y);
|
||||
|
||||
#region Server Loc
|
||||
Label? ll = new Label(Globals.DefaultFont)
|
||||
@ -59,7 +59,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
|
||||
tb = new()
|
||||
{
|
||||
Location = new(10.ScaleInt(),50.ScaleInt(), 0),
|
||||
Location = new(10.ScaleInt(),50.ScaleInt()),
|
||||
Size = s,
|
||||
WatermarkText = "Server Address",
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
@ -117,7 +117,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
BackgroundColor = new(255,20,20,255),
|
||||
TextureDisplay = TextureDisplay.HorizontalCenter,
|
||||
Shader = Form.Shader,
|
||||
Location = new(tb.Location.X + tb.Size.X + tb.Location.X, tb.Location.Y, 0)
|
||||
Location = new(tb.Location.X + tb.Size.X + tb.Location.X, tb.Location.Y)
|
||||
};
|
||||
foreach (string v in Globals.Luski.SupportedVersions)
|
||||
{
|
||||
@ -135,8 +135,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
|
||||
};
|
||||
ll2.Location = new((version.Size.X / 2) - (ll2.Size.X / 2),
|
||||
((version.Size.Y - ll2.Size.Y) / 2)
|
||||
, 0);
|
||||
((version.Size.Y - ll2.Size.Y) / 2));
|
||||
version.Controls.Add(ll2);
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -183,13 +182,13 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
|
||||
AccountButton ca = new AccountButton("Create Account", this)
|
||||
{
|
||||
Location = new(tb.Location.X, tb.Location.Y + tb.Location.X + tb.Size.Y, 0),
|
||||
Location = new(tb.Location.X, tb.Location.Y + tb.Location.X + tb.Size.Y),
|
||||
OnPageLoad = () =>
|
||||
{
|
||||
btn!.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
|
||||
page!.Controls.Add(UserName = new()
|
||||
{
|
||||
Location = new(0, 10.ScaleInt(), 0),
|
||||
Location = new(0, 10.ScaleInt()),
|
||||
Size = new(page.Size.X, 30.ScaleInt()),
|
||||
WatermarkText = "Username",
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
@ -243,7 +242,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
|
||||
page.Controls.Add(Password = new()
|
||||
{
|
||||
Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y, 0),
|
||||
Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y),
|
||||
Size = new(page.Size.X, UserName.Size.Y),
|
||||
WatermarkText = "Password",
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
@ -302,11 +301,11 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
IgnoreHover = false
|
||||
});
|
||||
rec.Location = new(page.Size.X - rec.Size.X, page.Size.Y - rec.Size.Y, 0);
|
||||
rec.Location = new(page.Size.X - rec.Size.X, page.Size.Y - rec.Size.Y);
|
||||
|
||||
page.Controls.Add(DisplayName = new()
|
||||
{
|
||||
Location = new(0, Password.Location.Y + Password.Size.Y + UserName.Location.Y + UserName.Location.Y, 0),
|
||||
Location = new(0, Password.Location.Y + Password.Size.Y + UserName.Location.Y + UserName.Location.Y),
|
||||
Size = new(page.Size.X- tb.Location.X - rec.Size.X, Password.Size.Y ),
|
||||
WatermarkText = "Display Name",
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
@ -358,20 +357,19 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
};
|
||||
ca.Size = new((Form.Size.X - tb.Location.X - tb.Location.X - (tb.Location.X / 2)) / 2, ca.Size.Y);
|
||||
ca.l.Location = new((ca.Size.X - ca.l.Size.X) / 2,
|
||||
((ca.Size.Y - ca.l.Size.Y) / 2)
|
||||
, 0);
|
||||
((ca.Size.Y - ca.l.Size.Y) / 2));
|
||||
ca.l.ForceDistanceUpdate(ca);
|
||||
Form.Controls.Add(ca);
|
||||
|
||||
AccountButton lo = new AccountButton("Login", this)
|
||||
{
|
||||
Location = new(ca.Location.X + ca.Size.X + (tb.Location.X / 2),ca.Location.Y, 0),
|
||||
Location = new(ca.Location.X + ca.Size.X + (tb.Location.X / 2),ca.Location.Y),
|
||||
OnPageLoad = () =>
|
||||
{
|
||||
btn!.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
|
||||
page!.Controls.Add(UserName = new()
|
||||
{
|
||||
Location = new(0, 22.ScaleInt(), 0),
|
||||
Location = new(0, 22.ScaleInt()),
|
||||
Size = new(page.Size.X, 31.ScaleInt()),
|
||||
WatermarkText = "Username",
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
@ -425,7 +423,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
UserName.Size = UserName.Size;
|
||||
page.Controls.Add(Password = new()
|
||||
{
|
||||
Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y, 0),
|
||||
Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y),
|
||||
Size = new(page.Size.X, UserName.Size.Y),
|
||||
WatermarkText = "Password",
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
@ -481,8 +479,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
};
|
||||
lo.Size = ca.Size;
|
||||
lo.l.Location = new((lo.Size.X / 2) - (lo.l.Size.X / 2),
|
||||
((lo.Size.Y - lo.l.Size.Y) / 2)
|
||||
, 0);
|
||||
((lo.Size.Y - lo.l.Size.Y) / 2));
|
||||
lo.l.ForceDistanceUpdate(lo);
|
||||
Form.Controls.Add(lo);
|
||||
|
||||
@ -493,7 +490,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
|
||||
page = new()
|
||||
{
|
||||
Location = new(tb.Location.X, ca.Location.Y + ca.Size.Y + tb.Location.X, 0),
|
||||
Location = new(tb.Location.X, ca.Location.Y + ca.Size.Y + tb.Location.X),
|
||||
BackgroundColor = Form.BackgroundColor
|
||||
};
|
||||
page.Size = new(Form.Size.X - tb.Location.X - tb.Location.X, Form.Size.Y - tb.Location.X - page.Location.Y - ca.Size.Y - tb.Location.X);
|
||||
@ -501,7 +498,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
|
||||
btn = new(Globals.ms.TextureManager.GetTextureResource("BadTextbox.png"))
|
||||
{
|
||||
Location = new(page.Location.X, page.Location.Y + page.Size.Y + tb.Location.X, 0),
|
||||
Location = new(page.Location.X, page.Location.Y + page.Size.Y + tb.Location.X),
|
||||
Size = new(page.Size.X, ca.Size.Y),
|
||||
TextureDisplay = TextureDisplay.Center
|
||||
};
|
||||
@ -513,13 +510,12 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
IgnoreHover = true
|
||||
};
|
||||
sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2),
|
||||
((btn.Size.Y - sub.Size.Y) / 2)
|
||||
, 0);
|
||||
((btn.Size.Y - sub.Size.Y) / 2));
|
||||
sub.ForceDistanceUpdate(btn);
|
||||
btn.Controls.Add(sub);
|
||||
Form.Controls.Add(btn);
|
||||
|
||||
Form.Location = new((base.Size.X - Form.Size.X) / 2, (base.Size.Y - Form.Size.Y) / 2, 0);
|
||||
Form.Location = new((base.Size.X - Form.Size.X) / 2, (base.Size.Y - Form.Size.Y) / 2);
|
||||
Controls.Add(Form);
|
||||
btn.Clicked += BtnOnClicked;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class FullScreenMedia : UserControl
|
||||
IMG = new(t)
|
||||
{
|
||||
Size = t.RawSize!.Value,
|
||||
Location = new((base.Size.X - t.RawSize!.Value.X) / 2, (base.Size.Y - t.RawSize!.Value.Y) / 2, 0),
|
||||
Location = new((base.Size.X - t.RawSize!.Value.X) / 2, (base.Size.Y - t.RawSize!.Value.Y) / 2),
|
||||
Anchor = ObjectAnchor.All
|
||||
};
|
||||
BackgroundColor = new(0, 0, 0, 130);
|
||||
|
@ -54,14 +54,14 @@ public class Category : UserControl, IChannelAdder
|
||||
});
|
||||
|
||||
c.Clicked += c.AllOnClicked;
|
||||
c.Name.Location = new(26.ScaleInt(), (((c.Size.Y - c.Name.Size.Y)/2)), 0);
|
||||
c.Name.Location = new(26.ScaleInt(), (((c.Size.Y - c.Name.Size.Y)/2)));
|
||||
c.Members = new()
|
||||
{
|
||||
Anchor = ObjectAnchor.All,
|
||||
Location = new(20.ScaleInt(), c.Size.Y, 0),
|
||||
Location = new(20.ScaleInt(), c.Size.Y),
|
||||
IgnoreHover = true
|
||||
};
|
||||
c.ee.Location = new(c.ee.Location.X, c.Name.Location.Y, 0);
|
||||
c.ee.Location = new(c.ee.Location.X, c.Name.Location.Y);
|
||||
c.Members.SetSize(c.Size.X - c.Members.Location.X, 0);
|
||||
c.Controls.Add(c.Members);
|
||||
c.Members.ForceDistanceUpdate(c);
|
||||
@ -122,12 +122,12 @@ public class Category : UserControl, IChannelAdder
|
||||
if (value)
|
||||
{
|
||||
ee.DIR = new(0,1);
|
||||
ee.Location = new(ee.Location.X, (ee.Location.Y - ee.Size.Y), 0);
|
||||
ee.Location = new(ee.Location.X, (ee.Location.Y - ee.Size.Y));
|
||||
}
|
||||
else
|
||||
{
|
||||
ee.DIR = new(1,0);
|
||||
ee.Location = new(ee.Location.X, (ee.Location.Y + ee.Size.Y), 0);
|
||||
ee.Location = new(ee.Location.X, (ee.Location.Y + ee.Size.Y));
|
||||
}
|
||||
e = value;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class Channel : UserControl
|
||||
int i = 4.ScaleInt();
|
||||
r = new Rectangle(Globals.ms.TextureManager.GetAlphaCircle())
|
||||
{
|
||||
Location = new(i,i,0),
|
||||
Location = new(i),
|
||||
Size = new (32.ScaleInt()),
|
||||
IgnoreHover = true
|
||||
};
|
||||
@ -50,8 +50,7 @@ public class Channel : UserControl
|
||||
Controls.Add(ChannelName);
|
||||
Clicked += AllOnClicked;
|
||||
ChannelName.Location = new(40.ScaleInt(),
|
||||
((base.Size.Y - ChannelName.Size.Y) / 2)
|
||||
, 0);
|
||||
((base.Size.Y - ChannelName.Size.Y) / 2));
|
||||
base.HoverMouse = MouseCursor.Hand;
|
||||
}
|
||||
|
||||
@ -74,8 +73,7 @@ public class Channel : UserControl
|
||||
Controls.Add(ChannelName);
|
||||
Clicked += AllOnClicked;
|
||||
ChannelName.Location = new(i,
|
||||
((base.Size.Y - ChannelName.Size.Y) / 2)
|
||||
, 0);
|
||||
((base.Size.Y - ChannelName.Size.Y) / 2));
|
||||
base.HoverMouse = MouseCursor.Hand;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ using Luski.GUI.MainScreen.Interfaces;
|
||||
using Luski.GUI.MainScreen.UI.PublicServers;
|
||||
using Luski.net.Structures.Public;
|
||||
using Luski.Shared.PublicServers.V1.Enums;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.Generic;
|
||||
|
||||
@ -15,6 +16,55 @@ public class ChannelSelector : FlowLayout, IChannelAdder
|
||||
public Dictionary<long, IChannelAdder> ChannelAdders = new();
|
||||
public Channel? Selected;
|
||||
|
||||
public override void ResizeDraw(int x, int y, int sx, int sy, int sw, int sh)
|
||||
{
|
||||
if (OldHeight == Size.Y)
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, Size.X, Size.Y, x, y);
|
||||
}
|
||||
else if (OldHeight < Size.Y)
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, OldWidth, OldHeight, x, y);
|
||||
int nsh = sh - OldHeight+1;
|
||||
if (nsh <= 0) return;
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, nsh);
|
||||
DrawBase();
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, sh);
|
||||
|
||||
for (int i = 0; i < Controls.Length; i++)
|
||||
{
|
||||
if (!Controls[i].Loaded)
|
||||
{
|
||||
BlockDraw = true;
|
||||
Controls[i].LoadToParent(this, Window!);
|
||||
BlockDraw = false;
|
||||
}
|
||||
if (Controls[i].Location.X >= Size.X ||
|
||||
Controls[i].Location.Y >= Size.Y ||
|
||||
Controls[i].Location.X + Controls[i].Size.X < OldWidth ||
|
||||
Controls[i].Location.Y + Controls[i].Size.Y < OldHeight) continue;
|
||||
|
||||
|
||||
if (Controls[i] is IParent pp)
|
||||
{
|
||||
pp.ResizeDraw(x,y,sx,sy,sw,sh);
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, sh);
|
||||
}
|
||||
else
|
||||
{
|
||||
Controls[i].Draw(x,y,sx,sy,sw,sh);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, Size.X, Size.Y, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task LoadSelectorRoot(SocketCategory Cat)
|
||||
{
|
||||
CurrentCategory = Cat;
|
||||
|
65
Luski/GUI/MainScreen/UI/Generic/MessageFlow.cs
Normal file
65
Luski/GUI/MainScreen/UI/Generic/MessageFlow.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.Generic;
|
||||
|
||||
public class MessageFlow : FlowLayout
|
||||
{
|
||||
public override void ResizeDraw(int x, int y, int sx, int sy, int sw, int sh)
|
||||
{
|
||||
if (LuskiExperiments.GUI.LiveLabelSize.IsEnabled())
|
||||
{
|
||||
if (OldHeight == Size.Y)
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, Size.X, Size.Y, x, y);
|
||||
}
|
||||
else if (OldHeight < Size.Y && OldWidth < Size.X)
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, OldWidth, OldHeight, x, y);
|
||||
int nsh = sh - OldHeight+1;
|
||||
if (nsh <= 0) return;
|
||||
int nsw = sw - OldWidth+1;
|
||||
if (nsw <= 0) return;
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, nsh);
|
||||
DrawBase();
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, nsw, sh);
|
||||
DrawBase();
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, sh);
|
||||
|
||||
for (int i = 0; i < Controls.Length; i++)
|
||||
{
|
||||
if (!Controls[i].Loaded)
|
||||
{
|
||||
BlockDraw = true;
|
||||
Controls[i].LoadToParent(this, Window!);
|
||||
BlockDraw = false;
|
||||
}
|
||||
if (Controls[i].Location.X >= Size.X ||
|
||||
Controls[i].Location.Y >= Size.Y ||
|
||||
Controls[i].Location.X + Controls[i].Size.X < OldWidth ||
|
||||
Controls[i].Location.Y + Controls[i].Size.Y < OldHeight) continue;
|
||||
|
||||
|
||||
if (Controls[i] is IParent pp)
|
||||
{
|
||||
pp.ResizeDraw(x,y,sx,sy,sw,sh);
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, sh);
|
||||
}
|
||||
else
|
||||
{
|
||||
Controls[i].Draw(x,y,sx,sy,sw,sh);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, Size.X, Size.Y, x, y);
|
||||
}
|
||||
}
|
||||
else base.ResizeDraw(x,y,sx,sy,sw,sh);
|
||||
}
|
||||
}
|
@ -65,6 +65,8 @@ public class AdvancedGradientLabel : LabelBase
|
||||
Matrix4 rotateM = Matrix4.CreateRotationZ(angle_rad);
|
||||
Matrix4 transOriginM = Matrix4.CreateTranslation(new Vector3(loc_.X + Parent!.IntToWindow(0), loc_.Y + (Font.PixelHeight * Scale) + Parent!.IntToWindow(0, true), 0f));
|
||||
float char_x = 0.0f;
|
||||
Matrix4 staticTransform = rotateM * transOriginM;
|
||||
GL.UniformMatrix4(0, false, ref staticTransform);
|
||||
|
||||
GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
|
||||
GL.ActiveTexture((Shader.GetUniformLocation("u_texture") switch
|
||||
@ -115,11 +117,9 @@ public class AdvancedGradientLabel : LabelBase
|
||||
float yrel = (ch.Size.Y - ch.Bearing.Y) * Scale;
|
||||
yrel += hhh;
|
||||
char_x += (ch.Advance >> 6) * Scale;
|
||||
Matrix4 scaleM = Matrix4.CreateScale(new Vector3(w, h, 1.0f));
|
||||
Matrix4 transRelM = Matrix4.CreateTranslation(new Vector3(xrel, yrel, 0.0f));
|
||||
|
||||
Matrix4 modelM = scaleM * transRelM * rotateM * transOriginM;
|
||||
GL.UniformMatrix4(Shader.GetUniformLocation("model"), false, ref modelM);
|
||||
GL.Uniform2(Shader.GetUniformLocation("scale"), w, h);
|
||||
GL.Uniform2(Shader.GetUniformLocation("offset"), xrel, yrel);
|
||||
|
||||
ch.Texture.Use();
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class CompressedFlow : UserControl
|
||||
}
|
||||
else
|
||||
{
|
||||
arg2.Location = new(Padding.X, Padding.Y, 0);
|
||||
arg2.Location = new(Padding.X, Padding.Y);
|
||||
}
|
||||
UpdateControlesFromIndex(arg1);
|
||||
return Task.CompletedTask;
|
||||
@ -68,12 +68,12 @@ public class CompressedFlow : UserControl
|
||||
if (Controls[i-1].Location.X + Controls[i-1].Size.X + Padding.Z + Controls[i].Size.X + ChildPadding.X > Size.X)
|
||||
{
|
||||
Controls[i].Location = new(Padding.X,
|
||||
Controls[i - 1].Location.Y + Controls[i - 1].Size.Y + ChildPadding.Y, 0);
|
||||
Controls[i - 1].Location.Y + Controls[i - 1].Size.Y + ChildPadding.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
Controls[i].Location = new(ChildPadding.X + Controls[i - 1].Location.X + Controls[i - 1].Size.X,
|
||||
Controls[i - 1].Location.Y, 0);
|
||||
Controls[i - 1].Location.Y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class DropDown<TSelection> : UserControl where TSelection : DropDownOptio
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
DropDownContainer.Location = this.GetParentLocation(DropDownParentOverride)+ new Vector3i(0, Size.Y, 0);
|
||||
DropDownContainer.Location = this.GetParentLocation(DropDownParentOverride)+ new Vector2i(0, Size.Y);
|
||||
DropDownParentOverride.Controls.Add(DropDownContainer);
|
||||
DropDownContainer.Size = new(Size.X, DropDownContainer.Size.Y);
|
||||
DropDownContainer.ForceDistanceUpdate(DropDownParentOverride);
|
||||
|
@ -28,11 +28,11 @@ public class FileUpload : UserControl
|
||||
Label fileNameLabel, fileSizeLabel;
|
||||
base.Size = new(333.ScaleInt(), 66.ScaleInt());
|
||||
base.BackgroundColor = new(40, 40, 40, 255);
|
||||
Controls.Add(fileSizeLabel = new Label(Globals.DefaultFont) { Text = fst, Location = new(64, 39, 0) });
|
||||
Controls.Add(fileSizeLabel = new Label(Globals.DefaultFont) { Text = fst, Location = new(64, 39) });
|
||||
Controls.Add(fileNameLabel = new Label(Globals.DefaultFont)
|
||||
{
|
||||
Color = new(102 / (float)255, 227 / (float)255, 170 / (float)255, 1), Text = FI.Name,
|
||||
Location = new(64, 6, 0)
|
||||
Location = new(64, 6)
|
||||
});
|
||||
if (fileSizeLabel.Size.X > fileNameLabel.Size.X)
|
||||
base.Size = new(fileSizeLabel.Location.X + fileSizeLabel.Size.X + 5.ScaleInt(), base.Size.Y);
|
||||
|
@ -580,6 +580,8 @@ public class LuskiLabel : LabelBase
|
||||
Matrix4 rotateM = Matrix4.CreateRotationZ(angle_rad);
|
||||
Matrix4 transOriginM = Matrix4.CreateTranslation(new Vector3(loc_.X + Parent!.IntToWindow(0), loc_.Y + (MaxLineSizes[0].Item1.Y * Scale) + Parent!.IntToWindow(0, true), 0f));
|
||||
float char_x = 0.0f;
|
||||
Matrix4 staticTransform = rotateM * transOriginM;
|
||||
GL.UniformMatrix4(Shader.GetUniformLocation("model"), false, ref staticTransform);
|
||||
|
||||
GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
|
||||
|
||||
@ -756,11 +758,9 @@ public class LuskiLabel : LabelBase
|
||||
float yrel = (ch.Size.Y - ch.Bearing.Y) * Scale;
|
||||
yrel += hhh;
|
||||
char_x += (ch.Advance >> 6) * Scale;
|
||||
Matrix4 scaleM = Matrix4.CreateScale(new Vector3(w, h, 1.0f));
|
||||
Matrix4 transRelM = Matrix4.CreateTranslation(new Vector3(xrel, yrel, 0.0f));
|
||||
|
||||
Matrix4 modelM = scaleM * transRelM * rotateM * transOriginM;
|
||||
GL.UniformMatrix4(Shader.GetUniformLocation("model"), false, ref modelM);
|
||||
GL.Uniform2(Shader.GetUniformLocation("scale"), w, h);
|
||||
GL.Uniform2(Shader.GetUniformLocation("offset"), xrel, yrel);
|
||||
|
||||
ch.Texture.Use();
|
||||
|
||||
|
@ -21,7 +21,7 @@ public class NumberSelector<TNumber> : UserControl where TNumber : INumber<TNumb
|
||||
set
|
||||
{
|
||||
space = value;
|
||||
progressBar.Location = new(value, progressBar.Location.Y, 0);
|
||||
progressBar.Location = new(value, progressBar.Location.Y);
|
||||
progressBar.Size = new(base.Size.X - value - value, progressBar.Size.Y);
|
||||
//progressBar.SetLocation(value, progressBar.Location.Y);
|
||||
//progressBar.SetSize(base.Size.X - value - value, progressBar.Size.Y);
|
||||
|
@ -16,7 +16,7 @@ public class ProfileView : UserControl
|
||||
this.User = u;
|
||||
base.Size = new(244.ScaleInt(), 44.ScaleInt());
|
||||
base.BackgroundColor = new(34, 34, 34, 255);
|
||||
user.Location = new(8.ScaleInt(), 6.ScaleInt(), 0);
|
||||
user.Location = new(8.ScaleInt(), 6.ScaleInt());
|
||||
user.ForceDistanceUpdate(this);
|
||||
user.IgnoreHover = true;
|
||||
|
||||
@ -35,7 +35,7 @@ public class ProfileView : UserControl
|
||||
IgnoreHover = true
|
||||
};
|
||||
uname.Location = new(user.Location.X + user.Size.X + 8.ScaleInt(),
|
||||
(user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)), 0);
|
||||
(user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)));
|
||||
Controls.Add(uname);
|
||||
Controls.Add(user);
|
||||
}
|
||||
|
57
Luski/GUI/MainScreen/UI/LuskiControls/ServerFlow.cs
Normal file
57
Luski/GUI/MainScreen/UI/LuskiControls/ServerFlow.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
|
||||
public class ServerFlow : FlowLayout
|
||||
{
|
||||
public override void ResizeDraw(int x, int y, int sx, int sy, int sw, int sh)
|
||||
{
|
||||
if (OldHeight == Size.Y)
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, Size.X, Size.Y, x, y);
|
||||
}
|
||||
else if (OldHeight < Size.Y)
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, OldWidth, OldHeight, x, y);
|
||||
int nsh = sh - OldHeight+1;
|
||||
if (nsh <= 0) return;
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, nsh);
|
||||
DrawBase();
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, sh);
|
||||
|
||||
for (int i = 0; i < Controls.Length; i++)
|
||||
{
|
||||
if (!Controls[i].Loaded)
|
||||
{
|
||||
BlockDraw = true;
|
||||
Controls[i].LoadToParent(this, Window!);
|
||||
BlockDraw = false;
|
||||
}
|
||||
if (Controls[i].Location.X >= Size.X ||
|
||||
Controls[i].Location.Y >= Size.Y ||
|
||||
Controls[i].Location.X + Controls[i].Size.X < OldWidth ||
|
||||
Controls[i].Location.Y + Controls[i].Size.Y < OldHeight) continue;
|
||||
|
||||
|
||||
if (Controls[i] is IParent pp)
|
||||
{
|
||||
pp.ResizeDraw(x,y,sx,sy,sw,sh);
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, sh);
|
||||
}
|
||||
else
|
||||
{
|
||||
Controls[i].Draw(x,y,sx,sy,sw,sh);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, Size.X, Size.Y, x, y);
|
||||
}
|
||||
}
|
||||
}
|
@ -27,8 +27,7 @@ public class PageTab : UserControl
|
||||
IgnoreHover = true
|
||||
};
|
||||
l.Location = new(5.ScaleInt(),
|
||||
((base.Size.Y - l.Size.Y) / 2)
|
||||
, 0);
|
||||
((base.Size.Y - l.Size.Y) / 2));
|
||||
Controls.Add(l);
|
||||
base.BackgroundColor = new(0, 0, 0, 0);
|
||||
Clicked += OnClicked;
|
||||
|
@ -27,17 +27,17 @@ public class SettingsCategory<TSettingsMenu> : UserControl where TSettingsMenu :
|
||||
}
|
||||
Top = new(fi)
|
||||
{
|
||||
Location = new(5.ScaleInt(), 5.ScaleInt(), 0),
|
||||
Location = new(5.ScaleInt(), 5.ScaleInt()),
|
||||
Text = Name
|
||||
};
|
||||
base.BackgroundColor = new(255, 255, 255, 0);
|
||||
base.Size = new(307.ScaleInt(), 20.ScaleInt() + Top.Size.Y);
|
||||
Top.Location = new((base.Size.X - Top.Size.X) / 2, Top.Location.Y, 0);
|
||||
Top.Location = new((base.Size.X - Top.Size.X) / 2, Top.Location.Y);
|
||||
line = new()
|
||||
{
|
||||
Size = new(base.Size.X, 1.ScaleInt()),
|
||||
BackgroundColor = Color4.Gray,
|
||||
Location = new(0, base.Size.Y - 1.ScaleInt(), 0)
|
||||
Location = new(0, base.Size.Y - 1.ScaleInt())
|
||||
};
|
||||
line.ForceDistanceUpdate(this);
|
||||
Controls.Add(line);
|
||||
@ -46,7 +46,7 @@ public class SettingsCategory<TSettingsMenu> : UserControl where TSettingsMenu :
|
||||
|
||||
public PageTab AddPage<TPage>(TPage Page) where TPage : ISettingsPage
|
||||
{
|
||||
Page.Location = new(ss.fl.Size.X + 40.ScaleInt(), 0, 0);
|
||||
Page.Location = new(ss.fl.Size.X + 40.ScaleInt(), 0);
|
||||
Page.Size = new(Globals.ms.CS.X - ss.fl.Size.X - 80.ScaleInt(), Globals.ms.CS.Y);
|
||||
Page.AllowHoverFromBehind = true;
|
||||
Page.Anchor = ObjectAnchor.All;
|
||||
@ -61,8 +61,8 @@ public class SettingsCategory<TSettingsMenu> : UserControl where TSettingsMenu :
|
||||
};
|
||||
Controls.Add(cb);
|
||||
int f = 5.ScaleInt();
|
||||
cb.Location = new (line.Location.X + f, line.Location.Y - f, 0);
|
||||
line.Location = new(line.Location.X, line.Location.Y + cb.Size.Y + f, 0);
|
||||
cb.Location = new (line.Location.X + f, line.Location.Y - f);
|
||||
line.Location = new(line.Location.X, line.Location.Y + cb.Size.Y + f);
|
||||
Size = new(Size.X, Size.Y + cb.Size.Y + f);
|
||||
Page.Tag = cb;
|
||||
return cb;
|
||||
@ -86,7 +86,7 @@ public class SettingsCategory<TSettingsMenu> : UserControl where TSettingsMenu :
|
||||
if (Page.Tag is PageTab cb)
|
||||
{
|
||||
int f = 5.ScaleInt();
|
||||
line.Location = new(line.Location.X, line.Location.Y - cb.Size.Y - f, 0);
|
||||
line.Location = new(line.Location.X, line.Location.Y - cb.Size.Y - f);
|
||||
Size = new(Size.X, Size.Y - cb.Size.Y - f);
|
||||
Controls.Remove(cb);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class SettingsMenu : UserControl
|
||||
Controls.Add(fl);
|
||||
Rectangle closebtn = new(Globals.ms.TextureManager.GetTextureResource("close.png"))
|
||||
{
|
||||
Location = new(Globals.ms.ClientSize.X - 40.ScaleInt(), 8.ScaleInt(),0),
|
||||
Location = new(Globals.ms.ClientSize.X - 40.ScaleInt(), 8.ScaleInt()),
|
||||
Size = new(32.ScaleInt()),
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
BackgroundColor = Color4.Gray,
|
||||
|
@ -108,7 +108,7 @@ public class TextBox : UserControl
|
||||
Text = Text.Insert(CursorLocation, ClipString);
|
||||
CursorLocation += ClipString.Length;
|
||||
Vector2i f = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = _label.Location + new Vector3i(f.X, f.Y, 0);
|
||||
Pointer.Location = _label.Location + new Vector2i(f.X, f.Y);
|
||||
Pointer.Visible = true;
|
||||
if (LetterPress is not null) LetterPress.Invoke().Wait();
|
||||
}
|
||||
@ -133,7 +133,7 @@ public class TextBox : UserControl
|
||||
_label.Location = value switch
|
||||
{
|
||||
TextLocation.LineCenter => new(10.ScaleInt(),
|
||||
((Size.Y - _label.Size.Y) / 2), Location.Z),
|
||||
((Size.Y - _label.Size.Y) / 2)),
|
||||
_ => _label.Location
|
||||
};
|
||||
_watermark.Location = _label.Location;
|
||||
@ -143,7 +143,7 @@ public class TextBox : UserControl
|
||||
_watermark.Location = value switch
|
||||
{
|
||||
TextLocation.LineCenter => new(10.ScaleInt(),
|
||||
((Size.Y - _watermark.Size.Y) / 2), Location.Z),
|
||||
((Size.Y - _watermark.Size.Y) / 2)),
|
||||
_ => _watermark.Location
|
||||
};
|
||||
_label.Location = _watermark.Location;
|
||||
@ -204,7 +204,7 @@ public class TextBox : UserControl
|
||||
_label.Visible = true;
|
||||
_label.Location = TextLocation switch
|
||||
{
|
||||
TextLocation.LineCenter => new(10.ScaleInt(), ((Size.Y - _label.Size.Y) / 2), Location.Z),
|
||||
TextLocation.LineCenter => new(10.ScaleInt(), ((Size.Y - _label.Size.Y) / 2)),
|
||||
_ => _label.Location
|
||||
};
|
||||
/*
|
||||
@ -232,7 +232,7 @@ public class TextBox : UserControl
|
||||
_watermark.Visible = true;
|
||||
_watermark.Location = TextLocation switch
|
||||
{
|
||||
TextLocation.LineCenter => new(10.ScaleInt(), ((Size.Y - _watermark.Size.Y) / 2), Location.Z),
|
||||
TextLocation.LineCenter => new(10.ScaleInt(), ((Size.Y - _watermark.Size.Y) / 2)),
|
||||
_ => _watermark.Location
|
||||
};
|
||||
/*
|
||||
@ -251,7 +251,7 @@ public class TextBox : UserControl
|
||||
{
|
||||
CursorLocation = _label.Text.Length;
|
||||
var xy = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = new(_label.Location.X + xy.X, _label.Location.Y + xy.Y, Pointer.Location.Z);
|
||||
Pointer.Location = new(_label.Location.X + xy.X, _label.Location.Y + xy.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -278,14 +278,14 @@ public class TextBox : UserControl
|
||||
{
|
||||
CursorLocation--;
|
||||
var f = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = _label.Location + new Vector3i(f.X, f.Y, 0);
|
||||
Pointer.Location = _label.Location + new Vector2i(f.X, f.Y);
|
||||
Pointer.Visible = true;
|
||||
}
|
||||
if (KeyArgs.Key == Keys.Right && CursorLocation != Text.Length)
|
||||
{
|
||||
CursorLocation++;
|
||||
var f = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = _label.Location + new Vector3i(f.X, f.Y, 0);
|
||||
Pointer.Location = _label.Location + new Vector2i(f.X, f.Y);
|
||||
Pointer.Visible = true;
|
||||
}
|
||||
if (KeyArgs.Key == Keys.CapsLock || KeyArgs.Key == Keys.Menu || KeyArgs.Key == Keys.LeftSuper || KeyArgs.Key == Keys.RightSuper || KeyArgs.Key == Keys.End || KeyArgs.Key == Keys.Home || KeyArgs.Key == Keys.PageDown || KeyArgs.Key == Keys.PageUp || KeyArgs.Key == Keys.Insert || KeyArgs.Key == Keys.Up || KeyArgs.Key == Keys.Down || KeyArgs.Key == Keys.Left || KeyArgs.Key == Keys.Right) return;
|
||||
@ -301,7 +301,7 @@ public class TextBox : UserControl
|
||||
Text = Text.Remove(CursorLocation, 1);
|
||||
if (LetterRemoved is not null) LetterRemoved.Invoke().Wait();
|
||||
var f = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = _label.Location + new Vector3i(f.X, f.Y, 0);
|
||||
Pointer.Location = _label.Location + new Vector2i(f.X, f.Y);
|
||||
Pointer.Visible = true;
|
||||
}
|
||||
if (KeyArgs.Key == Keys.Delete)
|
||||
@ -327,7 +327,7 @@ public class TextBox : UserControl
|
||||
Text += '\n';
|
||||
CursorLocation++;
|
||||
var f = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = _label.Location + new Vector3i(f.X, f.Y, 0);
|
||||
Pointer.Location = _label.Location + new Vector2i(f.X, f.Y);
|
||||
Pointer.Visible = true;
|
||||
}
|
||||
else
|
||||
|
@ -17,7 +17,7 @@ public class UserView : UserControl
|
||||
this.User = u;
|
||||
base.Size = new(244.ScaleInt(), 44.ScaleInt());
|
||||
base.BackgroundColor = new(34, 34, 34, 255);
|
||||
user.Location = new(8.ScaleInt(), 6.ScaleInt(), 0);
|
||||
user.Location = new(8.ScaleInt(), 6.ScaleInt());
|
||||
user.ForceDistanceUpdate(this);
|
||||
string name = p.DisplayName;
|
||||
if (r.ColorType == ColorType.Full)
|
||||
@ -34,7 +34,7 @@ public class UserView : UserControl
|
||||
Text = (offline ? $"[color=\"#00000099\" blend=\"{(int)BlendType.MultiplyAlpha}\"]{name}[/color]" : name)
|
||||
};
|
||||
uname.Location = new(user.Location.X + user.Size.X + 8.ScaleInt(),
|
||||
(user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)), 0);
|
||||
(user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)));
|
||||
Controls.Add(uname);
|
||||
Controls.Add(user);
|
||||
}
|
||||
|
@ -21,10 +21,9 @@ public class VersionDropButton : DropDownOption
|
||||
IgnoreHover = true
|
||||
};
|
||||
l.Location = new((base.Size.X / 2) - (l.Size.X / 2),
|
||||
((base.Size.Y - l.Size.Y) / 2)
|
||||
, 0);
|
||||
((base.Size.Y - l.Size.Y) / 2));
|
||||
Controls.Add(l);
|
||||
BackgroundColor = new(0, 0, 0, 0);
|
||||
base.BackgroundColor = new(0, 0, 0, 0);
|
||||
MouseEnter += o =>
|
||||
{
|
||||
BackgroundColor = new(141, 151, 165, 30);
|
||||
|
@ -12,15 +12,6 @@ public class Updater : PageFlow
|
||||
{
|
||||
PageName = "Updater Config";
|
||||
TextBox t;
|
||||
Controls.Add(t =new TextBox()
|
||||
{
|
||||
Text = Globals.UpdaterSettings.Updater!,
|
||||
WatermarkText = "Updater File",
|
||||
TextureDisplay = TextureDisplay.Center,
|
||||
Size = new(base.Size.X, 34.ScaleInt()),
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
AllowMultiLine = false
|
||||
});
|
||||
foreach (PropertyInfo prop in typeof(UpdaterSettings).GetProperties())
|
||||
{
|
||||
object PropVal = prop.GetValue(Globals.UpdaterSettings)!;
|
||||
@ -75,13 +66,6 @@ public class Updater : PageFlow
|
||||
}
|
||||
}
|
||||
|
||||
t.ForceDistanceUpdate(this);
|
||||
t.KeyPress += _ =>
|
||||
{
|
||||
Globals.UpdaterSettings.Updater = t.Text;
|
||||
Globals.UpdaterSettings.SaveSettings(Path.Combine(Globals.LuskiPath, "UpdaterSettings.json"), UpdaterSettingsContext.Default.UpdaterSettings);
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
WindowLoaded += _ =>
|
||||
{
|
||||
Globals.ms.ForceUpdate();
|
||||
|
@ -20,7 +20,7 @@ public class Appearance : PageFlow
|
||||
{
|
||||
Size = new(base.Size.X - 2, 1.ScaleInt()),
|
||||
BackgroundColor = Color4.Gray,
|
||||
Location = new(1, base.Size.Y - 1.ScaleInt(), 0),
|
||||
Location = new(1, base.Size.Y - 1.ScaleInt()),
|
||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Bottom
|
||||
}, LightDD = new(LuskiThemes.Light)
|
||||
{
|
||||
@ -33,8 +33,7 @@ public class Appearance : PageFlow
|
||||
IgnoreHover = true
|
||||
};
|
||||
ll.Location = new(10.ScaleInt(),
|
||||
((ThemeDrop.Size.Y - ll.Size.Y) / 2)
|
||||
, 0);
|
||||
((ThemeDrop.Size.Y - ll.Size.Y) / 2));
|
||||
ThemeDrop.Controls.Add(ll);
|
||||
},
|
||||
Size = new(297.ScaleInt(), 40.ScaleInt()),
|
||||
@ -42,7 +41,7 @@ public class Appearance : PageFlow
|
||||
{
|
||||
DropDownParentOverride = Globals.ms,
|
||||
Size = new(40.ScaleInt()),
|
||||
Location = new(5.ScaleInt(), 5.ScaleInt(), 0),
|
||||
Location = new(5.ScaleInt(), 5.ScaleInt()),
|
||||
BackgroundColor = new(40, 40, 40, 255),
|
||||
Anchor = ObjectAnchor.Right | ObjectAnchor.Left,};
|
||||
foreach (ThemeStart themeStart in LuskiThemes.LuskiThemeList)
|
||||
@ -60,8 +59,7 @@ public class Appearance : PageFlow
|
||||
IgnoreHover = true
|
||||
};
|
||||
ll.Location = new(10.ScaleInt(),
|
||||
((ThemeDrop.Size.Y - ll.Size.Y) / 2)
|
||||
, 0);
|
||||
((ThemeDrop.Size.Y - ll.Size.Y) / 2));
|
||||
ThemeDrop.Controls.Add(ll);
|
||||
},
|
||||
Size = new(297.ScaleInt(), 40.ScaleInt()),
|
||||
@ -76,7 +74,7 @@ public class Appearance : PageFlow
|
||||
{
|
||||
Size = new(base.Size.X - 2, 1.ScaleInt()),
|
||||
BackgroundColor = Color4.Gray,
|
||||
Location = new(1, base.Size.Y - 1.ScaleInt(), 0),
|
||||
Location = new(1, base.Size.Y - 1.ScaleInt()),
|
||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Bottom
|
||||
};
|
||||
ThemeDrop.OpenStatusChanged += b =>
|
||||
@ -84,7 +82,7 @@ public class Appearance : PageFlow
|
||||
BlockDraw = true;
|
||||
Size = new(base.Size.X, base.Size.Y + ( b ? ThemeDrop.DropDownContainer.Size.Y : -1 * ThemeDrop.DropDownContainer.Size.Y));
|
||||
line!.Location = new(line.Location.X,
|
||||
line.Location.Y + (b ? ThemeDrop.DropDownContainer.Size.Y : -1 * ThemeDrop.DropDownContainer.Size.Y), 0);
|
||||
line.Location.Y + (b ? ThemeDrop.DropDownContainer.Size.Y : -1 * ThemeDrop.DropDownContainer.Size.Y));
|
||||
if (b)
|
||||
{
|
||||
ThemeDrop.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangleTop.png");
|
||||
|
@ -29,7 +29,7 @@ public class AddChannel : UserControl
|
||||
//Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
//TextureDisplay = TextureDisplay.Center
|
||||
};
|
||||
fl.Location = new((base.Size.X - fl.Size.X) / 2, (base.Size.Y - fl.Size.Y) / 2, 0);
|
||||
fl.Location = new((base.Size.X - fl.Size.X) / 2, (base.Size.Y - fl.Size.Y) / 2);
|
||||
fl.Controls.Add(new Label(Globals.DefaultFont) {Text = "Channel Name"});
|
||||
fl.Controls.Add(cn =new TextBox()
|
||||
{
|
||||
@ -58,8 +58,7 @@ public class AddChannel : UserControl
|
||||
IgnoreHover = true
|
||||
};
|
||||
sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2),
|
||||
((btn.Size.Y - sub.Size.Y) / 2)
|
||||
, 0);
|
||||
((btn.Size.Y - sub.Size.Y) / 2));
|
||||
btn.Clicked += BtnOnClicked;
|
||||
sub.ForceDistanceUpdate(btn);
|
||||
btn.Controls.Add(sub);
|
||||
|
@ -83,7 +83,7 @@ public class ChatMessage : UserControl
|
||||
}
|
||||
}
|
||||
|
||||
UserIcon.Location = new(10.ScaleInt(), 2.ScaleInt(), 0);
|
||||
UserIcon.Location = new(10.ScaleInt(), 2.ScaleInt());
|
||||
Controls.Add(UserIcon);
|
||||
string name = Author.DisplayName;
|
||||
if (r.ColorType == ColorType.Full)
|
||||
@ -97,16 +97,15 @@ public class ChatMessage : UserControl
|
||||
Controls.Add(label1 = new (Globals.DefaultFont) { Text = name });
|
||||
label1.Location = new(
|
||||
54.ScaleInt(),
|
||||
UserIcon.Location.Y,
|
||||
0);
|
||||
UserIcon.Location.Y);
|
||||
Label label2;
|
||||
LastObject = label1;
|
||||
FirstL = label1;
|
||||
Controls.Add(label2 = new(Globals.TopTimeFont) { Location = new(label1.Location.X + label1.Size.X + 8.ScaleInt(), (int)(label1.Location.Y + label1.Font.PixelHeight - Globals.TopTimeFont.PixelHeight), 0), Text = time_str});
|
||||
Controls.Add(label2 = new(Globals.TopTimeFont) { Location = new(label1.Location.X + label1.Size.X + 8.ScaleInt(), (int)(label1.Location.Y + label1.Font.PixelHeight - Globals.TopTimeFont.PixelHeight)), Text = time_str});
|
||||
if (!string.IsNullOrWhiteSpace(Msg.Context))
|
||||
{
|
||||
LuskiLabel l;
|
||||
Controls.Add(l = new(Globals.MessageFont) { Location = new(LastObject.Location.X, (int)(UserIcon.Location.Y + UserIcon.Size.Y - Globals.MessageFont.PixelHeight), 0), Text = message.Context});
|
||||
Controls.Add(l = new(Globals.MessageFont) { Location = new(LastObject.Location.X, (int)(UserIcon.Location.Y + UserIcon.Size.Y - Globals.MessageFont.PixelHeight)), Text = message.Context});
|
||||
LastObject = l;
|
||||
LuskiContextMenu lcm = new();
|
||||
Label llllll = lcm.AddLabel("Copy Text");
|
||||
@ -174,7 +173,7 @@ public class ChatMessage : UserControl
|
||||
|
||||
files_on_row++;
|
||||
IRenderObject cem = ContentEmbed.GetEmbed(this, Msg.Files[i], Msg.ChannelID).Result;
|
||||
cem.Location = new((int)(lx - 333), (int)(LastObject.Location.Y + 2 + LastObject.Size.Y + (HorPadding * row) + (66 * (row - 1))), 0);
|
||||
cem.Location = new((int)(lx - 333), (int)(LastObject.Location.Y + 2 + LastObject.Size.Y + (HorPadding * row) + (66 * (row - 1))));
|
||||
LastObject = cem;
|
||||
Controls.Add(cem);
|
||||
}
|
||||
@ -198,11 +197,11 @@ public class ChatMessage : UserControl
|
||||
};
|
||||
if (LastObject is Label l)
|
||||
{
|
||||
newLabel.Location = new(FirstL.Location.X, (int)(l.Location.Y + l.Size.Y + VerticalPadding), 0);
|
||||
newLabel.Location = new(FirstL.Location.X, (int)(l.Location.Y + l.Size.Y + VerticalPadding));
|
||||
}
|
||||
else
|
||||
{
|
||||
newLabel.Location = new(FirstL.Location.X, Size.Y, 0);
|
||||
newLabel.Location = new(FirstL.Location.X, Size.Y);
|
||||
}
|
||||
bool result = Uri.TryCreate(newLabel.Text, UriKind.Absolute, out Uri? uriResult)
|
||||
&& (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
|
||||
@ -248,7 +247,7 @@ public class ChatMessage : UserControl
|
||||
|
||||
filesonrow++;
|
||||
IRenderObject cem = await ContentEmbed.GetEmbed(this, msg.Files[i], msg.ChannelID);
|
||||
cem.Location = new((int)(lx - 333), (int)(LastObject.Location.Y + 2 + LastObject.Size.Y + (HorPadding * row) + (66 * (row - 1))), 0);
|
||||
cem.Location = new((int)(lx - 333), (int)(LastObject.Location.Y + 2 + LastObject.Size.Y + (HorPadding * row) + (66 * (row - 1))));
|
||||
LastObject = cem;
|
||||
Controls.Add(cem);
|
||||
}
|
||||
@ -327,8 +326,7 @@ public class ChatMessage : UserControl
|
||||
};
|
||||
m.Location = new(
|
||||
label.Location.X - m.Size.X - 5.ScaleInt(),
|
||||
(int)(label.Location.Y + label.Font.PixelHeight - Globals.SmallTimeFont.PixelHeight),
|
||||
0);
|
||||
(int)(label.Location.Y + label.Font.PixelHeight - Globals.SmallTimeFont.PixelHeight));
|
||||
|
||||
Controls.Add(m);
|
||||
Labels.Add(m);
|
||||
|
@ -95,11 +95,11 @@ public class ContentEmbed : UserControl
|
||||
else if (size < 1000000000000) fst = Math.Round(size / (double)1000000000, 2) + " GB";
|
||||
base.SetSize(333.ScaleInt(), 66.ScaleInt());
|
||||
base.BackgroundColor = new(40, 40, 40, 255);
|
||||
Controls.Add(fileSizeLabel = new Label(Globals.DefaultFont) { Text = fst, Location = new(64, 39, 0) });
|
||||
Controls.Add(fileSizeLabel = new Label(Globals.DefaultFont) { Text = fst, Location = new(64, 39) });
|
||||
Controls.Add(fileNameLabel = new Label(Globals.DefaultFont)
|
||||
{
|
||||
Color = new(102 / (float)255, 227 / (float)255, 170 / (float)255, 1), Text = file.Name,
|
||||
Location = new(64, 6, 0)
|
||||
Location = new(64, 6)
|
||||
});
|
||||
fileNameLabel.Clicked += FileNameLabelOnClicked;
|
||||
if (DownloadIcon is null)
|
||||
@ -111,7 +111,7 @@ public class ContentEmbed : UserControl
|
||||
}
|
||||
|
||||
Controls.Add(new Rectangle(DownloadIcon)
|
||||
{ Location = new(8, 6, 0), Size = new(50, 50) });
|
||||
{ Location = new(8, 6), Size = new(50, 50) });
|
||||
int temp = fileNameLabel.Size.X + fileNameLabel.Location.X;
|
||||
int temp2 = fileSizeLabel.Size.X + fileSizeLabel.Location.X;
|
||||
//if (temp >= temp2) Size = new(temp + 4, Size.Y);
|
||||
|
@ -4,6 +4,7 @@ using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.GUI.MainScreen.UI.Generic;
|
||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
using Luski.net.Structures.Public;
|
||||
using Luski.Shared.PublicServers.V1.Enums;
|
||||
@ -19,7 +20,7 @@ namespace Luski.GUI.MainScreen.UI.PublicServers;
|
||||
public class PublicChat : UserControl
|
||||
{
|
||||
|
||||
public FlowLayout MessageFlow;
|
||||
public MessageFlow MessageFlow;
|
||||
private Label desc;
|
||||
private LuskiLabel title;
|
||||
private TextBox tb;
|
||||
@ -37,7 +38,7 @@ public class PublicChat : UserControl
|
||||
Controls.Add(MessageFlow = new()
|
||||
{
|
||||
Size = new(base.Size.X, 785.ScaleInt()),
|
||||
Location = new(0, 52.ScaleInt(), 0),
|
||||
Location = new(0, 52.ScaleInt()),
|
||||
BackgroundColor = new(40,40,40,255),
|
||||
Anchor = ObjectAnchor.All,
|
||||
HScrollPixels = Globals.Settings.PerScrollPixels,
|
||||
@ -62,7 +63,7 @@ public class PublicChat : UserControl
|
||||
new(Globals.ms.TextureManager.GetTextureResource("person.png"))
|
||||
{
|
||||
Size = new(24.ScaleInt()),
|
||||
Location = new(944.ScaleInt(), 12.ScaleInt(),0),
|
||||
Location = new(944.ScaleInt(), 12.ScaleInt()),
|
||||
Anchor = ObjectAnchor.Right | ObjectAnchor.Top,
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
BackgroundColor = Color4.LightGray
|
||||
@ -81,14 +82,14 @@ public class PublicChat : UserControl
|
||||
titlecon.Controls.Add(desc = new(Globals.DefaultFont)
|
||||
{
|
||||
Color = new(161,161,161,255),
|
||||
Location = new(title.Location.X + title.Size.X + 5, title.Location.Y, 0)
|
||||
Location = new(title.Location.X + title.Size.X + 5, title.Location.Y)
|
||||
});
|
||||
|
||||
Controls.Add(tb = new()
|
||||
{
|
||||
// InsideColor = new(28, 28, 28, 255),
|
||||
//BorderColor = Color4.DarkCyan,
|
||||
Location = new(10.ScaleInt(), 824.ScaleInt(), 0),
|
||||
Location = new(10.ScaleInt(), 824.ScaleInt()),
|
||||
Size = new(960.ScaleInt(), 34.ScaleInt()),
|
||||
Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left | ObjectAnchor.Right,
|
||||
HoverMouse = MouseCursor.IBeam,
|
||||
@ -110,7 +111,7 @@ public class PublicChat : UserControl
|
||||
{
|
||||
BackgroundColor = base.BackgroundColor,
|
||||
Size = new(MessageFlow.Size.X, 0),
|
||||
Location = new(MessageFlow.Location.X, MessageFlow.Location.Y + MessageFlow.Size.Y, 0),
|
||||
Location = new(MessageFlow.Location.X, MessageFlow.Location.Y + MessageFlow.Size.Y),
|
||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Bottom | ObjectAnchor.Right
|
||||
};
|
||||
Controls.Add(FileFlow);
|
||||
@ -138,8 +139,7 @@ public class PublicChat : UserControl
|
||||
for (int i = 1; i < cm.MessageObjs.Count; i++)
|
||||
{
|
||||
cm.MessageObjs[i].Location = new(cm.MessageObjs[i].Location.X,
|
||||
cm.MessageObjs[i - 1].Location.Y + cm.MessageObjs[i - 1].Size.Y,
|
||||
cm.MessageObjs[i].Location.Z);
|
||||
cm.MessageObjs[i - 1].Location.Y + cm.MessageObjs[i - 1].Size.Y);
|
||||
cm.MessageObjs[i].ForceDistanceUpdate(cm);
|
||||
if (cm.MessageObjs[i] is Label l)
|
||||
{
|
||||
@ -196,7 +196,7 @@ public class PublicChat : UserControl
|
||||
private Task TbOnOnRemoveLine()
|
||||
{
|
||||
BlockDraw = true;
|
||||
tb.Location = new(tb.Location.X, tb.Location.Y + (int)tb.Font.PixelHeight, 0);
|
||||
tb.Location = new(tb.Location.X, tb.Location.Y + (int)tb.Font.PixelHeight);
|
||||
MessageFlow.SetSize(MessageFlow.Size.X, MessageFlow.Size.Y + (int)tb.Font.PixelHeight);
|
||||
BlockDraw = false;
|
||||
return Task.CompletedTask;
|
||||
@ -205,7 +205,7 @@ public class PublicChat : UserControl
|
||||
private Task TbOnOnNewLine()
|
||||
{
|
||||
BlockDraw = true;
|
||||
tb.Location = new(tb.Location.X, tb.Location.Y - (int)tb.Font.PixelHeight, 0);
|
||||
tb.Location = new(tb.Location.X, tb.Location.Y - (int)tb.Font.PixelHeight);
|
||||
MessageFlow.Size = new(MessageFlow.Size.X, MessageFlow.Size.Y - (int)tb.Font.PixelHeight);
|
||||
BlockDraw = false;
|
||||
return Task.CompletedTask;
|
||||
@ -227,7 +227,7 @@ public class PublicChat : UserControl
|
||||
{
|
||||
BackgroundColor = new(34, 34, 34, 255),
|
||||
Size = new(x, Size.Y - titlecon.Size.Y),
|
||||
Location = new(Size.X - x, titlecon.Size.Y, 0),
|
||||
Location = new(Size.X - x, titlecon.Size.Y),
|
||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Right | ObjectAnchor.Bottom
|
||||
};
|
||||
memberflow.ForceDistanceUpdate(this);
|
||||
@ -407,7 +407,7 @@ public class PublicChat : UserControl
|
||||
{
|
||||
Console.WriteLine(arg.Size);
|
||||
FileFlow.BackgroundColor = Color4.Green;
|
||||
arg.Location = new(arg.Location.X, arg.Location.Y + OldSize - arg.Size.Y, 0);
|
||||
arg.Location = new(arg.Location.X, arg.Location.Y + OldSize - arg.Size.Y);
|
||||
OldSize = arg.Size.Y;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
@ -432,13 +432,11 @@ public class PublicChat : UserControl
|
||||
var five = 5.ScaleInt();
|
||||
title.Location = new(five + five,
|
||||
(titlecon.Size.Y - ((int)(title.Font.PixelHeight * ((float)title.Font.CurrentFonts[0].Face.Height /
|
||||
title.Font.CurrentFonts[0].Face.UnitsPerEM)))) / 2,
|
||||
title.Location.Z);
|
||||
title.Font.CurrentFonts[0].Face.UnitsPerEM)))) / 2);
|
||||
desc.Text = channel.Description;
|
||||
desc.Location = new((int)(title.Location.X + title.Size.X + five),
|
||||
(titlecon.Size.Y - ((int)(desc.Font.PixelHeight * ((float)desc.Font.CurrentFonts[0].Face.Height /
|
||||
desc.Font.CurrentFonts[0].Face.UnitsPerEM)))) / 2,
|
||||
desc.Location.Z);
|
||||
desc.Font.CurrentFonts[0].Face.UnitsPerEM)))) / 2);
|
||||
if (Window is not null)
|
||||
{
|
||||
Window.Title = $"{channel.Name} | {channel.Server.Name} - Luski";
|
||||
|
@ -23,7 +23,7 @@ public class RoleIcon : UserControl
|
||||
Rectangle Color = new(Globals.ms.TextureManager.GetAlphaCircle())
|
||||
{
|
||||
Size = new(12.ScaleInt()),
|
||||
Location = new(4.ScaleInt(), 19.ScaleInt(), 0),
|
||||
Location = new(4.ScaleInt(), 19.ScaleInt()),
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
IgnoreHover = true,
|
||||
BackgroundColor = role.Colors[0].ToColor4()
|
||||
@ -34,7 +34,7 @@ public class RoleIcon : UserControl
|
||||
IgnoreHover = true
|
||||
};
|
||||
name.Location = new(Color.Location.X + Color.Size.X + 4.ScaleInt(),
|
||||
(Color.Location.Y + ((Color.Size.Y - name.Size.Y) / 2)), 0);
|
||||
(Color.Location.Y + ((Color.Size.Y - name.Size.Y) / 2)));
|
||||
Controls.Add(name);
|
||||
Controls.Add(Color);
|
||||
Clicked += _ =>
|
||||
|
@ -15,7 +15,7 @@ public class RoleMember : UserControl
|
||||
Task<IRenderObject> icon = p.MakeRct(u, new(24.ScaleInt()));
|
||||
icon.Wait();
|
||||
int val = 8.ScaleInt();
|
||||
icon.Result.Location = new(val, val, 0);
|
||||
icon.Result.Location = new(val, val);
|
||||
Controls.Add(icon.Result);
|
||||
LuskiLabel dn = new(Globals.DefaultFont)
|
||||
{
|
||||
@ -24,6 +24,6 @@ public class RoleMember : UserControl
|
||||
Controls.Add(dn);
|
||||
|
||||
dn.Location = new(icon.Result.Location.X + icon.Result.Size.X + 5.ScaleInt(),
|
||||
icon.Result.Location.Y + ((icon.Result.Size.Y - dn.Size.Y) / 2), 0);
|
||||
icon.Result.Location.Y + ((icon.Result.Size.Y - dn.Size.Y) / 2));
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ public class Roles : PageFlow
|
||||
PageName = "Roles";
|
||||
Page = new(ps, this)
|
||||
{
|
||||
Location = new(0, TitleLable.Size.Y, 0),
|
||||
Location = new(0, TitleLable.Size.Y),
|
||||
Anchor = ObjectAnchor.All
|
||||
};
|
||||
Controls.Add(Page);
|
||||
|
@ -26,7 +26,7 @@ public class ServerRoleInteraction : UserControl
|
||||
};
|
||||
Rectangle hline = new()
|
||||
{
|
||||
Location = new(RoleFlow.Size.X, 0, 0),
|
||||
Location = new(RoleFlow.Size.X, 0),
|
||||
Size = new(1.ScaleInt(), base.Size.Y),
|
||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Top | ObjectAnchor.Bottom,
|
||||
BackgroundColor = Color4.White
|
||||
@ -37,7 +37,7 @@ public class ServerRoleInteraction : UserControl
|
||||
{
|
||||
//BackgroundColor = base.BackgroundColor,
|
||||
Size = new(srp.Size.X - RoleFlow.Size.X, base.Size.Y),
|
||||
Location = new(RoleFlow.Size.X + hline.Size.X, 0, 0),
|
||||
Location = new(RoleFlow.Size.X + hline.Size.X, 0),
|
||||
Anchor = ObjectAnchor.All
|
||||
};
|
||||
SRO.ForceDistanceUpdate(this);
|
||||
@ -57,7 +57,7 @@ public class ServerRoleInteraction : UserControl
|
||||
Visible = false
|
||||
};
|
||||
Warning.Size = new(base.Size.X - space - space, Warning.Size.Y);
|
||||
Warning.Location = new(space, base.Size.Y - Warning.Size.Y - space, 0);
|
||||
Warning.Location = new(space, base.Size.Y - Warning.Size.Y - space);
|
||||
Warning.ForceDistanceUpdate(this);
|
||||
Controls.Add(Warning);
|
||||
SRO.Init(Warning);
|
||||
|
@ -34,16 +34,14 @@ public class ServerRoleOptions : UserControl
|
||||
Page.BackgroundColor = new(0, 0, 0, 0);
|
||||
base.BackgroundColor = new(0, 0, 0, 0);
|
||||
int space = 20.ScaleInt();
|
||||
Display.Location = new(space, 0, 0);
|
||||
Permissions.Location = new(Display.Location.X + Display.Size.X + space, Permissions.Location.Y,
|
||||
Permissions.Location.Z);
|
||||
ManageMembers.Location = new(Permissions.Location.X + Permissions.Size.X + space, ManageMembers.Location.Y,
|
||||
ManageMembers.Location.Z);
|
||||
Line.Location = new(space, Display.Size.Y, 0);
|
||||
Display.Location = new(space, 0);
|
||||
Permissions.Location = new(Display.Location.X + Display.Size.X + space, Permissions.Location.Y);
|
||||
ManageMembers.Location = new(Permissions.Location.X + Permissions.Size.X + space, ManageMembers.Location.Y);
|
||||
Line.Location = new(space, Display.Size.Y);
|
||||
Line.Size = new(Size.X - space - space, 2.ScaleInt());
|
||||
Line.Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Top;
|
||||
Line.ForceDistanceUpdate(this);
|
||||
SelectedLine.Location = new(Display.Location.X, Line.Location.Y, Line.Location.Z);
|
||||
SelectedLine.Location = new(Display.Location.X, Line.Location.Y);
|
||||
SelectedLine.BackgroundColor = Globals.DodgerBlue;
|
||||
SelectedLine.Size = new(Display.Size.X, Line.Size.Y);
|
||||
Display.Clicked += _ =>
|
||||
@ -65,7 +63,7 @@ public class ServerRoleOptions : UserControl
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
Page.Size = new(Line.Size.X, base.Size.Y - Line.Location.Y - Line.Size.Y);
|
||||
Page.Location = new(Line.Location.X, Line.Size.Y + Line.Location.Y, 0);
|
||||
Page.Location = new(Line.Location.X, Line.Size.Y + Line.Location.Y);
|
||||
Page.HScrollPixels = (uint)30.ScaleInt();
|
||||
Page.Anchor = ObjectAnchor.All;
|
||||
Page.ForceDistanceUpdate(this);
|
||||
@ -92,7 +90,7 @@ public class ServerRoleOptions : UserControl
|
||||
}
|
||||
if (l.Tag is Rectangle line)
|
||||
{
|
||||
line.Location = new(line.Location.X, line.Location.Y - diff.Y, 0);
|
||||
line.Location = new(line.Location.X, line.Location.Y - diff.Y);
|
||||
}
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
@ -118,7 +116,7 @@ public class ServerRoleOptions : UserControl
|
||||
}
|
||||
CurrentPageToLoad = LoadDisplay;
|
||||
SelectedLine.Size = new(Display.Size.X, Line.Size.Y);
|
||||
SelectedLine.Location = new(Display.Location.X, Line.Location.Y, Line.Location.Z);
|
||||
SelectedLine.Location = new(Display.Location.X, Line.Location.Y);
|
||||
Page.Controls.Clear();
|
||||
TryDraw();
|
||||
}
|
||||
@ -135,7 +133,7 @@ public class ServerRoleOptions : UserControl
|
||||
}
|
||||
CurrentPageToLoad = LoadPermissions;
|
||||
SelectedLine.Size = new(Permissions.Size.X, Line.Size.Y);
|
||||
SelectedLine.Location = new(Permissions.Location.X, Line.Location.Y, Line.Location.Z);
|
||||
SelectedLine.Location = new(Permissions.Location.X, Line.Location.Y);
|
||||
RemoveSaveEvents();
|
||||
BlockDraw = true;
|
||||
Page.Controls.Clear();
|
||||
@ -227,7 +225,7 @@ public class ServerRoleOptions : UserControl
|
||||
CurrentPageToLoad = LoadMembers;
|
||||
BlockDraw = true;
|
||||
SelectedLine.Size = new(ManageMembers.Size.X, Line.Size.Y);
|
||||
SelectedLine.Location = new(ManageMembers.Location.X, Line.Location.Y, Line.Location.Z);
|
||||
SelectedLine.Location = new(ManageMembers.Location.X, Line.Location.Y);
|
||||
Page.Controls.Clear();
|
||||
var m = r.GetMembers();
|
||||
m.Wait();
|
||||
|
@ -29,7 +29,7 @@ public class SaveWarning : UserControl
|
||||
Size = new(140.ScaleInt(), 32.ScaleInt()),
|
||||
Anchor = ObjectAnchor.Right | ObjectAnchor.Top | ObjectAnchor.Bottom
|
||||
};
|
||||
savetext.Location = new((uc.Size.X - savetext.Size.X) / 2, ((uc.Size.Y - savetext.Size.Y) / 2), 0);
|
||||
savetext.Location = new((uc.Size.X - savetext.Size.X) / 2, ((uc.Size.Y - savetext.Size.Y) / 2));
|
||||
uc.MouseEnter += _ =>
|
||||
{
|
||||
uc.BackgroundColor = new(26, 99, 52, 255);
|
||||
@ -45,8 +45,8 @@ public class SaveWarning : UserControl
|
||||
if (SaveClicked is not null) return SaveClicked.Invoke();
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
uc.Location = new(base.Size.X - space - uc.Size.X, space, 0);
|
||||
warning.Location = new(space, savetext.Location.Y + uc.Location.Y, 0);
|
||||
uc.Location = new(base.Size.X - space - uc.Size.X, space);
|
||||
warning.Location = new(space, savetext.Location.Y + uc.Location.Y);
|
||||
uc.Controls.Add(savetext);
|
||||
uc.ForceDistanceUpdate(this);
|
||||
Controls.Add(uc);
|
||||
|
@ -68,11 +68,11 @@ public class ServerIcon<TServer> : UserControl where TServer : Server
|
||||
r.Textures.Add(t);
|
||||
}
|
||||
|
||||
r.Location = new(18.ScaleInt(), 8.ScaleInt(), 0);
|
||||
r.Location = new(18.ScaleInt(), 8.ScaleInt());
|
||||
r.IgnoreHover = true;
|
||||
Rectangle rr = new(r.Textures[0])
|
||||
{
|
||||
Location = new(17.ScaleInt(), 7.ScaleInt(), 0),
|
||||
Location = new(17.ScaleInt(), 7.ScaleInt()),
|
||||
Size = new(34.ScaleInt()),
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
BackgroundColor = new(26, 26, 26, 255),
|
||||
@ -80,7 +80,7 @@ public class ServerIcon<TServer> : UserControl where TServer : Server
|
||||
};
|
||||
SelectedRect = new(r.Textures[0])
|
||||
{
|
||||
Location = new(14.ScaleInt(), 4.ScaleInt(), 0),
|
||||
Location = new(14.ScaleInt(), 4.ScaleInt()),
|
||||
Size = new(40.ScaleInt()),
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
BackgroundColor = new(26, 26, 26, 255),
|
||||
|
@ -40,7 +40,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
};
|
||||
Label t;
|
||||
Form.Controls.Add(t=new Label(Globals.DefaultFont) { Scale = 1.6f, Text = "Server Login", Color = Globals.DodgerBlue });
|
||||
t.Location = new((Form.Size.X / 2) - (t.Size.X / 2), t.Location.Y, 0);
|
||||
t.Location = new((Form.Size.X / 2) - (t.Size.X / 2), t.Location.Y);
|
||||
|
||||
#region Server Loc
|
||||
Label? ll = new Label(Globals.DefaultFont)
|
||||
@ -60,7 +60,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
|
||||
tb = new()
|
||||
{
|
||||
Location = new(10.ScaleInt(),50.ScaleInt(), 0),
|
||||
Location = new(10.ScaleInt(),50.ScaleInt()),
|
||||
Size = s,
|
||||
Text = address,
|
||||
WatermarkText = "Server Address",
|
||||
@ -123,7 +123,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
BackgroundColor = new(255,20,20,255),
|
||||
TextureDisplay = TextureDisplay.HorizontalCenter,
|
||||
Shader = Form.Shader,
|
||||
Location = new(tb.Location.X + tb.Size.X + tb.Location.X, tb.Location.Y, 0)
|
||||
Location = new(tb.Location.X + tb.Size.X + tb.Location.X, tb.Location.Y)
|
||||
};
|
||||
foreach (string v in Globals.Luski.SupportedVersions)
|
||||
{
|
||||
@ -141,8 +141,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
|
||||
};
|
||||
ll2.Location = new((version.Size.X / 2) - (ll2.Size.X / 2),
|
||||
((version.Size.Y - ll2.Size.Y) / 2)
|
||||
, 0);
|
||||
((version.Size.Y - ll2.Size.Y) / 2));
|
||||
version.Controls.Add(ll2);
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -189,13 +188,13 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
|
||||
AccountButton ca = new AccountButton("Create Account", this)
|
||||
{
|
||||
Location = new(tb.Location.X, tb.Location.Y + tb.Location.X + tb.Size.Y, 0),
|
||||
Location = new(tb.Location.X, tb.Location.Y + tb.Location.X + tb.Size.Y),
|
||||
OnPageLoad = () =>
|
||||
{
|
||||
btn.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
|
||||
page!.Controls.Add(UserName = new()
|
||||
{
|
||||
Location = new(0, 10.ScaleInt(), 0),
|
||||
Location = new(0, 10.ScaleInt()),
|
||||
Size = new(page.Size.X, 30.ScaleInt()),
|
||||
WatermarkText = "Username",
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
@ -244,7 +243,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
|
||||
page.Controls.Add(Password = new()
|
||||
{
|
||||
Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y, 0),
|
||||
Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y),
|
||||
Size = new(page.Size.X, UserName.Size.Y),
|
||||
WatermarkText = "Password",
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
@ -289,11 +288,11 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
IgnoreHover = false
|
||||
});
|
||||
rec.Location = new(page.Size.X - rec.Size.X, page.Size.Y - rec.Size.Y, 0);
|
||||
rec.Location = new(page.Size.X - rec.Size.X, page.Size.Y - rec.Size.Y);
|
||||
|
||||
page.Controls.Add(DisplayName = new()
|
||||
{
|
||||
Location = new(0, Password.Location.Y + Password.Size.Y + UserName.Location.Y + UserName.Location.Y, 0),
|
||||
Location = new(0, Password.Location.Y + Password.Size.Y + UserName.Location.Y + UserName.Location.Y),
|
||||
Size = new(page.Size.X- tb.Location.X - rec.Size.X, Password.Size.Y ),
|
||||
WatermarkText = "Display Name",
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
@ -343,20 +342,19 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
};
|
||||
ca.Size = new((Form.Size.X - tb.Location.X - tb.Location.X - (tb.Location.X / 2)) / 2, ca.Size.Y);
|
||||
ca.l.Location = new((ca.Size.X - ca.l.Size.X) / 2,
|
||||
((ca.Size.Y - ca.l.Size.Y) / 2)
|
||||
, 0);
|
||||
((ca.Size.Y - ca.l.Size.Y) / 2));
|
||||
ca.l.ForceDistanceUpdate(ca);
|
||||
Form.Controls.Add(ca);
|
||||
|
||||
AccountButton lo = new AccountButton("Login", this)
|
||||
{
|
||||
Location = new(ca.Location.X + ca.Size.X + (tb.Location.X / 2),ca.Location.Y, 0),
|
||||
Location = new(ca.Location.X + ca.Size.X + (tb.Location.X / 2),ca.Location.Y),
|
||||
OnPageLoad = () =>
|
||||
{
|
||||
btn!.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
|
||||
page!.Controls.Add(UserName = new()
|
||||
{
|
||||
Location = new(0, 22.ScaleInt(), 0),
|
||||
Location = new(0, 22.ScaleInt()),
|
||||
Size = new(page.Size.X, 31.ScaleInt()),
|
||||
WatermarkText = "Username",
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
@ -401,7 +399,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
|
||||
page.Controls.Add(Password = new()
|
||||
{
|
||||
Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y, 0),
|
||||
Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y),
|
||||
Size = new(page.Size.X, UserName.Size.Y),
|
||||
WatermarkText = "Password",
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
@ -452,8 +450,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
};
|
||||
lo.Size = ca.Size;
|
||||
lo.l.Location = new((lo.Size.X / 2) - (lo.l.Size.X / 2),
|
||||
((lo.Size.Y - lo.l.Size.Y) / 2)
|
||||
, 0);
|
||||
((lo.Size.Y - lo.l.Size.Y) / 2));
|
||||
lo.l.ForceDistanceUpdate(lo);
|
||||
Form.Controls.Add(lo);
|
||||
|
||||
@ -464,7 +461,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
|
||||
page = new()
|
||||
{
|
||||
Location = new(tb.Location.X, ca.Location.Y + ca.Size.Y + tb.Location.X, 0),
|
||||
Location = new(tb.Location.X, ca.Location.Y + ca.Size.Y + tb.Location.X),
|
||||
BackgroundColor = Form.BackgroundColor,
|
||||
Anchor = ObjectAnchor.All
|
||||
};
|
||||
@ -473,7 +470,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
|
||||
btn = new(Globals.ms.TextureManager.GetTextureResource("BadTextbox.png"))
|
||||
{
|
||||
Location = new(page.Location.X, page.Location.Y + page.Size.Y + tb.Location.X, 0),
|
||||
Location = new(page.Location.X, page.Location.Y + page.Size.Y + tb.Location.X),
|
||||
Size = new(page.Size.X, ca.Size.Y),
|
||||
TextureDisplay = TextureDisplay.Center,
|
||||
Anchor = ObjectAnchor.All
|
||||
@ -486,12 +483,11 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
Anchor = ObjectAnchor.All
|
||||
};
|
||||
sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2),
|
||||
((btn.Size.Y - sub.Size.Y) / 2)
|
||||
, 0);
|
||||
((btn.Size.Y - sub.Size.Y) / 2));
|
||||
sub.ForceDistanceUpdate(btn);
|
||||
btn.Controls.Add(sub);
|
||||
Form.Controls.Add(btn);
|
||||
Form.Location = new((base.Size.X - Form.Size.X) / 2, (base.Size.Y - Form.Size.Y) / 2, 0);
|
||||
Form.Location = new((base.Size.X - Form.Size.X) / 2, (base.Size.Y - Form.Size.Y) / 2);
|
||||
Controls.Add(Form);
|
||||
btn.Clicked += BtnOnClicked;
|
||||
}
|
||||
|
@ -27,8 +27,7 @@ public class ExperimentDropButton : DropDownOption
|
||||
IgnoreHover = true
|
||||
};
|
||||
l.Location = new(10.ScaleInt(),
|
||||
((base.Size.Y - l.Size.Y) / 2)
|
||||
, 0);
|
||||
((base.Size.Y - l.Size.Y) / 2));
|
||||
d = new(Globals.MessageFont)
|
||||
{
|
||||
Text = esi.Description,
|
||||
@ -36,8 +35,7 @@ public class ExperimentDropButton : DropDownOption
|
||||
IgnoreHover = true
|
||||
};
|
||||
d.Location = new(l.Location.X + l.Size.X + l.Location.X,
|
||||
l.Location.Y + (int)l.Font.PixelHeight - (int)d.Font.PixelHeight
|
||||
, 0);
|
||||
l.Location.Y + (int)l.Font.PixelHeight - (int)d.Font.PixelHeight);
|
||||
Controls.Add(d);
|
||||
Controls.Add(l);
|
||||
base.BackgroundColor = new(0, 0, 0, 0);
|
||||
|
@ -38,13 +38,13 @@ public class ExperimentGUI : UserControl
|
||||
}
|
||||
Top = new(Globals.DefaultFont)
|
||||
{
|
||||
Location = new(5.ScaleInt(), 5.ScaleInt(), 0),
|
||||
Location = new(5.ScaleInt(), 5.ScaleInt()),
|
||||
Text = ei.DisplayName
|
||||
};
|
||||
Label n = new(Globals.MessageFont)
|
||||
{
|
||||
Text = ei.Name,
|
||||
Location = new(Top.Location.X, Top.Location.Y + Top.Size.Y + Top.Location.Y, 0),
|
||||
Location = new(Top.Location.X, Top.Location.Y + Top.Size.Y + Top.Location.Y),
|
||||
Color = Color4.Gray
|
||||
};
|
||||
Controls.Add(n);
|
||||
@ -60,8 +60,7 @@ public class ExperimentGUI : UserControl
|
||||
IgnoreHover = true
|
||||
};
|
||||
ll.Location = new(10.ScaleInt(),
|
||||
((dd!.Size.Y - ll.Size.Y) / 2)
|
||||
, 0);
|
||||
((dd!.Size.Y - ll.Size.Y) / 2));
|
||||
dd.Controls.Add(ll);
|
||||
},
|
||||
Size = new(297.ScaleInt(), 40.ScaleInt())
|
||||
@ -73,7 +72,7 @@ public class ExperimentGUI : UserControl
|
||||
}, Disabled)
|
||||
{
|
||||
Size = new(base.Size.X, 40.ScaleInt()),
|
||||
Location = new(Top.Location.X, n.Location.Y + n.Size.Y + Top.Location.Y, 0),
|
||||
Location = new(Top.Location.X, n.Location.Y + n.Size.Y + Top.Location.Y),
|
||||
BackgroundColor = new(40, 40, 40, 255),
|
||||
Anchor = ObjectAnchor.Right | ObjectAnchor.Left,
|
||||
DropDownParentOverride = this
|
||||
@ -87,7 +86,7 @@ public class ExperimentGUI : UserControl
|
||||
BlockDraw = true;
|
||||
Size = new(base.Size.X, base.Size.Y + ( b ? dd.DropDownContainer.Size.Y : -1 * dd.DropDownContainer.Size.Y));
|
||||
line!.Location = new(line.Location.X,
|
||||
line.Location.Y + (b ? dd.DropDownContainer.Size.Y : -1 * dd.DropDownContainer.Size.Y), 0);
|
||||
line.Location.Y + (b ? dd.DropDownContainer.Size.Y : -1 * dd.DropDownContainer.Size.Y));
|
||||
if (b)
|
||||
{
|
||||
dd.Textures[0] = TopOpen;
|
||||
@ -116,8 +115,7 @@ public class ExperimentGUI : UserControl
|
||||
IgnoreHover = true
|
||||
};
|
||||
ll.Location = new(10.ScaleInt(),
|
||||
((dd.Size.Y - ll.Size.Y) / 2)
|
||||
, 0);
|
||||
((dd.Size.Y - ll.Size.Y) / 2));
|
||||
dd.Controls.Add(ll);
|
||||
}
|
||||
};
|
||||
@ -138,7 +136,7 @@ public class ExperimentGUI : UserControl
|
||||
{
|
||||
Size = new(base.Size.X - 2, 1.ScaleInt()),
|
||||
BackgroundColor = Color4.Gray,
|
||||
Location = new(1, base.Size.Y - 1.ScaleInt(), 0),
|
||||
Location = new(1, base.Size.Y - 1.ScaleInt()),
|
||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Bottom
|
||||
};
|
||||
line.ForceDistanceUpdate(this);
|
||||
|
@ -27,8 +27,7 @@ public class ThemeDropButton : DropDownOption
|
||||
IgnoreHover = true
|
||||
};
|
||||
l.Location = new(10.ScaleInt(),
|
||||
((base.Size.Y - l.Size.Y) / 2)
|
||||
, 0);
|
||||
((base.Size.Y - l.Size.Y) / 2));
|
||||
d = new(Globals.MessageFont)
|
||||
{
|
||||
Text = esi.Description,
|
||||
@ -36,8 +35,7 @@ public class ThemeDropButton : DropDownOption
|
||||
IgnoreHover = true
|
||||
};
|
||||
d.Location = new(l.Location.X + l.Size.X + l.Location.X,
|
||||
l.Location.Y + (int)l.Font.PixelHeight - (int)d.Font.PixelHeight
|
||||
, 0);
|
||||
l.Location.Y + (int)l.Font.PixelHeight - (int)d.Font.PixelHeight);
|
||||
Controls.Add(d);
|
||||
Controls.Add(l);
|
||||
BackgroundColor = new(0, 0, 0, 0);
|
||||
|
@ -111,6 +111,16 @@ public class MainScreenWindow : Window
|
||||
|
||||
public MainScreenWindow() : base(Settings)
|
||||
{
|
||||
if (LuskiExperiments.GUI.SubFrames.IsEnabled())
|
||||
{
|
||||
UseSubFrames = true;
|
||||
}
|
||||
|
||||
LuskiExperiments.GUI.SubFrames.EventToggled += b =>
|
||||
{
|
||||
UseSubFrames = b;
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
Globals.ms = this;
|
||||
SetWindowSize(new(1332.ScaleInt(), 866.ScaleInt()));
|
||||
Shader s = new Shader("Luski.Resources.Shaders.LeftToRightLabel", Embeded: true, Assembly: Assembly.GetExecutingAssembly());
|
||||
@ -181,9 +191,12 @@ public class MainScreenWindow : Window
|
||||
{
|
||||
BlockDraw = false;
|
||||
Console.WriteLine("start");
|
||||
string irl =
|
||||
$"https://www.jacobtech.com/Updater/GetProgramVersion?directory=Luski&branch=main&selfcontained={Globals.UpdaterSettings.SelfContained.ToString().ToLower()}&platform={Globals.UpdaterSettings.Platform}";
|
||||
Console.WriteLine(irl);
|
||||
if (Globals.UpdaterSettings.AutoUpdateCheck && new HttpClient()
|
||||
.GetAsync(
|
||||
$"https://www.jacobtech.com/Updater/GetProgramVersion?directory=Luski&branch=main&selfcontained={Globals.UpdaterSettings.SelfContained.ToString().ToLower()}&platform={Globals.UpdaterSettings.Platform}")
|
||||
irl)
|
||||
.Result.Content.ReadAsStringAsync().Result !=
|
||||
FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion)
|
||||
{
|
||||
@ -198,11 +211,13 @@ public class MainScreenWindow : Window
|
||||
await LoginOnChangeToApp();
|
||||
}
|
||||
|
||||
public FlowLayout ServerFlow;
|
||||
private UserControl SerBox, ServerTitle;
|
||||
public ServerFlow ServerFlow;
|
||||
private UserControl ServerTitle;
|
||||
public PublicChat ChatBoxArea;
|
||||
public ChannelSelector ChannelSelector;
|
||||
|
||||
|
||||
|
||||
public async Task LoadPublicServer(PublicServer? Server)
|
||||
{
|
||||
GL.Enable(EnableCap.DepthTest);
|
||||
@ -223,11 +238,13 @@ public class MainScreenWindow : Window
|
||||
|
||||
ServerTitle.Controls.Clear();
|
||||
ChannelSelector.Controls.Clear();
|
||||
SerBox.Controls.Remove(ServerTitle, false);
|
||||
SerBox.Controls.Remove(ChannelSelector, false);
|
||||
SerBox.Controls.Clear();
|
||||
SerBox.Controls.Add(ServerTitle);
|
||||
SerBox.Controls.Add(ChannelSelector);
|
||||
Controls.Remove(ServerTitle, false);
|
||||
Controls.Remove(ChannelSelector, false);
|
||||
Controls.Remove(ServerFlow, false);
|
||||
Controls.Clear();
|
||||
Controls.Add(ServerTitle);
|
||||
Controls.Add(ChannelSelector);
|
||||
Controls.Add(ServerFlow);
|
||||
|
||||
#endregion
|
||||
|
||||
@ -251,10 +268,9 @@ public class MainScreenWindow : Window
|
||||
};
|
||||
title.Color = Color4.Green;
|
||||
}
|
||||
title.Location = new(5.ScaleInt(), (int)((ServerTitle.Size.Y - title.LineHeight) / 2), 0);
|
||||
title.Location = new(5.ScaleInt(), (int)((ServerTitle.Size.Y - title.LineHeight) / 2));
|
||||
ServerTitle.Controls.Add(title);
|
||||
ServerTitle.ForceDistanceUpdate(SerBox);
|
||||
SerBox.Controls.Add(ServerTitle);
|
||||
ServerTitle.ForceDistanceUpdate(this);
|
||||
|
||||
#endregion
|
||||
|
||||
@ -281,11 +297,11 @@ public class MainScreenWindow : Window
|
||||
ChatBoxArea = new()
|
||||
{
|
||||
Anchor = ObjectAnchor.All,
|
||||
Location = new(ChannelSelector.Size.X, 0, 0),
|
||||
Size = new(SerBox.Size.X - ChannelSelector.Size.X, SerBox.Size.Y),
|
||||
Location = new(ChannelSelector.Size.X + ServerFlow.Size.X, 0),
|
||||
Size = new(Size.X - ChannelSelector.Size.X - ServerFlow.Size.X, CS.Y),
|
||||
};
|
||||
SerBox.Controls.Add(ChatBoxArea);
|
||||
ChatBoxArea.LoadToParent(SerBox, this);
|
||||
Controls.Add(ChatBoxArea);
|
||||
ChatBoxArea.LoadToParent(this, this);
|
||||
ChatBoxArea.ForceDistanceUpdate();
|
||||
ChatBoxArea.MessageFlow.ForceDistanceUpdate(ChatBoxArea);
|
||||
#endregion
|
||||
@ -300,13 +316,14 @@ public class MainScreenWindow : Window
|
||||
ServerProfile DefaultProfile = await Server.GetProfile(Server.User.ServerProfile, CancellationToken.None);
|
||||
IRenderObject u = await DefaultProfile.MakeRct(Server.User, new(46.ScaleInt()));
|
||||
int ii = 4.ScaleInt();
|
||||
u.Location = new(ii, ChannelSelector.Location.Y + ChannelSelector.Size.Y + ii, 0);
|
||||
u.Location = new(ii + ServerFlow.Size.X, ChannelSelector.Location.Y + ChannelSelector.Size.Y + ii);
|
||||
u.Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left;
|
||||
SerBox.Controls.Add(u);
|
||||
u.LoadToParent(SerBox, this);
|
||||
Controls.Add(u);
|
||||
u.LoadToParent(this, this);
|
||||
u.ForceDistanceUpdate();
|
||||
string name = DefaultProfile.DisplayName;
|
||||
Role r = (await Server.User.GetRoles())[0];if (r.ColorType == ColorType.Full)
|
||||
Role r = (await Server.User.GetRoles())[0];
|
||||
if (r.ColorType == ColorType.Full)
|
||||
{
|
||||
name = $"[color=\"{r.Colors[0].ToDatabaseStr()}\"]{name}[/color]";
|
||||
}
|
||||
@ -321,7 +338,7 @@ public class MainScreenWindow : Window
|
||||
};
|
||||
|
||||
ul.Location = new(u.Location.X + u.Size.X + 5.ScaleInt(),
|
||||
(u.Location.Y + ((u.Size.Y - ul.Size.Y) / 2)), 0);
|
||||
(u.Location.Y + ((u.Size.Y - ul.Size.Y) / 2)));
|
||||
Rectangle Expand = new(TextureManager.GetTextureResource("Expand.png"))
|
||||
{
|
||||
Size = new(20.ScaleInt()),
|
||||
@ -342,13 +359,13 @@ public class MainScreenWindow : Window
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
Expand.Location = new(ul.Location.X + ul.Size.X + 5.ScaleInt(),
|
||||
u.Location.Y + ((u.Size.Y - Expand.Size.Y) / 2), 0);
|
||||
Expand.ForceDistanceUpdate(SerBox);
|
||||
SerBox.Controls.Add(Expand);
|
||||
SerBox.Controls.Add(ul);
|
||||
u.Location.Y + ((u.Size.Y - Expand.Size.Y) / 2));
|
||||
Expand.ForceDistanceUpdate(this);
|
||||
Controls.Add(Expand);
|
||||
Controls.Add(ul);
|
||||
Rectangle setting = new(TextureManager.GetTextureResource("settings.png"))
|
||||
{
|
||||
Location = new(ChannelSelector.Size.X - 40.ScaleInt(), ChannelSelector.Location.Y + ChannelSelector.Size.Y + 11.ScaleInt(),0),
|
||||
Location = new(ChannelSelector.Size.X - 40.ScaleInt() + ServerFlow.Size.X, ChannelSelector.Location.Y + ChannelSelector.Size.Y + 11.ScaleInt()),
|
||||
Size = new(32.ScaleInt()),
|
||||
Shader = Rectangle.DefaultAlphaShader[Context],
|
||||
BackgroundColor = Color4.Gray,
|
||||
@ -366,8 +383,8 @@ public class MainScreenWindow : Window
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
setting.Clicked += SettingOnClicked;
|
||||
setting.ForceDistanceUpdate(SerBox);
|
||||
SerBox.Controls.Add(setting);
|
||||
setting.ForceDistanceUpdate(this);
|
||||
Controls.Add(setting);
|
||||
ForceUpdate();
|
||||
TryDraw();
|
||||
#endregion
|
||||
@ -382,6 +399,11 @@ public class MainScreenWindow : Window
|
||||
|
||||
private FlowLayout? ProfileFlow;
|
||||
|
||||
public override void ForceUpdate(bool resize = false)
|
||||
{
|
||||
base.ForceUpdate(resize && LuskiExperiments.GUI.BufferCopy.IsEnabled());
|
||||
}
|
||||
|
||||
private async Task ExpandOnClicked(IRenderObject arg)
|
||||
{
|
||||
try
|
||||
@ -406,7 +428,7 @@ public class MainScreenWindow : Window
|
||||
s.Item3.Text = prof.DisplayName;
|
||||
Controls.Remove(ProfileFlow);
|
||||
ProfileFlow = null;
|
||||
arg.Location = new(arg.Location.X - oldx + s.Item3.Size.X, arg.Location.Y, arg.Location.Z);
|
||||
arg.Location = new(arg.Location.X - oldx + s.Item3.Size.X, arg.Location.Y);
|
||||
arg.ForceDistanceUpdate(arg.Parent!);
|
||||
Globals.ServerProfile = prof;
|
||||
arg.Tag = new Tuple<SocketAppUser, IRenderObject, LabelBase>(s.Item1, iro, s.Item3);
|
||||
@ -417,8 +439,7 @@ public class MainScreenWindow : Window
|
||||
}
|
||||
|
||||
ProfileFlow.Location = new(ServerFlow.Size.X + 5.ScaleInt(),
|
||||
CS.Y - 54.ScaleInt() - ProfileFlow.Size.Y,
|
||||
0);
|
||||
CS.Y - 54.ScaleInt() - ProfileFlow.Size.Y);
|
||||
Controls.Add(ProfileFlow);
|
||||
}
|
||||
else
|
||||
@ -449,18 +470,11 @@ public class MainScreenWindow : Window
|
||||
|
||||
public async Task LoadMainServer(MainServer Server)
|
||||
{
|
||||
if (SerBox is null)
|
||||
SerBox = new()
|
||||
{
|
||||
Location = new(ServerFlow.Size.X, 0, 0),
|
||||
Size = new(Size.X - ServerFlow.Size.X, Size.Y),
|
||||
Anchor = ObjectAnchor.All
|
||||
};
|
||||
Controls.Add(SerBox);
|
||||
SerBox.ForceDistanceUpdate();
|
||||
SerBox.Controls.Clear();
|
||||
|
||||
}
|
||||
|
||||
private Vector2i? p1, p2;
|
||||
|
||||
protected override void OnKeyDown(KeyboardKeyEventArgs e)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
@ -468,6 +482,37 @@ public class MainScreenWindow : Window
|
||||
{
|
||||
Globals.PrintParent(this);
|
||||
}
|
||||
else if (e.Key == Keys.F1)
|
||||
{
|
||||
p1 = new Vector2i((int)MousePosition.X, (int)MousePosition.Y);
|
||||
Console.WriteLine($"P1 set to: {p1.Value}");
|
||||
}
|
||||
else if (e.Key == Keys.F2)
|
||||
{
|
||||
p2 = new Vector2i((int)MousePosition.X, (int)MousePosition.Y);
|
||||
Console.WriteLine($"P2 set to: {p2.Value}");
|
||||
}
|
||||
else if (e.Key == Keys.F3)
|
||||
{
|
||||
if (p1 is null || p2 is null)
|
||||
{
|
||||
Console.WriteLine("P1 or P2 has not been set");
|
||||
return;
|
||||
}
|
||||
Vector2i size = p2.Value - p1.Value;
|
||||
CopyFromFrontToBack(p1.Value.X, p1.Value.Y, size.X, size.Y, (int)MousePosition.X, (int)MousePosition.Y);
|
||||
Console.WriteLine($"Buffer coppy");
|
||||
}
|
||||
else if (e.Key == Keys.F4)
|
||||
{
|
||||
if (!Context.IsCurrent) Context.MakeCurrent();
|
||||
Context.SwapBuffers();
|
||||
Console.WriteLine($"Force Swap");
|
||||
}
|
||||
else if (e.Key == Keys.F5)
|
||||
{
|
||||
ForceUpdate();
|
||||
}
|
||||
else if (e.Key == Keys.F10)
|
||||
{
|
||||
CheckParent(this);
|
||||
@ -480,31 +525,6 @@ public class MainScreenWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
public override void CheckParent(IParent p, IRenderObject c, int xx, Vector3i di)
|
||||
{
|
||||
if (p.IgnoreVisForChildren || p.Controls.Length <= 1 || xx >= p.Controls.Length || !c.Visible || c is ILabel) return;
|
||||
for (int i = xx; i > 0; i--)
|
||||
{
|
||||
if (!p.Controls[i].IsVisible ||
|
||||
((p.Controls[i].Location.X + di.X >= c.Location.X && p.Controls[i].Location.X + p.Controls[i].Size.X + di.X - c.Size.X <= c.Location.X) &&
|
||||
(p.Controls[i].Location.Y + di.Y >= c.Location.Y && p.Controls[i].Location.Y + p.Controls[i].Size.Y + di.X - c.Size.Y <= c.Location.Y)))
|
||||
{
|
||||
p.Controls[i].NotifiNotVisible();
|
||||
continue;
|
||||
}
|
||||
if (p.Controls[i] is IParent pp) CheckParent(pp, c, pp.Controls.Length-1, di + p.Controls[i].Location);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CheckParent(IParent p)
|
||||
{
|
||||
for (int i = p.Controls.Length - 1; i > 0; i--)
|
||||
{
|
||||
CheckParent(p, p.Controls[i], i-1, new());
|
||||
if (p.Controls[i] is IParent pp) CheckParent(pp);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<Task> LoginOnChangeToApp()
|
||||
{
|
||||
Controls.Clear();
|
||||
@ -527,44 +547,36 @@ public class MainScreenWindow : Window
|
||||
WindowBorder = WindowBorder.Resizable;
|
||||
BackgroundColor = new Color4(20, 20, 20, 255);
|
||||
|
||||
Controls.Add(ServerFlow = new FlowLayout()
|
||||
Controls.Add(ServerFlow = new()
|
||||
{
|
||||
BackgroundColor = new(26, 26, 26, 255),
|
||||
Size = new(68.ScaleInt(), CS.Y),
|
||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom,
|
||||
Location = new(0,0,0)
|
||||
Location = new(0)
|
||||
});
|
||||
ServerFlow.ForceDistanceUpdate(this);
|
||||
ServerFlow.LoadToParent(this,this);
|
||||
DrawFrame();
|
||||
|
||||
SerBox = new()
|
||||
{
|
||||
Location = new(ServerFlow.Size.X, 0, 0),
|
||||
Size = new(Size.X - ServerFlow.Size.X, CS.Y),
|
||||
Anchor = ObjectAnchor.All,
|
||||
BackgroundColor = new(20, 20, 20, 255)
|
||||
};
|
||||
Controls.Add(SerBox);
|
||||
SerBox.LoadToParent(this, this);
|
||||
|
||||
ServerTitle = new()
|
||||
{
|
||||
Location = new(ServerFlow.Size.X, 0),
|
||||
Size = new(307.ScaleInt(), 46.ScaleInt()),
|
||||
BackgroundColor = new(30, 30, 30, 255)
|
||||
};
|
||||
SerBox.Controls.Add(ServerTitle);
|
||||
Controls.Add(ServerTitle);
|
||||
|
||||
|
||||
ChannelSelector = new()
|
||||
{
|
||||
BackgroundColor = new(34, 34, 34, 255),
|
||||
Location = new(0, ServerTitle.Size.Y +2.ScaleInt(), 0),
|
||||
Location = new(ServerFlow.Size.X, ServerTitle.Size.Y +2.ScaleInt()),
|
||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom
|
||||
};
|
||||
ChannelSelector.Size = new(ServerTitle.Size.X, SerBox.Size.Y - 54.ScaleInt() - ChannelSelector.Location.Y);
|
||||
SerBox.Controls.Add(ChannelSelector);
|
||||
ChannelSelector.ForceDistanceUpdate(SerBox);
|
||||
ChannelSelector.Size = new(ServerTitle.Size.X, CS.Y - 54.ScaleInt() - ChannelSelector.Location.Y);
|
||||
Controls.Add(ChannelSelector);
|
||||
ChannelSelector.ForceDistanceUpdate(this);
|
||||
|
||||
Console.WriteLine("Waiting");
|
||||
Task.WhenAll(Globals.ServersLoading.ToArray()).Wait();
|
||||
@ -597,7 +609,8 @@ public class MainScreenWindow : Window
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override void ForceUpdate()
|
||||
/*
|
||||
public override void ForceUpdate(bool resize = false)
|
||||
{
|
||||
DateTime dt = DateTime.Now;
|
||||
BlockDraw = true;
|
||||
@ -612,7 +625,7 @@ public class MainScreenWindow : Window
|
||||
if (!left && !right) { Controls[i].Anchor |= ObjectAnchor.Left; left = true; }
|
||||
|
||||
int lx, ly, sy, sx;
|
||||
bool UpdateDistance = false;
|
||||
bool UpdateDistance = false, SizeChanged = false;
|
||||
if ((Controls[i].Anchor & ObjectAnchor.PreventWidthChange) == ObjectAnchor.PreventWidthChange)
|
||||
{
|
||||
UpdateDistance = true;
|
||||
@ -621,12 +634,12 @@ public class MainScreenWindow : Window
|
||||
}
|
||||
else
|
||||
{
|
||||
SizeChanged = true;
|
||||
lx = (left ? Controls[i].Location.X : CS.X - Controls[i].Distance.X - Controls[i].Size.X);
|
||||
sx = (right ? CS.X - Controls[i].Distance.X - lx : Controls[i].Size.X);
|
||||
}
|
||||
if ((Controls[i].Anchor & ObjectAnchor.PreventHeightChange) == ObjectAnchor.PreventHeightChange)
|
||||
{
|
||||
UpdateDistance = true;
|
||||
ly = Controls[i].Location.Y + ((CS.Y - Controls[i].Distance.Y - Controls[i].Size.Y - Controls[i].Location.Y) / 2);
|
||||
sy = Controls[i].Size.Y;
|
||||
}
|
||||
@ -636,13 +649,17 @@ public class MainScreenWindow : Window
|
||||
sy = (bottom ? CS.Y - Controls[i].Distance.Y - ly : Controls[i].Size.Y);
|
||||
}
|
||||
|
||||
if (Controls[i].Size.X != sx && Controls[i].Size.Y != sy)
|
||||
{
|
||||
SizeChanged = true;
|
||||
}
|
||||
Controls[i].SetSize(sx, sy);
|
||||
Controls[i].SetLocation(lx, ly);
|
||||
if (UpdateDistance)
|
||||
{
|
||||
Controls[i].ForceDistanceUpdate(this);
|
||||
}
|
||||
if (Controls[i] is IParent parent)
|
||||
if (Controls[i] is IParent parent && SizeChanged)
|
||||
{
|
||||
parent.ParentResize();
|
||||
}
|
||||
@ -653,7 +670,9 @@ public class MainScreenWindow : Window
|
||||
UpdateAdverage = new((UpdateAdverage.Value.Ticks + (DateTime.Now - dt).Ticks)/2);
|
||||
}
|
||||
DateTime dtt = DateTime.Now;
|
||||
DrawFrame();
|
||||
if (resize) ResizeFrameP1();
|
||||
else FrameP1();
|
||||
CheckParent(this);
|
||||
if (DrawAdverage is null || TotalAdverage is null)
|
||||
{
|
||||
DrawAdverage = DateTime.Now - dtt;
|
||||
@ -666,6 +685,7 @@ public class MainScreenWindow : Window
|
||||
}
|
||||
BlockDraw = false;
|
||||
}
|
||||
*/
|
||||
|
||||
private TimeSpan? UpdateAdverage, DrawAdverage, TotalAdverage;
|
||||
|
||||
|
@ -34,36 +34,21 @@ public class UpdateWindow : Window
|
||||
{
|
||||
Label t;
|
||||
Controls.Add(t = new Label(Globals.DefaultFont) { Scale = 1.2f, Location = new(17.5.ScaleInt()), Text = "Luski has detected that your\nclient is on an older version\nfor your branch."});
|
||||
if (!Globals.Empty(Globals.UpdaterSettings.Updater))
|
||||
{
|
||||
t.Text += "\n\nWould you like to update?";
|
||||
Controls.Add(yes = new(Globals.LuskiTexture, Globals.DefaultFont)
|
||||
{
|
||||
Text = "Yes",
|
||||
Location = new(t.Location.X, t.Location.Y + t.Size.Y + (int)(t.Scale * t.Font.PixelHeight), 0),
|
||||
Location = new(t.Location.X, t.Location.Y + t.Size.Y + (int)(t.Scale * t.Font.PixelHeight)),
|
||||
Size = new(t.Size.X, 33.5.ScaleInt())
|
||||
});
|
||||
Controls.Add(no = new(Globals.LuskiTexture, Globals.DefaultFont)
|
||||
{
|
||||
Text = "No", Location = new(t.Location.X, yes.Location.Y + yes.Size.Y + 20, 0),
|
||||
Text = "No", Location = new(t.Location.X, yes.Location.Y + yes.Size.Y + 20),
|
||||
Size = new(yes.Size.X, 35.5.ScaleInt())
|
||||
});
|
||||
Size = new(t.Location.X + t.Location.X + t.Size.X, no.Location.Y + no.Size.Y + t.Location.X);
|
||||
yes.Clicked += YesOnClicked;
|
||||
no.Clicked += NoOnClicked;
|
||||
}
|
||||
else
|
||||
{
|
||||
t.Text += "\n\nNo updater path was set\nSet a path for auto updates";
|
||||
Controls.Add(no = new(Globals.LuskiTexture, Globals.DefaultFont)
|
||||
{
|
||||
Text = "Ok",
|
||||
Location = new(t.Location.X, t.Location.Y + t.Size.Y + (int)(t.Scale * t.Font.PixelHeight), 0),
|
||||
Size = new(t.Size.X, 35.5.ScaleInt()),
|
||||
});
|
||||
Size = new(t.Location.X + t.Location.X + t.Size.X, no.Location.Y + no.Size.Y + t.Location.X);
|
||||
no.Clicked += NoOnClicked;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ public static class Globals
|
||||
|
||||
public static void PrintParent(IParent par)
|
||||
{
|
||||
void PrintP(int index, IParent p, Vector3i l)
|
||||
void PrintP(int index, IParent p, Vector2i l)
|
||||
{
|
||||
string sp = "";
|
||||
for (int i = 0; i < index; i++)
|
||||
@ -118,6 +118,26 @@ public static class Globals
|
||||
PrintP(1,par, par.Position);
|
||||
}
|
||||
|
||||
public static int CountDraws(IParent par)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < par.Controls.Length; i++)
|
||||
{
|
||||
if (par.Controls[i].IgnoreHover) continue;
|
||||
if (par.Controls[i].IsVisible || par.Controls[i] is LabelBase)
|
||||
{
|
||||
count++;
|
||||
if (par.Controls[i] is IParent pp)
|
||||
{
|
||||
count += CountDraws(pp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public static void RegisterExperiment(ExperimentInfo exp)
|
||||
{
|
||||
IEnumerable<ExperimentJson> found = MissingExperiments.Where(e => e.Name == exp.Name);
|
||||
@ -280,12 +300,12 @@ public static class Globals
|
||||
int space = 5.ScaleInt();
|
||||
tc.Controls.Add(ll =new Label(Globals.DefaultFont)
|
||||
{
|
||||
Location = new(0, space + space, 0),
|
||||
Location = new(0, space + space),
|
||||
Text = Name
|
||||
});
|
||||
tc.Controls.Add(l =new Label(Globals.DefaultFont)
|
||||
{
|
||||
Location = new(ll.Location.X, ll.Size.Y + space, 0),
|
||||
Location = new(ll.Location.X, ll.Size.Y + space),
|
||||
Color = Color4.Gray,
|
||||
MaxSize = parent.Size,
|
||||
Text = description
|
||||
@ -293,11 +313,11 @@ public static class Globals
|
||||
if (List is not null) List.Add(l);
|
||||
tc.Size = l.Size;
|
||||
tc.Controls.Add(ts);
|
||||
ts.Location = new(parent.Size.X - ts.Size.X - 5.ScaleInt(), ll.Location.Y, 0);
|
||||
ts.Location = new(parent.Size.X - ts.Size.X - 5.ScaleInt(), ll.Location.Y);
|
||||
|
||||
Rectangle TempLine = new()
|
||||
{
|
||||
Location = new(0, l.Location.Y + l.Size.Y + space, 0),
|
||||
Location = new(0, l.Location.Y + l.Size.Y + space),
|
||||
BackgroundColor = Color4.White,
|
||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Top
|
||||
};
|
||||
@ -337,23 +357,23 @@ public static class Globals
|
||||
int space = 5.ScaleInt();
|
||||
tc.Controls.Add(ll =new Label(Globals.DefaultFont)
|
||||
{
|
||||
Location = new(0, space + space, 0),
|
||||
Location = new(0, space + space),
|
||||
Text = Name
|
||||
});
|
||||
tc.Controls.Add(l =new Label(Globals.DefaultFont)
|
||||
{
|
||||
Location = new(ll.Location.X, ll.Size.Y + space, 0),
|
||||
Location = new(ll.Location.X, ll.Size.Y + space),
|
||||
Color = Color4.Gray,
|
||||
MaxSize = parent.Size,
|
||||
Text = description
|
||||
});
|
||||
tc.Size = l.Size;
|
||||
tc.Controls.Add(NumberSelector);
|
||||
NumberSelector.Location = new(5.ScaleInt(), l.Location.Y + l.Size.Y + space, 0);
|
||||
NumberSelector.Location = new(5.ScaleInt(), l.Location.Y + l.Size.Y + space);
|
||||
|
||||
Rectangle TempLine = new()
|
||||
{
|
||||
Location = new(0, NumberSelector.Location.Y + NumberSelector.Size.Y + space, 0),
|
||||
Location = new(0, NumberSelector.Location.Y + NumberSelector.Size.Y + space),
|
||||
BackgroundColor = Color4.White,
|
||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Top
|
||||
};
|
||||
@ -402,25 +422,25 @@ public static class Globals
|
||||
int space = 5.ScaleInt();
|
||||
tc.Controls.Add(ll =new Label(Globals.DefaultFont)
|
||||
{
|
||||
Location = new(0, space + space, 0),
|
||||
Location = new(0, space + space),
|
||||
Text = Name
|
||||
});
|
||||
tc.Controls.Add(l =new Label(Globals.DefaultFont)
|
||||
{
|
||||
Location = new(ll.Location.X, ll.Size.Y + space, 0),
|
||||
Location = new(ll.Location.X, ll.Size.Y + space),
|
||||
Color = Color4.Gray,
|
||||
MaxSize = parent.Size,
|
||||
Text = description
|
||||
});
|
||||
tc.Size = l.Size;
|
||||
tc.Controls.Add(ts);
|
||||
ts.Location = new(parent.Size.X - ts.Size.X - 5.ScaleInt(), ll.Location.Y, 0);
|
||||
ts.Location = new(parent.Size.X - ts.Size.X - 5.ScaleInt(), ll.Location.Y);
|
||||
tc.Controls.Add(NumberSelector);
|
||||
NumberSelector.Location = new(5.ScaleInt(), l.Location.Y + l.Size.Y + space, 0);
|
||||
NumberSelector.Location = new(5.ScaleInt(), l.Location.Y + l.Size.Y + space);
|
||||
|
||||
Rectangle TempLine = new()
|
||||
{
|
||||
Location = new(0, NumberSelector.Location.Y + NumberSelector.Size.Y + space, 0),
|
||||
Location = new(0, NumberSelector.Location.Y + NumberSelector.Size.Y + space),
|
||||
BackgroundColor = Color4.White,
|
||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Top
|
||||
};
|
||||
@ -664,8 +684,7 @@ public static class Globals
|
||||
Vector2i y = l.GetSizeOfChar(0),
|
||||
yy = l.GetBearingOfChar(0);
|
||||
l.Location = new((r.Size.X - l.Size.X)/2,
|
||||
(int)(r.Size.Y - l.Font.PixelHeight + yy.Y - (r.Size.Y / 2) - (y.Y/2)),
|
||||
0);
|
||||
(int)(r.Size.Y - l.Font.PixelHeight + yy.Y - (r.Size.Y / 2) - (y.Y/2)));
|
||||
r.Controls.Add(l);
|
||||
return r;
|
||||
}
|
||||
@ -697,8 +716,7 @@ public static class Globals
|
||||
Vector2i y = l.GetSizeOfChar(0),
|
||||
yy = l.GetBearingOfChar(0);
|
||||
l.Location = new((r.Size.X - l.Size.X)/2,
|
||||
(int)(r.Size.Y - l.Font.PixelHeight + yy.Y - (r.Size.Y / 2) - (y.Y/2)),
|
||||
0);
|
||||
(int)(r.Size.Y - l.Font.PixelHeight + yy.Y - (r.Size.Y / 2) - (y.Y/2)));
|
||||
r.Controls.Add(l);
|
||||
return r;
|
||||
}
|
||||
|
@ -22,8 +22,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GraphicsManager" Version="1.1.0-alpha98" />
|
||||
<PackageReference Include="GraphicsManager" Version="1.1.1-alpha24" />
|
||||
<PackageReference Include="Luski.net" Version="2.0.1-alpha18" />
|
||||
<PackageReference Include="Updater" Version="1.0.0-alpha04" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -16,6 +16,24 @@ public static class LuskiExperiments
|
||||
{
|
||||
GUI.LiveLabelSize
|
||||
}
|
||||
},
|
||||
new()
|
||||
{
|
||||
DisplayName = "Rendering Sub Frames",
|
||||
Name = "2024_11_sub_frames",
|
||||
Options = new()
|
||||
{
|
||||
GUI.SubFrames
|
||||
}
|
||||
},
|
||||
new()
|
||||
{
|
||||
DisplayName = "Buffer Copying",
|
||||
Name = "2024_11_buffer_copying",
|
||||
Options = new()
|
||||
{
|
||||
GUI.BufferCopy
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -74,5 +92,15 @@ public static class LuskiExperiments
|
||||
Name = "Proper Label Size",
|
||||
Description = "Live updates labels to be the right length during resize.", RequiresRestart = false
|
||||
};
|
||||
public static readonly ExperimentSelectorInfo SubFrames = new()
|
||||
{
|
||||
Name = "Sub Frames",
|
||||
Description = "Speeds up rendering controls by smaller area.", RequiresRestart = false
|
||||
};
|
||||
public static readonly ExperimentSelectorInfo BufferCopy = new()
|
||||
{
|
||||
Name = "Buffer Copy",
|
||||
Description = "Speeds up rendering controls during resize by copying from the GPU", RequiresRestart = false
|
||||
};
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ using Luski.GUI;
|
||||
using OpenTK.Windowing.Common.Input;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using Updater;
|
||||
using Image = OpenTK.Windowing.Common.Input.Image;
|
||||
|
||||
try
|
||||
@ -63,16 +64,41 @@ try
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Globals.UpdaterSettings = Globals.GetSettings(Path.Combine(Globals.LuskiPath, "UpdaterSettings.json"), UpdaterSettingsContext.Default.UpdaterSettings);
|
||||
if (Globals.UpdaterSettings.Updater is null) Globals.UpdaterSettings.Updater = string.Empty;
|
||||
Image<Rgba32> Logo = SixLabors.ImageSharp.Image.Load<Rgba32>(Globals.GetResource("Textures.Luski.png"));
|
||||
Logo.DangerousTryGetSinglePixelMemory(out Memory<Rgba32> m);
|
||||
byte[] pixels = new byte[4 * Logo.Width * Logo.Height];
|
||||
Logo.CopyPixelDataTo(pixels);
|
||||
Logo.Dispose();
|
||||
|
||||
Globals.Icon = new WindowIcon(new Image(Logo.Width, Logo.Height, pixels));
|
||||
|
||||
Logo.Dispose();
|
||||
if (args is not null && args.Length > 0)
|
||||
{
|
||||
if (args.Contains(Handler.UpdateArg))
|
||||
{
|
||||
string tm = args[Array.IndexOf(args, Handler.UpdateArg) + 1].Remove(0, 1);
|
||||
tm = tm.Remove(tm.Length - 1, 1);
|
||||
Console.WriteLine(tm);
|
||||
Handler.StartUpdate(Globals.Icon,
|
||||
AppDomain.CurrentDomain.FriendlyName,
|
||||
"Luski",
|
||||
tm,
|
||||
Path.Combine(Globals.LuskiPath, "UpdaterSettings.json"),
|
||||
Globals.UpdaterSettings.Platform, SelfContained: Globals.UpdaterSettings.SelfContained);
|
||||
return;
|
||||
}
|
||||
if (args.Contains(Handler.PostUpdateArg))
|
||||
{
|
||||
string tm = args[Array.IndexOf(args, Handler.PostUpdateArg) + 1].Remove(0, 1);
|
||||
tm = tm.Remove(tm.Length - 1, 1);
|
||||
Handler.PostUpdate(tm);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
MainScreenWindow.Settings.Icon = Globals.Icon;
|
||||
Globals.ms = new MainScreenWindow();
|
||||
@ -81,6 +107,7 @@ try
|
||||
pixels = Array.Empty<byte>();
|
||||
Globals.ms.StartRender();
|
||||
Globals.ms.Dispose();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -89,35 +116,7 @@ catch (Exception ex)
|
||||
|
||||
if (Globals.Download)
|
||||
{
|
||||
Console.WriteLine("Auto Update Starting");
|
||||
List<string> arguments = new List<string>
|
||||
{
|
||||
"--process",
|
||||
Process.GetCurrentProcess().ProcessName,
|
||||
"--remotedirectory",
|
||||
"Luski",
|
||||
"--localdirectory",
|
||||
AppDomain.CurrentDomain.BaseDirectory,
|
||||
"--branch",
|
||||
"main",
|
||||
"--selfcontained",
|
||||
Globals.UpdaterSettings.SelfContained.ToString().ToLower(),
|
||||
"--platform",
|
||||
Globals.UpdaterSettings.Platform,
|
||||
"--setconfig",
|
||||
Path.Combine(Globals.LuskiPath, "UpdaterSettings.json")
|
||||
};
|
||||
if (Globals.UpdaterSettings.AutoLaunch)
|
||||
{
|
||||
arguments.Add("--dll");
|
||||
arguments.Add(AppDomain.CurrentDomain.FriendlyName);
|
||||
}
|
||||
Process p = new();
|
||||
p.StartInfo.FileName = Globals.UpdaterSettings.Updater;
|
||||
p.StartInfo.UseShellExecute = true;
|
||||
p.StartInfo.CreateNoWindow = true;
|
||||
p.StartInfo.WorkingDirectory = new FileInfo(Globals.UpdaterSettings.Updater!).Directory!.FullName;
|
||||
p.StartInfo.Arguments = $"\"{string.Join("\" \"", arguments)}\"";
|
||||
p.Start();
|
||||
Environment.Exit(0);
|
||||
Console.WriteLine("Update Starting");
|
||||
Handler.PreUpdate(AppDomain.CurrentDomain.FriendlyName);
|
||||
|
||||
}
|
@ -7,9 +7,12 @@ out vec2 vUV;
|
||||
|
||||
uniform mat4 model;
|
||||
uniform mat4 projection;
|
||||
uniform vec2 scale;
|
||||
uniform vec2 offset;
|
||||
|
||||
void main()
|
||||
{
|
||||
vUV = in_uv.xy;
|
||||
gl_Position = projection * model * vec4(in_pos.xy, 0.0, 1.0);
|
||||
vec2 scaledPos = in_pos * scale + offset;
|
||||
gl_Position = projection * model * vec4(scaledPos, 0.0, 1.0);
|
||||
}
|
Loading…
Reference in New Issue
Block a user