Pre GM clean

This commit is contained in:
JacobTech 2024-11-24 17:04:24 -05:00
parent c23ae353d7
commit cf238410d2
9 changed files with 214 additions and 61 deletions

View File

@ -5,6 +5,8 @@ using Luski.Classes.Attribs;
using Luski.Classes.Attribs.NumberSlider; using Luski.Classes.Attribs.NumberSlider;
using Luski.Enums; using Luski.Enums;
using Luski.Enums.Strings; using Luski.Enums.Strings;
using Luski.GUI;
using OpenTK.Windowing.GraphicsLibraryFramework;
namespace Luski.Classes; namespace Luski.Classes;
@ -60,6 +62,12 @@ public class Settings
{ {
Globals.ms.LogFrames = (_Logs & ConsoleLog.DrawFrames) == ConsoleLog.DrawFrames; Globals.ms.LogFrames = (_Logs & ConsoleLog.DrawFrames) == ConsoleLog.DrawFrames;
Globals.ms.ShowMissingChar = (_Logs & ConsoleLog.ShowMissingChar) == ConsoleLog.ShowMissingChar; Globals.ms.ShowMissingChar = (_Logs & ConsoleLog.ShowMissingChar) == ConsoleLog.ShowMissingChar;
if ((Globals.Settings.Logs & ConsoleLog.ShowErrorsForGLFW) == ConsoleLog.ShowErrorsForGLFW)
GLFW.SetErrorCallback(MainScreenWindow.OnGLFW_Error);
else
{
GLFW.SetErrorCallback(null);
}
} }
} }
} }

View File

@ -1,5 +1,7 @@
using GraphicsManager.Interfaces; using GraphicsManager.Interfaces;
using GraphicsManager.Objects; using GraphicsManager.Objects;
using Luski.GUI.MainScreen.UI.PublicServers;
using OpenTK.Graphics.OpenGL4;
using OpenTK.Mathematics; using OpenTK.Mathematics;
namespace Luski.GUI.MainScreen.UI.LuskiControls; namespace Luski.GUI.MainScreen.UI.LuskiControls;
@ -53,6 +55,8 @@ public class CompressedFlow : UserControl
return Task.CompletedTask; return Task.CompletedTask;
} }
private void UpdateControlesFromIndex(int index) private void UpdateControlesFromIndex(int index)
{ {
if (Controls.Length == 0) if (Controls.Length == 0)
@ -62,26 +66,40 @@ public class CompressedFlow : UserControl
if (SizeUpdateNotIgnored is not null) _ = SizeUpdateNotIgnored.Invoke(this); if (SizeUpdateNotIgnored is not null) _ = SizeUpdateNotIgnored.Invoke(this);
return; return;
} }
int lasty = -1;
int rowheight = -1;
for (int i = 0; i <= Math.Min(index-1, Controls.Length-1); i++)
{
if (Controls[i].Location.Y > lasty)
{
lasty = Controls[i].Location.Y;
rowheight = 0;
}
if (Controls[i].Size.Y > rowheight) rowheight = Controls[i].Size.Y;
}
if (index == 0) index++; if (index == 0) index++;
for (int i = index; i < Controls.Length; i++) for (int i = index; i < Controls.Length; i++)
{ {
if (Controls[i-1].Location.X + Controls[i-1].Size.X + Padding.Z + Controls[i].Size.X + ChildPadding.X > Size.X) 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].Location = new(Padding.X,
Controls[i - 1].Location.Y + Controls[i - 1].Size.Y + ChildPadding.Y); lasty + rowheight + ChildPadding.Y);
lasty = Controls[i].Location.Y;
rowheight = Controls[i].Size.Y;
} }
else else
{ {
Controls[i].Location = new(ChildPadding.X + Controls[i - 1].Location.X + Controls[i - 1].Size.X, Controls[i].Location = new(ChildPadding.X + Controls[i - 1].Location.X + Controls[i - 1].Size.X,
Controls[i - 1].Location.Y); Controls[i - 1].Location.Y);
if (Controls[i].Size.Y > rowheight) rowheight = Controls[i].Size.Y;
} }
} }
if (Controls[Controls.Length - 1].Location.Y + Controls[Controls.Length - 1].Size.Y + Padding.W != Size.Y) if (lasty + rowheight + Padding.W != Size.Y)
{ {
IgnoreNextSizeChange = true; IgnoreNextSizeChange = true;
Size = new(Size.X, Size = new(Size.X,
Controls[Controls.Length - 1].Location.Y + Controls[Controls.Length - 1].Size.Y + Padding.W); lasty + rowheight + Padding.W);
if (SizeUpdateNotIgnored is not null) _ = SizeUpdateNotIgnored.Invoke(this); if (SizeUpdateNotIgnored is not null) _ = SizeUpdateNotIgnored.Invoke(this);
} }
} }

View File

@ -0,0 +1,90 @@
using GraphicsManager.Enums;
using GraphicsManager.Interfaces;
using GraphicsManager.Objects;
using OpenTK.Mathematics;
namespace Luski.GUI.MainScreen.UI.LuskiControls;
public class MessageCompressedFlow : UserControl
{
public MessageCompressedFlow()
{
Controls.ControlAfterAdded += ControlsOnControlAdded;
Controls.ControlRemoved += ControlsOnControlRemoved;
SizeChanged += OnSizeChanged;
WallSpacing = new(5.ScaleInt());
}
public Vector4i WallSpacing { get; set; }
public event Func<IRenderObject, Task>? SizeUpdateNotIgnored;
private bool IgnoreNextSizeChange;
private Task OnSizeChanged(IRenderObject arg)
{
if (IgnoreNextSizeChange)
{
IgnoreNextSizeChange = false;
return Task.CompletedTask;
}
UpdateControlesFromIndex(0);
return Task.CompletedTask;
}
private Task ControlsOnControlRemoved()
{
UpdateControlesFromIndex(0);
return Task.CompletedTask;
}
private Task ControlsOnControlAdded(int arg1, IRenderObject arg2)
{
if (arg1 != 0)
{
arg2.Margins = new(0, 3.ScaleInt(), 0, 0);
arg2.Location = new(WallSpacing.X + arg2.Margins.X, Controls[arg1-1].Location.X + Controls[arg1-1].Size.Y + Controls[arg1-1].Margins.W + arg2.Margins.Y);
}
else
{
arg2.Location = new(WallSpacing.X + arg2.Margins.X, WallSpacing.Y + arg2.Margins.Y);
}
if (arg2 is CompressedFlow c)
{
c.Anchor = ObjectAnchor.Left | ObjectAnchor.Top | ObjectAnchor.Right;
c.SizeUpdateNotIgnored += o =>
{
UpdateControlesFromIndex(arg1 + 1);
return Task.CompletedTask;
};
}
UpdateControlesFromIndex(arg1);
return Task.CompletedTask;
}
private void UpdateControlesFromIndex(int index)
{
if (Controls.Length == 0)
{
IgnoreNextSizeChange = true;
Size = new(Size.X, 0);
if (SizeUpdateNotIgnored is not null) _ = SizeUpdateNotIgnored.Invoke(this);
return;
}
if (index == 0) index++;
for (int i = index; i < Controls.Length; i++)
{
Controls[i].Location = new(WallSpacing.X + Controls[i].Margins.X,
Controls[i - 1].Location.Y + Controls[i - 1].Size.Y + Controls[i - 1].Margins.W + Controls[i].Margins.Y);
}
if (Controls[Controls.Length - 1].Location.Y + Controls[Controls.Length - 1].Size.Y + Controls[Controls.Length - 1].Margins.Z + WallSpacing.W != Size.Y)
{
IgnoreNextSizeChange = true;
Size = new(Size.X,
Controls[Controls.Length - 1].Location.Y + Controls[Controls.Length - 1].Size.Y + Controls[Controls.Length - 1].Margins.Z + WallSpacing.W);
if (SizeUpdateNotIgnored is not null) _ = SizeUpdateNotIgnored.Invoke(this);
}
}
}

View File

@ -24,6 +24,7 @@ public class ChatMessage : UserControl
private IRenderObject LastObject; private IRenderObject LastObject;
public List<IRenderObject> MessageObjs = new(); public List<IRenderObject> MessageObjs = new();
private LabelBase FirstL; private LabelBase FirstL;
public MessageCompressedFlow MCF;
public readonly double HorPadding = 12.ScaleDouble(), public readonly double HorPadding = 12.ScaleDouble(),
VerticalPadding = 5.ScaleDouble(); VerticalPadding = 5.ScaleDouble();
@ -41,6 +42,7 @@ public class ChatMessage : UserControl
private ChatMessage(PublicChat p, SocketMessage message, SocketChannel chan, ServerProfile Author, IRenderObject UserIcon, Role r) private ChatMessage(PublicChat p, SocketMessage message, SocketChannel chan, ServerProfile Author, IRenderObject UserIcon, Role r)
{ {
pc = p; pc = p;
LuskiLabel label1; LuskiLabel label1;
base.SetSize(723.5.ScaleInt(), 37.ScaleInt()); base.SetSize(723.5.ScaleInt(), 37.ScaleInt());
@ -102,10 +104,22 @@ public class ChatMessage : UserControl
LastObject = label1; LastObject = label1;
FirstL = 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)), 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});
MCF = new()
{
Location = new(LastObject.Location.X, (int)(UserIcon.Location.Y + UserIcon.Size.Y - Globals.MessageFont.PixelHeight)),
BackgroundColor = new(0,0,0,0),
Size = new(base.Size.X - LastObject.Location.X - 5.ScaleInt(), 0),
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Right,
};
MCF.SizeUpdateNotIgnored += MCFOnSizeUpdateNotIgnored;
MCF.ForceDistanceUpdate(this);
Controls.Add(MCF);
if (!string.IsNullOrWhiteSpace(Msg.Context)) if (!string.IsNullOrWhiteSpace(Msg.Context))
{ {
LuskiLabel l; LuskiLabel l;
Controls.Add(l = new(Globals.MessageFont) { Location = new(LastObject.Location.X, (int)(UserIcon.Location.Y + UserIcon.Size.Y - Globals.MessageFont.PixelHeight)), Text = message.Context}); MCF.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; LastObject = l;
LuskiContextMenu lcm = new(); LuskiContextMenu lcm = new();
Label llllll = lcm.AddLabel("Copy Text"); Label llllll = lcm.AddLabel("Copy Text");
@ -159,19 +173,29 @@ public class ChatMessage : UserControl
if (Msg.Files.Count > 0) if (Msg.Files.Count > 0)
{ {
CompressedFlow cf = new()
{
Size = new(base.Size.X - FirstL.Location.X, 0),
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Top,
BackgroundColor = new(0,0,0,50)
};
for (int i = 0; i < Msg.Files.Count; i++) for (int i = 0; i < Msg.Files.Count; i++)
{ {
var cem = ContentEmbed.GetEmbed(this, Msg.Files[i], Msg.ChannelID); var cem = ContentEmbed.GetEmbed(this, Msg.Files[i], Msg.ChannelID);
cem.Wait(); cem.Wait();
cem.Result.Location = new(FirstL.Location.X, cf.Controls.Add(cem.Result);
(int)(LastObject.Location.Y + LastObject.Size.Y + VerticalPadding));
LastObject = cem.Result;
Controls.Add(cem.Result);
} }
MCF.Controls.Add(cf);
} }
if (LastObject is Label ll) base.Size = new(base.Size.X, (int)(ll.Location.Y + ll.Size.Y + VerticalPadding)); base.Size = new(base.Size.X , MCF.Size.Y + MCF.Location.Y);
else base.Size = new(base.Size.X ,(int)(LastObject.Location.Y + LastObject.Size.Y + VerticalPadding)); base.BackgroundColor = new(0,0,0,50);
}
private Task MCFOnSizeUpdateNotIgnored(IRenderObject arg)
{
base.Size = new(base.Size.X , MCF.Size.Y + MCF.Location.Y);
return Task.CompletedTask;
} }
@ -205,7 +229,7 @@ public class ChatMessage : UserControl
newLabel.MouseEnter += NewLabel_MouseEnter; newLabel.MouseEnter += NewLabel_MouseEnter;
newLabel.MouseLeave += NewLabel_MouseLeave; newLabel.MouseLeave += NewLabel_MouseLeave;
Controls.Add(newLabel); MCF.Controls.Add(newLabel);
MessageObjs.Add(newLabel); MessageObjs.Add(newLabel);
LastObject = newLabel; LastObject = newLabel;
LuskiContextMenu lcm = new(); LuskiContextMenu lcm = new();
@ -221,41 +245,25 @@ public class ChatMessage : UserControl
newLabel.ContextMenu = lcm; newLabel.ContextMenu = lcm;
} }
if (msg.Files.Count > 0) if (msg.Files.Count > 0)
{ {
/*CompressedFlow cf = new() CompressedFlow cf = new()
{ {
Size = new(base.Size.X - FirstL.Location.X, 0), Size = new(base.Size.X - FirstL.Location.X, 0),
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Top, Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Top,
Location = new(FirstL.Location.X, (int)(LastObject.Location.Y + LastObject.Size.Y + VerticalPadding)), BackgroundColor = new(0,0,0,0)
BackgroundColor = base.BackgroundColor
}; };
Controls.Add(cf);
*/
for (int i = 0; i < msg.Files.Count; i++) for (int i = 0; i < msg.Files.Count; i++)
{ {
IRenderObject cem = await ContentEmbed.GetEmbed(this, msg.Files[i], msg.ChannelID); IRenderObject cem = await ContentEmbed.GetEmbed(this, msg.Files[i], msg.ChannelID);
cem.Location = new(FirstL.Location.X, cf.Controls.Add(cem);
(int)(LastObject.Location.Y + LastObject.Size.Y + VerticalPadding));
LastObject = cem;
Controls.Add(cem);
} }
MCF.Controls.Add(cf);
// LastObject = cf;
} }
Size = new(Size.X , MCF.Size.Y + MCF.Location.Y);
if (LastObject is Label ll) Size = new(Size.X, (int)(ll.Location.Y + ll.Size.Y + VerticalPadding));
else Size = new(Size.X ,(int)(LastObject.Location.Y + LastObject.Size.Y + VerticalPadding));
if (LastObject is CompressedFlow)
{
LastObject.ForceDistanceUpdate(this);
}
BlockDraw = false; BlockDraw = false;
//if (Parent is not null) Globals.ms.pc.MessageFlow.ReportSizeUpdate(this);
TryDraw(); TryDraw();
} }

View File

@ -27,13 +27,13 @@ public class ContentEmbed : UserControl
Rectangle r; Rectangle r;
double s = 322.ScaleDouble(); double s = 322.ScaleDouble();
double scale = s / t.RawSize!.Value.X; double scale = s / t.RawSize!.Value.X;
m.Controls.Add(r = new Rectangle(t) r = new Rectangle(t)
{ {
Size = new((int)s, (int)(scale * t.RawSize.Value.Y)), Size = new((int)s, (int)(scale * t.RawSize.Value.Y)),
Shader = Texture.TextureShader[Globals.ms.Context], Shader = Texture.TextureShader[Globals.ms.Context],
HoverMouse = MouseCursor.Hand, HoverMouse = MouseCursor.Hand,
Tag = m.pc Tag = m.pc
}); };
r.Clicked += ROnClicked; r.Clicked += ROnClicked;
return r; return r;
} }
@ -116,6 +116,8 @@ public class ContentEmbed : UserControl
int temp2 = fileSizeLabel.Size.X + fileSizeLabel.Location.X; int temp2 = fileSizeLabel.Size.X + fileSizeLabel.Location.X;
//if (temp >= temp2) Size = new(temp + 4, Size.Y); //if (temp >= temp2) Size = new(temp + 4, Size.Y);
//else Size = new(temp2 + 4, Size.Y); //else Size = new(temp2 + 4, Size.Y);
//base.BackgroundColor = new(0, 0, 0, 50);
base.BackgroundColor = new(0, 0, 0, 0);
} }
private Task FileNameLabelOnClicked(IRenderObject arg) private Task FileNameLabelOnClicked(IRenderObject arg)

View File

@ -190,8 +190,21 @@ public class PublicChat : UserControl
FilesList.Add(fileUpload.PublicSF!); FilesList.Add(fileUpload.PublicSF!);
} }
Task<SocketMessage> m = Channel!.SendMessage(tb.Text, Profile: Globals.ServerProfile, files: FilesList.ToArray());
Task<string> taskA = new Task<string>( () =>
{
Console.WriteLine("Hello from taskA.");
return "";
});
// Start the task.
taskA.Start();
// Output a message from the calling thread.
Console.WriteLine("Hello from thread '{0}'.",
Thread.CurrentThread.Name);
taskA.Wait();
ClearFiles(); ClearFiles();
await Channel!.SendMessage(tb.Text, Profile: Globals.ServerProfile, files: FilesList.ToArray()); m.Wait();
tb.Text = string.Empty; tb.Text = string.Empty;
tb.CursorLocation = 0; tb.CursorLocation = 0;
} }
@ -221,6 +234,7 @@ public class PublicChat : UserControl
private async Task UserConOnClicked(IRenderObject arg) private async Task UserConOnClicked(IRenderObject arg)
{ {
BlockDraw = true;
um_open = !um_open; um_open = !um_open;
if (um_open) if (um_open)
{ {
@ -368,6 +382,9 @@ public class PublicChat : UserControl
tb.Size = new(tb.Size.X + memberflow.Size.X, tb.Size.Y); tb.Size = new(tb.Size.X + memberflow.Size.X, tb.Size.Y);
tb.ForceDistanceUpdate(); tb.ForceDistanceUpdate();
} }
BlockDraw = false;
TryDraw();
} }
private SocketMessage? lastm; private SocketMessage? lastm;
@ -422,9 +439,13 @@ public class PublicChat : UserControl
public void ClearFiles() public void ClearFiles()
{ {
DateTime dt = DateTime.Now;
FilesToUpload.Clear(); FilesToUpload.Clear();
Console.WriteLine("Clear 1 " + (DateTime.Now - dt));
FileFlow.Controls.Clear(); FileFlow.Controls.Clear();
Console.WriteLine("Clear 2 " + (DateTime.Now - dt));
MessageFlow.Size = new(MessageFlow.Size.X, FileFlow.Location.Y - MessageFlow.Location.Y); MessageFlow.Size = new(MessageFlow.Size.X, FileFlow.Location.Y - MessageFlow.Location.Y);
Console.WriteLine("Size in " + (DateTime.Now - dt));
} }
public void RemoveFile(FileUpload FU) public void RemoveFile(FileUpload FU)

View File

@ -39,16 +39,15 @@ public class MainScreenWindow : Window
StartFocused = true, StartFocused = true,
ClientSize = new Vector2i(624, 1090), ClientSize = new Vector2i(624, 1090),
Icon = Globals.Icon, Icon = Globals.Icon,
SharedContext = null, SharedContext = null
}; };
public TabControl? tc;
private FlowLayout? channelpicker, friends, friend_request; private FlowLayout? channelpicker, friends, friend_request;
private RoundedButton? FriendManagerBtn; private RoundedButton? FriendManagerBtn;
public static DebugProc DebugMessageDelegate = OnDebugMessage; public static DebugProc DebugMessageDelegate = OnDebugMessage;
private static GLFWCallbacks.ErrorCallback GLFW_Error = OnGLFW_Error;
private static void OnGLFW_Error(ErrorCode e, string d)
public static void OnGLFW_Error(ErrorCode e, string d)
{ {
if ((Globals.Settings.Logs & ConsoleLog.ShowErrorsForGLFW) != ConsoleLog.ShowErrorsForGLFW) return; if ((Globals.Settings.Logs & ConsoleLog.ShowErrorsForGLFW) != ConsoleLog.ShowErrorsForGLFW) return;
Console.ForegroundColor = ConsoleColor.DarkRed; Console.ForegroundColor = ConsoleColor.DarkRed;
@ -144,7 +143,8 @@ public class MainScreenWindow : Window
VSync = VSyncMode.On; VSync = VSyncMode.On;
GL.DebugMessageCallback(DebugMessageDelegate, IntPtr.Zero); GL.DebugMessageCallback(DebugMessageDelegate, IntPtr.Zero);
GL.Enable(EnableCap.DebugOutput); GL.Enable(EnableCap.DebugOutput);
GLFW.SetErrorCallback(GLFW_Error); if ((Globals.Settings.Logs & ConsoleLog.ShowErrorsForGLFW) == ConsoleLog.ShowErrorsForGLFW)
GLFW.SetErrorCallback(OnGLFW_Error);
try try
{ {
Globals.DefaultFontFamly = FontFamily.LoadFontFamily(Globals.GetResource("Fonts.OpenSans.zip"), "OpenSans"); Globals.DefaultFontFamly = FontFamily.LoadFontFamily(Globals.GetResource("Fonts.OpenSans.zip"), "OpenSans");
@ -416,37 +416,37 @@ public class MainScreenWindow : Window
protected override void OnFileDrop(FileDropEventArgs obj) protected override void OnFileDrop(FileDropEventArgs obj)
{ {
void CheckFileDrop(IParent p, Vector2i diff) void CheckFileDrop(IParent ParentToCheck, Vector2i diff)
{ {
bool found = false; bool found = false;
for (int i = p.Controls.Length - 1; i >= 0; i--) for (int i = ParentToCheck.Controls.Length - 1; i >= 0; i--)
{ {
if ((p.Controls[i].Location + diff).X <= (int)MousePosition.X && if ((ParentToCheck.Controls[i].Location + diff).X <= (int)MousePosition.X &&
(p.Controls[i].Location + diff).Y <= (int)MousePosition.Y && (ParentToCheck.Controls[i].Location + diff).Y <= (int)MousePosition.Y &&
(p.Controls[i].Location + p.Controls[i].Size + diff).X >= (int)MousePosition.X && (ParentToCheck.Controls[i].Location + ParentToCheck.Controls[i].Size + diff).X >= (int)MousePosition.X &&
(p.Controls[i].Location + p.Controls[i].Size + diff).Y >= (int)MousePosition.Y) (ParentToCheck.Controls[i].Location + ParentToCheck.Controls[i].Size + diff).Y >= (int)MousePosition.Y)
{ {
if (p.Controls[i] is IParent pp) if (ParentToCheck.Controls[i] is IParent NextParentToCheck)
{ {
if (pp.CollectUpperFiles) if (NextParentToCheck.CollectUpperFiles)
{ {
found = true; found = true;
p.Controls[i].SendFilesEvent(obj.FileNames); ParentToCheck.Controls[i].SendFilesEvent(obj.FileNames);
} }
else else
{ {
CheckFileDrop(pp, pp.Controls[i].Location + diff); CheckFileDrop(NextParentToCheck, ParentToCheck.Controls[i].Location + diff);
} }
} }
else else
{ {
found = true; found = true;
p.Controls[i].SendFilesEvent(obj.FileNames); ParentToCheck.Controls[i].SendFilesEvent(obj.FileNames);
} }
} }
} }
if (!found && p is IRenderObject renderObject) if (!found && ParentToCheck is IRenderObject renderObject)
{ {
renderObject.SendFilesEvent(obj.FileNames); renderObject.SendFilesEvent(obj.FileNames);
} }

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
@ -22,7 +22,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GraphicsManager" Version="1.1.1-alpha35" /> <PackageReference Include="GraphicsManager" Version="1.1.1-alpha36" />
<PackageReference Include="Luski.net" Version="2.0.1-alpha18" /> <PackageReference Include="Luski.net" Version="2.0.1-alpha18" />
<PackageReference Include="Updater" Version="1.0.0-alpha05" /> <PackageReference Include="Updater" Version="1.0.0-alpha05" />
</ItemGroup> </ItemGroup>

View File

@ -1,8 +1,8 @@
using System.Diagnostics; using Luski;
using Luski;
using Luski.Classes; using Luski.Classes;
using Luski.GUI; using Luski.GUI;
using OpenTK.Windowing.Common.Input; using OpenTK.Windowing.Common.Input;
using OpenTK.Windowing.GraphicsLibraryFramework;
using SixLabors.ImageSharp; using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
using Updater; using Updater;
@ -10,7 +10,11 @@ using Image = OpenTK.Windowing.Common.Input.Image;
try try
{ {
Console.WriteLine("App Running");
GLFW.SetErrorCallback(null);
Console.WriteLine("STOP ErrorCallback");
Globals.Settings = Globals.GetSettings(Path.Combine(Globals.LuskiPath, "Settings.json"), SettingsContext.Default.Settings); Globals.Settings = Globals.GetSettings(Path.Combine(Globals.LuskiPath, "Settings.json"), SettingsContext.Default.Settings);
Console.WriteLine("load settings");
foreach (ExperimentInfo le in LuskiExperiments.LuskiExperimentsList) foreach (ExperimentInfo le in LuskiExperiments.LuskiExperimentsList)
{ {
Globals.RegisterExperiment(le); Globals.RegisterExperiment(le);
@ -64,14 +68,14 @@ try
} }
} }
} }
Console.WriteLine("Servers found");
Globals.UpdaterSettings = Globals.GetSettings(Path.Combine(Globals.LuskiPath, "UpdaterSettings.json"), UpdaterSettingsContext.Default.UpdaterSettings); Globals.UpdaterSettings = Globals.GetSettings(Path.Combine(Globals.LuskiPath, "UpdaterSettings.json"), UpdaterSettingsContext.Default.UpdaterSettings);
Image<Rgba32> Logo = SixLabors.ImageSharp.Image.Load<Rgba32>(Globals.GetResource("Textures.Luski.png")); Image<Rgba32> Logo = SixLabors.ImageSharp.Image.Load<Rgba32>(Globals.GetResource("Textures.Luski.png"));
Logo.DangerousTryGetSinglePixelMemory(out Memory<Rgba32> m); Logo.DangerousTryGetSinglePixelMemory(out Memory<Rgba32> m);
byte[] pixels = new byte[4 * Logo.Width * Logo.Height]; byte[] pixels = new byte[4 * Logo.Width * Logo.Height];
Logo.CopyPixelDataTo(pixels); Logo.CopyPixelDataTo(pixels);
Logo.Dispose(); Logo.Dispose();
GLFW.SetErrorCallback(null);
Globals.Icon = new WindowIcon(new Image(Logo.Width, Logo.Height, pixels)); Globals.Icon = new WindowIcon(new Image(Logo.Width, Logo.Height, pixels));
if (args is not null && args.Length > 0) if (args is not null && args.Length > 0)
@ -98,8 +102,9 @@ try
} }
Console.WriteLine("icon");
MainScreenWindow.Settings.Icon = Globals.Icon; MainScreenWindow.Settings.Icon = Globals.Icon;
Globals.ms = new MainScreenWindow(); Globals.ms = new MainScreenWindow();
Globals.ms.CustomF11 = false; Globals.ms.CustomF11 = false;
//Globals.ms.DrawFrame(); //Globals.ms.DrawFrame();
@ -110,6 +115,7 @@ try
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("oh no, an error occured");
Console.WriteLine(ex); Console.WriteLine(ex);
} }