Categories And Scissor
The scissor code should now properly cut all controls from going past the parent.
This commit is contained in:
parent
ab73abc7c7
commit
2dee38084e
@ -9,23 +9,30 @@ public enum ConsoleLog : long
|
||||
None = 0,
|
||||
[Shared.GlobalAttributes.DisplayName("OpenGL Errors")]
|
||||
[Description("Show OpenGL Major Errors")]
|
||||
[Category("Rendering")]
|
||||
BigErrosForOpenGL = 1,
|
||||
[Shared.GlobalAttributes.DisplayName("OpenGL Medium Errors")]
|
||||
[Description("Show OpenGL Medium Errors")]
|
||||
[Category("Rendering")]
|
||||
MediumErrosForOpenGL = 2,
|
||||
[Shared.GlobalAttributes.DisplayName("OpenGL Small Errors")]
|
||||
[Description("Show OpenGL Small Errors")]
|
||||
[Category("Rendering")]
|
||||
LowErrosForOpenGL = 4,
|
||||
[Shared.GlobalAttributes.DisplayName("OpenGL Info")]
|
||||
[Description("Show OpenGL Info")]
|
||||
[Category("Rendering")]
|
||||
InfoForOpenGL = 8,
|
||||
[Shared.GlobalAttributes.DisplayName("Log Frames")]
|
||||
[Description("Shows draw fram message in the console")]
|
||||
[Category("Rendering")]
|
||||
DrawFrames = 16,
|
||||
[Shared.GlobalAttributes.DisplayName("Show Missing Charters")]
|
||||
[Description("Show Missing Charters")]
|
||||
[Category("Rendering")]
|
||||
ShowMissingChar = 32,
|
||||
[Shared.GlobalAttributes.DisplayName("GLFW Errors")]
|
||||
[Description("Show GLFW Errors")]
|
||||
[Category("Rendering")]
|
||||
ShowErrorsForGLFW = 64
|
||||
}
|
@ -48,7 +48,7 @@ public class AdvancedGradientLabel : LabelBase
|
||||
base.LoadToParent(window, win);
|
||||
}
|
||||
|
||||
public override void Draw(int x, int y, int ww, int hh)
|
||||
public override void Draw(int x, int y, int sx, int sy, int sw, int sh)
|
||||
{
|
||||
if (Visible && Loaded && this.Font is not null && Colors.Length > 1)
|
||||
{
|
||||
|
@ -550,7 +550,7 @@ public class LuskiLabel : LabelBase
|
||||
private List<SubHitBox> Links = new();
|
||||
|
||||
|
||||
public override void Draw(int x, int y, int ww, int hh)
|
||||
public override void Draw(int x, int y, int sx, int sy, int sw, int sh)
|
||||
{
|
||||
if (Visible && Loaded)
|
||||
{
|
||||
|
@ -143,6 +143,7 @@ public class ServerRoleOptions : UserControl
|
||||
NeedMax.Clear();
|
||||
Type PropType = typeof(ServerPermission);
|
||||
IEnumerable<ServerPermission> values = Enum.GetValues(PropType).Cast<ServerPermission>();
|
||||
Dictionary<string, UserControl> Cats = new();
|
||||
foreach (var val in values)
|
||||
{
|
||||
try
|
||||
@ -150,10 +151,27 @@ public class ServerRoleOptions : UserControl
|
||||
MemberInfo? enumValueMemberInfo = Globals.GetMemberInfo(PropType, val);
|
||||
string description = Globals.GetAttribute<DescriptionAttribute, ServerPermission>(enumValueMemberInfo!, val).Description;
|
||||
string Name = Globals.GetAttribute<DisplayNameAttribute, ServerPermission>(enumValueMemberInfo!, val).DisplayName;
|
||||
string cat = Globals.GetAttribute<CategoryAttribute, ServerPermission>(enumValueMemberInfo!, val).Category;
|
||||
if (cat.ToLower() == "internal") continue;
|
||||
|
||||
if (!Cats.ContainsKey(cat))
|
||||
{
|
||||
UserControl c = new UserControl()
|
||||
{
|
||||
BackgroundColor = Page.BackgroundColor,
|
||||
Size = new(Page.Size.X, 50.ScaleInt())
|
||||
};
|
||||
Label tmp = new(Globals.DefaultFont)
|
||||
{
|
||||
Text = cat + " Permissions"
|
||||
};
|
||||
tmp.SetLocation(2.ScaleInt(), (int)((c.Size.Y - tmp.Font.PixelHeight)/2));
|
||||
c.Controls.Add(tmp);
|
||||
Page.Controls.Add(c);
|
||||
Cats.Add(cat, c);
|
||||
}
|
||||
|
||||
if (Name.ToLower() == "view this") continue;
|
||||
Globals.AddBool(Page, Name, description + " in the server.", r.ServerPermissions.HasFlag(val), _ =>
|
||||
UserControl tc = Globals.AddBool(Cats[cat], Name, description + " in the server.", r.ServerPermissions.HasFlag(val), _ =>
|
||||
{
|
||||
TempPermissions ^= val;
|
||||
if (TempPermissions != r.ServerPermissions)
|
||||
@ -165,6 +183,8 @@ public class ServerRoleOptions : UserControl
|
||||
Warning.Visible = false;
|
||||
}
|
||||
}, NeedMax);
|
||||
tc.SetLocation(tc.Location.X, Cats[cat].Size.Y);
|
||||
Cats[cat].SetSize(Cats[cat].Size.X, Cats[cat].Size.Y + tc.Size.Y);
|
||||
|
||||
}
|
||||
catch
|
||||
|
@ -260,7 +260,7 @@ public static class Globals
|
||||
public static API Luski { get; } = new();
|
||||
public static MainScreenWindow ms;
|
||||
|
||||
public static void AddBool(IParent parent, string Name, string description, bool s, Action<bool> a, List<Label>? List = null)
|
||||
public static UserControl AddBool(IParent parent, string Name, string description, bool s, Action<bool> a, List<Label>? List = null)
|
||||
{
|
||||
ToggleSwitch ts = new()
|
||||
{
|
||||
@ -309,6 +309,7 @@ public static class Globals
|
||||
};
|
||||
tc.ForceDistanceUpdate(parent);
|
||||
parent.Controls.Add(tc);
|
||||
return tc;
|
||||
}
|
||||
|
||||
public static void AddBool<TEnum>(IParent parent, Type t, TEnum e, bool s, Action<bool> a, List<Label>? List = null) where TEnum : Enum
|
||||
|
@ -22,8 +22,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GraphicsManager" Version="1.1.0-alpha35" />
|
||||
<PackageReference Include="Luski.net" Version="2.0.1-alpha14" />
|
||||
<PackageReference Include="GraphicsManager" Version="1.1.0-alpha50" />
|
||||
<PackageReference Include="Luski.net" Version="2.0.1-alpha15" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user